Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split entrypoint/route handling into separate dev and prod versions #75169

Draft
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

wbinnssmith
Copy link
Member

@wbinnssmith wbinnssmith commented Jan 22, 2025

Currently, for handleEntrypoints, handlePagesErrorRoute, handleRouteType, etc, both dev and prod use cases are combined into the same functions. This leads to a lot of branching, use-case-specific arguments, etc. for minimal opportunity for shared code.

In a following PR, entrypoint writing for prod will be done through a single napi call to rust, further branching the two versions.

This splits them formally, at the cost of duplicating a handful of lines in each case. Perhaps in the future we can develop a better system for sharing code, but this makes things far clearer and easier to maintain in this moment.

Test Plan: CI

@ijjk ijjk added created-by: Turbopack team PRs by the Turbopack team. type: next labels Jan 22, 2025
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/split-handle-endpoints branch from 4c98342 to 4f3128a Compare January 22, 2025 00:40
@wbinnssmith wbinnssmith changed the title wbinnssmith/split handle endpoints Split entrypoint/route handling into separate dev and prod versions Jan 22, 2025
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/split-handle-endpoints branch from 4f3128a to 5b0fbd6 Compare January 22, 2025 01:26
@ijjk
Copy link
Member

ijjk commented Jan 22, 2025

Failing test suites

Commit: 7eb1d8a

pnpm test test/integration/middleware-basic/test/index.test.js (turbopack)

  • production mode > loads a middleware
Expand output

● production mode › loads a middleware

expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false

  20 |   it('loads a middleware', async () => {
  21 |     const response = await fetchViaHTTP(appPort, '/post-1')
> 22 |     expect(response.headers.has(header)).toBe(true)
     |                                          ^
  23 |   })
  24 | }
  25 |

  at Object.toBe (integration/middleware-basic/test/index.test.js:22:42)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/draft-mode-middleware/draft-mode-middleware.test.ts (turbopack)

  • app-dir - draft-mode-middleware > should be able to enable draft mode with middleware present
  • app-dir - draft-mode-middleware > should be able to disable draft mode with middleware present
Expand output

● app-dir - draft-mode-middleware › should be able to enable draft mode with middleware present

expect(received).toContain(expected) // indexOf

Expected substring: "draftMode().isEnabled from middleware: true"
Received string:    "   No config file found
   No config file found
   ▲ Next.js 15.2.0-canary.19 (Turbopack)·
   Creating an optimized production build ...
   No config file found
   Building (0/5) ...
   Building (1/5)··
   Building (2/5)··
   Building (3/5)··
 ✓ Building (5/5)
 ✓ Compiled successfully in 2.4s
   Linting and checking validity of types ...·
   We detected TypeScript in your project and created a tsconfig.json file for you.
   Collecting page data ...
   Generating static pages (0/6) ...
   Generating static pages (1/6)··
   Generating static pages (2/6)··
   Generating static pages (4/6)··
 ✓ Generating static pages (6/6)
   Finalizing page optimization ...
   Collecting build traces ...·
Route (app)                                Size     First Load JS
┌ ○ /_not-found                            0 B             119 kB
├ ƒ /api/disable-draft                     0 B                0 B
├ ƒ /api/draft                             0 B                0 B
└ ○ /preview-page                          0 B             119 kB
+ First Load JS shared by all              119 kB
  ├ chunks/node_modules__pnpm_3397f5._.js  84 kB
  ├ chunks/node_modules__pnpm_ab2540._.js  24.5 kB
  └ other shared chunks (total)            10.9 kB··
○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand·
   ▲ Next.js 15.2.0-canary.19 (Turbopack)
   - Local:        http://localhost:45127
   - Network:      http://135.181.51.13:45127·
 ✓ Starting...
   No config file found
   No config file found
 ✓ Ready in 313ms
   No config file found
"

  18 |
  19 |     await retry(async () => {
> 20 |       expect(next.cliOutput).toContain(
     |                              ^
  21 |         'draftMode().isEnabled from middleware: true'
  22 |       )
  23 |     })

  at toContain (e2e/app-dir/draft-mode-middleware/draft-mode-middleware.test.ts:20:30)
  at fn (lib/next-test-utils.ts:806:20)
  at Object.<anonymous> (e2e/app-dir/draft-mode-middleware/draft-mode-middleware.test.ts:19:5)

● app-dir - draft-mode-middleware › should be able to disable draft mode with middleware present

expect(received).toContain(expected) // indexOf

Expected substring: "draftMode().isEnabled from middleware: false"
Received string:    "   No config file found
   No config file found
   ▲ Next.js 15.2.0-canary.19 (Turbopack)·
   Creating an optimized production build ...
   No config file found
   Building (0/5) ...
   Building (1/5)··
   Building (2/5)··
   Building (3/5)··
 ✓ Building (5/5)
 ✓ Compiled successfully in 2.4s
   Linting and checking validity of types ...·
   We detected TypeScript in your project and created a tsconfig.json file for you.
   Collecting page data ...
   Generating static pages (0/6) ...
   Generating static pages (1/6)··
   Generating static pages (2/6)··
   Generating static pages (4/6)··
 ✓ Generating static pages (6/6)
   Finalizing page optimization ...
   Collecting build traces ...·
