Commit graph

11364 commits

Author SHA1 Message Date
Baruch-Adi Hen
e2fde26b59
Fix: Cleaner error message when importing sass without it being installed in dev (#35051)
This PR removes the not-very-helpful stack trace when sass is being used but the npm package is not installed. Fixes #13975

- Fix behavior to show the modified error message if either node-sass OR sass is missing
- dispose of stack trace if the condition above passes
- update the error link to [err.sh](https://err.sh/next.js/install-sass) equivalent 
- update the relevant test to verify the stack trace is omitted and to account for the new link


## Bug

- [x] Related issues linked using `fixes #13975`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-22 06:56:18 +00:00
hui.liu
11cb49b385
Fix next/link can't jump to non-latin anchors (#36430)
fixes #11109 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-22 06:32:11 +00:00
Iaroslav Kolbin
29b3cdf93f
Remove invalid attrs for head html element (#36457)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 00:54:33 -05:00
Justin Goping
9b61b10245
Fix Trusted Types violations from dangerouslySetInnerHTML on style elements (#36751)
Remove dangerouslySetInnerHTML usage in style elements

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 00:26:54 -05:00
Munawwar
bb7b75809d
update zustand example (#35022)
Made SSG and SSR code similar. Comments and variable renames on store.js

Checklist:

## Documentation / Examples

- [✓] Make sure the linting passes by running `yarn lint`
2022-05-22 04:57:40 +00:00
irvile
53eb046790
fix(with-tailwindcss-emotion): 'theme' of undefined (#35588)
Closes [#26337](https://github.com/vercel/next.js/issues/26337).
This PR fixes #26337.

The issue is just the version of xwind basically.
Not compatible with newer versions and jit mode.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-22 04:42:51 +00:00
Don Morrison
3c001aaae9
fix(examples/with-segment-analytics): Update README (#35387)
Update the README for `examples/with-segment-analytics`:

- Update reference from `_document.js` (removed in 92d87870af) to `_app.js`.
- Update reference links
- Make small language tweaks

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-22 04:33:01 +00:00
Justin Goping
15ddd20b1b
Enable Trusted Types Compatibility in Webpack (#36750)
Linked to issue #32209.

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] 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 helpful link attached, see `contributing.md`

## Documentation
The purpose of this PR is to enable Trusted Types compatibility in Webpack. When the app is run in development mode, Webpack is currently set to use an [eval-source-map](5a16b1a26f/packages/next/build/webpack/config/blocks/base.ts (L33)). This source map involves passing raw strings to `eval()` calls, which raise Trusted Types violations. The solution to this problem is to set `webpack5Config.output.trustedTypes` in the Webpack config. As shown in the documentation [here](https://webpack.js.org/configuration/output/#outputtrustedtypes), setting this value to a string will create a Trusted Types policy with the specified name. By creating a policy within Webpack, the raw strings passed to the `eval()` calls will be promoted to be of type `TrustedScript`. The issue where this was addressed in Webpack can be found [here](https://github.com/webpack/webpack/issues/14075).

### Note:
The policy name that is set in the Webpack config is currently `nextjs#bundler`. Once it is released to the public and application developers begin using it, it may be harder to change the value since any application developers with a custom policy name allowlist would now need to update their next.config.js headers to allow this new name. Thus, a good name should ideally be determined before this pull request is merged. The reason that `nextjs#bundler` is preferred over `nextjs#webpack` is in case Next.js moves to a different bundler in the future. Having a generic name would allow for application developers to keep their next.config.js file the same after the bundler switch has occurred. If a different name is preferred, feel free to comment what that would be.

The code was tested in a sample application to ensure it behaved as expected.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-22 04:25:26 +00:00
Elijah
a31793eceb
Properly await for this.hasPage() in base-server (#37091)
* Properly await for this.hasPage() in base-server

this.hasPage() is not properly awaited in a check in base-server.ts,
which may cause unexpected behavior.

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-21 23:00:49 -05:00
Joseph
8bdee983e0
feat: Opt-out Error page from dark scheme color (#36951)
* feat: Opt-out Error page from dark scheme color

* fix: Narrow `withDarkMode` to the media-query

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-21 22:35:17 -05:00
THE FALCON
7e57432247
Fix DecodeError from invalid URI causes 500 with middleware vs 400 without (#36993)
* Excluded `DecodeError` error from runMiddleware function

* Fix merge error/check and add test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-21 22:25:51 -05:00
idkwhojamesis
5b893663fd
Include router.asPath caveats in docs (#36876)
initial commit

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-21 21:45:47 -05:00
Igor Loskutov
87e93a275d
custom-server-express fix type definition and eliminate dead code (#37054)
Hi, this signature confused me a bit when I was porting it in typescript. Turns out there's dead code: there's no Error object passed to this function. Details of this signature are in this answer: https://stackoverflow.com/a/56291567/2123547, and in `@types/express-server-static-core` it is `listen(port: number, callback?: () => void): http.Server;`. Types definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/express-serve-static-core/index.d.ts#L1198

fixes #37053

## Bug

- [x ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ x] Make sure the linting passes by running `yarn lint`
2022-05-22 02:34:08 +00:00
Naveen
4fa54ede83
typo: Change yarn into pnpm (#37092)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-21 10:02:50 +00:00
JJ Kasper
2411d368d3
Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish

* update e2e tests

* add job name
2022-05-21 04:46:16 -05:00
LongYinan
33c837b115
Stabilize SWC emotion transform plugin (#37058) 2022-05-21 04:09:30 +00:00
Гончаров
e2e7f04c98
Fixed anotation param name (#37075)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-20 19:41:11 +00:00
JJ Kasper
6e40fbd495
Ensure hydration error doc link is shown with react 18 (#37074)
Follow-up to https://github.com/vercel/next.js/pull/31519 this ensures the error link we added is shown with react 18 as well. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-20 19:04:27 +00:00
Jiachi Liu
d25e246b50
Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time, applying them into proper places become more confusing.
In that case, we decide to make _app.js can't be a server component, and you can still keep all the existing thing there. And also you don't need to think of the corresponding APIs of custom _app in RSC

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Docs updated
2022-05-20 18:07:20 +00:00
JJ Kasper
5af2fbb3a7
Update a couple flakey tests (#37071) 2022-05-20 12:44:11 -05:00
Javi Velasco
036ffa7057
Extract and refactor getPageStaticInfo (#37062)
Extract config parsing
2022-05-20 14:24:00 +02:00
JJ Kasper
760750d851
Add note clarifying pnpm args handling (#37049)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

x-ref: https://github.com/vercel/next.js/pull/37045
x-ref: https://github.com/vercel/next.js/pull/37032
x-ref: https://github.com/vercel/next.js/pull/36602
x-ref: https://github.com/vercel/next.js/pull/36496
2022-05-19 22:35:39 +00:00
JJ Kasper
6cc2147386
v12.1.7-canary.10 2022-05-19 17:11:19 -05:00
Damien Simonin Feugas
bf089562c7
feat(middleware)!: forbids middleware response body (#36835)
_Hello Next.js team! First PR here, I hope I've followed the right practices._

### What's in there?

It has been decided to only support the following uses cases in Next.js' middleware:
- rewrite the URL (`x-middleware-rewrite` response header)
- redirect to another URL (`Location` response header)
- pass on to the next piece in the request pipeline (`x-middleware-next` response header)

1. during development, a warning on console tells developers when they are returning a response (either with `Response` or `NextResponse`).
2. at build time, this warning becomes an error.
3. at run time, returning a response body will trigger a 500 HTTP error with a JSON payload containing the detailed error.

All returned/thrown errors contain a link to the documentation.

This is a breaking feature compared to the _beta_ middleware implementation, and also removes `NextResponse.json()` which makes no sense any more.

### How to try it?
- runtime behavior: `HEADLESS=true yarn jest test/integration/middleware/core`
- build behavior : `yarn jest test/integration/middleware/build-errors`
- development behavior: `HEADLESS=true yarn jest test/development/middleware-warnings`

### Notes to reviewers

The limitation happens in next's web adapter. ~The initial implementation was to check `response.body` existence, but it turns out [`Response.redirect()`](https://github.com/vercel/next.js/blob/canary/packages/next/server/web/spec-compliant/response.ts#L42-L53) may set the response body (https://github.com/vercel/next.js/pull/31886). Hence why the proposed implementation specifically looks at response headers.~
`Response.redirect()` and `NextResponse.redirect()` do not need to include the final location in their body: it is handled by next server https://github.com/vercel/next.js/blob/canary/packages/next/server/next-server.ts#L1142

Because this is a breaking change, I had to adjust several tests cases, previously returning JSON/stream/text bodies. When relevant, these middlewares are returning data using response headers.

About DevEx: relying on AST analysis to detect forbidden use cases is not as good as running the code.
Such cases are easy to detect:
```js
new Response('a text value')
new Response(JSON.stringify({ /* whatever */ })
```
But these are false-positive cases:
```js
function returnNull() { return null }
new Response(returnNull())

function doesNothing() {}
new Response(doesNothing())
```
However, I see no good reasons to let users ship middleware such as the one above, hence why the build will fail, even if _technically speaking_, they are not setting the response body. 



## 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.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-19 22:02:20 +00:00
JJ Kasper
8dd4bc4125
Fix copying local swc binary for pnpm test (#37047)
This fixes the test when a publish is done, seems it's been passing for a while by using the wasm fallback instead but this fails on a publish since the current version being published isn't available until after the test runs

x-ref: https://github.com/vercel/next.js/runs/6512721965?check_suite_focus=true
2022-05-19 21:24:07 +00:00
JJ Kasper
b4af2f3f0d
Update to latest version of turbo (#37046)
Updates our turbo version to the latest
2022-05-19 20:59:06 +00:00
Donny/강동윤
9732463f92
Update swc (#37009)
This PR

 - updates swc crates to 224a2ea8b6

 - resolves`https://github.com/vercel/next.js/discussions/30237?sort=new#discussioncomment-2759673`

 - resolves `https://github.com/vercel/next.js/discussions/30237?sort=new#discussioncomment-2780370`


<img width="1840" alt="image" src="https://user-images.githubusercontent.com/29931815/169214393-5798681f-2a48-48b8-ba4a-24e4360e4ea5.png">
2022-05-19 20:29:04 +00:00
残月
5b21f09184
Fixes beforeInteractive inline scripts don't run (#37033)
BeforeInteractive inline script in v12.1.7-canary.8  don't run. Beacause the script has unknow src.

![image](https://user-images.githubusercontent.com/17813559/169257330-4419228a-6d10-4815-9451-d9a5dd7f011b.png)

Fixes https://github.com/vercel/next.js/issues/31275


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-19 19:53:30 +00:00
JJ Kasper
50833d009d
v12.1.7-canary.9 2022-05-19 13:06:44 -05:00
JJ Kasper
947bcd8ca7
Update to latest version of @vercel/nft (#37041) 2022-05-19 11:57:31 -05:00
Shu Ding
cd6b491cef
Fix styled-jsx not working in client components in the edge runtime when SSR (#37042)
The Edge SSR server and the client bundle should share the same Styled JSX instance to ensure the context can be passed correctly, same with the way we handle `next/head`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-19 16:44:43 +00:00
Javi Velasco
f354f46b3f
Deprecate nested Middleware in favor of root middleware (#36772)
This PR deprecates declaring a middleware under `pages` in favour of the project root naming it after `middleware` instead of `_middleware`. This is in the context of having a simpler execution model for middleware and also ships some refactor work. There is a ton of a code to be simplified after this deprecation but I think it is best to do it progressively.

With this PR, when in development, we will **fail** whenever we find a nested middleware but we do **not** include it in the compiler so if the project is using it, it will no longer work. For production we will **fail** too so it will not be possible to build and deploy a deprecated middleware. The error points to a page that should also be reviewed as part of **documentation**.

Aside from the deprecation, this migrates all middleware tests to work with a single middleware. It also splits tests into multiple folders to make them easier to isolate and work with. Finally it ships some small code refactor and simplifications.
2022-05-19 15:46:21 +00:00
Kiko Beats
cc8ab99a92
Edge Cookies: Add .getWithOptions method (#36943)
Hello,

This is an iteration after first work at https://github.com/vercel/next.js/pull/36478.

What that PR missed is a way to just get a cookie value. Well, this PR adds two new things:

`cookies.get` returns the cookie value that could be `string | undefined`:

```js
const response = new NextResponse()
response.cookies.set('foo', 'bar', { path: '/test' })

const value = response.cookies.get('foo')
console.log(value) // => 'bar'
```

Additionally, if you want to know all the cookie details, you can use `cookies.getWithOptions`:

```js
const response = new NextResponse()

response.cookies.set('foo', 'bar', { path: '/test' })
const { value, options } response.cookies.getWithOptions('foo')

console.log(value) // => 'bar'
console.log(options) // => { Path: '/test' }
```
2022-05-19 13:04:58 +00:00
JJ Kasper
5acf9db617
v12.1.7-canary.8 2022-05-18 20:35:50 -05:00
Hannes Bornö
e3382e64f0
Don't add locale to client side redirects from data fetching (#36944)
## Bug

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

Fixes #36169
2022-05-19 00:31:43 +00:00
Mike Fix
91c75b6c1f
Add with-markdoc/ example (#36867)
* add with-markdoc/ example

* rename as markdoc/

* use latest

* update README

* add .gitignore

* typescript changes

* update .gitignore

* make folders files

* update next.config.js

* fix prettier

* rename _app.ts -> _app.tsx
2022-05-18 18:52:45 -05:00
Steven
9f0024a5ee
Change experimental layout=raw to use native img lazy loading (#36985)
This PR changes the experimental `layout=raw` images to use the native lazy loading behavior (as opposed to the IntersectionObserver).

This will (eventually) lead to smaller client bundles and faster image loading since there is no JS needed to load the image.

However, we'll lose the `lazyRoot` and `lazyBoundary` behavior since those are specific to the IntersectionObserver implementation.
2022-05-18 21:05:15 +00:00
Houssein Djirdeh
81e69e8662
Fixes beforeInteractive scripts failing in custom document (#37000)
- Fixes #36997
- Fixes #31275

@janicklas-ralph Any idea why tests were passing while this check was failing? Can we add a stronger test for this?
2022-05-18 18:36:11 +00:00
Shu Ding
b2045c7669
Simplify the logic for static flight response generation (#36984)
* code refactor

* simplify static data

* htmlEscapeJsonString in view-render
2022-05-18 13:18:28 +02:00
JJ Kasper
f3c31137e1
Fix interopDefault on jest object-proxy (#37002)
This fixes the interop default from https://github.com/vercel/next.js/pull/36877 on the jest `object-proxy` as it currently causes the below error when running tests in our `with-jest` example:

```sh
    TypeError: 'get' on proxy: property '__esModule' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected 'true' but got 'false')
```

## Bug

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

x-ref: https://github.com/vercel/next.js/pull/36877
2022-05-18 09:41:13 +00:00
Damien Simonin Feugas
4a86a8ffb1
fix(middleware): false positive dynamic code detection at build time (#36955)
## What's in there?

Partially fixes https://github.com/vercel/edge-functions/issues/82
Relates to #36715 

Our webpack plugin for middleware leverages static analysis to detect Dyanamic code evaluation in user `_middleware.js` file (and depedencies). Since edge function runtime do not allow them, the build is aborted.

The use of `Function.bind` is considered invalid, while it is legit. A customer using `@aws-sdk/client-s3` reported it.
This PR fixes it.

Please note that this check is too strict: some dynamic code may be in the bundle (despite treeshaking), but may never be used (because of code branches). Since this point is under discussion, this PR adds tests covering some false positives (`@apollo/react-hook`, `qs` and `has`), but does not change the behavior (consider them as errors).

## Notes to reviewer

I looked for test facilities allowing to download the required 3rd party modules. `createNext()` in production context made my day, but showed two issues:
- `cliOutput` is not cleaned in between tests. While clearance during `stop()` would be annoying, I hope that clearance during `start()` is better.
- if `start()` fails while building, the created instance can never be stopped. This is because we don't clear `childProcess` after `build`. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-17 19:35:48 +00:00
Gaspar Garcia Jr
c72d32d3b5
Clarify .env* environment variable priority (#36967)
Clarify that the environment variables are ordered in descending priority and that the existing system environment is not overridden.

fixes https://github.com/vercel/next.js/issues/36966

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-17 17:52:41 +00:00
Josh Story
f1babe9302
escape flight response values (#36989)
Applies additional escaping to flight data written to script tags during RSC. A test was added. I'm not aware of any issues reported for this and there are no new errors

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-05-17 17:44:44 +00:00
Hannes Bornö
4fd883f238
Remove optional chaining from eslint rule to support older node versions (#36978)
fixes #36693

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-05-17 17:09:31 +00:00
JJ Kasper
af86ca08e4
v12.1.7-canary.7 2022-05-17 11:01:35 -05:00
Tim Neutkens
fe3d6b7aed
Add support for browserslist and legacyBrowsers experimental option (#36584)
Implements the first part of #33227

- Applies browserslist to JS transforms when `experimental.browsersListForSwc` is enabled. 
- You don't have to use browserslist, there's also `legacyBrowsers: false` which will be the new default in Next.js 13. See #33227 for which browsers and why. `legacyBrowsers` requires `browsersListForSwc: true` to function until it is the default. 

```js
module.exports = {
  experimental: {
    legacyBrowsers: false,
    browsersListForSwc: true,
  }
}
```

I only implemented the JS part of the RFC, the CSS part should be handled in a follow-up PR.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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.
- [x] 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.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-17 15:09:34 +00:00
JJ Kasper
c947abb439
Update lockfile patching for different versions (#36959)
This ensures different lockfile versions are handled and we skip patching when the version isn't supported. This also adds an env variable to allow skipping this check if desired. 

## Bug

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

Closes: https://github.com/vercel/next.js/issues/36816
2022-05-17 14:45:23 +00:00
Donny/강동윤
16bcb070d8
Update swc (#36972)
This PR updates swc to f226c0a3d8


This PR resolves

 - `https://github.com/vercel/next.js/discussions/30237#discussioncomment-2739632`

<img width="1840" alt="image" src="https://user-images.githubusercontent.com/29931815/168766189-c9412011-afae-4888-9b43-045e91478771.png">

Which is related to `styled-components`
2022-05-17 14:15:24 +00:00
Sukka
96034e2d9c
fix(#36651): disable reactRemoveProperties in jest transform (#36922)
## Bug

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

Fixes #36651.

Always disable `reactRemoveProperties` in `next/jest` transformation.
2022-05-17 11:05:31 +00:00
LongYinan
c7f2c635cb
Fix SWC dynamic transform with suspense but without ssr (#36825)
The Babel plugin works fine, so it seems not a runtime issue.

fixes https://github.com/vercel/next.js/issues/36636
2022-05-17 10:41:17 +00:00