Commit graph

11169 commits

Author SHA1 Message Date
Balázs Orbán
6aa9ef1955
enforce omitting name and version (#36771)
We have tests running on the examples repository that will fail if `name` or `version` is found in the `package.json`. We should make it more clear in the documentation to omit these fields.

@ijjk

## 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-09 11:27:44 +00:00
Kiko Beats
b78c28f7a0
feat: better cookies API for Edge Functions (#36478)
This PR introduces a more predictable API to manipulate cookies in an Edge Function context.

```js
const response = new NextResponse()

// set a cookie
response.cookies.set('foo, 'bar') // => set-cookie: 'foo=bar; Path=/'`

// set another cookie
response.cookies.set('fooz, 'barz') // => set-cookie: 'foo=bar; Path=/, fooz=barz; Path=/'`

// delete a cookie means mark it as expired
response.cookies.delete('foo') // => set-cookie: 'foo=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT, fooz=barz; Path=/'`

// clear all cookies means mark all of them as expired
response.cookies.clear() // => set-cookie: 'fooz=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT, foo=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT'`
``` 

This new cookies API uses [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) interface, and it's available for `NextRequest` and `NextResponse`.

Additionally, you can pass a specific cookies option as a third argument in `set` method:

```js
response.cookies.set('foo', 'bar', {
  path: '/',
  maxAge: 60 * 60 * 24 * 7,
  httpOnly: true,
  sameSite: 'strict',
  domain: 'example.com'
}
```

**Note**: `maxAge` it's in seconds rather than milliseconds.

Any cookie manipulation will be reflected over the `set-cookie` header, transparently.

closes #31719
2022-05-09 09:50:32 +00:00
Tim Neutkens
40e9891175
Add flight render starting point (#36760)
## 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-08 16:38:43 +00:00
Sukka
26459ef097
replace use-subscription with use-sync-external-store (#36733)
- [x] Make sure the linting passes by running `yarn lint`

Back in 2019, React released the first version of `use-subscription` (https://github.com/facebook/react/pull/15022). At the time, we only has limited information about concurrent rendering, and #9026 add the initial concurrent mode support.

In 2020, React provides a first-party official API `useMutableSource` (https://github.com/reactjs/rfcs/pull/147, https://github.com/facebook/react/pull/18000):

> ... enables React components to safely and efficiently read from a mutable external source in Concurrent Mode.

React 18 introduces `useMutableSource`'s replacement `useSyncExternalStore` (see details here: https://github.com/reactwg/react-18/discussions/86), and React changes `use-subscription` implementation to use `useSyncExternalStore` directly: https://github.com/facebook/react/pull/24289

> In React 18, `React.useSyncExternalStore` is a built-in replacement for `useSubscription`.
> 
> This PR makes `useSubscription` simply use `React.useSyncExternalStore` when available. For pre-18, it uses a `use-sync-external-store` shim which is very similar in `use-subscription` but fixes some flaws with concurrent rendering.

And according to `use-subscription`:

> You may now migrate to [`use-sync-external-store`](https://www.npmjs.com/package/use-sync-external-store) directly instead, which has the same API as `React.useSyncExternalStore`. The `use-subscription` package is now a thin wrapper over `use-sync-external-store` and will not be updated further.

The PR does exactly that:

- Removes the precompiled `use-subscription` introduced in #35746
- Adds the `use-sync-external-store` to the dependencies.
  - The `use-sync-external-store` package enables compatibility with React 16 and React 17.
  - Do not pre-compile `use-sync-external-store` since it is also the dependency of some popular React state management libraries like `react-redux`, `zustand`, `valtio`, `@xstate/react` and `@apollo/client`, etc. By install
- Replace `useSubscription` usage with `useSyncExternalStore` 

---

Ref: #9026, #35746 and #36159


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-05-08 12:19:33 +00:00
Steven Tey
3fd1168504
Fixed typo (#36753)
## 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-07 20:50:31 +00:00
Jiachi Liu
a84672e63e
Use react dom server node api to detect react root is enabled (#36749)
x-ref: https://github.com/vercel/next.js/pull/36552#issuecomment-1120128946
x-ref: https://github.com/preactjs/next-plugin-preact/pull/59

`preact/compat` doesn't have `/server.browser` exports, to make it work with latest of next.js: 

* use `react-dom/server` to detect if it could opt-in streaming rendering by checking react 18 `renderToPipeableStream` API in short time fix. In long term `preact/compat`should support `/server.browser` that same with react 17.
* Also filed a PR to `next-plugin-preact` to skip chunk-prepending to pages in edge compiler
2022-05-07 18:45:40 +00:00
Tim Neutkens
51d962d60f
Leverage pageExtensions for resolving in loader (#36747)
## 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-07 13:37:14 +00:00
Rich Haines
49910ea9ac
Updated the middleware api docs env section to remove dev and prod (#36739)
…rding due to customer confusion

This PR updates the middleware (edge functions) api docs environment section to remove the dev and prod wording due to customer confusion

## 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-07 00:24:39 +00:00
Tim Neutkens
e78c42c91b
Fix leftover todo in loader (#36734) 2022-05-06 18:11:11 +02:00
Tim Neutkens
a1bb1c69ed v12.1.7-canary.3 2022-05-06 13:11:55 +02:00
Jiachi Liu
f6af0bc2d8
test: merge rsc custom app cases (#36713)
the rsc & streaming test app is too big to build which is time consuming, move custom _app cases to switchable runtime test suite
2022-05-05 23:16:24 +00:00
Tim Neutkens
6f90d19609
Add route loader (#36712)
* Add route loader

* Update to leverage new view-loader

* fix lint

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-05 15:42:22 -05:00
Jiachi Liu
4fb0beb1ee
fix: duplicate app server (#36710)
Fixes #36659

`App` is alreay included in `ServerComponentWrapper`

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-05-05 18:53:51 +00:00
JJ Kasper
41c0a66902
Update renderOpts.dev handling and fix check (#36666)
* Update renderOpts.dev handling and fix check

* Update awaiting in load-components

* extra arg

* fix streaming case
2022-05-05 11:11:17 -05:00
Luis Alvarez D
08ffbc9e09
Fix playwright tests (#36705) 2022-05-05 10:08:28 -05:00
Steven
cefb944ee5 v12.1.7-canary.2 2022-05-05 08:08:52 -04:00
JJ Kasper
e8a8220d49
Tweak routing tests (#36667)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2022-05-05 13:15:32 +02:00
Steven
da8d1984d2
Add experimental wildcard remotePatterns config for upstream images (#36245)
## Description 
This PR implements a new configuration object in `next.config.js` called `experimental.images.remotePatterns`.

This will eventually deprecate `images.domains` because it covers the same use cases and more by allowing wildcard pattern matching on `hostname` and `pathname` and also allows restricting `protocol` and `port`.

## Feature

- [x] Implements an existing feature request.
- [x] Related issues linked
- [x] Unit tests added
- [x] Integration tests added
- [x] Documentation added
- [x] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

## Related 

- Fixes #27925 
- Closes #18429 
- Closes #18632
- Closes #18730
- Closes #27345
2022-05-05 02:19:16 +00:00
Justin Goping
0dd62111f6
Fix various Trusted Types violations without use of policy (#34726)
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
There are three Trusted Types violations that are fixed in this PR:
### 1. ban-element-innerhtml-assignments: maintain--tab-focus.ts
The innerHTML assignment here is unsafe as a string is being used that could contain an XSS attack. The solution chosen was to replace the string containing HTML with programmatically-created DOM elements. This removes the Trusted Types violation as there is no longer a string passed in that can contain an XSS attack.

Notes on solution:
-  The `<svg>` tag is omitted completely since the original snippet returns fragment.firstChild.firstChild. The first firstChild omits the `<div>`, and the second firstChild omits the `<svg>`, so to remove unnecessary code the created elements start at the foreignObject level.
-  The reason createElementNS is used instead of createElement is because the ‘foreignObject’ element is a separate namespace from the default HTML elements. The documentation for this command is found [here](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS).

The code was tested to be equivalent by rendering both the original code and the re-written code in a browser to see if they evaluate to the same thing in the DOM. The DOM elements styles were then compared to ensure that they were identical.

### 2. ban-window-stringfunctiondef: packages/next/lib/recursive-delete.ts
The setTimeout function caused a Trusted Types violation because if a string is passed in as the callback, XSS can occur. The solution to this problem is to ensure that only function callbacks can be passed to setTimeout. There is only one call to the sleep function and it does not involve a string callback, so this can be enforced without breaking the application logic. In the process of doing this, promisify has been removed and the promise has been created explicitly.

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

### 3. ban-window-stringfunctiondef: packages/next/client/dev/fouc.ts
This file also uses setTimeout, so the call was wrapped in a `safeSetTimeout` call that specifies that the callback argument is not a string.
2022-05-05 00:11:36 +00:00
Ryan Patterson
d1db7141ba
Add docs about nextRuntime for custom webpack (#36685)
This variable is exported by next but undocumented, and its usage is necessary to build auxiliary scripts for your server-side applications. See https://github.com/vercel/next.js/issues/36237#issuecomment-1117694528 for an example.



## 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-04 19:14:06 +00:00
LongYinan
2012f4e7c6
Update components in GitHub Actions (#36669)
`build-native` jobs tested on https://github.com/vercel/next.js/runs/6288266017
2022-05-04 18:51:25 +00:00
oof2win2
3e78f0cb5d
fix(docs): mention cookies in context (#36342)
Mention that the HTTP.IncomingMessage object is augmented by `cookies` in getServerSideProps

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-04 16:25:55 +00:00
Justin Goping
44c89e50c8
Route Loader Trusted Types Violation Fix (#34730)
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
There is one tsec violation that is fixed in this PR:
### 1. ban-script-src-assignment: route-loader.ts
XSS can occur with the line script.src = src in appendScript(src, script) if src can be controlled by a malicious user. From tracing through the code, it was determined that src comes from the function `getFilesForRoute(route)`. The behaviour of this function differs depending on the environment (development vs. production), but in both cases the function will construct strings that lead to valid file paths. These strings depend on two variables: `assetPrefix` and `route`, but due to the nature of the constructed strings it was determined that the scripts here are safe to use. Thus, the solution was to promote these strings to `TrustedScriptURL`s. This is the Trusted Types way of declaring that the script URL passed to the DOM sink is safe from DOM XSS attacks.

To create a `TrustedScriptURL`, a policy needs to be created. This policy was put in its own file: `client/trusted-types.ts`. This policy has the name `nextjs`. If this name should be changed to something else, feel free to change it now. However, 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.

The code was tested in a sample application to ensure it behaved as expected.
2022-05-03 23:22:08 +00:00
Jiachi Liu
ce6e8b5622
fix: react root enabled properly in custom server (#36664)
Fixes #36643

## Bug

* hoist react dom choosing in client
* also assign __NEXT_REACT_ROOT env in custom server

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-05-03 22:42:00 +00:00
Stig Kleppe-Jørgensen
9cda84b484
Improve wording (#36649)
## 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] Improve wording
- [ ] Make sure the linting passes by running `yarn lint`
2022-05-03 21:57:29 +00:00
JJ Kasper
87529e987c
v12.1.7-canary.1 2022-05-03 16:02:45 -05:00
jpveilleux
0234e6d553
Added type to Page Component for TypeScript (#36608)
* Added type to Page Component for TypeScript

Following this tutorial, I noticed that TS was complaining that "getLayout" did not exist on Page. That is normal since Page is typed as NextPage. I simply exported the new type we create in "_App.tsx" and used it as the return type for Page. This will probably help others seeing that red in their editors and perhaps being confused.

* Small linting change

* Apply suggestions from code review

* Update layouts.md

* lint fix

* update type

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-03 15:58:31 -05:00
JJ Kasper
95fb221e87
Fix asPath handling for data route revalidation in minimal mode (#36660) 2022-05-03 15:40:36 -05:00
Tim Neutkens
fdc4ab88d6
Enable disabled tests that pass (#36644) 2022-05-03 15:12:06 +02:00
Tim Neutkens
b9bf269991 v12.1.7-canary.0 2022-05-03 13:17:28 +02:00
abdallah akrab
3682534986
docs: add jest-environment-jsdom package for Jest configuration (#36632)
## Documentation / Examples

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

Jest 28 does not include jest-environment-jsdom by default.

following guide & running jest without jest-environment-jsdom causes the following  error:

<img width="1598" alt="image" src="https://user-images.githubusercontent.com/37980706/166319065-2bc29bb4-7d56-43e5-b85d-5a7484f17b1b.png">
2022-05-03 11:12:52 +00:00
Maria Violante
fec5318e91
Update buttercms example (#35436)
* remove old buttercms project files

* Updated .gitignore

* Add new buttercms files

* Add readme and remove name from package.json

* fix linting error

* Fix eslint

* Update examples/cms-buttercms/.gitignore

Co-authored-by: Lee Robinson <me@leerob.io>

* renamed .env.sample > .env.local.example

* remove dangerously allow svg

* Update examples/cms-buttercms/package.json

Co-authored-by: Lee Robinson <me@leerob.io>
2022-05-03 12:41:27 +02:00
JJ Kasper
44f436b91b
Add initial handling for routing tests (#36635)
x-ref: https://github.com/vercel/next.js/pull/36618
2022-05-03 10:37:23 +00:00
OJ Kwon
837e0a6af8
feat(next-swc): introduce experimental tracing support for swc (#35803)
* feat(next-swc/napi): expose initcustomtracesubscriber

* feat(next/config): enable experimental swcTrace

* feat(trace): add trace for emotion transform

* refactor(swc): use .next for the default trace output

* refactor(swc): teardown subscriber via drop

* refactor(swc/trace): simplify config

* refactor(swc/trace): adjust teardown
2022-05-02 15:20:59 -07:00
JJ Kasper
3692a5ecdb
Add falling back to wasm swc build on native load failure (#36612)
Follow-up to https://github.com/vercel/next.js/pull/36527 this adds falling back to the wasm swc build when loading the native bindings fails so that we don't block the build on the native dependency being available.  

This continues off of https://github.com/vercel/next.js/pull/33496 but does not add a postinstall script yet and only downloads the fallback when the native dependency fails to load.
2022-05-02 21:11:45 +00:00
Jiachi Liu
fcec758779
Flush initial styled-jsx in gIP first in concurrent rendering (#36594)
* Use flushed effects to generate styled-jsx styles insted of gIP by default

* ensure styles are flushed inside the default getInitialProps

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Shu Ding <g@shud.in>
2022-05-02 22:52:46 +02:00
JJ Kasper
b188fab336
v12.1.6 2022-05-02 14:46:56 -05:00
Steven
f492962a82
Update codeowners image pattern (#36631)
Fixes the GitHub CODEOWNERS pattern matching which previously missed adding me to #36611
2022-05-02 19:45:28 +00:00
Tim Neutkens
0c23f5d1d2 v12.1.6-canary.17 2022-05-02 20:27:26 +02:00
HYEON GYU KIM
cb4eaaab6d
add Script key for cache (#36627)
Script component manages the cache as src or id. But in this example, id is missed.

## 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-02 17:31:45 +00:00
Tim Neutkens
20e5fed1cf
Handle styled-jsx in newLinkBehavior codemod (#36628)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-05-02 19:07:14 +02:00
Naoyuki Kanezawa
9e53af8e30
Fix next node buildin module error message for edge runtime (#36434)
- improve the message for importing node builtin module on edge runtime
- fix to show the message on overlay of error browser with `next dev`
- fix https://github.com/vercel/next.js/issues/36237

The message is NOT shown when using edge runtime (not middleware) since I cannot find a way to detect a webpack compilation is for edge runtime.

## 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-02 15:21:40 +00:00
JJ Kasper
c905fda590
Fix swc jest pagesDir config (#36623)
This updates the `pagesDir` config for the new return shape updated in https://github.com/vercel/next.js/pull/36619, no additional tests were added as existing tests were failing from this. 

x-ref: https://github.com/vercel/next.js/runs/6257712883?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/6257712805?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/pull/36619
2022-05-02 14:59:38 +00:00
Tim Neutkens
4eee0e32f3
Update findPagesDir (#36619)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-05-02 15:07:21 +02:00
Tim Neutkens
6bb0e91a0c
Add tests for routing experiment (#36618)
## 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-02 10:18:16 +00:00
Tim Neutkens
ddba1aab1f v12.1.6-canary.16 2022-05-01 18:58:46 +02:00
Tim Neutkens
5aa54b3385
Add pagesDir to Jest transformer (#36599)
Fixes #35469

Adds `pagesDir` which is required for the Relay transform.

Added a test case based on https://github.com/hanford/relay-swc-jest.



## 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-01 16:39:30 +00:00
JJ Kasper
bd3dfe1f4b
Update status code for normalize error (#36580)
This updates to show a 400 (bad request) when an invalid path is sent to Next.js similar to our decode failure handling. 

## Bug

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

Closes: https://github.com/vercel/next.js/issues/36555

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-05-01 09:23:06 +00:00
Jiachi Liu
7a09f88d14
Reexports styled-jsx JSXStyle in nextjs (#36585)
When using pnpm / yarnPnP to install next.js, styled-jsx as dependency is not hoisted in the top level node_modules, it will fail when nodejs is trying to resolve `styled-jsx/style` from project directory. Re-export `styled-jsx/style` in next.js and let swc/babel plugin compile the import path it to `next/dist/shared/lib/styled-jsx`

Resolves #10149
Closes #21320
Closes #9325



Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-04-30 20:25:05 +00:00
ro11ingbutler
948128ae19
Fix typo (#36592)
## 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-04-30 18:35:38 +00:00