Route (app)                                Size     First Load JS
┌ ○ /_not-found                            0 B             119 kB
├ ƒ /api/disable-draft                     0 B                0 B
├ ƒ /api/draft                             0 B                0 B
└ ○ /preview-page                          0 B             119 kB
+ First Load JS shared by all              119 kB
  ├ chunks/node_modules__pnpm_3397f5._.js  84 kB
  ├ chunks/node_modules__pnpm_ab2540._.js  24.5 kB
  └ other shared chunks (total)            10.9 kB··
○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand·
   ▲ Next.js 15.2.0-canary.19 (Turbopack)
   - Local:        http://localhost:45127
   - Network:      http://135.181.51.13:45127·
 ✓ Starting...
   No config file found
   No config file found
 ✓ Ready in 313ms
   No config file found
"

  31 |     const browser = await next.browser('/api/disable-draft')
  32 |     await retry(async () => {
> 33 |       expect(next.cliOutput).toContain(
     |                              ^
  34 |         'draftMode().isEnabled from middleware: false'
  35 |       )
  36 |     })

  at toContain (e2e/app-dir/draft-mode-middleware/draft-mode-middleware.test.ts:33:30)
  at fn (lib/next-test-utils.ts:806:20)
  at Object.<anonymous> (e2e/app-dir/draft-mode-middleware/draft-mode-middleware.test.ts:32:5)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/rewrite-headers/rewrite-headers.test.ts (turbopack)

  • rewrite-headers > middleware rewrite Prefetch RSC (/hello/wyatt) > should have the expected headers
  • rewrite-headers > middleware rewrite RSC (/hello/wyatt) > should have the expected headers
  • rewrite-headers > middleware rewrite dynamic Prefetch RSC (/hello/bob) > should have the expected headers
  • rewrite-headers > middleware rewrite dynamic RSC (/hello/bob) > should have the expected headers
  • rewrite-headers > middleware rewrite query Prefetch RSC (/hello/john) > should have the expected headers
  • rewrite-headers > middleware rewrite query RSC (/hello/john) > should have the expected headers
Expand output

● rewrite-headers › middleware rewrite RSC (/hello/wyatt) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 4
+ Received  + 1

- Object {
-   "x-nextjs-rewritten-path": "/hello/admin",
-   "x-nextjs-rewritten-query": "key=value",
- }
+ Object {}

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

● rewrite-headers › middleware rewrite Prefetch RSC (/hello/wyatt) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 4
+ Received  + 1

- Object {
-   "x-nextjs-rewritten-path": "/hello/admin",
-   "x-nextjs-rewritten-query": "key=value",
- }
+ Object {}

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

● rewrite-headers › middleware rewrite dynamic RSC (/hello/bob) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 0

  Object {
-   "x-nextjs-rewritten-path": "/hello/bobby",
    "x-nextjs-rewritten-query": null,
  }

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

● rewrite-headers › middleware rewrite dynamic Prefetch RSC (/hello/bob) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 0

  Object {
-   "x-nextjs-rewritten-path": "/hello/bobby",
    "x-nextjs-rewritten-query": null,
  }

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

● rewrite-headers › middleware rewrite query RSC (/hello/john) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 0

  Object {
    "x-nextjs-rewritten-path": null,
-   "x-nextjs-rewritten-query": "key=value",
  }

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

● rewrite-headers › middleware rewrite query Prefetch RSC (/hello/john) › should have the expected headers

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 0

  Object {
    "x-nextjs-rewritten-path": null,
-   "x-nextjs-rewritten-query": "key=value",
  }

  404 |         })
  405 |
> 406 |         expect(headers).toEqual(expected)
      |                         ^
  407 |       })
  408 |     }
  409 |   )

  at Object.toEqual (e2e/app-dir/rewrite-headers/rewrite-headers.test.ts:406:25)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/middleware-sitemap/matcher-exclude-sitemap/index.test.ts (turbopack)

  • middleware-sitemap > should not be affected by middleware if sitemap.xml is excluded from the matcher
Expand output

● middleware-sitemap › should not be affected by middleware if sitemap.xml is excluded from the matcher

expect(received).toContain(expected) // indexOf

