Commit graph

12825 commits

Author SHA1 Message Date
Tim Neutkens
14c9376899
BREAKING CHANGE: Remove React 17 (#41629)
Next.js 13 will require React 18.

In this PR I've only updated the peerDependency and removed the test runs in GH actions. Further cleanup will follow later, this allows us to remove the code supporting it later.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-10-21 22:20:36 +00:00
Steven
7102050ec7
Add support for images.loaderFile config (#41585)
This PR adds a new configure property, `images.loaderFile` that allow
you to define a path to a file with an exported image loader function.

This is useful when migrating from `next/legacy/image` to `next/image`
because it lets you configure the loader for every instance of
`next/image` once, similar to the legacy "built-in loaders".
2022-10-21 12:31:53 -07:00
Damien Simonin Feugas
6f43c90b92
feat(edge): adds AsyncLocalStorage support to the edge function sandbox (#41622)
## 📖  Feature

Adds `AsyncLocalStorage` as a global variable to any edge function (middleware, Edge API routes).
Falls back to Node.js' implementation. 

## 🧪 How to test

1. `pnpm build`
2. `pnpm testheadless --testPathPattern async-local`
2022-10-21 12:17:58 +00:00
Hannes Bornö
bdc53ef651
Root layout head not required (#41621)
Remove head as required in root layout.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-21 02:12:27 -07:00
Steven
001a67dfd9
Add test fixture e2e/app-dir/next-image (#41609)
This PR adds a test fixture `e2e/app-dir/next-image` to ensure `next/image` works with the `app` dir.
2022-10-20 23:21:28 +00:00
Ismael
75aab126a2
remove next/future/image ref (#41610)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 21:02:59 +00:00
Shu Ding
6bd789dad3
Fix missing JSON.stringify in loader (#41599)
We can't directly put `filePath` in the generated code as it can contain in valid JavaScript string such as `"\2"` in `"C:\Users\foo\2022\bar.js"`. Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal

Reported issue in Next.js:

![image](https://user-images.githubusercontent.com/3676859/196962933-0a3bf4b4-9142-426f-9ac5-bdcfb3c5ebf0.png)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 18:41:25 +00:00
Janicklas Ralph
56b097a8fb
Updating size-adjust calculation (#41406)
<!--
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 that you're making:




## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
-->

Updating size-adjust calc to use azAvgWidth instead of xAvgCharWidth

Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-20 10:58:26 -07:00
Hannes Bornö
77ba4a867a
Font loader types (#41591)
Make local and google font loaders more similar. Both should define `weight: string` and `style: string`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 17:42:19 +00:00
Shu Ding
138a7bfda2
Add transpilePackages option (#41583)
This is a new experimental feature to specify a list of packages (or
subpaths in packages, like `pkg/src/index.ts`), to opt-in Next.js
transpilation in the server build.

cc @jescalan 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 18:49:29 +02:00
Jimmy Lai
6d29713023
perf: refactor path logic in router + add LRU cache (#41365)
I'm investigating the runtime perf of the node server and this was one of the hot spot I stumbled upon.

This diff:
- refactors getPagePath to not throw when it doesn't find a path: this function is used to check if a path exists, we don't want that kind of overhead there
- adds a LRU cache to cache the result of the evaluation

Results:

before:
> 110k requests in 11.01s, 285 MB read

after
>135k requests in 11.01s, 348 MB read

on an autocannon run



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 15:42:50 +00:00
Yohann MARTZOLFF
12408a3f2d
chore(examples): update with-apivideo (#39727)
Co-authored-by: Thibault Beyou <37510686+ThibaultBee@users.noreply.github.com>
2022-10-20 17:05:54 +02:00
Balázs Orbán
2cafe367ac chore: clarify issue template for examples 2022-10-20 17:03:31 +02:00
Tim Neutkens
f7fecf00cb
Add back/forward test for new router (#41590) 2022-10-20 13:54:17 +02:00
Hannes Bornö
d7348c4ef4
Full remaining path in selected layout segment (#41562)
Make `useSelectedLayoutSegment` include the remaining segments from the current level to the leaf node.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 11:45:16 +00:00
Hannes Bornö
a5d53155cd
Check root layout change on client (#41475)
Moves the logic that checks if there's a new root layout to the client.
Adds test for static and dynamic catchall.

Related: #41457

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-19 18:38:00 -07:00
Seiya Nuta
765791a6d1
Support overriding request headers in middlewares (#41380)
This PR adds a feature in middleware to add, modify, or delete request headers. This feature is quite useful to pass data from middleware to Serverless/Edge API routes.

### Questions for Reviewers

- Should we deny modifying standard request headers like `Transfer-Encoding`?
- Should we throw an error if the header is too large? Real-world HTTP servers will accept up to only 8KB - 32KB.

### New APIs

Adds a new option `request.headers` to the `MiddlewareResponseInit` parameter in `NextResponse.next()` and `NextResponse.rewrite()`. It's a [`Header`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object holding *all* request headers. Specifically:

```ts
interface MiddlewareResponseInit extends ResponseInit {
  request?: {
    headers?: Headers
  }
}
```

### Example

```ts
// pages/api/hello.ts
export default (req, res) => {
  const valueFromMiddleware = req.headers['x-hello-from-middleware']
  return res.send(valueFromMiddleware)
}

// middleware.ts
import { NextRequest, NextResponse } from 'next/server'

export default function middleware(request: NextRequest) {
  // Clone request headers
  const headers = new Headers(request.headers);
  // Add a new request header
  headers.set('x-hello-from-middleware', 'foo');
  // Delete a request header from the client
  headers.delete('x-from-client');

  const resp = NextResponse.next({
    // New option `request.headers` which accepts a Headers object
    // overrides request headers with the specified new ones.
    request: {
      headers
    }
  });

  // You can still set *response* headers to the client, as before.
  resp.headers.set('x-hello-client', 'bar');
  return resp;
}
```

### New middleware headers

- `x-middleware-override-headers`: A comma separated list of *all* request header names. Headers not listed will be deleted.
- `x-middleware-request-<name>`: A new value for the header `<name>`.

## Related Discussions

- https://github.com/vercel/next.js/discussions/31188
- https://github.com/vercel/next.js/discussions/39300

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 01:36:05 +00:00
Shu Ding
b0db95ffc6
Update error message for invalid react-dom/server imports (#41582)
Related discussion:
https://vercel.slack.com/archives/C043ANYDB24/p1666208186363099?thread_ts=1664676119.265829&cid=C043ANYDB24.

Tl;dr: RSC already renders and serializes things dynamically, there is
no need to manually do that in RSC and embed them via
dangerouslySetInnerHTML.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:56:14 -07:00
Marcial Cambronero
cec9d02dee
Small change to note <Link /> executes server methods (#41577)
I stumbled upon a lack of clarity when using `<Link />` where I believed it didn't execute the server methods before navigation. This change makes it a bit more clear

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-20 00:51:51 +00:00
Shu Ding
4adab6a61e
Improve server bundling strategy (#41584)
This PR adds a list of popular packages that should always opt-out
bundling in the server layer.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:45:37 -07:00
Shu Ding
bad909e4d1
Update page config APIs (#41580)
This PR updates app configurations from `export const config = { ... }`
to be directly exported.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-20 02:39:25 +02:00
Tim Neutkens
d261e7cd25
Add back() and forward() to new router (#41575)
Adds `router.back()` and `router.forward()`.
<!--
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 that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:35:43 -07:00
JJ Kasper
2551978fa4
Increase timeout-minutes for dev jobs 2022-10-19 17:04:41 -07:00
Jaril
008a962df8
Run all dev tests with replay on retry (#41168)
<!--
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 that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

@ijjk WIP here.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-19 15:15:36 -07:00
JJ Kasper
d76d8270d6
Update RSC detection in minimal mode and fix config collection (#41541)
Updates our RSC detection for revalidation in minimal mode and also ensures we await import promises when collecting app dir config. 

x-ref: [slack thread](https://vercel.slack.com/archives/C035J346QQL/p1666202250144319)
x-ref: [slack thread](https://vercel.slack.com/archives/C035J346QQL/p1666125853222599?thread_ts=1666122861.189349&cid=C035J346QQL)
2022-10-19 21:38:54 +00:00
Shu Ding
f055b167a5
Add TypeScript plugin (#41569)
This PR implements the TypeScript plugin (only applied to the app directory), and it will be automatically added to tsconfig.json when running the CLI. Due to how TS plugins work (a package name is required to specify), hence we can't use a subpath import like `next/typescript` for the plugin. To avoid installing a separate dependency, here I propose to reuse the `next` package: if the default export is called with the TypeScript option, we can say it's being used as a plugin. There is also environment variables we can check here, however it's specifically for VS Code (`VSCODE_CLI=1`) where this plugin should be working with other editors too.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 20:59:39 +00:00
Steven
fe762d329f
Fix next/image svg blur placeholder with fill (#41573)
This PR fixes two bugs:

- Fixes #40419 
- Fixes #41393 

The first is when the aspect ratio of the `width` and `height` does not
match the aspect ratio of the `blurDataURL` provided. This can result in
artifacts around the edges. The solution is to add
`preserveAspectRatio="none"`.

The second is when there is no `width` or `height` provided (which is
normal when using `fill`) so the viewBox was undefined. This can also
cause artifacts around the edges. The solution is to change the blur
technique from gaussian to css filter, similar to `next/legacy/image`.

Note: css blur might be [slower in
firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=925025) which is
why we'll only use it for this corner case.
2022-10-19 13:21:41 -07:00
Balázs Orbán
422ccb98b8
fix: allow user directory with styled-jsx prefix in next dev (#41484)
Fixes #41476, ref #40679

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 19:01:48 +00:00
Tim Neutkens
4ba1002175
Create hash digest for errors in app in production (#41559) 2022-10-19 19:56:55 +02:00
Shu Ding
fda355daa2
Improve type checking (#41427)
This PR implements the process of generating strict "type guard" files,
to ensure that all entrypoints have the correct export types. The type
checking process happens automatically during `next build`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-10-19 18:28:36 +02:00
Jiachi Liu
897af6238e
Upgrade react-server-dom-webpack and precompiled assets (#41547)
Upgrade `react-server-dom-webpack` for exports renaming purpose

x-ref: https://github.com/facebook/react/pull/25504
2022-10-19 15:09:49 +00:00
Steven
6d088205b3
Fix docs typo in next/image sizes using fill prop (#41560)
Fix typo mentioned in
https://github.com/vercel/next.js/pull/41434#issuecomment-1283855509
2022-10-19 09:53:03 -04:00
Seiya Nuta
3f7e922a40
Docs for request headers overrides in middleware (#41546)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-19 15:46:03 +02:00
Tim Neutkens
d27185bb9a v12.3.2-canary.32 2022-10-19 13:29:32 +02:00
Tim Neutkens
4e40ba8488
Fix case where dispatch was missing (#41553) 2022-10-19 13:28:24 +02:00
Balázs Orbán
9ac231a0b4
chore(examples): upgrade Stripe example (#41550) 2022-10-19 11:22:50 +02:00
Jiachi Liu
2d1f72995b v12.3.2-canary.31 2022-10-18 21:19:01 -07:00
Jiachi Liu
5d532afa71
Mark styled-jsx as client-only package (#41414)
For css-in-js libs like styled-jsx we don't recommend to use on server side since it will blow up the rsc payload during navigation. This upgration of styled-jsx includes `client-only` as dependency so that it will throw when it's been used on serevr layer

x-ref: https://github.com/vercel/styled-jsx/pull/816
2022-10-19 03:52:33 +00:00
Donny/강동윤
7bde099a43
chore: Update swc_core to v0.39.7 (#41544)
This PR updates swc crates to 287c2f2941


- Closes https://github.com/vercel/next.js/issues/41527.
2022-10-19 03:04:32 +00:00
Steven
cff9fc9d74
BREAKING CHANGE: Remove browsersListForSwc and change default to legacyBrowsers: false (#41529)
Remove `browsersListForSwc` since it is enabled by default now, and disable `legacyBrowsers` by default.

This PR also bumps the default browserslist to the following:

- Chrome 64+
- Edge 79+
- Firefox 67+
- Opera 51+
- Safari 12+

See related RFC:
- Closes #33227 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-19 01:38:39 +00:00
JJ Kasper
3e2aec5e76
Fix E2E deploy test for API bodies (#41542)
Fixes:
https://github.com/vercel/next.js/actions/runs/3275381974/jobs/5390966319
2022-10-18 18:07:39 -07:00
Jiachi Liu
bc335d7ef7
Prebundle react for appDir (#41337)
Inline a react and react-dom for app dir, when `appDir` flag is enabled
opt into the built-in version for all.

For server layer react, use the react share subset for server
components.
For all server side of react-dom usage, use the server-rendering-stub.

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-18 16:32:23 -07:00
Steven
17773a1cf3
Fix links to next/legacy/image demo (#41539)
This PR fixes links to `next/legacy/image` (demo, deploy, etc)
2022-10-18 16:09:43 -07:00
JJ Kasper
cf1c0b6075
v12.3.2-canary.30 2022-10-18 09:54:31 -07:00
Shu Ding
761d7646cc
Fix next-app-loader bug in windows (#41520)
There is this `createAbsolutePath` function that concatenates a virtual
route and a dir path. The virtual route uses the posix separator `/` but
the dir path uses `\` in Windows.

Here's an example of the error:

```
error - ./node_modules/.pnpm/next@12.3.2-canary.29_ikefsjgelhtr3cq7h24gohqzbe/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%
2Fpage.tsx&appDir=E%3A%5CWorkSpace%5C2022%5Csongbook.studio%5Capp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js!
Module parse failed: Octal literal in strict mode (9:41)
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-18 09:53:08 -07:00
Steven
9c5bb5bfe9
BREAKING CHANGE: Remove target: serverless (#41495)
The `target: serverless` config was deprecated a year ago starting in
[Next.js 12](https://nextjs.org/blog/next-12).

Tests were disabled in #41252 so we can now remove `target: serverless`
and all usage of `target` in `next.config.js`.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-18 09:47:13 -07:00
Kiko Beats
ebae05eeed
Update edge runtime to 1.1.0-beta.40 (#41513)
changes: https://github.com/vercel/edge-runtime/compare/edge-runtime@1.1.0-beta.39...edge-runtime@1.1.0-beta.40
2022-10-18 13:57:11 +00:00
Steven
9775111ab6
Add swcMinify to the Upgrade Guide (#41521)
Follow up to:

- #41506
2022-10-18 13:29:08 +00:00
Balázs Orbán
a36798968f
fix(ts): Cookies -> NextCookies (#41491) 2022-10-18 15:13:42 +02:00
JJ Kasper
df0e61b023
Fix app sc_client componet HMR server-side (#41510)
This ensures we properly clear the `sc_client` component cache from
`react-server-dom-webpack` in development so that HMR works properly
after a refresh.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

Fixes: [slack
thread](https://vercel.slack.com/archives/C043ANYDB24/p1666051202574509)
2022-10-18 00:48:27 -07:00