From 959936652eb49238a074c21b87a6478c0cb73d7d Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Wed, 11 Dec 2024 23:25:50 -0600 Subject: [PATCH 01/10] Escape the '.' in '.json' when making static data routes. --- packages/next/src/server/lib/router-utils/build-data-route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/server/lib/router-utils/build-data-route.ts b/packages/next/src/server/lib/router-utils/build-data-route.ts index 6aab1d9144ceb..b0564da5ac1a1 100644 --- a/packages/next/src/server/lib/router-utils/build-data-route.ts +++ b/packages/next/src/server/lib/router-utils/build-data-route.ts @@ -33,7 +33,7 @@ export function buildDataRoute(page: string, buildId: string) { `^${path.posix.join( '/_next/data', escapeStringRegexp(buildId), - `${pagePath}.json` + `${pagePath}\\.json` )}$` ).source ) From ae98fbaabc4cdd1e5d889c4345b27ce1a7bb511b Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 11:16:38 -0600 Subject: [PATCH 02/10] Update tests to expected escaped period in json extensions --- test/e2e/edge-pages-support/index.test.ts | 2 +- .../e2e/getserversideprops/test/index.test.ts | 34 ++-- test/e2e/prerender.test.ts | 126 +++++++------- .../404-page-ssg/test/index.test.js | 2 +- test/integration/i18n-support/test/shared.js | 158 +++++++++--------- 5 files changed, 161 insertions(+), 161 deletions(-) diff --git a/test/e2e/edge-pages-support/index.test.ts b/test/e2e/edge-pages-support/index.test.ts index 9ba79dc3b28f4..625489c236d1f 100644 --- a/test/e2e/edge-pages-support/index.test.ts +++ b/test/e2e/edge-pages-support/index.test.ts @@ -163,7 +163,7 @@ describe('edge-render-getserversideprops', () => { expect(manifest.dataRoutes).toEqual([ { dataRouteRegex: normalizeRegEx( - `^/_next/data/${escapeStringRegexp(next.buildId)}/index.json$` + `^/_next/data/${escapeStringRegexp(next.buildId)}/index\\.json$` ), page: '/', }, diff --git a/test/e2e/getserversideprops/test/index.test.ts b/test/e2e/getserversideprops/test/index.test.ts index 09c8450bd3b07..46f996dfe46af 100644 --- a/test/e2e/getserversideprops/test/index.test.ts +++ b/test/e2e/getserversideprops/test/index.test.ts @@ -26,19 +26,19 @@ let next: NextInstance const expectedManifestRoutes = () => [ { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/index.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/index\\.json$` ), page: '/', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/another.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/another\\.json$` ), page: '/another', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/blog.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/blog\\.json$` ), page: '/blog', }, @@ -83,44 +83,44 @@ const expectedManifestRoutes = () => [ }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/custom-cache.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/custom-cache\\.json$` ), page: '/custom-cache', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/default-revalidate.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/default-revalidate\\.json$` ), page: '/default-revalidate', }, { dataRouteRegex: `^\\/_next\\/data\\/${escapeRegex( buildId - )}\\/early-request-end.json$`, + )}\\/early-request-end\\.json$`, page: '/early-request-end', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/enoent.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/enoent\\.json$` ), page: '/enoent', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/invalid-keys.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/invalid-keys\\.json$` ), page: '/invalid-keys', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/non-json.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/non\\-json\\.json$` ), page: '/non-json', }, { dataRouteRegex: `^\\/_next\\/data\\/${escapeRegex( buildId - )}\\/not-found.json$`, + )}\\/not-found\\.json$`, page: '/not-found', }, { @@ -137,13 +137,13 @@ const expectedManifestRoutes = () => [ }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/promise.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/promise\\.json$` ), page: '/promise', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/promise\\/mutate-res.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/promise\\/mutate-res\\.json$` ), page: '/promise/mutate-res', }, @@ -151,7 +151,7 @@ const expectedManifestRoutes = () => [ dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( buildId - )}\\/promise\\/mutate-res-no-streaming.json$` + )}\\/promise\\/mutate-res-no-streaming\\.json$` ), page: '/promise/mutate-res-no-streaming', }, @@ -159,25 +159,25 @@ const expectedManifestRoutes = () => [ dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( buildId - )}\\/promise\\/mutate-res-props.json$` + )}\\/promise\\/mutate-res-props\\.json$` ), page: '/promise/mutate-res-props', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/refresh.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/refresh\\.json$` ), page: '/refresh', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/slow.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/slow\\.json$` ), page: '/slow', }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/something.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/something\\.json$` ), page: '/something', }, diff --git a/test/e2e/prerender.test.ts b/test/e2e/prerender.test.ts index 238742b745f3d..02d29ed02b57d 100644 --- a/test/e2e/prerender.test.ts +++ b/test/e2e/prerender.test.ts @@ -105,235 +105,235 @@ describe('Prerender', () => { const expectedManifestRoutes = () => ({ '/': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/index.json`, + dataRoute: `/_next/data/${next.buildId}/index\\.json`, initialRevalidateSeconds: 2, srcRoute: null, }, '/blog/[post3]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/[post3].json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post3]\\.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-1.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-1\\.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-2': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-2.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-2\\.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-4': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-4.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-4\\.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-1/comment-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-1/comment-1.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-1/comment-1\\.json`, initialRevalidateSeconds: 2, srcRoute: '/blog/[post]/[comment]', }, '/blog/post-2/comment-2': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-2/comment-2.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-2/comment-2\\.json`, initialRevalidateSeconds: 2, srcRoute: '/blog/[post]/[comment]', }, '/blog/post.1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post.1.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post.1\\.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/catchall-explicit/another/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/another/value.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/another/value\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/first.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/first\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/hello/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/hello/another.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/hello/another\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/second': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/second.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/second\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/[first]/[second]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[first]/[second].json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[first]/[second]\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/[third]/[fourth]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[third]/[fourth].json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[third]/[fourth]\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-optional': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-optional.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional\\.json`, initialRevalidateSeconds: false, srcRoute: '/catchall-optional/[[...slug]]', }, '/catchall-optional/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-optional/value.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional/value\\.json`, initialRevalidateSeconds: false, srcRoute: '/catchall-optional/[[...slug]]', }, '/large-page-data': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/large-page-data.json`, + dataRoute: `/_next/data/${next.buildId}/large-page-data\\.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/another.json`, + dataRoute: `/_next/data/${next.buildId}/another\\.json`, initialRevalidateSeconds: 1, srcRoute: null, }, '/preview': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/preview.json`, + dataRoute: `/_next/data/${next.buildId}/preview\\.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/api-docs/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/api-docs/first.json`, + dataRoute: `/_next/data/${next.buildId}/api-docs/first\\.json`, initialRevalidateSeconds: false, srcRoute: '/api-docs/[...slug]', }, '/blocking-fallback-once/404-on-manual-revalidate': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/404-on-manual-revalidate.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/404-on-manual-revalidate\\.json`, initialRevalidateSeconds: false, srcRoute: '/blocking-fallback-once/[slug]', }, '/blocking-fallback-some/a': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/a.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/a\\.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback-some/[slug]', }, '/blocking-fallback-some/b': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/b.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/b\\.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback-some/[slug]', }, '/blocking-fallback/lots-of-data': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/lots-of-data.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/lots-of-data\\.json`, initialRevalidateSeconds: false, srcRoute: '/blocking-fallback/[slug]', }, '/blocking-fallback/test-errors-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/test-errors-1.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/test-errors-1\\.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback/[slug]', }, '/blog': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog.json`, + dataRoute: `/_next/data/${next.buildId}/blog\\.json`, initialRevalidateSeconds: 10, srcRoute: null, }, '/default-revalidate': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/default-revalidate.json`, + dataRoute: `/_next/data/${next.buildId}/default-revalidate\\.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/dynamic/[first]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/dynamic/[first].json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[first]\\.json`, initialRevalidateSeconds: false, srcRoute: '/dynamic/[slug]', }, '/dynamic/[second]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/dynamic/[second].json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[second]\\.json`, initialRevalidateSeconds: false, srcRoute: '/dynamic/[slug]', }, // TODO: investigate index/index // '/index': { - // dataRoute: `/_next/data/${next.buildId}/index/index.json`, + // dataRoute: `/_next/data/${next.buildId}/index/index\\.json`, // initialRevalidateSeconds: false, // srcRoute: null, // }, '/lang/de/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/de/about.json`, + dataRoute: `/_next/data/${next.buildId}/lang/de/about\\.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/en/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/en/about.json`, + dataRoute: `/_next/data/${next.buildId}/lang/en/about\\.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/es/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/es/about.json`, + dataRoute: `/_next/data/${next.buildId}/lang/es/about\\.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/fr/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/fr/about.json`, + dataRoute: `/_next/data/${next.buildId}/lang/fr/about\\.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/something': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/something.json`, + dataRoute: `/_next/data/${next.buildId}/something\\.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/catchall/another/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/another/value.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/another/value\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/first.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/first\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/second': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/second.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/second\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/hello/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/hello/another.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/hello/another\\.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, @@ -1334,7 +1334,7 @@ describe('Prerender', () => { expect(dataRoutes).toEqual([ { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/index.json$` + `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/index\\.json$` ), page: '/', }, @@ -1342,7 +1342,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/another.json$` + )}\\/another\\.json$` ), page: '/another', }, @@ -1364,7 +1364,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/bad-gssp.json$` + )}\\/bad-gssp\\.json$` ), page: '/bad-gssp', }, @@ -1372,7 +1372,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/bad-ssr.json$` + )}\\/bad-ssr\\.json$` ), page: '/bad-ssr', }, @@ -1414,7 +1414,7 @@ describe('Prerender', () => { }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/blog.json$` + `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/blog\\.json$` ), page: '/blog', }, @@ -1493,7 +1493,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/default-revalidate.json$` + )}\\/default-revalidate\\.json$` ), page: '/default-revalidate', }, @@ -1557,7 +1557,7 @@ describe('Prerender', () => { { dataRouteRegex: `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/large-page-data-ssr.json$`, + )}\\/large-page-data-ssr\\.json$`, page: '/large-page-data-ssr', }, { @@ -1592,7 +1592,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/preview.json$` + )}\\/preview\\.json$` ), page: '/preview', }, @@ -1600,7 +1600,7 @@ describe('Prerender', () => { dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/something.json$` + )}\\/something\\.json$` ), page: '/something', }, @@ -1648,7 +1648,7 @@ describe('Prerender', () => { expect(manifest.routes).toEqual(expectedManifestRoutes()) expect(manifest.dynamicRoutes).toEqual({ '/api-docs/[...slug]': { - dataRoute: `/_next/data/${next.buildId}/api-docs/[...slug].json`, + dataRoute: `/_next/data/${next.buildId}/api-docs/[...slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/api\\-docs\\/(.+?)\\.json$` ), @@ -1657,7 +1657,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback-once/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/[slug].json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/[slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\-once\\/([^\\/]+?)\\.json$` ), @@ -1668,7 +1668,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback-some/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/[slug].json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/[slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\-some\\/([^\\/]+?)\\.json$` ), @@ -1679,7 +1679,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/[slug].json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/[slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\/([^\\/]+?)\\.json$` ), @@ -1691,7 +1691,7 @@ describe('Prerender', () => { }, '/blog/[post]': { fallback: '/blog/[post].html', - dataRoute: `/_next/data/${next.buildId}/blog/[post].json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blog\\/([^\\/]+?)\\.json$` ), @@ -1700,7 +1700,7 @@ describe('Prerender', () => { }, '/blog/[post]/[comment]': { fallback: '/blog/[post]/[comment].html', - dataRoute: `/_next/data/${next.buildId}/blog/[post]/[comment].json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post]/[comment]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blog\\/([^\\/]+?)\\/([^\\/]+?)\\.json$` ), @@ -1710,7 +1710,7 @@ describe('Prerender', () => { allowHeader, }, '/dynamic/[slug]': { - dataRoute: `/_next/data/${next.buildId}/dynamic/[slug].json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/dynamic\\/([^\\/]+?)\\.json$` ), @@ -1719,7 +1719,7 @@ describe('Prerender', () => { allowHeader, }, '/fallback-only/[slug]': { - dataRoute: `/_next/data/${next.buildId}/fallback-only/[slug].json`, + dataRoute: `/_next/data/${next.buildId}/fallback-only/[slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/fallback\\-only\\/([^\\/]+?)\\.json$` ), @@ -1730,7 +1730,7 @@ describe('Prerender', () => { allowHeader, }, '/lang/[lang]/about': { - dataRoute: `/_next/data/${next.buildId}/lang/[lang]/about.json`, + dataRoute: `/_next/data/${next.buildId}/lang/[lang]/about\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/lang\\/([^\\/]+?)\\/about\\.json$` ), @@ -1741,7 +1741,7 @@ describe('Prerender', () => { allowHeader, }, '/non-json-blocking/[p]': { - dataRoute: `/_next/data/${next.buildId}/non-json-blocking/[p].json`, + dataRoute: `/_next/data/${next.buildId}/non-json-blocking/[p]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/non\\-json\\-blocking\\/([^\\/]+?)\\.json$` ), @@ -1752,7 +1752,7 @@ describe('Prerender', () => { allowHeader, }, '/non-json/[p]': { - dataRoute: `/_next/data/${next.buildId}/non-json/[p].json`, + dataRoute: `/_next/data/${next.buildId}/non-json/[p]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/non\\-json\\/([^\\/]+?)\\.json$` ), @@ -1764,7 +1764,7 @@ describe('Prerender', () => { }, '/user/[user]/profile': { fallback: '/user/[user]/profile.html', - dataRoute: `/_next/data/${next.buildId}/user/[user]/profile.json`, + dataRoute: `/_next/data/${next.buildId}/user/[user]/profile\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/user\\/([^\\/]+?)\\/profile\\.json$` ), @@ -1777,14 +1777,14 @@ describe('Prerender', () => { '/catchall/[...slug]': { fallback: '/catchall/[...slug].html', routeRegex: normalizeRegEx('^\\/catchall\\/(.+?)(?:\\/)?$'), - dataRoute: `/_next/data/${next.buildId}/catchall/[...slug].json`, + dataRoute: `/_next/data/${next.buildId}/catchall/[...slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\/(.+?)\\.json$` ), allowHeader, }, '/catchall-optional/[[...slug]]': { - dataRoute: `/_next/data/${next.buildId}/catchall-optional/[[...slug]].json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional/[[...slug]]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\-optional(?:\\/(.+?))?\\.json$` ), @@ -1795,7 +1795,7 @@ describe('Prerender', () => { allowHeader, }, '/catchall-explicit/[...slug]': { - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[...slug].json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[...slug]\\.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\-explicit\\/(.+?)\\.json$` ), diff --git a/test/integration/404-page-ssg/test/index.test.js b/test/integration/404-page-ssg/test/index.test.js index 6bd929b3dafb6..c6446189b9cba 100644 --- a/test/integration/404-page-ssg/test/index.test.js +++ b/test/integration/404-page-ssg/test/index.test.js @@ -77,7 +77,7 @@ const runTests = (isDev) => { ], initialRevalidateSeconds: false, srcRoute: null, - dataRoute: `/_next/data/${buildId}/404.json`, + dataRoute: `/_next/data/${buildId}/404\\.json`, }) }) } diff --git a/test/integration/i18n-support/test/shared.js b/test/integration/i18n-support/test/shared.js index 6e6e810e78522..31fdbb79a11ec 100644 --- a/test/integration/i18n-support/test/shared.js +++ b/test/integration/i18n-support/test/shared.js @@ -781,7 +781,7 @@ export function runTests(ctx) { "/do": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -794,7 +794,7 @@ export function runTests(ctx) { "/do-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -807,7 +807,7 @@ export function runTests(ctx) { "/do-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -820,7 +820,7 @@ export function runTests(ctx) { "/do-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -833,7 +833,7 @@ export function runTests(ctx) { "/do-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -846,7 +846,7 @@ export function runTests(ctx) { "/do-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/do-BE/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/do-BE/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -859,7 +859,7 @@ export function runTests(ctx) { "/do-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -872,7 +872,7 @@ export function runTests(ctx) { "/do/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -885,7 +885,7 @@ export function runTests(ctx) { "/do/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -898,7 +898,7 @@ export function runTests(ctx) { "/do/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -911,7 +911,7 @@ export function runTests(ctx) { "/do/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/do/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/do/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -924,7 +924,7 @@ export function runTests(ctx) { "/do/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -937,7 +937,7 @@ export function runTests(ctx) { "/en": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -950,7 +950,7 @@ export function runTests(ctx) { "/en-US": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -963,7 +963,7 @@ export function runTests(ctx) { "/en-US/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -976,7 +976,7 @@ export function runTests(ctx) { "/en-US/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -989,7 +989,7 @@ export function runTests(ctx) { "/en-US/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1002,7 +1002,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1015,7 +1015,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/first.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/first\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1028,7 +1028,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/second.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/second\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1041,7 +1041,7 @@ export function runTests(ctx) { "/en-US/gsp/no-fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/first.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/first\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1054,7 +1054,7 @@ export function runTests(ctx) { "/en-US/gsp/no-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/second.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/second\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1067,7 +1067,7 @@ export function runTests(ctx) { "/en-US/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1080,7 +1080,7 @@ export function runTests(ctx) { "/en-US/not-found/blocking-fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/blocking-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/first.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/first\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1093,7 +1093,7 @@ export function runTests(ctx) { "/en-US/not-found/blocking-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/blocking-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/second.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/second\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1106,7 +1106,7 @@ export function runTests(ctx) { "/en-US/not-found/fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/first.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/first\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1119,7 +1119,7 @@ export function runTests(ctx) { "/en-US/not-found/fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/second.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/second\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1132,7 +1132,7 @@ export function runTests(ctx) { "/en/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1145,7 +1145,7 @@ export function runTests(ctx) { "/en/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1158,7 +1158,7 @@ export function runTests(ctx) { "/en/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1171,7 +1171,7 @@ export function runTests(ctx) { "/en/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/en/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1184,7 +1184,7 @@ export function runTests(ctx) { "/en/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1197,7 +1197,7 @@ export function runTests(ctx) { "/fr": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1210,7 +1210,7 @@ export function runTests(ctx) { "/fr-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1223,7 +1223,7 @@ export function runTests(ctx) { "/fr-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1236,7 +1236,7 @@ export function runTests(ctx) { "/fr-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1249,7 +1249,7 @@ export function runTests(ctx) { "/fr-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1262,7 +1262,7 @@ export function runTests(ctx) { "/fr-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/fr-BE/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/fr-BE/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1275,7 +1275,7 @@ export function runTests(ctx) { "/fr-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1288,7 +1288,7 @@ export function runTests(ctx) { "/fr/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1301,7 +1301,7 @@ export function runTests(ctx) { "/fr/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1314,7 +1314,7 @@ export function runTests(ctx) { "/fr/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1327,7 +1327,7 @@ export function runTests(ctx) { "/fr/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/fr/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/fr/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1340,7 +1340,7 @@ export function runTests(ctx) { "/fr/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1353,7 +1353,7 @@ export function runTests(ctx) { "/go": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1366,7 +1366,7 @@ export function runTests(ctx) { "/go-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1379,7 +1379,7 @@ export function runTests(ctx) { "/go-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1392,7 +1392,7 @@ export function runTests(ctx) { "/go-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1405,7 +1405,7 @@ export function runTests(ctx) { "/go-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1418,7 +1418,7 @@ export function runTests(ctx) { "/go-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/go-BE/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/go-BE/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1431,7 +1431,7 @@ export function runTests(ctx) { "/go-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1444,7 +1444,7 @@ export function runTests(ctx) { "/go/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1457,7 +1457,7 @@ export function runTests(ctx) { "/go/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1470,7 +1470,7 @@ export function runTests(ctx) { "/go/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1483,7 +1483,7 @@ export function runTests(ctx) { "/go/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/go/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/go/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1496,7 +1496,7 @@ export function runTests(ctx) { "/go/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1509,7 +1509,7 @@ export function runTests(ctx) { "/nl": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1522,7 +1522,7 @@ export function runTests(ctx) { "/nl-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1535,7 +1535,7 @@ export function runTests(ctx) { "/nl-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1548,7 +1548,7 @@ export function runTests(ctx) { "/nl-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1561,7 +1561,7 @@ export function runTests(ctx) { "/nl-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1574,7 +1574,7 @@ export function runTests(ctx) { "/nl-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-BE/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/nl-BE/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1587,7 +1587,7 @@ export function runTests(ctx) { "/nl-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1600,7 +1600,7 @@ export function runTests(ctx) { "/nl-NL": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index.json", + "dataRoute": "/_next/data/BUILD_ID/index\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1613,7 +1613,7 @@ export function runTests(ctx) { "/nl-NL/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1626,7 +1626,7 @@ export function runTests(ctx) { "/nl-NL/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1639,7 +1639,7 @@ export function runTests(ctx) { "/nl-NL/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1652,7 +1652,7 @@ export function runTests(ctx) { "/nl-NL/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1665,7 +1665,7 @@ export function runTests(ctx) { "/nl-NL/gsp/no-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/no-fallback/second.json", + "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/no-fallback/second\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1678,7 +1678,7 @@ export function runTests(ctx) { "/nl-NL/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1691,7 +1691,7 @@ export function runTests(ctx) { "/nl/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404.json", + "dataRoute": "/_next/data/BUILD_ID/404\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1704,7 +1704,7 @@ export function runTests(ctx) { "/nl/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank.json", + "dataRoute": "/_next/data/BUILD_ID/frank\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1717,7 +1717,7 @@ export function runTests(ctx) { "/nl/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp.json", + "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1730,7 +1730,7 @@ export function runTests(ctx) { "/nl/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl/gsp/fallback/always.json", + "dataRoute": "/_next/data/BUILD_ID/nl/gsp/fallback/always\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1743,7 +1743,7 @@ export function runTests(ctx) { "/nl/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found.json", + "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", "allowHeader": [ "host", "x-matched-path", @@ -1768,7 +1768,7 @@ export function runTests(ctx) { "{ "/gsp/fallback/[slug]": { "routeRegex": "^\\/gsp\\/fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/gsp/fallback/[slug].json", + "dataRoute": "/_next/data/BUILD_ID/gsp/fallback/[slug]\\.json", "fallback": "/gsp/fallback/[slug].html", "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/gsp\\/fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1782,7 +1782,7 @@ export function runTests(ctx) { }, "/gsp/no-fallback/[slug]": { "routeRegex": "^\\/gsp\\/no\\-fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/gsp/no-fallback/[slug].json", + "dataRoute": "/_next/data/BUILD_ID/gsp/no-fallback/[slug]\\.json", "fallback": false, "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/gsp\\/no\\-fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1796,7 +1796,7 @@ export function runTests(ctx) { }, "/not-found/blocking-fallback/[slug]": { "routeRegex": "^\\/not\\-found\\/blocking\\-fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/not-found/blocking-fallback/[slug].json", + "dataRoute": "/_next/data/BUILD_ID/not-found/blocking-fallback/[slug]\\.json", "fallback": null, "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/not\\-found\\/blocking\\-fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1810,7 +1810,7 @@ export function runTests(ctx) { }, "/not-found/fallback/[slug]": { "routeRegex": "^\\/not\\-found\\/fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/not-found/fallback/[slug].json", + "dataRoute": "/_next/data/BUILD_ID/not-found/fallback/[slug]\\.json", "fallback": "/not-found/fallback/[slug].html", "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/not\\-found\\/fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ From dae0d33d5742a01b97ee94e7920981e187cd1e35 Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 12:15:58 -0600 Subject: [PATCH 03/10] Fix two more locations that weren't escaping properly --- packages/next/src/build/index.ts | 2 +- .../next/src/server/lib/router-utils/build-data-route.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index a2d9c4731741f..3166ee4f94511 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -3544,7 +3544,7 @@ export default async function build( const dataRoute = path.posix.join( '/_next/data', buildId, - `${normalizedRoute}.json` + `${normalizedRoute}\\.json` ) prerenderManifest.dynamicRoutes[tbdRoute] = { diff --git a/packages/next/src/server/lib/router-utils/build-data-route.ts b/packages/next/src/server/lib/router-utils/build-data-route.ts index b0564da5ac1a1..fcd292f5c0240 100644 --- a/packages/next/src/server/lib/router-utils/build-data-route.ts +++ b/packages/next/src/server/lib/router-utils/build-data-route.ts @@ -7,7 +7,11 @@ import { escapeStringRegexp } from '../../../shared/lib/escape-regexp' export function buildDataRoute(page: string, buildId: string) { const pagePath = normalizePagePath(page) - const dataRoute = path.posix.join('/_next/data', buildId, `${pagePath}.json`) + const dataRoute = path.posix.join( + '/_next/data', + buildId, + `${pagePath}\\.json` + ) let dataRouteRegex: string let namedDataRouteRegex: string | undefined From f3fc58108ee6155234910348f85a6781a9918afd Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 12:21:51 -0600 Subject: [PATCH 04/10] Undo changes to test that didn't need changes --- test/integration/404-page-ssg/test/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/404-page-ssg/test/index.test.js b/test/integration/404-page-ssg/test/index.test.js index c6446189b9cba..6bd929b3dafb6 100644 --- a/test/integration/404-page-ssg/test/index.test.js +++ b/test/integration/404-page-ssg/test/index.test.js @@ -77,7 +77,7 @@ const runTests = (isDev) => { ], initialRevalidateSeconds: false, srcRoute: null, - dataRoute: `/_next/data/${buildId}/404\\.json`, + dataRoute: `/_next/data/${buildId}/404.json`, }) }) } From 126ed373d83084af663ec3a3afdc6bc998a8e9dc Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 12:27:53 -0600 Subject: [PATCH 05/10] Fix another test typo --- test/e2e/getserversideprops/test/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/getserversideprops/test/index.test.ts b/test/e2e/getserversideprops/test/index.test.ts index 46f996dfe46af..b0957855a4ae0 100644 --- a/test/e2e/getserversideprops/test/index.test.ts +++ b/test/e2e/getserversideprops/test/index.test.ts @@ -113,7 +113,7 @@ const expectedManifestRoutes = () => [ }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/non\\-json\\.json$` + `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/non-json\\.json$` ), page: '/non-json', }, From de91bc78e6d346a02c74cdd0acacd2391921340e Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 12:52:26 -0600 Subject: [PATCH 06/10] Undo escapes we don't need --- packages/next/src/build/index.ts | 2 +- .../next/src/server/lib/router-utils/build-data-route.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 3166ee4f94511..a2d9c4731741f 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -3544,7 +3544,7 @@ export default async function build( const dataRoute = path.posix.join( '/_next/data', buildId, - `${normalizedRoute}\\.json` + `${normalizedRoute}.json` ) prerenderManifest.dynamicRoutes[tbdRoute] = { diff --git a/packages/next/src/server/lib/router-utils/build-data-route.ts b/packages/next/src/server/lib/router-utils/build-data-route.ts index fcd292f5c0240..6b8560a21340d 100644 --- a/packages/next/src/server/lib/router-utils/build-data-route.ts +++ b/packages/next/src/server/lib/router-utils/build-data-route.ts @@ -7,11 +7,7 @@ import { escapeStringRegexp } from '../../../shared/lib/escape-regexp' export function buildDataRoute(page: string, buildId: string) { const pagePath = normalizePagePath(page) - const dataRoute = path.posix.join( - '/_next/data', - buildId, - `${pagePath}\\.json` - ) + const dataRoute = path.posix.join('/_next/data', buildId, `${pagePath}.json`) let dataRouteRegex: string let namedDataRouteRegex: string | undefined @@ -31,6 +27,7 @@ export function buildDataRoute(page: string, buildId: string) { `\\.json$` ) routeKeys = routeRegex.routeKeys + console.log("DYNAMIC ROUTE", { routeKeys, dataRouteRegex, namedDataRouteRegex, routeRegex }) } else { dataRouteRegex = normalizeRouteRegex( new RegExp( @@ -41,6 +38,7 @@ export function buildDataRoute(page: string, buildId: string) { )}$` ).source ) + console.log("STATIC ROUTE", { routeKeys, dataRouteRegex, namedDataRouteRegex }) } return { From 0202e4bb2a814bf56515a6a48b7cbc3be7198ca1 Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 12:54:47 -0600 Subject: [PATCH 07/10] Remove debug logs --- packages/next/src/server/lib/router-utils/build-data-route.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/next/src/server/lib/router-utils/build-data-route.ts b/packages/next/src/server/lib/router-utils/build-data-route.ts index 6b8560a21340d..b0564da5ac1a1 100644 --- a/packages/next/src/server/lib/router-utils/build-data-route.ts +++ b/packages/next/src/server/lib/router-utils/build-data-route.ts @@ -27,7 +27,6 @@ export function buildDataRoute(page: string, buildId: string) { `\\.json$` ) routeKeys = routeRegex.routeKeys - console.log("DYNAMIC ROUTE", { routeKeys, dataRouteRegex, namedDataRouteRegex, routeRegex }) } else { dataRouteRegex = normalizeRouteRegex( new RegExp( @@ -38,7 +37,6 @@ export function buildDataRoute(page: string, buildId: string) { )}$` ).source ) - console.log("STATIC ROUTE", { routeKeys, dataRouteRegex, namedDataRouteRegex }) } return { From 11d6cbb082692e6fdabdc6c131e6efef0f7853c5 Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 13:04:53 -0600 Subject: [PATCH 08/10] Don't change some tests that don't expect escaping --- test/e2e/prerender.test.ts | 108 ++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/test/e2e/prerender.test.ts b/test/e2e/prerender.test.ts index 02d29ed02b57d..27ecae42c43d8 100644 --- a/test/e2e/prerender.test.ts +++ b/test/e2e/prerender.test.ts @@ -105,235 +105,235 @@ describe('Prerender', () => { const expectedManifestRoutes = () => ({ '/': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/index\\.json`, + dataRoute: `/_next/data/${next.buildId}/index.json`, initialRevalidateSeconds: 2, srcRoute: null, }, '/blog/[post3]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/[post3]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post3].json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-1\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-1.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-2': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-2\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-2.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-4': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-4\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-4.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/blog/post-1/comment-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-1/comment-1\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-1/comment-1.json`, initialRevalidateSeconds: 2, srcRoute: '/blog/[post]/[comment]', }, '/blog/post-2/comment-2': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post-2/comment-2\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post-2/comment-2.json`, initialRevalidateSeconds: 2, srcRoute: '/blog/[post]/[comment]', }, '/blog/post.1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog/post.1\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/post.1.json`, initialRevalidateSeconds: 10, srcRoute: '/blog/[post]', }, '/catchall-explicit/another/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/another/value\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/another/value.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/first\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/first.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/hello/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/hello/another\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/hello/another.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/second': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/second\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/second.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/[first]/[second]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[first]/[second]\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[first]/[second].json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-explicit/[third]/[fourth]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[third]/[fourth]\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[third]/[fourth].json`, initialRevalidateSeconds: 1, srcRoute: '/catchall-explicit/[...slug]', }, '/catchall-optional': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-optional\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional.json`, initialRevalidateSeconds: false, srcRoute: '/catchall-optional/[[...slug]]', }, '/catchall-optional/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall-optional/value\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional/value.json`, initialRevalidateSeconds: false, srcRoute: '/catchall-optional/[[...slug]]', }, '/large-page-data': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/large-page-data\\.json`, + dataRoute: `/_next/data/${next.buildId}/large-page-data.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/another\\.json`, + dataRoute: `/_next/data/${next.buildId}/another.json`, initialRevalidateSeconds: 1, srcRoute: null, }, '/preview': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/preview\\.json`, + dataRoute: `/_next/data/${next.buildId}/preview.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/api-docs/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/api-docs/first\\.json`, + dataRoute: `/_next/data/${next.buildId}/api-docs/first.json`, initialRevalidateSeconds: false, srcRoute: '/api-docs/[...slug]', }, '/blocking-fallback-once/404-on-manual-revalidate': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/404-on-manual-revalidate\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/404-on-manual-revalidate.json`, initialRevalidateSeconds: false, srcRoute: '/blocking-fallback-once/[slug]', }, '/blocking-fallback-some/a': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/a\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/a.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback-some/[slug]', }, '/blocking-fallback-some/b': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/b\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/b.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback-some/[slug]', }, '/blocking-fallback/lots-of-data': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/lots-of-data\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/lots-of-data.json`, initialRevalidateSeconds: false, srcRoute: '/blocking-fallback/[slug]', }, '/blocking-fallback/test-errors-1': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/test-errors-1\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/test-errors-1.json`, initialRevalidateSeconds: 1, srcRoute: '/blocking-fallback/[slug]', }, '/blog': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/blog\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog.json`, initialRevalidateSeconds: 10, srcRoute: null, }, '/default-revalidate': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/default-revalidate\\.json`, + dataRoute: `/_next/data/${next.buildId}/default-revalidate.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/dynamic/[first]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/dynamic/[first]\\.json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[first].json`, initialRevalidateSeconds: false, srcRoute: '/dynamic/[slug]', }, '/dynamic/[second]': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/dynamic/[second]\\.json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[second].json`, initialRevalidateSeconds: false, srcRoute: '/dynamic/[slug]', }, // TODO: investigate index/index // '/index': { - // dataRoute: `/_next/data/${next.buildId}/index/index\\.json`, + // dataRoute: `/_next/data/${next.buildId}/index/index.json`, // initialRevalidateSeconds: false, // srcRoute: null, // }, '/lang/de/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/de/about\\.json`, + dataRoute: `/_next/data/${next.buildId}/lang/de/about.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/en/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/en/about\\.json`, + dataRoute: `/_next/data/${next.buildId}/lang/en/about.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/es/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/es/about\\.json`, + dataRoute: `/_next/data/${next.buildId}/lang/es/about.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/lang/fr/about': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/lang/fr/about\\.json`, + dataRoute: `/_next/data/${next.buildId}/lang/fr/about.json`, initialRevalidateSeconds: false, srcRoute: '/lang/[lang]/about', }, '/something': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/something\\.json`, + dataRoute: `/_next/data/${next.buildId}/something.json`, initialRevalidateSeconds: false, srcRoute: null, }, '/catchall/another/value': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/another/value\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/another/value.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/first': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/first\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/first.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/second': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/second\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/second.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, '/catchall/hello/another': { allowHeader, - dataRoute: `/_next/data/${next.buildId}/catchall/hello/another\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/hello/another.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', }, @@ -1648,7 +1648,7 @@ describe('Prerender', () => { expect(manifest.routes).toEqual(expectedManifestRoutes()) expect(manifest.dynamicRoutes).toEqual({ '/api-docs/[...slug]': { - dataRoute: `/_next/data/${next.buildId}/api-docs/[...slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/api-docs/[...slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/api\\-docs\\/(.+?)\\.json$` ), @@ -1657,7 +1657,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback-once/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/[slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-once/[slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\-once\\/([^\\/]+?)\\.json$` ), @@ -1668,7 +1668,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback-some/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/[slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback-some/[slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\-some\\/([^\\/]+?)\\.json$` ), @@ -1679,7 +1679,7 @@ describe('Prerender', () => { allowHeader, }, '/blocking-fallback/[slug]': { - dataRoute: `/_next/data/${next.buildId}/blocking-fallback/[slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blocking-fallback/[slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blocking\\-fallback\\/([^\\/]+?)\\.json$` ), @@ -1691,7 +1691,7 @@ describe('Prerender', () => { }, '/blog/[post]': { fallback: '/blog/[post].html', - dataRoute: `/_next/data/${next.buildId}/blog/[post]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blog\\/([^\\/]+?)\\.json$` ), @@ -1700,7 +1700,7 @@ describe('Prerender', () => { }, '/blog/[post]/[comment]': { fallback: '/blog/[post]/[comment].html', - dataRoute: `/_next/data/${next.buildId}/blog/[post]/[comment]\\.json`, + dataRoute: `/_next/data/${next.buildId}/blog/[post]/[comment].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/blog\\/([^\\/]+?)\\/([^\\/]+?)\\.json$` ), @@ -1710,7 +1710,7 @@ describe('Prerender', () => { allowHeader, }, '/dynamic/[slug]': { - dataRoute: `/_next/data/${next.buildId}/dynamic/[slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/dynamic/[slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/dynamic\\/([^\\/]+?)\\.json$` ), @@ -1719,7 +1719,7 @@ describe('Prerender', () => { allowHeader, }, '/fallback-only/[slug]': { - dataRoute: `/_next/data/${next.buildId}/fallback-only/[slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/fallback-only/[slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/fallback\\-only\\/([^\\/]+?)\\.json$` ), @@ -1730,7 +1730,7 @@ describe('Prerender', () => { allowHeader, }, '/lang/[lang]/about': { - dataRoute: `/_next/data/${next.buildId}/lang/[lang]/about\\.json`, + dataRoute: `/_next/data/${next.buildId}/lang/[lang]/about.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/lang\\/([^\\/]+?)\\/about\\.json$` ), @@ -1741,7 +1741,7 @@ describe('Prerender', () => { allowHeader, }, '/non-json-blocking/[p]': { - dataRoute: `/_next/data/${next.buildId}/non-json-blocking/[p]\\.json`, + dataRoute: `/_next/data/${next.buildId}/non-json-blocking/[p].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/non\\-json\\-blocking\\/([^\\/]+?)\\.json$` ), @@ -1752,7 +1752,7 @@ describe('Prerender', () => { allowHeader, }, '/non-json/[p]': { - dataRoute: `/_next/data/${next.buildId}/non-json/[p]\\.json`, + dataRoute: `/_next/data/${next.buildId}/non-json/[p].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/non\\-json\\/([^\\/]+?)\\.json$` ), @@ -1764,7 +1764,7 @@ describe('Prerender', () => { }, '/user/[user]/profile': { fallback: '/user/[user]/profile.html', - dataRoute: `/_next/data/${next.buildId}/user/[user]/profile\\.json`, + dataRoute: `/_next/data/${next.buildId}/user/[user]/profile.json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/user\\/([^\\/]+?)\\/profile\\.json$` ), @@ -1777,14 +1777,14 @@ describe('Prerender', () => { '/catchall/[...slug]': { fallback: '/catchall/[...slug].html', routeRegex: normalizeRegEx('^\\/catchall\\/(.+?)(?:\\/)?$'), - dataRoute: `/_next/data/${next.buildId}/catchall/[...slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall/[...slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\/(.+?)\\.json$` ), allowHeader, }, '/catchall-optional/[[...slug]]': { - dataRoute: `/_next/data/${next.buildId}/catchall-optional/[[...slug]]\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-optional/[[...slug]].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\-optional(?:\\/(.+?))?\\.json$` ), @@ -1795,7 +1795,7 @@ describe('Prerender', () => { allowHeader, }, '/catchall-explicit/[...slug]': { - dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[...slug]\\.json`, + dataRoute: `/_next/data/${next.buildId}/catchall-explicit/[...slug].json`, dataRouteRegex: normalizeRegEx( `^\\/_next\\/data\\/${escapedBuildId}\\/catchall\\-explicit\\/(.+?)\\.json$` ), From 0c4c509f1662e14f65236e221860af5e4389e4d7 Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 13:07:41 -0600 Subject: [PATCH 09/10] Undo more test changes that weren't needed --- test/integration/i18n-support/test/shared.js | 158 +++++++++---------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/test/integration/i18n-support/test/shared.js b/test/integration/i18n-support/test/shared.js index 31fdbb79a11ec..6e6e810e78522 100644 --- a/test/integration/i18n-support/test/shared.js +++ b/test/integration/i18n-support/test/shared.js @@ -781,7 +781,7 @@ export function runTests(ctx) { "/do": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -794,7 +794,7 @@ export function runTests(ctx) { "/do-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -807,7 +807,7 @@ export function runTests(ctx) { "/do-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -820,7 +820,7 @@ export function runTests(ctx) { "/do-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -833,7 +833,7 @@ export function runTests(ctx) { "/do-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -846,7 +846,7 @@ export function runTests(ctx) { "/do-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/do-BE/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/do-BE/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -859,7 +859,7 @@ export function runTests(ctx) { "/do-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -872,7 +872,7 @@ export function runTests(ctx) { "/do/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -885,7 +885,7 @@ export function runTests(ctx) { "/do/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -898,7 +898,7 @@ export function runTests(ctx) { "/do/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -911,7 +911,7 @@ export function runTests(ctx) { "/do/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/do/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/do/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -924,7 +924,7 @@ export function runTests(ctx) { "/do/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -937,7 +937,7 @@ export function runTests(ctx) { "/en": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -950,7 +950,7 @@ export function runTests(ctx) { "/en-US": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -963,7 +963,7 @@ export function runTests(ctx) { "/en-US/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -976,7 +976,7 @@ export function runTests(ctx) { "/en-US/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -989,7 +989,7 @@ export function runTests(ctx) { "/en-US/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1002,7 +1002,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1015,7 +1015,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/first\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/first.json", "allowHeader": [ "host", "x-matched-path", @@ -1028,7 +1028,7 @@ export function runTests(ctx) { "/en-US/gsp/fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/second\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/fallback/second.json", "allowHeader": [ "host", "x-matched-path", @@ -1041,7 +1041,7 @@ export function runTests(ctx) { "/en-US/gsp/no-fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/first\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/first.json", "allowHeader": [ "host", "x-matched-path", @@ -1054,7 +1054,7 @@ export function runTests(ctx) { "/en-US/gsp/no-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/second\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/gsp/no-fallback/second.json", "allowHeader": [ "host", "x-matched-path", @@ -1067,7 +1067,7 @@ export function runTests(ctx) { "/en-US/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1080,7 +1080,7 @@ export function runTests(ctx) { "/en-US/not-found/blocking-fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/blocking-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/first\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/first.json", "allowHeader": [ "host", "x-matched-path", @@ -1093,7 +1093,7 @@ export function runTests(ctx) { "/en-US/not-found/blocking-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/blocking-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/second\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/blocking-fallback/second.json", "allowHeader": [ "host", "x-matched-path", @@ -1106,7 +1106,7 @@ export function runTests(ctx) { "/en-US/not-found/fallback/first": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/first\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/first.json", "allowHeader": [ "host", "x-matched-path", @@ -1119,7 +1119,7 @@ export function runTests(ctx) { "/en-US/not-found/fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/not-found/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/second\\.json", + "dataRoute": "/_next/data/BUILD_ID/en-US/not-found/fallback/second.json", "allowHeader": [ "host", "x-matched-path", @@ -1132,7 +1132,7 @@ export function runTests(ctx) { "/en/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1145,7 +1145,7 @@ export function runTests(ctx) { "/en/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1158,7 +1158,7 @@ export function runTests(ctx) { "/en/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1171,7 +1171,7 @@ export function runTests(ctx) { "/en/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/en/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/en/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1184,7 +1184,7 @@ export function runTests(ctx) { "/en/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1197,7 +1197,7 @@ export function runTests(ctx) { "/fr": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1210,7 +1210,7 @@ export function runTests(ctx) { "/fr-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1223,7 +1223,7 @@ export function runTests(ctx) { "/fr-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1236,7 +1236,7 @@ export function runTests(ctx) { "/fr-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1249,7 +1249,7 @@ export function runTests(ctx) { "/fr-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1262,7 +1262,7 @@ export function runTests(ctx) { "/fr-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/fr-BE/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/fr-BE/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1275,7 +1275,7 @@ export function runTests(ctx) { "/fr-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1288,7 +1288,7 @@ export function runTests(ctx) { "/fr/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1301,7 +1301,7 @@ export function runTests(ctx) { "/fr/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1314,7 +1314,7 @@ export function runTests(ctx) { "/fr/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1327,7 +1327,7 @@ export function runTests(ctx) { "/fr/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/fr/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/fr/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1340,7 +1340,7 @@ export function runTests(ctx) { "/fr/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1353,7 +1353,7 @@ export function runTests(ctx) { "/go": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1366,7 +1366,7 @@ export function runTests(ctx) { "/go-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1379,7 +1379,7 @@ export function runTests(ctx) { "/go-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1392,7 +1392,7 @@ export function runTests(ctx) { "/go-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1405,7 +1405,7 @@ export function runTests(ctx) { "/go-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1418,7 +1418,7 @@ export function runTests(ctx) { "/go-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/go-BE/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/go-BE/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1431,7 +1431,7 @@ export function runTests(ctx) { "/go-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1444,7 +1444,7 @@ export function runTests(ctx) { "/go/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1457,7 +1457,7 @@ export function runTests(ctx) { "/go/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1470,7 +1470,7 @@ export function runTests(ctx) { "/go/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1483,7 +1483,7 @@ export function runTests(ctx) { "/go/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/go/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/go/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1496,7 +1496,7 @@ export function runTests(ctx) { "/go/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1509,7 +1509,7 @@ export function runTests(ctx) { "/nl": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1522,7 +1522,7 @@ export function runTests(ctx) { "/nl-BE": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1535,7 +1535,7 @@ export function runTests(ctx) { "/nl-BE/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1548,7 +1548,7 @@ export function runTests(ctx) { "/nl-BE/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1561,7 +1561,7 @@ export function runTests(ctx) { "/nl-BE/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1574,7 +1574,7 @@ export function runTests(ctx) { "/nl-BE/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-BE/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/nl-BE/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1587,7 +1587,7 @@ export function runTests(ctx) { "/nl-BE/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1600,7 +1600,7 @@ export function runTests(ctx) { "/nl-NL": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/index\\.json", + "dataRoute": "/_next/data/BUILD_ID/index.json", "allowHeader": [ "host", "x-matched-path", @@ -1613,7 +1613,7 @@ export function runTests(ctx) { "/nl-NL/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1626,7 +1626,7 @@ export function runTests(ctx) { "/nl-NL/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1639,7 +1639,7 @@ export function runTests(ctx) { "/nl-NL/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1652,7 +1652,7 @@ export function runTests(ctx) { "/nl-NL/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1665,7 +1665,7 @@ export function runTests(ctx) { "/nl-NL/gsp/no-fallback/second": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/no-fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/no-fallback/second\\.json", + "dataRoute": "/_next/data/BUILD_ID/nl-NL/gsp/no-fallback/second.json", "allowHeader": [ "host", "x-matched-path", @@ -1678,7 +1678,7 @@ export function runTests(ctx) { "/nl-NL/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1691,7 +1691,7 @@ export function runTests(ctx) { "/nl/404": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/404\\.json", + "dataRoute": "/_next/data/BUILD_ID/404.json", "allowHeader": [ "host", "x-matched-path", @@ -1704,7 +1704,7 @@ export function runTests(ctx) { "/nl/frank": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/frank\\.json", + "dataRoute": "/_next/data/BUILD_ID/frank.json", "allowHeader": [ "host", "x-matched-path", @@ -1717,7 +1717,7 @@ export function runTests(ctx) { "/nl/gsp": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/gsp\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp.json", "allowHeader": [ "host", "x-matched-path", @@ -1730,7 +1730,7 @@ export function runTests(ctx) { "/nl/gsp/fallback/always": { "initialRevalidateSeconds": false, "srcRoute": "/gsp/fallback/[slug]", - "dataRoute": "/_next/data/BUILD_ID/nl/gsp/fallback/always\\.json", + "dataRoute": "/_next/data/BUILD_ID/nl/gsp/fallback/always.json", "allowHeader": [ "host", "x-matched-path", @@ -1743,7 +1743,7 @@ export function runTests(ctx) { "/nl/not-found": { "initialRevalidateSeconds": false, "srcRoute": null, - "dataRoute": "/_next/data/BUILD_ID/not-found\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found.json", "allowHeader": [ "host", "x-matched-path", @@ -1768,7 +1768,7 @@ export function runTests(ctx) { "{ "/gsp/fallback/[slug]": { "routeRegex": "^\\/gsp\\/fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/gsp/fallback/[slug]\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp/fallback/[slug].json", "fallback": "/gsp/fallback/[slug].html", "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/gsp\\/fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1782,7 +1782,7 @@ export function runTests(ctx) { }, "/gsp/no-fallback/[slug]": { "routeRegex": "^\\/gsp\\/no\\-fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/gsp/no-fallback/[slug]\\.json", + "dataRoute": "/_next/data/BUILD_ID/gsp/no-fallback/[slug].json", "fallback": false, "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/gsp\\/no\\-fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1796,7 +1796,7 @@ export function runTests(ctx) { }, "/not-found/blocking-fallback/[slug]": { "routeRegex": "^\\/not\\-found\\/blocking\\-fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/not-found/blocking-fallback/[slug]\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found/blocking-fallback/[slug].json", "fallback": null, "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/not\\-found\\/blocking\\-fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ @@ -1810,7 +1810,7 @@ export function runTests(ctx) { }, "/not-found/fallback/[slug]": { "routeRegex": "^\\/not\\-found\\/fallback\\/([^\\/]+?)(?:\\/)?$", - "dataRoute": "/_next/data/BUILD_ID/not-found/fallback/[slug]\\.json", + "dataRoute": "/_next/data/BUILD_ID/not-found/fallback/[slug].json", "fallback": "/not-found/fallback/[slug].html", "dataRouteRegex": "^\\/_next\\/data\\/BUILD_ID\\/not\\-found\\/fallback\\/([^\\/]+?)\\.json$", "allowHeader": [ From 029e3d6b35d6f51d96777656885ad727e1d900b0 Mon Sep 17 00:00:00 2001 From: Tim Caswell Date: Thu, 12 Dec 2024 13:24:44 -0600 Subject: [PATCH 10/10] Update 3 more tests that should expect escapes --- test/e2e/prerender.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/prerender.test.ts b/test/e2e/prerender.test.ts index 27ecae42c43d8..531f47efba330 100644 --- a/test/e2e/prerender.test.ts +++ b/test/e2e/prerender.test.ts @@ -1530,7 +1530,7 @@ describe('Prerender', () => { // dataRouteRegex: normalizeRegEx( // `^\\/_next\\/data\\/${escapeRegex( // next.buildId - // )}\\/index\\/index.json$` + // )}\\/index\\/index\\.json$` // ), // page: '/index', // }, @@ -1551,7 +1551,7 @@ describe('Prerender', () => { { dataRouteRegex: `^\\/_next\\/data\\/${escapeRegex( next.buildId - )}\\/large-page-data.json$`, + )}\\/large-page-data\\.json$`, page: '/large-page-data', }, { @@ -1606,7 +1606,7 @@ describe('Prerender', () => { }, { dataRouteRegex: normalizeRegEx( - `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/ssr.json$` + `^\\/_next\\/data\\/${escapeRegex(next.buildId)}\\/ssr\\.json$` ), page: '/ssr', },