Expected substring: "redirected"
Received string:    "<!DOCTYPE html><html><head><meta charSet=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/><link rel=\"preload\" as=\"script\" fetchPriority=\"low\" href=\"/_next/static/chunks/node_modules__pnpm_6f5c02._.js\"/><script src=\"/_next/static/chunks/node_modules__pnpm_6a1d76._.js\" async=\"\"></script><script src=\"/_next/static/chunks/_193b8d._.js\" async=\"\"></script><script src=\"/_next/static/chunks/badf7_next_dist_f82fac._.js\" async=\"\"></script><script src=\"/_next/static/chunks/badf7_next_dist_build_polyfills_polyfill-nomodule.js\" noModule=\"\"></script></head><body><p>hello world</p><script src=\"/_next/static/chunks/node_modules__pnpm_6f5c02._.js\" async=\"\"></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,\"1:\\\"$Sreact.fragment\\\"\\n2:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/client/components/layout-router.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"default\\\"]\\n3:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/client/components/render-from-template-context.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"default\\\"]\\n4:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"MetadataBoundary\\\"]\\n7:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"OutletBoundary\\\"]\\na:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"ViewportBoundary\\\"]\\nc:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-5767a165ce0b052461c7dc937b9171199316252181a45df5716f29d6d60e5eda+packa_vjbtuaayvaxl23uzahlchbwzlu/node_modules/next/dist/client/components/error-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/badf7_next_dist_f82fac._.js\\\"],\\\"default\\\"]\\n\"])</script><script>self.__next_f.push([1,\"0:{\\\"P\\\":null,\\\"b\\\":\\\"YI7Tpz0C2pXbAhqtO2Q4h\\\",\\\"p\\\":\\\"\\\",\\\"c\\\":[\\\"\\\",\\\"\\\"],\\\"i\\\":false,\\\"f\\\":[[[\\\"\\\",{\\\"children\\\":[\\\"__PAGE__\\\",{}]},\\\"$undefined\\\",\\\"$undefined\\\",true],[\\\"\\\",[\\\"$\\\",\\\"$1\\\",\\\"c\\\",{\\\"children\\\":[[[\\\"$\\\",\\\"script\\\",\\\"script-0\\\",{\\\"src\\\":\\\"/_next/static/chunks/badf7_next_dist_f82fac._.js\\\",\\\"async\\\":true,\\\"nonce\\\":\\\"$undefined\\\"}]],[\\\"$\\\",\\\"html\\\",null,{\\\"children\\\":[\\\"$\\\",\\\"body\\\",null,{\\\"children\\\":[\\\"$\\\",\\\"$L2\\\",null,{\\\"parallelRouterKey\\\":\\\"children\\\",\\\"error\\\":\\\"$undefined\\\",\\\"errorStyles\\\":\\\"$undefined\\\",\\\"errorScripts\\\":\\\"$undefined\\\",\\\"template\\\":[\\\"$\\\",\\\"$L3\\\",null,{}],\\\"templateStyles\\\":\\\"$undefined\\\",\\\"templateScripts\\\":\\\"$undefined\\\",\\\"notFound\\\":[[[\\\"$\\\",\\\"title\\\",null,{\\\"children\\\":\\\"404: This page could not be found.\\\"}],[\\\"$\\\",\\\"div\\\",null,{\\\"style\\\":{\\\"fontFamily\\\":\\\"system-ui,\\\\\\\"Segoe UI\\\\\\\",Roboto,Helvetica,Arial,sans-serif,\\\\\\\"Apple Color Emoji\\\\\\\",\\\\\\\"Segoe UI Emoji\\\\\\\"\\\",\\\"height\\\":\\\"100vh\\\",\\\"textAlign\\\":\\\"center\\\",\\\"display\\\":\\\"flex\\\",\\\"flexDirection\\\":\\\"column\\\",\\\"alignItems\\\":\\\"center\\\",\\\"justifyContent\\\":\\\"center\\\"},\\\"children\\\":[\\\"$\\\",\\\"div\\\",null,{\\\"children\\\":[[\\\"$\\\",\\\"style\\\",null,{\\\"dangerouslySetInnerHTML\\\":{\\\"__html\\\":\\\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\\\"}}],[\\\"$\\\",\\\"h1\\\",null,{\\\"className\\\":\\\"next-error-h1\\\",\\\"style\\\":{\\\"display\\\":\\\"inline-block\\\",\\\"margin\\\":\\\"0 20px 0 0\\\",\\\"padding\\\":\\\"0 23px 0 0\\\",\\\"fontSize\\\":24,\\\"fontWeight\\\":500,\\\"verticalAlign\\\":\\\"top\\\",\\\"lineHeight\\\":\\\"49px\\\"},\\\"children\\\":404}],[\\\"$\\\",\\\"div\\\",null,{\\\"style\\\":{\\\"display\\\":\\\"inline-block\\\"},\\\"children\\\":[\\\"$\\\",\\\"h2\\\",null,{\\\"style\\\":{\\\"fontSize\\\":14,\\\"fontWeight\\\":400,\\\"lineHeight\\\":\\\"49px\\\",\\\"margin\\\":0},\\\"children\\\":\\\"This page could not be found.\\\"}]}]]}]}]],[[\\\"$\\\",\\\"$1\\\",\\\"h\\\",{\\\"children\\\":[\\\"$\\\",\\\"$L4\\\",null,{\\\"children\\\":\\\"$L5\\\"}]}]],[]],\\\"forbidden\\\":\\\"$undefined\\\",\\\"unauthorized\\\":\\\"$undefined\\\"}]}]}]]}],{\\\"children\\\":[\\\"__PAGE__\\\",[\\\"$\\\",\\\"$1\\\",\\\"c\\\",{\\\"children\\\":[[\\\"$\\\",\\\"p\\\",null,{\\\"children\\\":\\\"hello world\\\"}],[[\\\"$\\\",\\\"$1\\\",\\\"h\\\",{\\\"children\\\":[\\\"$\\\",\\\"$L4\\\",null,{\\\"children\\\":\\\"$L6\\\"}]}]],null,[\\\"$\\\",\\\"$L7\\\",null,{\\\"children\\\":[\\\"$L8\\\",\\\"$L9\\\"]}]]}],{},null,false]},null,false],[[\\\"$\\\",\\\"$1\\\",\\\"v\\\",{\\\"children\\\":[null,[\\\"$\\\",\\\"$1\\\",\\\"nsZppFqfdLvQX7dvulgMs\\\",{\\\"children\\\":[[\\\"$\\\",\\\"$La\\\",null,{\\\"children\\\":\\\"$Lb\\\"}],null]}]]}],null],false]],\\\"m\\\":\\\"$undefined\\\",\\\"G\\\":[\\\"$c\\\",\\\"$undefined\\\"],\\\"s\\\":false,\\\"S\\\":true}\\n\"])</script><script>self.__next_f.push([1,\"b:[[\\\"$\\\",\\\"meta\\\",\\\"0\\\",{\\\"charSet\\\":\\\"utf-8\\\"}],[\\\"$\\\",\\\"meta\\\",\\\"1\\\",{\\\"name\\\":\\\"viewport\\\",\\\"content\\\":\\\"width=device-width, initial-scale=1\\\"}]]\\n5:[]\\n6:\\\"$5\\\"\\n9:null\\n8:null\\n\"])</script></body></html>"

   8 |   it('should not be affected by middleware if sitemap.xml is excluded from the matcher', async () => {
   9 |     let html = await next.render('/')
> 10 |     expect(html).toContain('redirected')
     |                  ^
  11 |
  12 |     html = await next.render('/sitemap.xml')
  13 |     expect(html).not.toContain('redirected')

  at Object.toContain (e2e/app-dir/middleware-sitemap/matcher-exclude-sitemap/index.test.ts:10:18)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/dynamic-io/dynamic-io.headers.test.ts (turbopack)

  • dynamic-io > should produce dynamic pages when using async or sync headers
  • dynamic-io > should be able to access headers properties asynchronously
  • dynamic-io > should be able to access headers properties synchronously
Expand output

● dynamic-io › should produce dynamic pages when using async or sync headers

expect(received).toBe(expected) // Object.is equality

Expected: "hello"
Received: ""

  49 |         expect($('#layout').text()).toBe('at runtime')
  50 |         expect($('#page').text()).toBe('at runtime')
> 51 |         expect($('#x-sentinel').text()).toBe('hello')
     |                                         ^
  52 |       }
  53 |
  54 |       $ = await next.render$('/headers/static-behavior/async', {})

  at Object.toBe (e2e/app-dir/dynamic-io/dynamic-io.headers.test.ts:51:41)

● dynamic-io › should be able to access headers properties asynchronously

expect(received).toContain(expected) // indexOf

Expected substring: "hello"
Received string:    ": "

  92 |       'Headers cannot be modified'
  93 |     )
