- 04 Apr, 2025 32 commits
-
-
vercel-release-bot authored
-
Hendrik Liebau authored
Accessing search params in `"use cache"` functions is not allowed. We need to make sure that a build or dev error is still triggered even when the `searchParams` access is wrapped in a try/catch block. This also fixes a bug where the errors were not correctly source-mapped with Turbopack. related: #75662 closes NAR-86
-
Jiachi Liu authored
temporarily disable the react 18 tests for toggling the frames, it's not a quick fix so I'll follow up in another PR.
-
Benjamin Woodruff authored
This was identified using the extra checks in #77760 and debugged using the tracing in #77798. 
-
Wyatt Johnson authored
Looping through the built output paths, this doesn't reset the prefetch segment data routes on every loop. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
vercel-release-bot authored
-
Hendrik Liebau authored
When `dynamicIO` is enabled, we're triggering a warmup request in dev mode. This ensures that replayed logs are associated with the correct environment (`Prerender` vs. `Server`), by seeding the caches before the actual render. This PR fixes two issues with the dev warmup: - Ensures that cache keys are identical between the warmup, the subsequent dynamic render, and the dynamic validation, by providing the HMR refresh hash (part of the cache key) for all dev render phases. - Ensures that stale cache entries are discarded during the warmup, by providing the implicit tags also during the warmup (and the dynamic validation).
-
Gengkun authored
Use the same inject react refresh loader logic with webpack, `test/integration/url-imports` should pass <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
Jiwon Choi authored
### Why? The plugin false-negatively logged that the initialization failed. Also, it didn't properly exit when it failed.
-
Hendrik Liebau authored
When the env variable `NEXT_PRIVATE_DEBUG_CACHE` is defined (see https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#verifying-correct-production-behavior), the default cache handler and the `"use cache"` wrapper will now emit debug logs. Note: This variable can already be used for `"use cache"` debug logging when deploying to Vercel.
-
Hendrik Liebau authored
When `"use cache"` is not used on the current route, we don't need to call `refreshTags` for the configured cache handlers. So instead of calling it at the beginning of the request for every cache handler, we now call it lazily right before the first cache entry is retrieved for the respective cache handler (once per request). Similarly, we now call `getExpiration` for the implicit tags of the current route lazily (also once per request) after an existing cache entry has been retrieved, and its timestamp needs to be compared with the expiration of the implicit tags.
-
Niklas Mischkulnig authored
1. There was a problem where the module name was `"path"` in the static analyzer (and not `path`), so the lookup to the Node builtin modules list silently failed as `"\"path\"" != "path"` 2. Then, to make this actually correct, introduce `JsValue::Promise` and `JsValue::Awaited` so that `import("path")` and `await import("path")` actually are different JsValues This is correctly tracked now and includes the Wasm asset in the NFT list: ```js const { readFileSync } = await import('fs') const { join } = await import('path') const wasm = readFileSync( join(process.cwd(), '../web/lib/results/parser/biome_wasm_bg_opt.wasm') ) ``` Closes PACK-4269 -
Tobias Koppers authored
### What? Enable content hashing for the client assets
-
Jiachi Liu authored
### What After https://github.com/vercel/vercel/pull/13011 landed on Vercel CLI, noticing that we're still checking the `vary` header in the tests, which is obselete now. In this PR we delete the handling for setting the `vary` header but still keep the cases of interception routes since it's still needed. ### Why Since v13.4.6 we added the `_rsc` query with the unique hash, `vary` header becomes not required anymore. Closes NDX-1010
-
Niklas Mischkulnig authored
i.e. don't include logos imported in a client reference in the NFT list of the parent RSC's serverless function Closes PACK-4257
-
Tim Neutkens authored
## For Maintainers ### What? - Add `compiled in` for middleware and instrumentation in Turbopack dev. - Fixed a bug where instrumentation.js was being compiled like a page file, local testing moves bootup from 2.5s to 700ms when you have a instrumentation file. ### How? - Added early returns in `hot-reloader-turbopack.ts` for middleware and instrumentation paths when there's no route definition, those cases are handled separately already. - Added build status indicators in `turbopack-utils.ts` for middleware and instrumentation using `startBuilding` and `finishBuilding` hooks - Added proper naming for Node.js and Edge instrumentation in the build status
-
rauno authored
This PR improves our height resizing strategy. Animating the height on page load or when the dialog opens is not ideal and it would be better if the dialog would just fade in and assume it's intrinsic height without motion. This is what happens before this PR when you open errors, and it can be distracting to experience such amount of motion at once: https://github.com/user-attachments/assets/eb03cc23-395e-4ff4-9ed2-ace1694ad917 The reason this happens is because some of the dialog contents load in async—for example the errors are actually suspended so that the message can be viewed without waiting for the stack frames to load: https://github.com/vercel/next.js/blob/1751db082d8c791e05ac1481a5036c8fb381d831/packages/next/src/client/components/react-dev-overlay/ui/container/errors.tsx#L202-L208 --- After this PR, we still measure the `height` of the dialog and animate it in response to user input, but only use the value when the height has stabilised. You can see what happens by observing the blue height value: https://github.com/user-attachments/assets/cf4c1e0f-5e2e-49ed-b94a-1df9822f20cc And another video from the fixture app: https://github.com/user-attachments/assets/a285253f-f320-4638-b19e-b7a27a434ee6 --- Closes NDX-983
-
Tobias Koppers authored
### What? Instead of embedding the chunk filename into the chunk itself (which is a probably for content hashing), use `document.currentScript` to grab the chunk path.
-
Delba de Oliveira authored
This section will be for developers who want to understand how things work. It's not essential knowledge, but good to know. A place for conceptual information and colorful diagrams that explain the magic behind things
✨ 🌈 -
Tobias Koppers authored
### What? Change the signuture of `ChunkingContext::chunk_path` to take an `Asset` argument. The `content()` of the `Asset` might be used in future generate a content hash for the chunk path
-
Tobias Koppers authored
### What? avoid using the original asset path for the source map path instead compute our own path based on similar input. This will become more important when we are using content hashes for files.
-
rauno authored
-
Jiwon Choi authored
Following up on https://github.com/vercel/next.js/pull/76953. In macOS, the scrollbar color is still light in dark mode. So, we modified the style for it at https://github.com/vercel/next.js/pull/76509. However, it didn't cover the scrollbars of the children of the dialog. Therefore, we sync the scrollbar of children to be dark in dark mode as well. | Before | After | |--------|--------| |  |  |
-
Jiwon Choi authored
### Why? The snapshot testing occasionally failed when the rules were modified in newer ESLint versions. This is because we snapshot-tested the whole eslint config output. However, this snapshot test is intended to verify if the necessary plugins were loaded, which can be done by checking the `plugins` property. ### How? Removed snapshot testing and added `plugins` to be checked along with the existing `parser` and `settings` checking.
-
Tobias Koppers authored
### What? SourceMaps contain some unnecessary sections than can be avoided.
-
vercel-release-bot authored
-
Donny/강동윤 authored
### What? Apply the normal variable renamer when we are not going to apply minfiying var renamer. ### Why? Var renamer should be applied at least once. ### How? Closes PACK-4245
-
Jiwon Choi authored
### Why? Previously, we indicated the bundler name only for Turbopack. To better indicate the user which bundler the app is running (especially when sharing errors via screenshot), always display bundler name on version info. | Webpack | Rspack | |--------|--------| |  |  | Closes NDX-986 --------- Co-authored-by:
Jiachi Liu <inbox@huozhi.im>
-
Jiwon Choi authored
### Why? This PR tackles two issues: 1. The Next.js TS plugin for metadata wasn't working. 2. The language service occasionally crashes in large projects. #### The Next.js TS plugin for metadata wasn't working The plugin wasn't working due to the position mismatch of `optionalReplacementSpan` since VSCode [v1.86](https://code.visualstudio.com/updates/v1_86) due to the behavior change of mapping the `replacementSpan` with `optionalReplacementSpan` if it exists. x-ref: https://github.com/microsoft/vscode/pull/200945/files#diff-9027dfcf905374dcada6a75144ed94935254a5a6bf325a20d557201cd7fbe704R766 #### The language service occasionally crashes in large projects Since we spun up another language service and a custom language service host for metadata rules, it occasionally crashed on large projects. ### How? - Synced the `optionalReplacementSpan` to the new position. - Removed creating another language service and relying on `@typescript/vfs` for the virtual file system, which is recommended: "where files on disk aren't the source of truth". https://github.com/user-attachments/assets/b5b325a4-fd2f-4210-be68-1aa5e40229c2 ### Success Criteria - [x] Does it do completions with `export const metadata = { a }`? - [x] Does it disable the plugin with `{ enabled: false }` in the tsconfig.json? - [x] Does the language service not break when used in large projects? ### Follow Up This fix is a partial port from the commit [071d839](https://github.com/vercel/next.js/pull/77206/commits/071d83904588c10d276a09f4f1e78ec7305ff80d) and will continue to follow up on the refactors from PR #77206, including a proper test to prevent regression. --------- Co-authored-by:
Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
vercel-release-bot authored
-
Jiachi Liu authored
Reverts vercel/next.js#77659 [x-ref](https://vercel.slack.com/archives/C03KAR5DCKC/p1743745064109939?thread_ts=1743528456.364379&cid=C03KAR5DCKC)
-
Niklas Mischkulnig authored
Previously, `"sideEffects": ["lib/common.js"]` never matched. Closes #66348 Closes PACK-4241
-
- 03 Apr, 2025 8 commits
-
-
Jude Gao authored
Fix the logic when user explicitly wants to leave the page but navigation is blocked.
-
Jiachi Liu authored
* Update hydration tests for 19.1 where we can have proper stack displayed by owner stack * Fix version matching test for 19.0.0
-
Jiachi Liu authored
### What Notice the test failing with error ``` [Error: The `<head>` tag may only be rendered once.] Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error Error: The `<head>` tag may only be rendered once. at pushStartInstance (/private/var/folders/wv/xyy9xyz10sl4twdx_hp25mjc0000gn/T/next-install-774bc5a37376114 1677200de6e06e9fd9908f6aa5d9bf1124d02f79d153de089/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules /react-dom/cjs/react-dom-server.edge.production.js:2161:17) ``` Turns out we had an extra `<head>` in the html
-
vercel-release-bot authored
-
Will Binns-Smith authored
Test Plan: CI. Tested locally with `test/development/app-dir/basic/basic.test.ts`. Will test with a create-next-app once published.
-
Will Binns-Smith authored
Note: **This does not include any error content aside from that the error is a `TurbopackInternalError`.** This adds a function, `TurbopackInternalError.createAndRecordTelemetry` that both creates the `TurbopackInternalError` instance and logs that it occurred to telemetry. This telemetry event only includes 1) that an error occurred once and 2) the error code or error name of the error, in this case `TurbopackInternalError`. Test Plan: Added a unit test, `TurbopackInternalError.test.ts` Manual test plan: - Insert a panic into Turbopack source in `analyse_ecmascript_module`. - Run `NEXT_TELEMETRY_DEBUG=1 NODE_OPTIONS="--trace-deprecation --enable-source-maps" pnpm next "build" "--turbo" "test/e2e/app-dir/app/“`. - Verify telemetry debugging shows an event called `NEXT_ERROR_THROWN` with `errorCode` of `TurbopackInternalError`. - Do the same with `NEXT_TELEMETRY_DEBUG=1 NODE_OPTIONS="--trace-deprecation --enable-source-maps" pnpm next "dev" "--turbo" "test/e2e/app-dir/app/“`
-
Andrew Clark authored
Adds a new API for observing the start of an App Router navigation: ```ts // <PROJECT_ROOT>/instrumentation-client.ts export function onRouterTransitionStart( url: string, navigationType: 'push' | 'replace' | 'traverse' ) { // ... } ``` `navigationType` is one of "push", "replace", or "traverse". This is inspired by the Navigation API: https://developer.mozilla.org/en-US/docs/Web/API/NavigateEvent/navigationType `onRouterTransitionStart` is intended for sending logs to a performance monitoring tool. It is _not_ intended as a general purpose event for implementing application behavior. It fires at the start of every client-side navigation, including those initiated by a popstate (back/forward) event. There is no corresponding API for observing the end of a navigation. We intend to build support for this in the future, but it's a non-trivial problem space due of the streaming nature of React transitions. Refer to the React Transition Tracing proposal for more details: https://github.com/reactjs/rfcs/blob/transition-tracing/text/0235-transition-tracing.md `onRouterTransitionStart` is only called during App Router navigations. To instrument Pages Router navigations, use `router.events`. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> -
vercel-release-bot authored
-