Commit graph

869 commits

Author SHA1 Message Date
Damien Simonin Feugas
77acd164d3
fix(47299): allow testing pages with metadata in jsdom test environment (#53578)
### 🧐 What's in there?

This is another attempt to allow testing server-only code with Jest.

### 🧪 How to test?

There's an integration tests which can be triggered with `pnpm testheadless server-only`

Here is a more comprehensive setup:
<details>
<summary><code>app/lib/index.ts</code></summary>

```ts
import 'server-only'

export function add(num1: number, num2: number) {
  return num1 + num2
}
```
</details>
<details>
<summary><code>app/lib/index.test.ts</code></summary>

```ts
import { add } from '.'

it('adds two numbers', () => {
  expect(add(1, 3)).toEqual(4)
})
```
</details>
<details>
<summary><code>app/client-component.tsx</code></summary>

```ts
'use client'

import { useState } from 'react'

export default function ClientComponent() {
  const [text, setText] = useState('not clicked yet')
  return <button onClick={() => setText('clicked!')}>{text}</button>
}
```
</details>
<details>
<summary><code>app/client-component.test.tsx</code></summary>

```ts
import { fireEvent, render, screen } from '@testing-library/react'
import ClientComponent from './client-component'

it('can be clicked', async () => {
  render(<ClientComponent />)
  const button = screen.getByRole('button')
  expect(button).toHaveTextContent('not clicked yet')
  await fireEvent.click(button)
  expect(button).toHaveTextContent('clicked!')
})
```
</details>
<details>
<summary><code>app/server-component.tsx</code></summary>

```ts
import { add } from '@/lib'

export default function ServerComponent({ a, b }: { a: number; b: number }) {
  return (
    <code role="comment">
      {a} + {b} = {add(a, b)}
    </code>
  )
}
```
</details>
<details>
<summary><code>app/server-component.test.tsx</code></summary>

```ts
import { render, screen } from '@testing-library/react'
import ServerComponent from './server-component'

it('renders', () => {
  render(<ServerComponent a={2} b={3} />)
  expect(screen.getByRole('comment')).toHaveTextContent('2 + 3 = 5')
})
```
</details>
<details>
<summary><code>app/page.tsx</code></summary>

```ts
import Link from 'next/link'
import ClientComponent from './client-component'
import ServerComponent from './server-component'

export default function Page() {
  return (
    <>
      <h1>Hello World</h1>
      <Link href="/dave">Dave?</Link>
      <p>
        <ClientComponent />
      </p>
      <p>
        <ServerComponent a={5} b={2} />
      </p>
    </>
  )
}
```
</details>
<details>
<summary><code>app/page.test.tsx</code></summary>

```ts
import { render, screen } from '@testing-library/react'
import Page from './page'

it('greets', () => {
  render(<Page />)
  expect(screen.getByRole('link')).toHaveTextContent('Dave?')
  expect(screen.getByRole('heading')).toHaveTextContent('Hello World')
  expect(screen.getByRole('button')).toHaveTextContent('not clicked yet')
  expect(screen.getByRole('comment')).toHaveTextContent('5 + 2 = 7')
})
```
</details>
<details>
<summary><code>app/[blog]/page.tsx</code></summary>

```ts
import { Metadata } from 'next'
import Link from 'next/link'

type Props = {
  params: { blog: string }
}

export async function generateMetadata({
  params: { blog: title },
}: Props): Promise<Metadata> {
  return { title, description: `A blog post about ${title}` }
}

export default function Page({ params }: Props) {
  return (
    <>
      <div>
        <Link href="/">Back</Link>
      </div>
      <h1>All about {params.blog}</h1>
    </>
  )
}
```
</details>
<details>
<summary><code>app/[blog]/page.test.tsx</code></summary>

```ts
import { render, screen } from '@testing-library/react'
import Page from './page'

it('has the appropriate title', () => {
  const title = 'Jane'
  render(<Page params={{ blog: title }} />)
  expect(screen.getByRole('heading')).toHaveTextContent(`All about ${title}`)
  expect(screen.getByRole('link')).toHaveTextContent('Back')
})
```
</details>
<details>
<summary><code>app/layout.tsx</code></summary>

```ts
export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  )
}
```
</details>
<details>
<summary><code>jest.config.js</code></summary>

```ts
const nextJest = require('next/jest')

const createJestConfig = nextJest({ dir: './' })

module.exports = createJestConfig({
  testEnvironment: 'jsdom',
  setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
})
```
</details>
<details>
<summary><code>package.json</code></summary>

```ts
{
  "name": "rsc-test",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "test": "jest"
  },
  "devDependencies": {
    "@testing-library/jest-dom": "latest"
  }
}
```
</details>
<details>
<summary><code>test-setup.ts</code></summary>

```ts
import '@testing-library/jest-dom'
```
</details>
   
The app should run and all test should pass.

###  Notes to reviewers

#### The problem:

1. next/jest configures jest with a transformer ([jest-transformer](https://github.com/vercel/next.js/blob/canary/packages/next/src/build/swc/jest-transformer.ts)) to compile react code with next -swc
2. the transformers configures next -swc for a given environment: Server or Client, based on jest global environment
3. Based on the environment, next -swc checks for invalid usage of `import('server-only')`  `“use client”`, `export const metadata` or `export async function generateMetadata` 
4. Because the global test environment is either jsdom or node, the same test suite can not include both client and server components

#### Possible mitigations

*A. Using jest projects*

When configured with [multiple projects](https://jestjs.io/docs/next/configuration/#projects-arraystring--projectconfig), Jest can launch different runners with different environment. This would allow running server-only code in node and client-only code in jsdom. 

However, it requires user to completely change their jest configuration. It would also require a different setup when scaffolding new app-directory project with create-next.

*B. Using doc blocks*

Jest allows changing the environment per test file [with docBlock](https://jestjs.io/docs/configuration#testenvironment-string). 

However, by the time jest is invoking next -swc on a source file to transform it, this information is gone, and next -swc is still invoked with the (wrong) global environment.

The PR #52393 provides a workaround for files with `import('server-only')`, but does not allow testing pages with metadata.

*C. Always compile for node*

Our jest-transformer could always configure next -swc for server:

- pass Server-specific validations `import('server-only')`  `export const metadata` or `export async function generateMetadata`
- does not complain about `"use client"`

This is what this PR is about!

Fixes #47299

Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-08-16 07:14:27 +00:00
Dima Voytenko
88b8d15f41
Test proxy mode: intercept the http and https client APIs (#54014)
Followup on the https://github.com/vercel/next.js/pull/52520. The enhancements:

1. Both `fetch` and `http(s)` APIs are intercepted in the testmode.
2. The loopback mode that would allow the test-side to use any fetch-mocking library of their choice.
2023-08-15 02:31:00 +00:00
vercel-release-bot
2fac86480c v13.4.16 2023-08-15 01:03:24 +00:00
vercel-release-bot
33d9bf2a8f v13.4.16-canary.1 2023-08-15 00:42:45 +00:00
vercel-release-bot
4d0aaafdef v13.4.16-canary.0 2023-08-14 22:26:27 +00:00
Will Binns-Smith
bd8ab094e5
Turbopack: fix hiding node_modules warnings in error overlay. (#54022)
This regressed in vercel/turbo#5661 when `context` was renamed `file_path`.
2023-08-14 21:38:52 +00:00
Dima Voytenko
88ad471e33
Concept: test mode for Playwright and similar integration tools (#52520)
An experimental test mode that enables integration tests to mock server-side fetch requests in Playwright tests.

For explanation on how this works, see the [`next-playwright/README.md`](https://github.com/vercel/next.js/pull/52520/files#diff-3b8da7782c16f015df5afafe0ac11247f5b8e5a1c0dbede341ca2b5124dfd924).
2023-08-14 18:45:50 +00:00
vercel-release-bot
6306ec1c1d v13.4.15 2023-08-14 16:40:09 +00:00
vercel-release-bot
242cdca8e0 v13.4.15-canary.0 2023-08-14 16:01:53 +00:00
Jiachi Liu
3f83743a6e
Make next a devDependency of @next/third-parties package (#53996)
ensure `next` is the dependency of third-parties package so turbo will
build next first then `@next/third-parties` to avoid type failing

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-14 08:55:57 -07:00
vercel-release-bot
4ee4458d46 v13.4.14 2023-08-14 10:46:46 +00:00
vercel-release-bot
e53f3af934 v13.4.14-canary.5 2023-08-14 07:58:37 +00:00
vercel-release-bot
df6ec96ab2 v13.4.14-canary.4 2023-08-14 04:47:55 +00:00
JJ Kasper
9a6ae144a9
Update swc runners config (#53939)
This fixes unexpected cache hits occurring causing latest next-swc
changes to not be built for the docker based builds. Noticed in our
turbo run summaries for these builds that no input files were detected
most likely due to older Node.js/pnpm versions being used from the old
Docker image.

This also updates to leverage new runner labels for better build perf
cutting build times down from over an hour down to around 20 min.

Fixes build issue on aarch64-linux-musl due to `TurboMalloc` not being
able to resolve. Test build done here
https://github.com/vercel/next.js/actions/runs/5850893681/job/15860929304

x-ref:
https://github.com/vercel/next.js/actions/runs/5843580924/job/15845848384

x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833506858
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833506925
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833507067
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833507135
2023-08-13 19:02:48 -07:00
vercel-release-bot
261db496f7 v13.4.14-canary.3 2023-08-12 21:41:13 +00:00
Josh Story
2b38118ea0
Update React ot latest canary (#53881)
Updated React from cb3404a0c to f359f9b41.

### React upstream changes

- https://github.com/facebook/react/pull/27191
- https://github.com/facebook/react/pull/27209
- https://github.com/facebook/react/pull/27199
- https://github.com/facebook/react/pull/27218
- https://github.com/facebook/react/pull/27217
- https://github.com/facebook/react/pull/27212
2023-08-12 17:20:14 +00:00
Dima Voytenko
4c14482553
[chore] Upgrade playwright to 1.35.1 (#53875) 2023-08-11 23:25:01 +00:00
Leah
ddc8f50d24
enable @vercel/og support for turbopack (#53917)
### What?

Now that we have wasm support (and support for `?module`) `@vercel/og` should be supported

### Turbopack updates

* https://github.com/vercel/turbo/pull/5677 
* https://github.com/vercel/turbo/pull/5660 

Closes WEB-138
2023-08-11 22:16:41 +00:00
vercel-release-bot
9229f74b86 v13.4.14-canary.2 2023-08-11 12:02:35 +00:00
Tobias Koppers
45576ae752
Turbopack: more tests and bugfixes for next.rs api (#53809)
### What?

* adds more HMR test cases
* fixes bugs found

### Why?

### Turbopack changes

* https://github.com/vercel/turbo/pull/5668 <!-- OJ Kwon - ci(test):
temporarily increase test timeout -->
* https://github.com/vercel/turbo/pull/5696 <!-- Tobias Koppers -
Cleanup minify -->
2023-08-11 10:29:36 +02:00
Josh Story
f0dab3a8da
update vendored React packages to the the latest canary (#53742)
Updated React from 9377e1010 to cb3404a0c.

### React upstream changes

- https://github.com/facebook/react/pull/27190
- https://github.com/facebook/react/pull/27189
- https://github.com/facebook/react/pull/27201
- https://github.com/facebook/react/pull/27147
- https://github.com/facebook/react/pull/26949
- https://github.com/facebook/react/pull/27058
- https://github.com/facebook/react/pull/27142
- https://github.com/facebook/react/pull/27133
- https://github.com/facebook/react/pull/27130
- https://github.com/facebook/react/pull/27105
- https://github.com/facebook/react/pull/27117
- https://github.com/facebook/react/pull/27057
2023-08-08 20:16:24 +00:00
Tobias Koppers
9d1b3f43a1
Turbopack: add hmr test case and fix bugs (#53719)
### What?

test case for HMR

### Turbopack Changes

* https://github.com/vercel/turbo/pull/5686 <!-- Tobias Koppers - remove
error in update -->
2023-08-08 17:07:24 +02:00
vercel-release-bot
d7405b0c28 v13.4.14-canary.1 2023-08-08 14:11:47 +00:00
Alex Kirszenberg
589150184e
Turbopack: Hide Turbo Engine internals (#53007)
See https://github.com/vercel/turbo/pull/5584
2023-08-07 14:55:13 +00:00
vercel-release-bot
5ea372d642 v13.4.14-canary.0 2023-08-07 12:49:08 +00:00
vercel-release-bot
498692b698 v13.4.13 2023-08-07 06:57:47 +00:00
vercel-release-bot
1e02a92a94 v13.4.13-canary.18 2023-08-07 01:06:01 +00:00
JJ Kasper
6483903372
Add update fonts workflow (#53645)
This adds a workflow to auto update our fonts data so we can stay up to date easier. 

Closes: https://github.com/vercel/next.js/pull/53246
Closes: https://github.com/vercel/next.js/pull/53510
2023-08-07 00:11:03 +00:00
vercel-release-bot
bc8deab6ef v13.4.13-canary.17 2023-08-06 20:38:12 +00:00
JJ Kasper
7bf3d77b5e
Revert "Implement new forking technique for vendored packages. (#51083)" (#53640)
This reverts commit e06880ea4c.

reverts: https://github.com/vercel/next.js/pull/51083

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1691349686136519)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691349579712979?thread_ts=1691217652.833079&cid=C03S8ED1DKM)
2023-08-06 13:00:12 -07:00
vercel-release-bot
f47081f15b v13.4.13-canary.16 2023-08-05 00:20:47 +00:00
Josh Story
e06880ea4c
Implement new forking technique for vendored packages. (#51083)
## Vendoring

Updates all module resolvers (node, webpack, nft for entrypoints, and nft for next-server) to consider whether vendored packages are suitable for a given resolve request and resolves them in an import semantics preserving way.

### Problem

Prior to the proposed change, vendoring has been accomplished but aliasing module requests from one specifier to a different specifier. For instance if we are using the built-in react packages for a build/runtime we might replace `require('react')` with `require('next/dist/compiled/react')`.

However this aliasing introduces a subtle bug. The React package has an export map that considers the condition `react-server` and when you require/import `'react'` the conditions should be considered and the underlying implementation of react may differ from one environment to another. In particular if you are resolving with the `react-server` condition you will be resolving the `react.shared-subset.js` implementation of React. This aliasing however breaks these semantics because it turns a bare specifier resolution of `react` with path `'.'` into a resolution with bare specifier `next` with path `'/dist/compiled/react'`. Module resolvers consider export maps of the package being imported from but in the case of `next` there is no consideration for the condition `react-server` and this resolution ends up pulling in the `index.js` implementation inside the React package by doing a simple path resolution to that package folder.

To work around this bug there is a prevalence of encoding the "right" resolution into the import itself. We for instance directly alias `react` to `next/dist/compiled/react/react.shared-subset.js` in certain cases. Other times we directly specify the runtime variant for instance `react-server-dom-webpack/server.edge` rather than `react-server-dom-wegbpack/server`, bypassing the export map altogether by selecting the runtime specific variant. However some code is meant to run in more than one runtime, for instance anything that is part of the client bundle which executes on the server during SSR and in the browser. There are workaround like using `require` conditionally or `import(...)` dynamically but these all have consequences for bundling and treeshaking and they still require careful consideration of the environment you are running in and which variant needs to load.

The result is that there is a large amount of manual pinning of aliases and additional complexity in the code and an inability to trust the package to specify the right resolution potentially causing conflicts in future versions as packages are updated.

It should be noted that aliasing is not in and of itself problematic when we are trying to implement a sort of lightweight forking based on build or runtime conditions. We have good examples of this for instance with the `next/head` package which within App Router should export a noop function. The problem is when we are trying to vendor an entire package and have the package behave semantically the same as if you had installed it yourself via node_modules

### Solution

The fix is seemingly straight forward. We need to stop aliasing these module specifiers and instead customize the resolution process to resolve from a location that will contain the desired vendored packages. We can then start simplifying our imports to use top level package resources and generally and let import conditions control the process of providing the right variant in the right context.

It should be said that vendoring is conditional. Currently we only vendor react pacakges for App Router runtimes. The implementation needs to be able to conditionally determine where a package resolves based on whether we're in an App Router context vs a Page Router one.

Additionally the implementation needs to support alternate packages such as supporting the experimental channel for React when using features that require this version.

### Implementation

The first step is to put the vendored packages inside a node_modules folder. This is essential to the correct resolving of packages by most tools that implement module resolution. For packages that are meant to be vendored, meaning whole package substitution we move the from `next/(src|dist)/compiled/...` to `next/(src|dist)/vendored/node_modules`. The purpose of this move is to clarify that vendored packages operate with a different implementation. This initial PR moves the react dependencies for App Router and `client-only` and `server-only` packages into this folder. In the future we can decide which other precompiled dependencies are best implemented as vendored packages and move them over.

It should be noted that because of our use of `JestWorker` we can get warnings for duplicate package names so we modify the vendored pacakges for react adding either `-vendored` or `-experimental-vendored` depending on which release channel the package came from. While this will require us to alter the request string for a module specifier it will still be treating the react package as the bare specifier and thus use the export map as required.

#### module resolvers
The next thing we need to do is have all systems that do module resolution implement an custom module resolution step. There are five different resolvers that need to be considered

##### node runtime
Updated the require-hook to resolve from the vendored directory without rewriting the request string to alter which package is identified in the bare specifier. For react packages we only do this vendoring if the `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT` envvar is set indicating the runtime is server App Router builds. If we need a single node runtime to be able to conditionally resolve to both vendored and non vendored versions we will need to combine this with aliasing and encode whether the request is for the vendored version in the request string. Our current architecture does not require this though so we will just rely on the envvar for now

##### webpack runtime
Removed all aliases configured for react packages. Rely on the node-runtime to properly alias external react dependencies. Add a resolver plugin `NextAppResolverPlugin` to preempt perform resolution from the context of the vendored directory when encountering a vendored eligible package.

##### turbopack runtime
updated the aliasing rules for react packages to resolve from the vendored directory when in an App Router context. This implementation is all essentially config b/c the capability of doing the resolve from any position (i.e. the vendored directory) already exists

##### nft entrypoints runtime
track chunks to trace for App Router separate from Pages Router. For the trace for App Router chunks use a custom resolve hook in nft which performs the resolution from the vendored directory when appropriate.

##### nft next-server runtime
The current implementation for next-server traces both node_modules and vendored version of packages so all versions are included. This is necessary because the next server can run in either context (App vs Page router) and may depend on any possible variants. We could in theory make two traces rather than a combined one but this will require additional downstream changes so for now it is the most conservative thing to do and is correct

Once we have the correct resolution semantics for all resolvers we can start to remove instances targeting our precompiled instances for instance making `import ... from "next/dist/compiled/react-server-dom-webpack/client"` and replacing with `import ... from "react-server-dom-webpack/client"`

We can also stop requiring runtime specific variants like `import ... from "react-server-dom-webpack/client.edge"` replacing it with the generic export `"react-server-dom-webpack/client"`

There are still two special case aliases related to react
1. In profiling mode (browser only) we rewrite `react-dom` to `react-dom/profiling` and `scheduler/tracing` to `scheduler/tracing-profiling`. This can be moved to using export maps and conditions once react publishses updates that implement this on the package side.
2. When resolving `react-dom` on the server we rewrite this to `react-dom/server-rendering-stub`. This is to avoid loading the entire react-dom client bundle on the server when most of it goes unused. In the next major react will update this top level export to only contain the parts that are usable in any runtime and this alias can be dropped entirely

There are two non-react packages currently be vendored that I have maintained but think we ought to discuss the validity of vendoring. The `client-only` and `server-only` packages are vendored so you can use them without having to remember to install them into your project. This is convenient but does perhaps become surprising if you don't realize what is happening. We should consider not doing this but we can make that decision in another discussion/PR.

#### Webpack Layers
One of the things our webpack config implements for App Router is layers which allow us to have separate instances of packages for the server components graph and the client (ssr) graph. The way we were managing layer selection was a but arbitrary so in addition to the other webpack changes the way you cause a file to always end up in a specific layer is to end it with `.serverlayer`, `.clientlayer` or `.sharedlayer`. These act as layer portals so something in the server layer can import `foo.clientlayer` and that module will in fact be bundled in the client layer.

#### Packaging Changes
Most package managers are fine with this resolution redirect however yarn berry (yarn 2+ with PnP) will not resolve packages that are not defined in a package.json as a dependency. This was not a problem with the prior strategy because it was never resolving these vendored packages it was always resolving the next package and then just pointing to a file within it that happened to be from react or a related package.

To get around this issue vendored packages are both committed in src and packed as a tgz file. Then in the next package.json we define these vendored packages as `optionalDependency` pointing to these tarballs. For yarn PnP these packed versions will get used and resolved rather than the locally commited src files. For other package managers the optional dependencies may or may not get installed but the resolution will still resolve to the checked in src files. This isn't a particularly satisfying implemenation and if pnpm were to be updated to have consistent behavior installing from tarballs we could actually move the vendoring entirely to dependencies and simplify our resolvers a fair bit. But this will require an upstream chagne in pnpm and would take time to propogate in the community since many use older versions

#### Upstream Changes

As part of this work I landed some other changes upstream that were necessary. One was to make our packing use `npm` to match our publishing step. This also allows us to pack `node_modules` folders which is normally not supported but is possible if you define the folder in the package.json's files property.

See: #52563

Additionally nft did not provide a way to use the internal resolver if you were going to use the resolve hook so that is now exposed

See: https://github.com/vercel/nft/pull/354

#### additional PR trivia
* When we prepare to make an isolated next install for integration tests we exclude node_modules by default so we have a special case to allow `/vendored/node_modules`

* The webpack module rules were refactored to be a little easier to reason about and while they do work as is it would be better for some of them to be wrapped in a `oneOf` rule however there is a bug in our css loader implementation that causes these oneOf rules to get deleted. We should fix this up in a followup to make the rules a little more robuts.


## Edits
* I removed `.sharedlayer` since this concept is leaky (not really related to the client/server boundary split) and it is getting refactored anyway soon into a precompiled runtime.
2023-08-04 23:47:10 +00:00
Will Binns-Smith
1d8a633595
Update to turbopack-230804.2 (#53588)
- vercel/turbo#5671
- vercel/turbo#5675
- vercel/turbo#5676
- vercel/turbo#5662
- vercel/turbo#5663
2023-08-04 21:51:35 +00:00
Leah
542c4fc26a
chore: update to pnpm@8.6.11 (#50923)
https://github.com/pnpm/pnpm/releases/tag/v8.0.0
2023-08-04 19:40:20 +00:00
Tobias Koppers
94709ef1b9
update turbopack and update code for API changes (#53576)
* https://github.com/vercel/turbo/pull/5640
* https://github.com/vercel/turbo/pull/5661
2023-08-04 21:14:41 +02:00
vercel-release-bot
324814f2ae v13.4.13-canary.15 2023-08-04 19:13:19 +00:00
vercel-release-bot
f04dc5ad51 v13.4.13-canary.14 2023-08-04 09:02:27 +00:00
Tobias Koppers
4ea1d8a45d
update turbopack (#53545)
* https://github.com/vercel/turbo/pull/5582 
* https://github.com/vercel/turbo/pull/5633 
* https://github.com/vercel/turbo/pull/5637 
* https://github.com/vercel/turbo/pull/5648 <!-- OJ Kwon - test(turbopack): run daily with --experimental  -->
* https://github.com/vercel/turbo/pull/5618 
* https://github.com/vercel/turbo/pull/5624 
* https://github.com/vercel/turbo/pull/5597 
* https://github.com/vercel/turbo/pull/5632 
* https://github.com/vercel/turbo/pull/5636 
* https://github.com/vercel/turbo/pull/5666
2023-08-04 07:19:20 +00:00
Balázs Orbán
9477b61b51
fix(next): clarify fetch polyfill, drop node-fetch (#53548)
### What?

Fix documentation about `fetch` polyfilling, and drop `node-fetch` references.

### Why?

Since we stopped using `node-fetch` in `next` in favor of `undici` there were some inconsistencies in the docs, and unused references to the `node-fetch` package inside `packages/next`-


Noted this while answering this [Slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691089801007129)
2023-08-03 23:12:26 +00:00
vercel-release-bot
be457445b8 v13.4.13-canary.13 2023-08-03 15:51:26 +00:00
vercel-release-bot
480e3a3939 v13.4.13-canary.12 2023-08-02 17:19:31 +00:00
vercel-release-bot
b1bf7aeefa v13.4.13-canary.11 2023-08-02 11:15:46 +00:00
vercel-release-bot
e757cac3f4 v13.4.13-canary.10 2023-08-02 09:49:13 +00:00
vercel-release-bot
3a3030882c v13.4.13-canary.9 2023-08-01 16:30:58 +00:00
Steven
8c6da3f72d
chore(test): move build-spinners node-pty test to isolated (#53408)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-01 00:30:22 +00:00
Josh Goldberg ✨
fc52e02787
chore: enable typescript-eslint's recommended and stylistic configs internally (#52948)
Spinning out from #37151 and my draft PR #52845, this enables the two
basic recommended rulesets from
[typescript-eslint](https://typescript-eslint.io) for the Next.js
monorepo source code:

*
[`plugin:@typescript-eslint/recommended`](https://typescript-eslint.io/linting/configs#recommended):
Our base recommended rules that detect common bugs or _(non-stylistic)_
TypeScript bad practices
*
[`plugin:@typescript-eslint/stylistic`](https://typescript-eslint.io/linting/configs#stylistic):
Our base starting stylistic recommended for keeping codebases visually
consistent and avoiding out-of-practice visual constructs

The process I used is pretty standard (see
https://github.com/typescript-eslint/typescript-eslint/issues/6760 for
other repos it was done on):

1. Enable those base recommended presets
2. Remove any rule settings that are now redundant
3. Reconfigure any rule whose default settings didn't seem to make sense
for this codebase
4. Add a `// Todo: ...` comment, and under it, add a disable for any
rule that immediately reported a lot of complaints

Note that this only enables the presets internally. It doesn't impact
what end-users of published packages such as Next.js or
`create-next-app` experience. That's a separate task in #52845.

I also didn't fix any existing warning from the `canary` branch. Would
you like me to do that? My preference would be a separate PR to get it
in more quickly.

Any code changes are commented inline.

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-07-31 16:32:54 -07:00
vercel-release-bot
caf5ee80be v13.4.13-canary.8 2023-07-31 20:06:20 +00:00
vercel-release-bot
82e3d5126a v13.4.13-canary.7 2023-07-31 17:31:05 +00:00
JJ Kasper
d8d45a9843
Remove fibers from peerDependencies (#53395)
We don't need this peerDependency as it's no longer recommended and only
added for specific cases. This avoids us having to run `node-gyp` just
for this peer dep.

> NOTE OF OBSOLESCENCE -- The author of this project recommends you
avoid its use if possible.

x-ref:
https://github.com/vercel/next.js/actions/runs/5716924037/job/15489725344?pr=53391
2023-07-31 10:12:42 -07:00
Tobias Koppers
3abaa85977
update turbopack (#53291)
* https://github.com/vercel/turbo/pull/5626 <!-- Tobias Koppers - remove
require.cache clear from chunk loading -->
2023-07-28 22:57:36 -07:00