> 94 |     expect($('#append-value-x-sentinel').text()).toContain('hello')
     |                                                  ^
  95 |
  96 |     // (await headers()).delete('...')
  97 |     expect($('#delete-result-x-sentinel').text()).toContain(

  at Object.toContain (e2e/app-dir/dynamic-io/dynamic-io.headers.test.ts:94:50)

● dynamic-io › should be able to access headers properties synchronously

expect(received).toContain(expected) // indexOf

Expected substring: "hello"
Received string:    ": "

  174 |       'Headers cannot be modified'
  175 |     )
> 176 |     expect($('#append-value-x-sentinel').text()).toContain('hello')
      |                                                  ^
  177 |     if (isNextDev) {
  178 |       expect(headerWarnings[i++]).toContain(
  179 |         "`headers().append('x-sentinel', ...)`"

  at Object.toContain (e2e/app-dir/dynamic-io/dynamic-io.headers.test.ts:176:50)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/middleware-sitemap/no-matcher/index.test.ts (turbopack)

  • middleware-sitemap > should be affected by middleware for sitemap.xml if there is no matcher
Expand output

● middleware-sitemap › should be affected by middleware for sitemap.xml if there is no matcher

expect(received).toContain(expected) // indexOf

Expected substring: "redirected"
Received string:    "<!DOCTYPE html><html><head><meta charSet=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/><link rel=\"preload\" as=\"script\" fetchPriority=\"low\" href=\"/_next/static/chunks/node_modules__pnpm_b7edeb._.js\"/><script src=\"/_next/static/chunks/node_modules__pnpm_1dbb2e._.js\" async=\"\"></script><script src=\"/_next/static/chunks/_3a3496._.js\" async=\"\"></script><script src=\"/_next/static/chunks/20be4_next_dist_f5f072._.js\" async=\"\"></script><script src=\"/_next/static/chunks/20be4_next_dist_build_polyfills_polyfill-nomodule.js\" noModule=\"\"></script></head><body><p>hello world</p><script src=\"/_next/static/chunks/node_modules__pnpm_b7edeb._.js\" async=\"\"></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,\"1:\\\"$Sreact.fragment\\\"\\n2:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/client/components/layout-router.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"default\\\"]\\n3:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/client/components/render-from-template-context.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"default\\\"]\\n4:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"MetadataBoundary\\\"]\\n7:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"OutletBoundary\\\"]\\na:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/lib/metadata/metadata-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"ViewportBoundary\\\"]\\nc:I[\\\"[project]/node_modules/.pnpm/next@file+..+next-repo-130a1225227a1389856eb511a9868c6ec1dd51e0985aa022a4f465ba86df7fd0+packa_pzyr3vpvftxtqs2ew7b33fsfey/node_modules/next/dist/client/components/error-boundary.js [app-client] (ecmascript)\\\",[\\\"static/chunks/20be4_next_dist_f5f072._.js\\\"],\\\"default\\\"]\\n\"])</script><script>self.__next_f.push([1,\"0:{\\\"P\\\":null,\\\"b\\\":\\\"LevBrZx8s65z2HCQendwQ\\\",\\\"p\\\":\\\"\\\",\\\"c\\\":[\\\"\\\",\\\"\\\"],\\\"i\\\":false,\\\"f\\\":[[[\\\"\\\",{\\\"children\\\":[\\\"__PAGE__\\\",{}]},\\\"$undefined\\\",\\\"$undefined\\\",true],[\\\"\\\",[\\\"$\\\",\\\"$1\\\",\\\"c\\\",{\\\"children\\\":[[[\\\"$\\\",\\\"script\\\",\\\"script-0\\\",{\\\"src\\\":\\\"/_next/static/chunks/20be4_next_dist_f5f072._.js\\\",\\\"async\\\":true,\\\"nonce\\\":\\\"$undefined\\\"}]],[\\\"$\\\",\\\"html\\\",null,{\\\"children\\\":[\\\"$\\\",\\\"body\\\",null,{\\\"children\\\":[\\\"$\\\",\\\"$L2\\\",null,{\\\"parallelRouterKey\\\":\\\"children\\\",\\\"error\\\":\\\"$undefined\\\",\\\"errorStyles\\\":\\\"$undefined\\\",\\\"errorScripts\\\":\\\"$undefined\\\",\\\"template\\\":[\\\"$\\\",\\\"$L3\\\",null,{}],\\\"templateStyles\\\":\\\"$undefined\\\",\\\"templateScripts\\\":\\\"$undefined\\\",\\\"notFound\\\":[[[\\\"$\\\",\\\"title\\\",null,{\\\"children\\\":\\\"404: This page could not be found.\\\"}],[\\\"$\\\",\\\"div\\\",null,{\\\"style\\\":{\\\"fontFamily\\\":\\\"system-ui,\\\\\\\"Segoe UI\\\\\\\",Roboto,Helvetica,Arial,sans-serif,\\\\\\\"Apple Color Emoji\\\\\\\",\\\\\\\"Segoe UI Emoji\\\\\\\"\\\",\\\"height\\\":\\\"100vh\\\",\\\"textAlign\\\":\\\"center\\\",\\\"display\\\":\\\"flex\\\",\\\"flexDirection\\\":\\\"column\\\",\\\"alignItems\\\":\\\"center\\\",\\\"justifyContent\\\":\\\"center\\\"},\\\"children\\\":[\\\"$\\\",\\\"div\\\",null,{\\\"children\\\":[[\\\"$\\\",\\\"style\\\",null,{\\\"dangerouslySetInnerHTML\\\":{\\\"__html\\\":\\\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\\\"}}],[\\\"$\\\",\\\"h1\\\",null,{\\\"className\\\":\\\"next-error-h1\\\",\\\"style\\\":{\\\"display\\\":\\\"inline-block\\\",\\\"margin\\\":\\\"0 20px 0 0\\\",\\\"padding\\\":\\\"0 23px 0 0\\\",\\\"fontSize\\\":24,\\\"fontWeight\\\":500,\\\"verticalAlign\\\":\\\"top\\\",\\\"lineHeight\\\":\\\"49px\\\"},\\\"children\\\":404}],[\\\"$\\\",\\\"div\\\",null,{\\\"style\\\":{\\\"display\\\":\\\"inline-block\\\"},\\\"children\\\":[\\\"$\\\",\\\"h2\\\",null,{\\\"style\\\":{\\\"fontSize\\\":14,\\\"fontWeight\\\":400,\\\"lineHeight\\\":\\\"49px\\\",\\\"margin\\\":0},\\\"children\\\":\\\"This page could not be found.\\\"}]}]]}]}]],[[\\\"$\\\",\\\"$1\\\",\\\"h\\\",{\\\"children\\\":[\\\"$\\\",\\\"$L4\\\",null,{\\\"children\\\":\\\"$L5\\\"}]}]],[]],\\\"forbidden\\\":\\\"$undefined\\\",\\\"unauthorized\\\":\\\"$undefined\\\"}]}]}]]}],{\\\"children\\\":[\\\"__PAGE__\\\",[\\\"$\\\",\\\"$1\\\",\\\"c\\\",{\\\"children\\\":[[\\\"$\\\",\\\"p\\\",null,{\\\"children\\\":\\\"hello world\\\"}],[[\\\"$\\\",\\\"$1\\\",\\\"h\\\",{\\\"children\\\":[\\\"$\\\",\\\"$L4\\\",null,{\\\"children\\\":\\\"$L6\\\"}]}]],null,[\\\"$\\\",\\\"$L7\\\",null,{\\\"children\\\":[\\\"$L8\\\",\\\"$L9\\\"]}]]}],{},null,false]},null,false],[[\\\"$\\\",\\\"$1\\\",\\\"v\\\",{\\\"children\\\":[null,[\\\"$\\\",\\\"$1\\\",\\\"g8sHRzsYGNJ720BZruH68\\\",{\\\"children\\\":[[\\\"$\\\",\\\"$La\\\",null,{\\\"children\\\":\\\"$Lb\\\"}],null]}]]}],null],false]],\\\"m\\\":\\\"$undefined\\\",\\\"G\\\":[\\\"$c\\\",\\\"$undefined\\\"],\\\"s\\\":false,\\\"S\\\":true}\\n\"])</script><script>self.__next_f.push([1,\"b:[[\\\"$\\\",\\\"meta\\\",\\\"0\\\",{\\\"charSet\\\":\\\"utf-8\\\"}],[\\\"$\\\",\\\"meta\\\",\\\"1\\\",{\\\"name\\\":\\\"viewport\\\",\\\"content\\\":\\\"width=device-width, initial-scale=1\\\"}]]\\n5:[]\\n6:\\\"$5\\\"\\n9:null\\n8:null\\n\"])</script></body></html>"

   8 |   it('should be affected by middleware for sitemap.xml if there is no matcher', async () => {
   9 |     let html = await next.render('/')
> 10 |     expect(html).toContain('redirected')
     |                  ^
  11 |
  12 |     html = await next.render('/sitemap.xml')
  13 |     expect(html).toContain('redirected')

  at Object.toContain (e2e/app-dir/middleware-sitemap/no-matcher/index.test.ts:10:18)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/hooks/hooks.test.ts (turbopack)

  • app dir - hooks > useSelectedLayoutSegments > should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware
Expand output

● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)

  140 |         const $ = await next.render$(path)
  141 |
> 142 |         expect(JSON.parse($('#outer-layout').text())).toEqual(outerLayout)
      |                     ^
  143 |         expect(JSON.parse($('#inner-layout').text())).toEqual(innerLayout)
  144 |       }
  145 |     )

  at parse (e2e/app-dir/hooks/hooks.test.ts:142:21)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/edge-runtime-response-error/test/index.test.js (turbopack)

  • Edge runtime code with imports > test error if response is not Response type > production mode > Middleware build test Response
Expand output

● Edge runtime code with imports › test error if response is not Response type › production mode › Middleware build test Response

expect(received).toContain(expected) // indexOf

Expected substring: "Expected an instance of Response to be returned"
Received string:    ""

  86 |           )
  87 |           const res = await fetchViaHTTP(context.appPort, url)
