- 29 Apr, 2023 9 commits
-
-
vercel-release-bot authored
-
vercel-release-bot authored
-
Tim Neutkens authored
### What? Whenever you navigated and a page suspended through `loading` or an error happened caught by `error` in the first level of segments (e.g. `/dashboard` but not `/dashboard/settings`) scroll would not be applied. This happened because the focus and scroll handling component is rendered as part of `InnerLayoutRouter` and the Suspense / Error boundary was rendered **around** `InnerLayoutRouter`. This behavior is incorrect as we still want to immediately scroll to the place where the loading is rendered. This PR fixes the behavior by allowing the scroll to apply to loading / error too. ### How? Moved the scrolling component around the loading/error/innerlayout boundary and added tests.
-
Jiachi Liu authored
### What? * Update google fonts for `next/font` with `scripts/update-google-fonts.js.` * Add npm script `pnpm update-google-fonts` ### How? Run `pnpm update-google-fonts`
-
Donny/강동윤 authored
### What? Update resolve rule for `@swc/helpers` => `node_modules/@swc/helpers` to `@swc/helpers/_` => `node_modules/@swc/helpers/_` to select only `@swc/helpers@v0.5.0`. ### Why? Previous rule make webpack merge `@swc/helpers@v0.4.x` and `@swc/helpers@v0.5.x` ### How? Closes WEB-948 Fixes #48593
-
Tobias Koppers authored
### What? add a test case ### Why? Some packages expect the default export of a commonjs module to be the whole exports object when importing from ESM. turbo PR: https://github.com/vercel/turbo/pull/4738
-
lijianan authored
This handles the case when `Infinity` is passed to the Image `width` prop
-
Tobias Koppers authored
### What? add .svg to the list of images that that return metadata ### Why? .svg files should also return width and height ### How? see https://github.com/vercel/turbo/pull/4741
-
Justin Ridgewell authored
We bind to an IPv6 unspecified address (`::`), which makes the old message say "started server on :::3000", and that's kinda ugly. The new message will say "[::]:3000".
-
- 28 Apr, 2023 17 commits
-
-
vercel-release-bot authored
-
Josh Story authored
This PR updates the way we preload fonts. Previously we tracked which fonts we needed to preload for each layer and rendered a `<link rel="preload" href="..." as="font" />` tag for each preloadable font. This unfortunately gets blocked by data fetching and we want to be able to hint these preloads as soon as possible. Now that React support Float methods in RSC we can use `ReactDOM.preload(..., { as: "font" })` to implement this functionality This PR makes the following changes 1. expose a `preloadFont` method through the RSC graph 2. expose a `preconnect` metho through the RSC graph 3. refactor the preloads generation to use `preloadFont` instead of rendering a preload link 4. If there are no fonts to preload but fonts are being used in CSS then a `preconnect` asset origin is called instead of rendering a preconnect link 5. instead of emitting a data attribute per font preload indicating whether the project is using size-adjust we now emit a single global meta tag. In the future we may get more granular about which fonts are being size adjusted. In the meantime the current hueristic is to add `-s` to the filename so it can still be inferred. In the process of completing this work I discovered there were some bugs in how the preconnect logic was originally implemented. Previously it was possible to get multiple preconnects per render. Additionally the preconnect href was always `"/"` which is not correct if you are hosting your fonts at a CDN. The refactor fixed both of these issues I want to do a larger refactor of the asset loading logic in App-Render but I'll save that for a couple weeks from now Additionally, the serialized output of preloads now omits the word anonymous when using crossorigin so tests were updated to reflect `crossorigin=""` Additionally, tests were updated to no longer look for the size-adjust data attribute on preloads Additionally, There is a note about leaving a `{null}` render in place to avoid a conflict with how the router models lazy trees. I'll follow up with a PR addressing this Co-authored-by:kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
Tim Neutkens authored
### What? Implements resolving of `runtime` and `preferredRegion` in layouts. It will resolve from the root layout down, each layout can override `runtime` or `preferredRegion`. ``` app ├── layout.js -> export const runtime = 'edge' ├── page.js -> Edge runtime └── dashboard ├── page.js -> Edge runtime └── settings ├── layout.js -> export const runtime = 'nodejs' └── page.js -> Node.js runtime ``` Adds support for `preferredRegion`. This is similar to `export const config = { region: ['sfo1'] }` in `pages`. However, there is a difference. It supports `export const preferredRegion = 'home'` and `export const preferredRegion = 'edge'`. `home` refers to the configured default region on your deployment platform and `edge` refers to "all regions". ### How? I've implemented a temporary resolving in `entries.ts`. `preferredRegion` is tracked through the entry module in webpack which is why it's added to all the loaders that create an entry module, this prevents having to resolve/parse again later on. Fixes NEXT-880 Fixes NEXT-1064 Fixes #48905 Closes #48933 -
JJ Kasper authored
Follow-up to https://github.com/vercel/next.js/pull/48870 this exposes WebSocket for the Next.js runtime so we don't have divergence in APIs as discussed with @cramforce
-
JJ Kasper authored
These warnings aren't actionable by users so this removes them from our compiled undici version. x-ref: [slack thread](https://vercel.slack.com/archives/C04R82GSDBN/p1682704853867449?thread_ts=1682624317.557059&cid=C04R82GSDBN)
-
Alex Kirszenberg authored
See https://github.com/vercel/turbo/pull/4740 This enables RSC CSS HMR. The `css_chunk_root_path` way somehow broke the propagation of invalidation for CSS chunks. This also updates Turbopack with the following changes: * https://github.com/vercel/turbo/pull/4738 <!-- Tobias Koppers - improve commonjs esm interop and node ESM --> * https://github.com/vercel/turbo/pull/4740 <!-- Alex Kirszenberg - Replace css_chunk_root_path with ProxiedAsset --> * https://github.com/vercel/turbo/pull/4741 <!-- Tobias Koppers - add svg size extraction --> --------- Co-authored-by:
Tobias Koppers <tobias.koppers@googlemail.com>
-
OJ Kwon authored
<!-- 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 or adding/fixing 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 ### Why? ### How? Closes NEXT- Fixes # --> ### What? This PR changes turbopack's appDir source lookup to honor existing behavior to ignore `_` started path. With this changes, turbopack able to pass test `test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts`, fixes WEB-844. Internally it simply amends two parts, first if given path starts with _, do not add those into entrypoints to it will not be served. If path starts with `%5F` instead, replacing path to _ so it can be served. --------- Co-authored-by:
Tobias Koppers <tobias.koppers@googlemail.com>
-
Leah authored
### What? We previously ran all route handlers with the edge runtime, which means you can't use built in node.js modules With this PR, the runtime can be selected as documented in the next.js docs Fixes WEB-873
-
Steven authored
We bumped `undici` fetch which has a minimum version of 16.8.0 so we need to make sure `next` and `create-next-app` also have the same minimum version. Since 14.x reaches End-of-Life on [2023-04-30](https://github.com/nodejs/Release), we can drop support for 14 in the next release. See also: - Related to #48870 - Related #48941
-
Jiachi Liu authored
### What? In #48928 we decided to error for the missing `id` from `generateImageMetadata` and `generateSitemaps` for better dev DX. This PR also refactors the metadata image urls generation that assumbling the utils together
-
Jan Kaifer authored
-
Connor Prussin authored
# What? This PR just refines some of the typescript types around `nextJest`, specifically refining the argument `customJestConfig` and the return value. ### Why? Before this PR, the return type of `nextJest` was inferred by typescript as `any` which is inaccurate and would require type casting for typescript to enable it to be used in a jest configuration written in typescript. I didn't add an issue for this since it was so trivial, but I can do so if it would be helpful.
-
Jiachi Liu authored
* Fix the `generateImageMetadata` for non dynamic routes and related `param` matching (Found during development) * Fix dynamic routes with number suffix `(\d)` (Fixes #48689)
-
vercel-release-bot authored
-
Balázs Orbán authored
### What? Exposing `globalThis.crypto`, based on [Node.js' WebCrypto API](https://nodejs.org/api/globals.html#crypto_1) ### Why? Similar to `fetch`, `crypto` is a popular API that is currently not available on `globalThis` in all active Node.js versions yet. This can help library authors to create runtime-agnostic packages. ### How? Node.js already has the WebCrypto API that can be imported, we just expose it on `globalThis` in Node.js versions where this is not available. Closes NEXT-1063 [Slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681821510191059)
-
sagarpreet-xflowpay authored
fixes #48794 <!-- 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 or adding/fixing 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 # --> --------- Co-authored-by:
Jimmy Lai <laijimmy0@gmail.com> Co-authored-by:
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
Justin Ridgewell authored
Depends on https://github.com/vercel/turbo/pull/4491 This adds support for the new `output: 'export'` configuration, and propagates the value through to our Node.js rendering code to render. Unfortunately, we don't support page-level configs at the moment, so we can't set a `export const config = { dynamic: 'force-dynamic' }` and test that the export value is being received (I've manually verified it, though). Fixes WEB-842
-
- 27 Apr, 2023 14 commits
-
-
Donny/강동윤 authored
### What? Enable import/export annotations for next.js files. ### Why? It's required to allow importing next.js modules from node. `cjs-module-lexer` needs these annotations to import CJS modules. ### How? Closes WEB-949 Fixes #48801
-
Kiko Beats authored
The current implementation is throwing wrongly if you set a falsy JS value (like `0` or `null`) So right now this is fail even it's a legit implementation: `process.counter = 0`
-
Kiko Beats authored
Hello, This Edge Runtime update fix some small bugs, and also it allows using `TextDecoderStream` and `TextEncoderStream` for development (aka `next dev`) Related: https://github.com/vercel/edge-runtime/releases/tag/edge-runtime%402.1.0 Fixes #47189 fix NEXT-833 ([link](https://linear.app/vercel/issue/NEXT-833))
-
vercel-release-bot authored
-
Shu Ding authored
Mostly mirrors the changed made in https://github.com/facebook/react/pull/26632 to our SWC transform. The implementation difference is that the AST transformer only adds a general purpose wrapper call `createServerReference(id)` from an aliased import, so we can easily change the underlying function in the bundler. This change only affects the client layer (when `self.config.is_server === false`). Needs to be landed after another React upgrade: https://github.com/vercel/next.js/pull/48697. cc @sebmarkbage.
-
Tobias Koppers authored
### What? add missing exports from next-app-loader ### Why? avoid crashing Co-authored-by:kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
Tim Neutkens authored
## What We recently added the searchParams as part of the __PAGE__ key in the router. There were still a few cases where it incorrectly checked equals instead of startsWith. ## How Searched for ` '__PAGE__'` in order to find the leftover cases and changed them. <!-- 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 or adding/fixing 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 # -->
-
Alex Kirszenberg authored
See https://github.com/vercel/turbo/pull/4695 ### Turbopack changes * https://github.com/vercel/turbo/pull/4683 <!-- Alex Kirszenberg - Update benchmark data --> * https://github.com/vercel/turbo/pull/4695 <!-- Alex Kirszenberg - Selectively load runtime CSS modules to avoid rule duplication --> --------- Co-authored-by:
Tobias Koppers <tobias.koppers@googlemail.com> Co-authored-by:
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
vercel-release-bot authored
-
Josh Story authored
This PR implements preloading of CSS from RSC. 1. The underlying Flight protocol was extended in https://github.com/facebook/react/pull/26502 to allow sending hints from RSC to SSR and Client runtimes. React was updated to include these changes. 2. We now call `ReactDOM.preload()` for each stylesheet used in a layout/page layer There are a few implementation details to take note of 1. we were previously using the `.browser` variant of a few React packages. This was a holdover from when there was just browser and node and we wanted to use the browser variant b/c we wanted the same code to work in edge/node runtimes. React now publishes a `.edge` variant which is like `.browser` but expects to be server only. This is necessary to get the opt-in for `AsyncLocalStorage`. 2. Even with the above change, AsyncLocalStorage was not patched on the global scope until after React was loaded. I moved this into a module which is loaded first 3. The component passed to RSC's `renderToReadableStream` is not actually part of the RSC module graph. If I tried to call `ReactDOM.preload()` inside that function or any other function defined inside `app-render.tsx` file it would actually see the wrong instance of `react-dom`. I added a new export on the RSC top level export which exposes a `preloadStyle(...)` function which just delegates to `ReactDOM.preload(...)`. This makes the preload run in the right module graph ~There are a couple of bugs in React that this work uncovered that I will upstream. We may want to delay merging until they are addressed. I'll update this comment when that is complete.~ 1. ~React, during SSR, can emit a preload for a style twice in some circumstances because late discovered stylesheets don't consider whether a preload has already been flushed when preparing to reveal a boundary they are within~ 2. ~React, during RSC updates on the client, can preload a style that is already in the document because it currently only looks for existing preload links and does not consider if there is a stylesheet link with the same href.~ ~both of these issues will not break functionality, they just make the network tab look at bit more noisy. We would expect network deduping to prevent multiple actual loads~ The above React bugs were fixed and included now in the React update in this PR --------- Co-authored-by:
Shu Ding <g@shud.in>
-
vercel-release-bot authored
-
Tim Neutkens authored
### What? Mux reported they're experiencing a specific case where scroll wasn't applied. I've found a bug when the first element in a layout or page, the one that React will return from `findDOMNode`, is display: hidden. At that point the rect is is `0` `0` `0` `0` and the current logic assumes that means it's in the viewport as it's top `0`. In order to fix this I've looked at a few ways: - Scrolling to top when the element is not visible - Scrolling to the parent element that is visible - **Scrolling to the closest sibling (nextSibling) of the element that is visible** Eventually I landed on the third option after looking at the Mux case, my reproduction, and the way vercel.com's pages leveraging App Router are structured. ### How? Used a while loop to check if the domNode is visible, if not we continue to the next sibling until one that is visible is found. If none are found we bail on resolving further. While looking into this it highlighted that we should add a global scroll handler in app-router too for the case where none of the layout-routers apply scroll. With this fix that is less urgent though so I've added a todo. Fixes NEXT-1056 <!-- 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 or adding/fixing 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 # -->
-
JJ Kasper authored
Since Node.js v14 is [end of life this week](https://github.com/nodejs/Release) this updates our minimum supported Node.js version to v16. x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1681225776529319?thread_ts=1681202375.559349&cid=C04DUD7EB1B)
-
Tobias Koppers authored
### What? * support local static metadata files; opengraph-image, twitter-image, favicon, manifest, icon, apple-icon * support global static metadata files: robots.txt, sitemap.xml, favicon.ico * dynamic metadata is not yet implemented, but yields a warning It's implemented a bit different compared to the webpack version. All images will use the usual image machinery, so they are emitted to output directory, content hashed and the url is shared with the same import import in the app. ### Why? Unsupported, and we want to have that. ### How? see also https://github.com/vercel/turbo/pull/4692 fixes WEB-524
-