> 88 |           expect(context.logs.stderr).toContain(
     |                                       ^
  89 |             'Expected an instance of Response to be returned'
  90 |           )
  91 |           expect(res.status).toBe(500)

  at Object.toContain (integration/edge-runtime-response-error/test/index.test.js:88:39)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/dynamic-routing/test/middleware.test.js (turbopack)

  • Dynamic Routing > production mode > should have correct cache entries on prefetch
Expand output

● Dynamic Routing › production mode › should have correct cache entries on prefetch

expect(received).toEqual(expected) // deep equality

- Expected  - 15
+ Received  +  0

  Array [
-   "/_next/data/BUILD_ID/[name].json?another=value&name=%5Bname%5D",
-   "/_next/data/BUILD_ID/added-later/first.json?name=added-later&comment=first",
-   "/_next/data/BUILD_ID/blog/321/comment/123.json?name=321&id=123",
-   "/_next/data/BUILD_ID/d/dynamic-1.json?id=dynamic-1",
-   "/_next/data/BUILD_ID/on-mount/test-w-hash.json?post=test-w-hash",
    "/_next/data/BUILD_ID/p1/p2/all-ssg/hello.json?rest=hello",
    "/_next/data/BUILD_ID/p1/p2/all-ssg/hello1/hello2.json?rest=hello1&rest=hello2",
-   "/_next/data/BUILD_ID/p1/p2/all-ssr/:42.json?rest=%3A42",
-   "/_next/data/BUILD_ID/p1/p2/all-ssr/hello.json?rest=hello",
-   "/_next/data/BUILD_ID/p1/p2/all-ssr/hello1%2F/he%2Fllo2.json?rest=hello1%2F&rest=he%2Fllo2",
-   "/_next/data/BUILD_ID/p1/p2/all-ssr/hello1/hello2.json?rest=hello1&rest=hello2",
    "/_next/data/BUILD_ID/p1/p2/nested-all-ssg/hello.json?rest=hello",
    "/_next/data/BUILD_ID/p1/p2/nested-all-ssg/hello1/hello2.json?rest=hello1&rest=hello2",
-   "/_next/data/BUILD_ID/post-1.json?fromHome=true&name=post-1",
-   "/_next/data/BUILD_ID/post-1.json?hidden=value&name=post-1",
-   "/_next/data/BUILD_ID/post-1.json?name=post-1",
-   "/_next/data/BUILD_ID/post-1.json?name=post-1&another=value",
-   "/_next/data/BUILD_ID/post-1/comment-1.json?name=post-1&comment=comment-1",
-   "/_next/data/BUILD_ID/post-1/comments.json?name=post-1",
  ]

  47 |
  48 |       const cacheKeys = await getCacheKeys()
> 49 |       expect(cacheKeys).toEqual(
     |                         ^
  50 |         process.env.__MIDDLEWARE_TEST
  51 |           ? [
  52 |               '/_next/data/BUILD_ID/[name].json?another=value&name=%5Bname%5D',

  at Object.toEqual (integration/dynamic-routing/test/index.test.js:49:25)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/edge-runtime-module-errors/test/module-imports.test.js (turbopack)

  • Edge runtime code with imports > Middleware dynamically importing 3rd party module > production mode > does not build and reports module not found error
  • Edge runtime code with imports > Middleware importing unused 3rd party module > production mode > does not build and reports module not found error
Expand output

● Edge runtime code with imports › Middleware dynamically importing 3rd party module › production mode › does not build and reports module not found error

expect(received).toEqual(expected) // deep equality

Expected: 1
Received: 0

  168 |             stderr: true,
  169 |           })
> 170 |           expect(code).toEqual(1)
      |                        ^
  171 |           expectModuleNotFoundProdError(moduleName, stderr)
  172 |         })
  173 |       }

  at Object.toEqual (integration/edge-runtime-module-errors/test/module-imports.test.js:170:24)

● Edge runtime code with imports › Middleware importing unused 3rd party module › production mode › does not build and reports module not found error

expect(received).toEqual(expected) // deep equality

Expected: 1
Received: 0

  233 |             stderr: true,
  234 |           })
> 235 |           expect(code).toEqual(1)
      |                        ^
  236 |
  237 |           expectModuleNotFoundProdError(moduleName, stderr)
  238 |         })

  at Object.toEqual (integration/edge-runtime-module-errors/test/module-imports.test.js:235:24)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts (turbopack)

  • x-forwarded-headers > should include x-forwarded-* headers
  • x-forwarded-headers > already assigned > should not override existing x-forwarded-* headers
  • x-forwarded-headers > host header exists > should include x-forwarded-* headers relative to host
Expand output

● x-forwarded-headers › should include x-forwarded-* headers

expect(received).toBe(expected) // Object.is equality

Expected: "localhost:45443"
Received: undefined

  19 |     expect(headers['x-forwarded-port']).toBe(url.port)
  20 |     expect(headers['x-forwarded-proto']).toBe(url.protocol.replace(':', ''))
> 21 |     expect(headers['middleware-x-forwarded-host']).toBe(url.host)
     |                                                    ^
  22 |     expect(headers['middleware-x-forwarded-port']).toBe(url.port)
  23 |     expect(headers['middleware-x-forwarded-proto']).toBe(
  24 |       url.protocol.replace(':', '')

  at Object.toBe (e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts:21:52)

● x-forwarded-headers › host header exists › should include x-forwarded-* headers relative to host

expect(received).toBe(expected) // Object.is equality

Expected: "subdomain.localhost:45443"
Received: undefined

  40 |       expect(headers['x-forwarded-port']).toBe(url.port)
  41 |       expect(headers['x-forwarded-proto']).toBe(url.protocol.replace(':', ''))
> 42 |       expect(headers['middleware-x-forwarded-host']).toBe(reqHeaders.host)
     |                                                      ^
  43 |       expect(headers['middleware-x-forwarded-port']).toBe(url.port)
  44 |       expect(headers['middleware-x-forwarded-proto']).toBe(
  45 |         url.protocol.replace(':', '')

  at Object.toBe (e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts:42:54)

● x-forwarded-headers › already assigned › should not override existing x-forwarded-* headers

expect(received).toBe(expected) // Object.is equality

Expected: "subdomain.localhost:45443"
Received: undefined

  69 |       expect(headers['x-forwarded-port']).toBe(reqHeaders.port)
  70 |       expect(headers['x-forwarded-proto']).toBe(reqHeaders.proto)
> 71 |       expect(headers['middleware-x-forwarded-host']).toBe(reqHeaders.host)
     |                                                      ^
  72 |       expect(headers['middleware-x-forwarded-port']).toBe(reqHeaders.port)
  73 |       expect(headers['middleware-x-forwarded-proto']).toBe(reqHeaders.proto)
  74 |     })

  at Object.toBe (e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts:71:54)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/edge-runtime-module-errors/test/index.test.js (turbopack)

  • Edge runtime code with imports > Middleware dynamically importing node.js module > production mode > throws unsupported module error in production at runtime and prints error on logs
  • Edge runtime code with imports > Middleware dynamically importing node.js module in a lib > production mode > throws unsupported module error in production at runtime and prints error on logs
  • Edge runtime code with imports > Middleware statically importing 3rd party module > production mode > does not build and reports
  • Edge runtime code with imports > Middleware using Buffer polyfill > production mode > does not throw in production at runtime
Expand output

● Edge runtime code with imports › Middleware dynamically importing node.js module › production mode › throws unsupported module error in production at runtime and prints error on logs

expect(received).toContain(expected) // indexOf

Expected substring: "A Node.js module is loaded ('fs'"
Received string:    " ⚠ Linting is disabled.
"

  111 |             stderr: true,
  112 |           })
> 113 |           expect(stderr).toContain(getUnsupportedModuleWarning(moduleName))
      |                          ^
  114 |           context.app = await nextStart(
  115 |             context.appDir,
  116 |             context.appPort,

  at Object.toContain (integration/edge-runtime-module-errors/test/index.test.js:113:26)

● Edge runtime code with imports › Middleware dynamically importing node.js module in a lib › production mode › throws unsupported module error in production at runtime and prints error on logs

expect(received).toContain(expected) // indexOf

Expected substring: "A Node.js module is loaded ('os'"
Received string:    " ⚠ Linting is disabled.
"

  199 |               stderr: true,
  200 |             })
> 201 |             expect(stderr).toContain(getUnsupportedModuleWarning(moduleName))
      |                            ^
  202 |             context.app = await nextStart(
  203 |               context.appDir,
  204 |               context.appPort,

  at Object.toContain (integration/edge-runtime-module-errors/test/index.test.js:201:28)

● Edge runtime code with imports › Middleware statically importing 3rd party module › production mode › does not build and reports

expect(received).toEqual(expected) // deep equality

Expected: 1
Received: 0

  272 |             stderr: true,
  273 |           })
> 274 |           expect(code).toEqual(1)
      |                        ^
  275 |           expectModuleNotFoundProdError(moduleName, stderr)
  276 |         })
  277 |       }

  at Object.toEqual (integration/edge-runtime-module-errors/test/index.test.js:274:24)

● Edge runtime code with imports › Middleware using Buffer polyfill › production mode › does not throw in production at runtime

expect(received).toBe(expected) // Object.is equality

Expected: "false"
Received: null

  406 |           const res = await fetchViaHTTP(context.appPort, url)
  407 |           expect(res.status).toBe(200)
> 408 |           expect(res.headers.get('x-from-runtime')).toBe('false')
      |                                                     ^
  409 |           expectNoError(moduleName)
  410 |         })
  411 |       }

  at Object.toBe (integration/edge-runtime-module-errors/test/index.test.js:408:53)

Read more about building and testing Next.js in contributing.md.

@ijjk
Copy link
Member

ijjk commented Jan 22, 2025

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
buildDuration 19.3s 16.6s N/A
buildDurationCached 15.6s 13.2s N/A
nodeModulesSize 418 MB 418 MB ⚠️ +117 kB
nextStartRea..uration (ms) 411ms 426ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
5306-HASH.js gzip 54 kB 54 kB N/A
8276.HASH.js gzip 169 B 168 B N/A
8377-HASH.js gzip 5.46 kB 5.46 kB N/A
bccd1874-HASH.js gzip 52.9 kB 52.9 kB
framework-HASH.js gzip 57.5 kB 57.5 kB N/A
main-app-HASH.js gzip 240 B 242 B N/A
main-HASH.js gzip 34.6 kB 34.6 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB N/A
Overall change 52.9 kB 52.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
_app-HASH.js gzip 193 B 193 B
_error-HASH.js gzip 193 B 193 B
amp-HASH.js gzip 512 B 510 B N/A
css-HASH.js gzip 343 B 342 B N/A
dynamic-HASH.js gzip 1.84 kB 1.84 kB
edge-ssr-HASH.js gzip 265 B 265 B
head-HASH.js gzip 363 B 362 B N/A
hooks-HASH.js gzip 393 B 392 B N/A
image-HASH.js gzip 4.59 kB 4.58 kB N/A
index-HASH.js gzip 268 B 268 B
link-HASH.js gzip 2.35 kB 2.35 kB N/A
routerDirect..HASH.js gzip 328 B 328 B
script-HASH.js gzip 397 B 397 B
withRouter-HASH.js gzip 323 B 326 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 3.59 kB 3.59 kB
Client Build Manifests
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
_buildManifest.js gzip 748 B 747 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
index.html gzip 524 B 523 B N/A
link.html gzip 540 B 538 B N/A
withRouter.html gzip 520 B 520 B
Overall change 520 B 520 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
edge-ssr.js gzip 129 kB 129 kB N/A
page.js gzip 208 kB 208 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
middleware-b..fest.js gzip 670 B 664 B N/A
middleware-r..fest.js gzip 155 B 156 B N/A
middleware.js gzip 31.3 kB 31.3 kB N/A
edge-runtime..pack.js gzip 844 B 844 B
Overall change 844 B 844 B
Next Runtimes
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
274-experime...dev.js gzip 322 B 322 B
274.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 375 kB 375 kB
app-page-exp..prod.js gzip 130 kB 130 kB
app-page-tur..prod.js gzip 143 kB 143 kB
app-page-tur..prod.js gzip 139 kB 139 kB
app-page.run...dev.js gzip 363 kB 363 kB
app-page.run..prod.js gzip 126 kB 126 kB
app-route-ex...dev.js gzip 37.6 kB 37.6 kB
app-route-ex..prod.js gzip 25.6 kB 25.6 kB
app-route-tu..prod.js gzip 25.6 kB 25.6 kB
app-route-tu..prod.js gzip 25.4 kB 25.4 kB
app-route.ru...dev.js gzip 39.2 kB 39.2 kB
app-route.ru..prod.js gzip 25.4 kB 25.4 kB
pages-api-tu..prod.js gzip 9.69 kB 9.69 kB
pages-api.ru...dev.js gzip 11.6 kB 11.6 kB
pages-api.ru..prod.js gzip 9.68 kB 9.68 kB
pages-turbo...prod.js gzip 21.9 kB 21.9 kB
pages.runtim...dev.js gzip 27.7 kB 27.7 kB
pages.runtim..prod.js gzip 21.9 kB 21.9 kB
server.runti..prod.js gzip 916 kB 916 kB
Overall change 2.47 MB 2.47 MB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js wbinnssmith/split-handle-endpoints Change
0.pack gzip 2.1 MB 2.1 MB ⚠️ +397 B
index.pack gzip 74.7 kB 74.3 kB N/A
Overall change 2.1 MB 2.1 MB ⚠️ +397 B
Diff details
Diff for main-HASH.js

Diff too large to display

Commit: 7eb1d8a

Currently, for `handleEntrypoints`, `handlePagesErrorRoute`, `handleRouteType`, etc, both dev and prod use cases are combined into the same functions. This leads to a lot of branching, use-case-specific arguments, etc. for minimal opportunity for shared code.

In a following PR, entrypoint writing for prod will be done through a single napi call to rust, further branching the two versions.

This splits them formally, at the cost of duplicating a handful of lines in each case. Perhaps in the future we can develop a better system for sharing code, but this makes things far clearer and easier to maintain in this moment.

Test Plan: CI
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/split-handle-endpoints branch from 5b0fbd6 to 7eb1d8a Compare January 22, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants