Commit graph

5120 commits

Author SHA1 Message Date
JJ Kasper
b314c9886c
v12.0.10-canary.0 2022-01-27 16:50:54 -06:00
JJ Kasper
6aef15dc23
Ensure non-error thrown in getStaticPaths shows correctly (#33753) 2022-01-27 16:31:54 -06:00
JJ Kasper
7ec49be7ac
Ensure all CSS files are included for experimental critical CSS (#33752)
* Ensure all CSS files are included for experimental critical CSS

* remove extra import
2022-01-27 16:22:20 -06:00
Gal Schlezinger
7b2ea48745
Allow to delete URL search params in middleware rewrites (#33725)
This allows to have a more streamlined API for rewrites.
Since middlewares are code and not static configurations, we can allow people to
delete query params and not just overwrite them.

**⚠️ Warning ⚠️** this is a breaking change in query parameter behavior with middlewares, but the API will make more sense now. Compare the following:

```diff
  import {NextResponse} from 'next/server'
  export default function middleware({ nextUrl }) {
-   nextUrl.searchParams.set('ignored-query-param', '');
+   nextUrl.searchParams.delete('ignored-query-param'); // 🎉
    return NextResponse.rewrite(nextUrl);
  }
```

Since this is breaking change, we're adding a warning every time we find a query param that is missing, and eventually--the warning will be deleted.
I don't think we need to worry about older versions of Next.js as the current behavior is misleading: merging query parameters make sense for static rewrites, but not for middlewares where you have access to all the query parameters and can manipulate them freely.

Related:
* This is the opposite of #33454
* This supersedes #33574
2022-01-27 22:06:39 +00:00
Steven
16b5bfa78e
Add stale-while-revalidate pattern to Image Optimization API (#33735)
- Resolves #27208
2022-01-27 21:33:23 +00:00
Pieter Bogaerts
662fa6362a
fix: fixes #33314 move is-plain-object for es5 compilation (#33690)
## Bug

- [ ] Related issues linked using `fixes #33314` #33314
- [ ] Moved the `is-plain-object` file to the shared directory since it's emitted to the client and thus needs to be transpiled.

This is just my 2nd PR so if I'm missing something please let me know.
2022-01-27 17:59:42 +00:00
Pepijn Senders
c8a0aac24e
chore: deprecate process.browser (#32862)
This value has been deprecated in favor of `typeof window !== 'undefined'` a long time ago ([ref](https://github.com/vercel/next.js/pull/7651)). We should also deprecate the value in the global types as it might give the wrong assumption that this value should still be used.
2022-01-27 16:55:26 +00:00
Shu Ding
7b524c1b97
Properly support custom 500 page in the web server (#33729)
In the web runtime, currently we use `absolute500Path || absoluteErrorPath` to act like `/_error`. This PR fixes the behavior to use the `/pages/500.js` for 500 errors and `/pages/_error.js` for 500 fallback and other errors.

## 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-01-27 16:20:16 +00:00
Jiachi Liu
3bda6e66b6
Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)


Co-authored-by: Donny/강동윤 <29931815+kdy1@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-27 15:48:09 +00:00
Balázs Orbán
7e95e30063
fix: allow certain variable names in development (#33638)
Fixes #24570

A few variable names (listed https://github.com/vercel/next.js/issues/24570#issuecomment-828721019) were causing problems when using `next dev`.

## 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-01-27 14:22:35 +00:00
Balázs Orbán
0d642f1264
feat: make compress configurable in standalone mode (#33717)
Fixes #33696

## 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-01-27 02:13:10 +00:00
Keen Yee Liau
c551a329d5
fix: image optimizer hangs when invalid image is requested (#33719)
When an invalid image is requested, the 'finish' event is never triggered,
which ultimately leads to a 504 Gateway Timeout error.

This is fixed by invoking the 'callback' in `_write()`.

fix https://github.com/vercel/next.js/issues/33441



## 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-01-27 01:41:57 +00:00
JJ Kasper
07431d3e0f
v12.0.9 2022-01-26 16:01:19 -06:00
JJ Kasper
c938e20077
v12.0.9-canary.12 2022-01-26 15:10:58 -06:00
JJ Kasper
865a079923
v12.0.9-canary.11 2022-01-26 10:31:07 -06:00
JJ Kasper
b5d4564cca
Revert "Relay Support in Rust Compiler" (#33699) 2022-01-26 17:26:32 +01:00
Tim Neutkens
65c63c9434 v12.0.9-canary.10 2022-01-26 12:00:50 +01:00
Terence Bezman
b20eb99a4d
Relay Support in Rust Compiler (#33240)
## Feature

Implements feature requested in https://github.com/vercel/next.js/issues/30805. 

A few people including myself have been looking to use Relay with Next.JS and want to use the new Rust Compiler. This is my stab at an implementation. 

### How it works?
Finds all  `graphql` tagged template experssions and replaces them with `require`s to the file generated by Relay.

### Where I need help
- I've only worked with Rust a handful of times so I would appreciate any feedback on my use of language features.
- Is there any performance overhead to many duplicate usages of `require`? I imagine there's a cache in place but I want to be sure.
- I've added some unit tests & integration tests but I might be missing some use cases. Feel free to comment some use cases I'm not thinking about.

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
  - I haven't added any docs since this is an experimental API.

## Documentation / Examples

You're expected to be running the Relay Compiler along side Next.JS when you're developing. This is pretty standard. I wouldn't expect people to have any problem with this.

### Usage
In your `next.config.js`
```js
module.exports = {
  experimental: {
    relay: {
      language: 'typescript', // or 'javascript`
      artifactDirectory: 'path/to/you/artifact/directory' // you can leave this undefined if you did not specify one in the `relay.json`
    }
  }
}
```


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-01-26 08:23:57 +00:00
Shu Ding
99d4d6c5a4
Implement web server as the request handler for edge SSR (#33635)
(#31506 for context)

This PR implements the minimum viable web server on top of the Next.js base server, and integrates it into our middleware (edge) SSR runtime to handle all the requests.

This also addresses problems like missing dynamic routes support in our current handler.

Note that this is the initial implementation with the assumption that the web server is running under minimal mode. Also later we can refactor the `__server_context` environment to properly passing the context via the constructor or methods.
2022-01-26 06:22:11 +00:00
Donny/강동윤
f0e31ee842
feat(next-swc): Update swc (#33675)
This PR applies

 - https://github.com/swc-project/swc/pull/3367
2022-01-26 05:46:29 +00:00
JJ Kasper
8d1c58525c
v12.0.9-canary.9 2022-01-25 10:53:28 -06:00
11koukou
7452c0bf1b
Add lazyRoot optional property to next/image component (#33290)
* Added 'rootEl' oprional property to next/Image component resembling 'root' option of the Intersection Observer API

* changed 'rootEl' to 'lazyBoundary' and its type as well

* added test, fixed initial root detection

* Update test/integration/image-component/default/test/index.test.js

Co-authored-by: Steven <steven@ceriously.com>

* prop names changed

* added 'lazyroot' prop to the documentation

* removed unused import

* Apply suggestions from code review

* Update docs with lazyRoot added in 12.0.9

Co-authored-by: Steven <steven@ceriously.com>
2022-01-25 14:54:15 +01:00
Donny/강동윤
9dd0399dd8
feat(next-swc): Update swc (#33628)
This PR applies


 - https://github.com/swc-project/swc/pull/3360

Closes https://github.com/vercel/next.js/issues/33600
2022-01-25 09:22:22 +00:00
JJ Kasper
f60a480771
v12.0.9-canary.8 2022-01-24 16:30:26 -06:00
JJ Kasper
c13d9a0c78
Update other instances of node-fetch (#33617)
* Update other instances of node-fetch

* update compiled
2022-01-24 16:18:39 -06:00
JJ Kasper
e8c15e5991
Ensure fetch polyfill is loaded in next-server (#33616) 2022-01-24 15:38:54 -06:00
JJ Kasper
3329ac6460
v12.0.9-canary.7 2022-01-24 13:14:25 -06:00
Tobias Koppers
2c6bd1ed1b
upgrade webpack (#33549)
https://github.com/webpack/webpack/releases/tag/v5.67.0
2022-01-24 18:32:47 +00:00
Jiachi Liu
62b63098a2
Fix rsc export component name detection (#33608) 2022-01-24 17:19:57 +01:00
Donny/강동윤
0fb1183973
feat(next-swc): Update swc (#33595)
This PR applies

 - https://github.com/swc-project/swc/pull/3344

Resolves https://github.com/vercel/next.js/discussions/30237#discussioncomment-2014245

 - https://github.com/swc-project/swc/pull/3348

 - https://github.com/swc-project/swc/pull/3352

This fixes `jsc.experimental.keepImportAssertions`.
2022-01-24 13:46:09 +00:00
PØL1
01cd69fbc3
Update deprecation for webpack5 config (#33560)
* Removed the s

Removed the s of
"This option was moved to the top level"
was before: "this options was moved to the top level"

* Update packages/next/server/config-shared.ts

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* Suggestion of @ijjk

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-01-23 13:34:08 -06:00
Steven
f81a6a5f0f
Bump nft to 0.17.4 (#33548)
- Fixes https://github.com/vercel/next.js/issues/33294

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-22 00:14:11 +00:00
JJ Kasper
f5fb18198c
Ensure optional value normalizing is correct for index (#33547)
This fixes a case where optional catch-all route values aren't normalized to an array properly when the `index` value is passed. An additional test case has been added to prevent regressing on this. 

x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1642791113093400)

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-01-21 23:16:24 +00:00
JJ Kasper
2a349c769d
v12.0.9-canary.6 2022-01-21 15:55:00 -06:00
Jiachi Liu
ebe95f4420
Bump styled-jsx (#33546)
Use stable v5 of styled-jsx
2022-01-21 21:27:37 +00:00
JJ Kasper
69524c290d
Fix static file check with i18n (#33503) 2022-01-21 14:38:59 -06:00
Jiachi Liu
557a972568
Simplify getMiddlewareInfo calls (#33542)
Subtask of #31506

* move `serverBuildDir` and getter function of `publicDir` to next-server as only used place
* simplify `getMiddlewareInfo`, remove `distDir` and other params could be accessed from web server itself
2022-01-21 16:24:57 +00:00
Shu Ding
76b9a5497f
Implement abstract methods to get manifest files in the base server (#33537)
Related to #31506, this PR adds `getPrerenderManifest` and `getRoutesManifest` methods to provide manifest files to the base server. In the future, we can consider making these methods async, or provide necessary manifests from the very top.

## 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-01-21 15:31:47 +00:00
Tim Neutkens
8959292d2b v12.0.9-canary.5 2022-01-21 15:42:22 +01:00
Donny/강동윤
8ff9785d08
Update swc (#33514)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-01-21 12:49:38 +01:00
Shu Ding
1c1a4de0e2
Refactor base server to remove native dependencies (#33499)
Part of #31506, this PR removes `loadEnvConfig` and `chalk` from the base server while keeping the same behavior for the node server.

## 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-01-20 21:25:44 +00:00
Steven
c879fce0d4
Fix multiple calls to image onLoadingComplete() (#33474)
The image prop `onLoadingComplete()` was unexpectedly called multiple times because it uses a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs).

This could lead to an infinite loop if `onLoadingComplete()` calls `setState()` as demonstrated in the updated test.

The solution is to handle refs with `useRef()` and `useEffect` so `onLoadingComplete()` is called at most once per component instance.

- Fixes #33463
2022-01-20 15:29:34 +00:00
Tim Neutkens
96057c8f67 v12.0.9-canary.4 2022-01-20 09:57:25 +01:00
Donny/강동윤
a54eb376e1
feat(next-swc): Update swc (#33485) 2022-01-20 09:54:56 +01:00
JJ Kasper
2fd17ba1f8
v12.0.9-canary.3 2022-01-19 16:09:37 -06:00
Jiachi Liu
8ca32f15f7
Move static serving to next server (#33475)
Part of #31506

Decouple static serving logic from base-server, let them go to next-server only
2022-01-19 21:54:04 +00:00
Balázs Orbán
1d4f364515
chore(deps): upgrade node-fetch (#33466)
Fixes #33462 

Tried upgrading to v3, but we rely on the `timeout` property:

e5dee17f77/packages/next/telemetry/post-payload.ts (L12)

Which was removed since it's non-standard:

https://github.com/node-fetch/node-fetch/blob/main/docs/v3-UPGRADE-GUIDE.md#the-timeout-option-was-removed

I wanted to keep this PR minimal, so I did not try to work around the above.

## 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-01-19 16:48:11 +00:00
JJ Kasper
818f6b3258
Update main field for nccd jest-worker (#33465) 2022-01-19 10:11:14 -06:00
Donny/강동윤
3574b91b48
feat(next-swc): Update swc (#33461)
This PR applies

 - https://github.com/swc-project/swc/pull/3313

 - https://github.com/swc-project/swc/pull/3310

Fixes https://github.com/vercel/next.js/issues/31077
2022-01-19 15:57:39 +00:00
Javi Velasco
e5dee17f77
Enforce absolute URLs in Edge Functions runtime (#33410)
We currently have inconsistencies when working with URLs in the Edge Functions runtime, this PR addresses them introducing a warning for inconsistent usage that will break in the future. Here is the reasoning.

### The Browser

When we are in a browser environment there is a fixed location stored at `globalThis.location`. Then, if one tries to build a request with a relative URL it will work using that location global hostname as _base_ to construct its URL. For example:

```typescript
// https://nextjs.org
new Request('/test').url; // https://nextjs.org/test
Response.redirect('/test').headers.get('Location'); // https://nextjs.org/test
```

However, if we attempt to run the same code from `about:blank` it would not work because the global to use as a base `String(globalThis.location)` is not a valid URL. Therefore a call to `Response.redirect('/test')` or `new Response('/test')` would fail.

### Edge Functions Runtime

In Next.js Edge Functions runtime the situation is slightly different from a browser. Say that we have a root middleware (`pages/_middleware`) that gets invoked for every page. In the middleware file we expose the handler function and also define a global variable that we mutate on every request:

```typescript
// pages/_middleware

let count = 0;

export function middleware(req: NextRequest) {
  console.log(req.url);
  count += 1;
}
```

Currently we cache the module scope in the runtime so subsequent invocations would hold the same globals and the module would not be evaluated again. This would make the counter to increment for each request that the middleware handles. It is for this reason that we **can't have a global location** that changes across different invocations. Each invocation of the same function uses the same global which also holds primitives like `URL` or `Request` so changing an hypothetical `globalThis.location` per request would affect concurrent requests being handled.

Then, it is not possible to use relative URLs in the same way the browser does because we don't have a global to rely on to use its host to compose a URL from a relative path.

### Why it works today

We are **not** validating what is provided to, for example, `NextResponse.rewrite()` nor `NextResponse.redirect()`. We simply create a `Response` instance that adds the corresponding header for the rewrite or the redirect. Then it is **the consumer** the one that composes the final destination based on the request. Theoretically you can pass any value and it would fail on redirect but won't validate the input.

Of course this is inconsistent because it doesn't make sense that `NextResponse.rewrite('/test')` works but `fetch(new NextRequest('/test'))` does not. Also we should validate what is provided. Finally, we want to be consistent with the way a browser behaves so `new Request('/test')` _should_ not work if there is no global location which we lack.

### What this PR does

We will have to deprecate the usage of relative URLs in the previously mentioned scenarios. In preparation for it, this PR adds a validation function in those places where it will break in the future, printing a warning with a link that points to a Next.js page with an explanation of the issue and ways to fix it.

Although middleware changes are not covered by semver, we will roll this for some time to make people aware that this change is coming. Then after a reasonable period of time we can remove the warning and make the code fail when using relative URLs in the previously exposed scenarios.
2022-01-19 15:10:25 +00:00
Shu Ding
4d3b2ea426
Move middleware handling to node server (#33448)
Part of #31506, this PR moves the code of middleware handling from the base server to the node server.

## 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-01-19 12:36:06 +00:00
Tim Neutkens
82f3233c0c v12.0.9-canary.2 2022-01-19 09:16:10 +01:00
Donny/강동윤
b111ba159a
fix(next-swc): Update swc (#33427)
This PR applies lots of patches, including

 - https://github.com/swc-project/swc/pull/3303
 - https://github.com/swc-project/swc/pull/3301
 - https://github.com/swc-project/swc/pull/3287
 - https://github.com/swc-project/swc/pull/3286
 - https://github.com/swc-project/swc/pull/3289

  - https://github.com/swc-project/swc/pull/3302
    - Fixes https://github.com/vercel/next.js/issues/33265

(Verified)

I'll undraft this after verifying
2022-01-19 08:15:45 +00:00
JJ Kasper
3220bbaba3
Fix pre-compiled check from copying react-refresh-utils (#33442)
This updates to not commit the copied `react-refresh-utils` files as they will change anytime a new version is published. 

Fixes: https://github.com/vercel/next.js/runs/4855748491?check_suite_focus=true
2022-01-18 18:49:26 +00:00
Jiachi Liu
c367c72d28
Disable cache for rsc pages (#33438)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-01-18 17:56:08 +01:00
Tim Neutkens
45eb137a89 v12.0.9-canary.1 2022-01-18 16:42:03 +01:00
Jiachi Liu
41614e52d7
Fix broken html on streaming render for error page (#33399)
## Bug

Fixes: #32515

Previously, we render the `suffix` after consuming 1st chunk, instead we should render it after stream finished

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-01-17 20:27:12 +00:00
Oleg Zuev
8dc46705f2
Replace regexp to plain string for optimization render HTML (#33306)
## Bug

Line `const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(*)` with RegExp almost 80 times slower than a plain string.

Before:
![telegram-cloud-photo-size-2-5409140542421448593-y](https://user-images.githubusercontent.com/22259080/149506024-84365840-5b0f-481f-b05f-1381d839c579.jpg)


After:
![telegram-cloud-photo-size-2-5409140542421448594-y](https://user-images.githubusercontent.com/22259080/149506036-0df69ae7-e265-40da-a865-73c84496aa58.jpg)
2022-01-17 16:22:44 +00:00
Jiachi Liu
f4d2938503
Remove node fetch polyfill from base server (#33395)
* keep fetch polyfill only in dev-server, next-server (polyfilled in next.ts)
* also export worker, static paths worker since they also requires it
2022-01-17 15:50:36 +00:00
JJ Kasper
25d064f812
Pre-compile more dependencies (#32742)
This ncc's some remaining dependencies bringing us under 20 install time dependencies (including nested dependencies), this also reduces install size by another `2.75 MB`. A follow-up PR will investigate a custom install script for our swc packages to allow us to remove the `optionalDependencies` which is slowing down install time as well. 

x-ref: https://github.com/vercel/next.js/pull/32679
x-ref: https://github.com/vercel/next.js/pull/32627
x-ref: https://github.com/vercel/next.js/issues/31887
x-ref: https://github.com/vercel/styled-jsx/pull/770
2022-01-17 15:17:22 +00:00
JJ Kasper
389432048c
Update check for fallback pages during export (#33323)
This fixes our check for fallback pages during `next export` as we are currently erroring even when the erroneous pages are not included in the `exportPathMap`. This also adds additional tests to certify the expected behavior for the error. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/29135
2022-01-17 14:44:45 +00:00
Donny/강동윤
aaa77dd73f
Update swc (#33342) 2022-01-17 15:09:55 +01:00
JJ Kasper
02405e2247
Fix getServerSideProps hanging in dev on early end (#33366)
This fixes the case where calling `res.end()` is `getServerSideProps` would cause the request to hang in development due to our `Proxy` around `res` causing internal `ServerResponse` fields to not be available ([related post](https://javascript.info/proxy#built-in-objects-internal-slots)). I also migrated our `getServerSideProps` test suite to an e2e suite with a test for this case. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/15118
Fixes: https://github.com/vercel/next.js/issues/32824
Closes: https://github.com/vercel/next.js/pull/33129
2022-01-16 16:14:21 +00:00
George Karagkiaouris
3e00a81ede
Base Http for BaseServer (#32999)
Adds base http classes, along with Node + Web (partial) implementations
Removes usage of IncomingMessage and ServerResponse from base server

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
2022-01-14 21:01:35 +00:00
JJ Kasper
613e4c91e3
Update yarn PnP tests and disable swc file reading for PnP (#33236)
* Update yarn PnP tests and disable swc file reading for PnP

* update job

* Update test

* add env variable

* update destory

* test one

* bump timeout

* update pnp install command

* only run pnp test

* add more logs

* handle exit signal

* dont inherit stdio for install

* update server start

* re-add test type

* add build log

* additional logging

* update build command

* remove separate timeout

* update install command

* install separate for better time info

* add cache pre-warming

* update yarn config

* enable other pnp tests

* Separate out tests

* fix-lint

* update path

* update test concurrency for isolated tests

* update retries

* Revert "update test concurrency for isolated tests"

This reverts commit 3a6e924df8ec61d55d3ee8a58d24cd50f0141195.

* re-enable production tests

* apply suggestions
2022-01-14 09:43:30 -06:00
Jiachi Liu
00a843280d
Custom app for server components (#33149)
## Feature

Resolves #30996

- [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.
- [ ] Errors have helpful link attached, see `contributing.md`
2022-01-14 13:01:00 +00:00
Tobias Koppers
30ca6b38ca
improve full refresh overlay (#33301)
include a few lines of stack trace in the full refresh overlay
error is not necessary webpack related



## 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-01-14 12:32:01 +00:00
Donny/강동윤
fd231a68bf
Update swc (#33201)
This PR is a bit big because AST definitions are modified recently because previous AST defs were too error-prone.
It will prevent plugin authors from making some common mistakes.


 - Closes #33088
 - Closes #31084
 - Closes #33283
2022-01-14 11:54:01 +00:00
JJ Kasper
7db6aa2fde
v12.0.9-canary.0 2022-01-13 15:19:42 -06:00
Gal Schlezinger
338307cd83
Fix global process testing for the process polyfill (#33220)
When there is a DOM element with id of `process`, the DOM marks it as a global, so `window.process` would exist. We should check for `process.env` to make sure it is available too.
2022-01-13 16:44:55 +00:00
Balázs Orbán
1dd053f9fa
chore(deps): upgrade postcss (#33142)
Fixes #33135

I also tried reducing the number of variants.

## 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-01-13 16:06:38 +00:00
Tim Neutkens
ca19860684 Update license year 2022-01-13 16:02:34 +01:00
Tobias Koppers
628e6aca97
use text data url instead of base64 for shorter encoding (#33218)
and text is easier to gzip

and it avoid the reference to `Buffer` from next

## 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-01-12 19:51:38 +00:00
Shu Ding
5572eb3988
Abstract out native filesystem usage from the base server (#33226)
This PR moves `require` and `fs` usage from the base server to the node server. Closes #32322.

## 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-01-12 18:12:36 +00:00
Tobias Koppers
3ee3ec30d9
update webpack (#33207)
https://github.com/webpack/webpack/releases/tag/v5.66.0
2022-01-12 16:46:59 +00:00
Gal Schlezinger
e69500462d
middlewares: limit process.env to inferred usage (#33186)
Production middlewares will only expose env vars that are statically analyzable, as mentioned here: https://nextjs.org/docs/api-reference/next/server#how-do-i-access-environment-variables

This creates some incompatibility with `next dev` and `next start`, where all `process.env` data is shared and can lead to unexpected behavior in runtime.

This PR fixes it by limiting the data in `process.env` with the inferred env vars from the code usage. I believe the test speaks for itself 🕺 

<!--
## 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-01-12 13:09:24 +00:00
Tim Neutkens
d7a96d22be v12.0.8 2022-01-12 09:14:02 +01:00
Tim Neutkens
df0e89984e v12.0.8-canary.22 2022-01-12 09:09:32 +01:00
Manny Becerra
36eba95227
Fixes #33153: Updating cross-references from master to main + canary (#33198)
* copy cleanup in env. variables docs

* copy cleanup in fast refresh docs

* Supplements #33153 - updating existing cross-references to `master` branch to renamed default branch of `main`

* Supplements #33153 - updating existing cross-references to `master` branch to renamed default branch of `main`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-01-12 02:55:35 +01:00
JJ Kasper
0de84472eb
v12.0.8-canary.21 2022-01-11 15:00:27 -06:00
JJ Kasper
57a87050e7
Add util for normalizing errors (#33159)
* JSON.stringify generic errors

* Add util for normalizing errors

* lint-fix

* Add better error for null case as well

Co-authored-by: Michael Ozeryansky <mozeryansky@users.noreply.github.com>
2022-01-11 14:40:03 -06:00
kaykdm
2d0fd341a3
Fix broken yarn pnp (#32867)
x-ref [#31552 ](https://github.com/vercel/next.js/issues/31552)
x-ref https://github.com/vercel/next.js/issues/32115
x-ref https://github.com/vercel/next.js/issues/32546
x-ref https://github.com/vercel/next.js/issues/32721

Since this PR https://github.com/vercel/next.js/pull/31455 is merged, `enhanced-resolve` dependency's resolved field is changed which caused broken yarn pnp.
I am not sure how this field has been changed or this is intentional or not 
When I install webpack locally, `enhanced-resolve`'s resolved field in lock file is always `registry.yarnpkg.com` not `codeload.github.com`

## 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

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


Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-11 19:46:18 +00:00
Tobias Koppers
9836429bee
drop dynamic import with ssr: false on server-side (#32606) 2022-01-11 14:46:28 +01:00
Fatih Kalifa
600f113358
next-swc: fix ssg code elimination when used in render (#32709)
* next-swc: fix ssg code elimination when used in render

* simplify logic and add more thorough tests

* comment

* remove fold_export_default and fix JSX member expression
2022-01-11 14:02:24 +01:00
JJ Kasper
3eabb7f4c7
v12.0.8-canary.20 2022-01-10 14:59:41 -06:00
Gal Schlezinger
4aa9879dcc
Allow dependencies to use environment variables in middlewares (#33141)
After discussing with @sokra, seems that the proposed solution is split in two:

* We need to make sure that the `process` polyfill uses `global.process` if available. This is because middlewares are bundled using `browser` target and therefore `process.env.MY_ENV` gets shimmed into `require('process').env.MY_ENV`.

* Allow `process.env` to be statically analyzed for dependencies so they will be exported to the manifest.

Related issues:

* should fix #33043.
2022-01-10 18:45:00 +00:00
Tobias Koppers
f0ad19aef6
use a separate webpack runtime for middleware (#33134)
it should not leak into the client runtime

cc @javivelasco 



## 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-01-10 17:41:53 +00:00
Donny/강동윤
87dbd03eb0
Update swc (#33063) 2022-01-10 11:37:32 +01:00
David Babel
320986a2b8
Update next.config.js (#33091)
## Feature

We are in a Typescript context, but the `next.config.js` cannot be parsed as is, since it fails on `File is a CommonJS module; it may be converted to an ES module.ts(80001)` so it does not parse the rest of the file :


![image](https://user-images.githubusercontent.com/5599375/148612812-de50b5d9-609e-4273-9892-5b3a4ad0b282.png)

Here we should have an error because the type is not the expected one.

With a little trick, it's possible to enable the check by : 
- adding `// @ts-check` at first line
- moving the export at the end of the file

And then it works like a charm :

![image](https://user-images.githubusercontent.com/5599375/148612666-ae5350d8-f16e-45e0-84e4-b31faf07fcca.png)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-08 01:47:22 +00:00
JJ Kasper
aeb67cc28d
v12.0.8-canary.19 2022-01-06 11:09:32 -06:00
Simon Kirsten
6f5bfc1b40
Fix middleware at root in standalone mode (#33053)
Fixes [a small bug](https://github.com/vercel/next.js/pull/32967#issuecomment-1006277236) that caused the build to crash if a _middleware is present at the root of the project and standalone mode is enabled.
2022-01-06 16:20:43 +00:00
JJ Kasper
efabf81e23
Add util for generating new tests/error documents (#33001)
* Add util for generating new tests/error documents

* update compiled

* lint-fix

* apply suggestions

* update wording

* update compiled
2022-01-06 09:45:04 -06:00
Steven
62227ee9aa
Bump @vercel/nft to 0.17.2 (#33048)
This bumps `@vercel/nft` to the latest version and consequently bumps `graceful-fs` to the latest version.

- Fixes #33003
- Related to https://github.com/vercel/nft/pull/258
- Related to https://github.com/browserify/resolve/issues/264

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-06 00:01:37 +00:00
JJ Kasper
5680007fa2
v12.0.8-canary.18 2022-01-05 13:49:39 -06:00
Balázs Orbán
626955d61c
fix: ensure revalidation error is logged from response-cache (#32657)
Something [between `11.0.2-canary.5` and `11.0.2-canary.6`](https://github.com/vercel/next.js/compare/v11.0.2-canary.5...v11.0.2-canary.6) changed the behavior that logged any runtime errors in `getStaticProps` to stderr. This is only observable if `getStaticProps` has a `revalidate` value, and the build did not fail. The error has to happen in a subsequent revalidation step.


This PR reverts the change and fixes #30375.

## 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`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-05 19:40:04 +00:00
JJ Kasper
1ee13baf00
Ensure NODE_ENV is not inlined for next/jest (#33032) 2022-01-05 09:22:22 -06:00
JJ Kasper
cfa8ab9cbf
v12.0.8-canary.17 2022-01-04 15:29:37 -06:00
Balázs Orbán
3ad2035ae6
feat(cli): introduce next info CLI command (#32972)
This PR adds a new command to the `next` CLI.

Running `next info` will print useful information to the terminal about how/where Next.js is run. This information can be added to the Bug report when opening an issue in the repository.

This makes reporting issues more accurate and doesn't require the user to guess certain details, the command will retrieve it on their behalf.

Example output:

```sh
$ npx --no-install next info

    Operating System:
      Platform: linux
      Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021
    Binaries:
      Node: 16.13.0
      npm: 8.1.0
      Yarn: 1.22.17
      pnpm: 6.24.2
    Relevant packages:
      next: 12.0.8-canary.14
      react: 17.0.2
      react-dom: 17.0.2


```

The idea is based on #32858

## 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.
- [ ] 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: Steven <229881+styfle@users.noreply.github.com>
2022-01-04 15:35:32 +00:00
JJ Kasper
69a56759ee
v12.0.8-canary.16 2022-01-03 18:58:27 -06:00
Steven
6f10d94d90
Revert "Reduce install size for linux glibc/musl (#32850)" (#32973)
This reverts commit a5fab84840.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-01-03 18:47:48 -06:00
JJ Kasper
e01ef297e7
Ensure middleware is output in standalone mode (#32967) 2022-01-03 18:47:18 -06:00
JJ Kasper
5378db8f80
v12.0.8-canary.15 2022-01-03 15:46:09 -06:00
Steven
a5fab84840
Reduce install size for linux glibc/musl (#32850)
In Next.js [12.0.1](
https://packagephobia.com/result?p=next@12.0.1), musl support was added which caused linux to install both glibc and musl binaries.

This PR adds the `install` script to prevent installing unused binaries, reducing the install size by 47MB.

We originally thought this could be added to Node.js core and thus npm but [it was rejected](https://github.com/nodejs/node/pull/41338).

Note getReport() works on Node.js [`>=11.8.0`](https://nodejs.org/api/process.html#processreportgetreporterr) which is safe to use since Next.js requires [`"node": ">=12.22.0"`](265f71e225/packages/next/package.json (L280)).
2022-01-03 21:17:46 +00:00
Devin Wall
d0e72fd9fa
Fixes issue with makeStylesheetInert (#32027)
Fixes https://github.com/vercel/next.js/issues/32024

Fixing makeStylesheetInert.
Fixes log import.



## 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

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


Co-authored-by: Devin Wall <87490815+DevinWallKcl@users.noreply.github.com>
2022-01-03 20:35:57 +00:00
JJ Kasper
52cf7fe51e
Ensure setImmediate and punycode are polyfilled (#32768)
* Ensure setimmediate and punycode are polyfilled

* update compiled
2022-01-03 13:31:23 -06:00
Javi Velasco
82adaee0cd
Allow to opt-out from preflight cache (#32767)
Fixes #32727

With this PR we introduce a new header that can be used to respond from Middleware `x-middleware-cache`. When the value of this header is set to `no-cache`, the client will **not** store the effects read from a preflight response to be used in an upcoming check.

Instead of using `Cache-Control` we are using a custom header to not mess with browser specific caching. Accepting a specific value to opt out (`no-cache`) opens the future opportunity of having other caching strategies.

This feature solves the issue of having a preflight request whose parameters can change from the client affecting the effects. For example, having a cookie that would make a middleware rewrite to one pathname or another and allowing to change that cookie from the client. In that case we'd always need to revalidate the effects on navigation synchronously.

Of course when using this feature it is possible that we add some latency on navigation so the preferred mechanism will be caching by default since it covers the most common use cases.
2022-01-03 18:13:28 +00:00
JJ Kasper
4d307716f7
Fix issue with escape-string-regexp in IE11 (#32708)
* Fix issue with escape-string-regexp in IE11

* remove escape-string-regexp dep

* Update compiled

* Link to original repo
2022-01-03 11:41:50 -06:00
JJ Kasper
c9c3183292
Remove un-needed test dependency (#32616)
* Remove un-needed test dependency

* update test

* update compiled
2022-01-03 10:08:30 -06:00
Balázs Orbán
be1d308417
fix(router): scroll to top when href="/" and hash already present (#32954)
When the URL already contains a hash (like `/#section`) and a `Link` with `href="/"` is clicked, the page should scroll to the top on the first click. Currently, it only happens with the second click (after `#section` has been removed from the URL).

Fixes #32931

## 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-01-03 02:57:02 +00:00
JJ Kasper
381ca374e5
v12.0.8-canary.14 2022-01-02 16:36:23 -06:00
Tim Neutkens
88a5f263f1
Move resolve-url-loader into Next.js (#32932)
* Move resolve-url-loader into Next.js

Fixes #32157

Moves resolve-url-loader into Next.js and strips out all features that are not used like `rework` support. Will reduce install size as well as allow for optimizing the approach in the near future.

* Update precompiled

* Use loader-utils 2

* Update trace test

* Revert "Update trace test"

This reverts commit 7c09a07871cc0ab72d5fcd4151a2d8efbc1aad8f.

* Add es5-ext as it's used in trace tests

* Update join-function.js

* Update bundle5.js
2022-01-02 16:16:17 -06:00
Tim Neutkens
a5bfc1eecc
Simplify trace span id generation (#32946)
Uses a simple counter for span ids, previously these required to be randomly generated but I've changed the importer script to ensure it gets prepended `0`s to make sure it gets to 16 characters which Jaeger requires.



## 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-01-02 21:22:01 +00:00
ryuurock
0bbbfa4818
Fix next/image noscript tag to only render when lazy (#32918)
Noscript is not required for Image that are loaded immediately

## 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`
- [x] 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: Steven <229881+styfle@users.noreply.github.com>
2022-01-01 22:46:49 +00:00
Thibaut SABOT
9d1fbbca7b
ignore .d.ts files inside pages folder (#30728)
Fixes https://github.com/vercel/next.js/issues/30698 and https://github.com/vercel/next.js/discussions/30618

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2022-01-01 17:16:03 +00:00
Houssein Djirdeh
d72f5bd69d
[ESLint] Adds lint rule to flag usage of <head> (#32897)
## Bug

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

Fixes #30142
2021-12-31 05:09:44 +00:00
Joost De Cock
34dcede690
fix(eslint-plugin-next): Broken links in eslint output (#32837)
This fixes broken links in the eslint output by removing the trailing full stop.
It also makes the formatting of (the output of) the various rules consistent.

## Documentation / Examples

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

> I don't think this is a bug, nor a feature, nor is it really documentation. 
> It's just a small nuisance that I bumped into and felt compelled to fix.
> I went with documentation as that seems the closest match

## What does this pull request do?

The elslint output of `eslint-plugin-next` contains useful links to the documentation about the various rules.
Unfortunately, on most (but not all) rules, those links are immediately followed by a full stop (`.`).

The terminal (or any parser) has no way of knowing that the full stop is not part of the URL. 
So it includes it and clicking the link leads to a 404 on the nextjs.org website.
 
![eslint](https://user-images.githubusercontent.com/1708494/147452577-43ad4ce7-df75-4d48-ab78-70b9b8212b7e.png)

This PR fixes that by removing the full stop. 

## But a final full stop is better grammar

I considered alternatives (such as [a zero-width space character](https://en.wikipedia.org/wiki/Zero-width_space#Prohibited_in_URLs)) in case the final full stop was part of the style guide or something.

However, as I went through the eslint rules, I notices that the messages for various rules were formatted inconsistently. 
Some with final full stop, some without.

As such, I made the all consistent with this structure:

> [message]. See: [url]

I feel this is a better solution than using the zero-width space as these sort of invisible characters 
in code can be a red flag that something fishy is going on.

I submit this pull request in the hope it will be useful, and a positive contribution to a project I have a great deal of appreciation for.
That being said, I fully understand if people would consider this a non-issue.
2021-12-28 02:18:39 +00:00
Colin Diesh
a989469228
Update readme.md of next-mdx to allow typescript file extensions for pages (#32830) 2021-12-26 17:43:47 -06:00
Balázs Orbán
4e345f6677
feat(eslint): allow a for internal url when target="blank" present (#32780)
When an `a` tag is used to link to an internal page, but the `target="_blank"` attribute is present, ESLint should not report it as an error and should not enforce using `next/link`.

Fixes #28547

## 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`
2021-12-25 00:55:43 +00:00
Tim Neutkens
e3776989bf
Remove anonymous default export rule from Babel (#32763)
We didn't port this plugin to next-swc given that the eslint setup warns for this automatically. Given that we still get issues opened for this particular warning coming from the plugin it'd be good to remove it.



## 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`
2021-12-23 17:31:38 +00:00
JJ Kasper
265f71e225
v12.0.8-canary.13 2021-12-22 13:03:32 -06:00
Steven
54f0cef9c0
Bump nft to version 0.17.1 (#32737)
https://github.com/vercel/nft/releases/tag/0.17.1

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-22 18:44:33 +00:00
Jiachi Liu
ec3ca398cb
Reduce styled-jsx size in client bundle (#32730)
We introduced the `StyleRegistry` on server side to make it concurrent safe for requests. For client we can have only 1 registry since there's only 1 instance per browser window. Keep consistence with previous usage

Closes vercel/next.js#32417
Closes vercel/next.js#30377

Revert change in #31357, it's not required anymore
2021-12-22 13:38:27 +00:00
JJ Kasper
b6fb52bbb0
Update web runtime externals (#32717)
As mentioned in https://github.com/vercel/next.js/pull/32679#discussion_r773357113 it looks like these externals need to be updated to the compiled path not that they are ncc'd. Also updated the test readme a bit to reduce confusion in https://github.com/vercel/next.js/issues/32367#issuecomment-997969759
2021-12-22 02:34:36 +00:00
Jiachi Liu
6581ba9dae
Bust cache for RSC in each render (#32710)
* flight response should not be cached since it's could be changed per fetching
* delete cache after readRoot has constructed react tree
2021-12-21 23:37:23 +00:00
JJ Kasper
d85e5ab48e
v12.0.8-canary.12 2021-12-21 14:46:52 -06:00
Dan Weaver
13bac7c739
fix popstate detection for safari when basepath is present (#32687)
* fix popstate detection for safari when basepath is present

* Add test case

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-21 14:11:10 -06:00
Jiachi Liu
c5291406aa
Escape from next head in rsc _error page (#32624)
* Don't render `next/head` in _error for RSC
* Save an error in `__next_s` for client to be aware RSC rendering is errored
* Fix `req.url` when errored
* Refactor some changes in middleware ssr loader
2021-12-21 19:24:57 +00:00
David Ramos
36a6e436b3
Don't swallow test failures caused by POSIX signals (#32688)
* Don't swallow test failures caused by POSIX signals

* Update tests to not import() inside jest

* Update tests

* apply suggestion

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-21 12:52:07 -06:00
Kiko Beats
0eba5b2558
web runtime: add AbortController & AbortSignal (#32089)
It adds AbortController and AbortSignal Web runtimes APIs to be used by the user at Edge Functions.

For doing that it delegates into `abort-controller` dependency that has been frozen to prevent any modification.

Co-authored-by: Zhang Zhi <20026577+fytriht@users.noreply.github.com>
2021-12-21 17:12:53 +00:00
JJ Kasper
3667eba385
Pre-compile more dependencies continued (#32679) 2021-12-21 16:13:45 +01:00
Steven
738a964ead
Fix style reset on image with placeholder=blur (#32680)
This PR is a follow up to PR #32623 to fix the remaining blur styles.

These are unlikely to be overridden by the user but this PR is necessary to make `placeholder=empty` (default behavior) and `placeholder=blur` end up with the same inline styles on the loaded image.

Related to https://github.com/vercel/next.js/issues/18398#issuecomment-997114428
2021-12-20 17:49:35 +00:00
JJ Kasper
725f6b44d6
v12.0.8-canary.11 2021-12-20 09:28:17 -06:00
Hannes Bornö
802f4dcf5d
next-swc: styled-jsx error checking and reporting updated (invalid-styled-jsx-children.md) (#31940)
Co-authored-by: Hannes Lund <hannes.lund.2@consultant.volvo.com>
2021-12-20 16:17:37 +01:00
Jiachi Liu
b3b92b610f
Upgrade react 18 to rc, drop prerelease warning (#32619)
### Enhancement

* Auto enable reactRoot API for react 18 since the legacy render in `react-dom` is dropped
* Remove prelrease warning
2021-12-20 13:43:42 +00:00
JJ Kasper
e8408c7086
Pre-compile more dependencies (#32627)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-20 14:01:35 +01:00
Donny/강동윤
026dd4cea0
chore: Update swc (#32664)
## 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`


Fixes https://github.com/vercel/next.js/issues/30800
2021-12-20 10:55:26 +00:00
Balázs Orbán
6ffa2baa4d
fix(next/jest): do not watch .next folder (#32659)
`jest --watch` looks for [changes in dotfiles and folders by default](https://github.com/facebook/jest/pull/10075), which resulted in the tests being re-run when navigating between pages with `next dev`.

Fixes #32650

## 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`
2021-12-19 19:03:54 +00:00
Shu Ding
8b12b174e5
Fix writing strings to the writable stream writer (#32637)
Only chunks are allowed to write to writable. This fixes the following error in the web runtime:

```
Uncaught (in promise) TypeError: This TransformStream is being used as a byte stream, but received a string on its
writable side. If you wish to write a string, you'll probably want to explicitly UTF-8-encode it with TextEncoder.
```

It doesn't fail in the Node.js sandbox since we polyfilled this case (which should be reverted back later).

## 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`
2021-12-18 18:39:36 +00:00
JJ Kasper
3e83205eab
v12.0.8-canary.10 2021-12-17 20:24:59 -06:00
Steven
079c4be439
Fix style.filter on image with placeholder=blur (#32623)
Fixes https://github.com/vercel/next.js/issues/18398#issuecomment-995871025
2021-12-18 02:08:48 +00:00
Jiachi Liu
b58a3f0b9d
Add options to defaultGetInitialProps and upgrade styled-jsx-with-csp example (#32594)
x-ref: https://github.com/vercel/styled-jsx/issues/763

* Add 2nd arg `options` to `docCtx.defaultGetInitialProps` to make customization easier
* Upgrade styled-jsx to fit typing
* Update styled-jsx csp example
2021-12-17 23:27:56 +00:00
Jiachi Liu
bb6d4d71fd
Move fs API for inc cache to node server (#32604)
Move fs API for incremental cache to node-server, leave a small group of mock file system for base server
2021-12-17 22:56:26 +00:00
JJ Kasper
d7811d3207
v12.0.8-canary.9 2021-12-17 15:47:01 -06:00
Antoine Apollis
83b04c8983
Feat/14701 full reload notification (#28866)
## 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 issue: #14701
- [ ] 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`

<details>

<summary>Screenshot</summary>

<img width="1388" alt="Screen Shot 2021-12-17 at 2 07 04 PM" src="https://user-images.githubusercontent.com/22380829/146602057-9675455d-cf10-435a-b121-bc462a87fbf3.png">


</details>

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-17 21:24:13 +00:00
JuanM04
59c1f0393c
Upgraded next-env dependencies (#32613)
Old PR: #32197

I forgot I had that PR open and I removed my fork. So, I've reopened this PR to solve the merging conflicts

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-12-17 20:52:28 +00:00
JJ Kasper
f61e3566bf
Ensure AMP optimizer is only excluded from trace when not used (#32577) 2021-12-17 13:57:03 -06:00
Shu Ding
346670ca6c
Fix ReadableStream.pipeTo() being unimplemented in the web runtime (#32602)
Currently we are using a TransformStream to process the forwarded stream for the inlined data, but unfortunately the `pipeTo` method is not implemented in the web runtime. This PR changes it to a naive way of doing so.

## 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`
2021-12-17 12:27:53 +00:00
Jared Palmer
ed022eda0f
Add turbo / improve Rust build caching in GitHub Actions (#31464)
Implements Turborepo for the Next.js repository and leverage it for native build caching.

Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
2021-12-16 20:10:45 +00:00
Tim Neutkens
e90f0aec7a v12.0.8-canary.8 2021-12-16 14:50:34 +01:00
Donny/강동윤
99f9be585b
Update swc (#32566)
## 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`


This applies

 - https://github.com/swc-project/swc/pull/3051

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

 - https://github.com/swc-project/swc/pull/3023

Fixes https://github.com/vercel/next.js/issues/32470
2021-12-16 13:48:03 +00:00
Donny/강동윤
47cd07bb75
fix(next-swc/styled-jsx): Fix interpolation in media query (#32490)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-16 12:23:31 +01:00
Ben
04fbc663f9
Check stack property for page export exceptions (#32289)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-16 09:41:45 +01:00
Justin Braithwaite
db91fbf407
Prevent NEXT_PHASE env change in workers (#28941)
`process.env.NEXT_PHASE` was moved in https://github.com/vercel/next.js/pull/20900 to be set during `staticCheckSpan.traceAsyncFn`. I believe this to be a mistake, the NEXT_PHASE should be set earlier in the code execution.

On a personal note, this impacts an application I am developing where we rely on the environment variable `NEXT_PHASE` to be set but is `undefined` when we check it.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-16 00:17:42 -06:00
Michiel Van Gendt
d7062dddcc
Include message body in redirect responses (#31886)
# Description

The redirect responses do not contain a message body. This is in conflict with the RFCs (below) and causes Traefik (a reverse proxy) to invalidate the responses. In this pull request, I add a response body to the redirect responses. 

This PR is similar to https://github.com/vercel/next.js/pull/25257, it appears that there are some other locations where redirection is handled incorrectly in next.js.

# References
- https://datatracker.ietf.org/doc/html/rfc7230#section-3.3

> All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses must not include a message-body. All other responses do include a message-body, although the body may be of zero length.

- https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3

> The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-16 05:41:43 +00:00
Hannes Bornö
b0bd0eefc6
next-swc: Emit errors and add tests to next-ssg (#32254)
## 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`
2021-12-16 04:26:41 +00:00
JJ Kasper
f221f8857d
v12.0.8-canary.7 2021-12-15 13:31:38 -06:00
Tim Neutkens
048d89c63a
Ensure experimental SWC options invalidate the cache (#32540) 2021-12-15 12:54:25 -06:00
Jorrit Schippers
f441a58da7
Remove unused classnames dependency from react-dev-overlay (#32487)
It seems that the classnames dependency is not referenced in the react-dev-overlay code.
2021-12-15 14:54:26 +00:00
JJ Kasper
5d606ebae4
Ensure image-optimizer is traced for standalone mode (#32522)
This ensures we trace the `image-optimizer` for the standalone output mode as previously this was always ignored under the assumption image optimizing would be handled at the CDN level in standalone mode. 

## 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

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

Fixes: https://github.com/vercel/next.js/issues/32513
2021-12-15 14:19:16 +00:00
Javi Velasco
3da1f17d5a
[middleware] Fix hydration for rewrites to dynamic pages (#32534)
Fixes #32302 

This PR fixes an issue on hydration where we rewrote using a middleware to a dynamic path. In such cases we need to run preflight to find out the middleware operation metadata.

## Bug

- [X] Related issues linked using `fixes #number`
- [X] Integration tests added
- [X] Errors have helpful link attached, see `contributing.md`
2021-12-15 13:33:13 +00:00
Shu Ding
e75361fd03
Fix server data cache key (#32506)
Currently we are using `location.href` which doesn't align with the other flight request's cache key (`pathname + search`). This fix unifies it.

## 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`
2021-12-14 19:52:37 +00:00
Tim Neutkens
12bb1b1da2 v12.0.8-canary.6 2021-12-14 18:05:17 +01:00
JJ Kasper
2a5c21b65c
Update to filter loader specific files from traces (#32267)
* Update to filter loader specific files from traces

* remove debug log
2021-12-14 10:41:10 -06:00
Tobias Koppers
f7153b13e9
upgrade webpack and watchpack (#32173)
Co-authored-by: sokra <sokra@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-14 11:48:49 +01:00
Tobias Koppers
ee220730db
fixes to allow lazy compilation for import() (#32441) 2021-12-14 11:33:04 +01:00
Jiachi Liu
67545bd654
Add vitals and rsc to npm files (#32472) 2021-12-14 11:30:14 +01:00
Shu Ding
8f9aed687a
Fixes for inline embedding data in the web runtime (#32471)
* fix missing renderToString

* workaround tee

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-14 00:48:36 +01:00
Oriol Collell
eba9da09eb
Fixes #32338 missing Document components trigger an error for production builds (#32345)
* Only validate _document subcomponents in dev environment

* Replace error by a warning

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-13 16:47:34 -06:00
Jiachi Liu
10d814d31a
Fix dynamic routes with pages under index folder (#32440)
Fixes incorrect generated manifest and generated directory for `index/[...dynamic]` pages

Too much normalizing adding extra `index/` prefix to `index/[...dynamic]` routes which lead to the incorrected generated routes like `.next/server/pages/index/index/index/[...dynamic]`

## Bug

Fixes https://github.com/vercel/customer-issues/issues/146

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-12-13 20:36:31 +00:00
JJ Kasper
48cee5485a
v12.0.8-canary.5 2021-12-13 13:07:44 -06:00
Javi Velasco
59f7676966
Fix running server with Polyfilled fetch (#32368)
**Note**: This PR is applying again changes landed #31935 that were reverted from an investigation.

This PR fixes #30398

By default Next will polyfill some fetch APIs (Request, Response, Header and fetch) only if fetch is not found in the global scope in certain entry points. If we have a custom server which is adding a global fetch (and only fetch) at the very top then the rest of APIs will not be polyfilled.

This PR adds a test on the custom server where we can add a custom polyfill for fetch with an env variable. This reproduces the issue since next-server.js will be required without having a polyfill for Response which makes it fail on requiring NextResponse. Then we remove the code that checks for subrequests to happen within the **sandbox** so that we don't need to polyfill `next-server` anymore.

The we also introduce an improvement on how we handle relative requests. Since #31858 introduced a `port` and `hostname` options for the server, we can always pass absolute URLs to the Middleware so we can always use the original `nextUrl` to pass it to fetch. This brings a lot of simplification for `NextURL` since we don't have to consider relative URLs no more.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-12-13 18:30:24 +00:00
Donny/강동윤
4c8415091c
Update jsx transform of swc (#32383)
## 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`


This PR applies

 - https://github.com/swc-project/swc/pull/2741

This fixes `development` mode of jsx.
2021-12-13 14:24:32 +00:00
Shu Ding
438ee9618f
Inline server data response with partial hydration (#32330)
This PR implements the basic inline embedded server response data (#30994) for RSC, as well as partial hydration (#31338) for RSC and React 18 SSR streaming.

For #30994, `renderTargetSuffix` is passed to the `bodyResult` resolver so the stream can inject corresponding hydration scripts and the closing body tag at the correct time. The expected behavior should be _prefix_, _body shell_, _suffix scripts_, _stream and inlined data_, _close body_.

For #31338, we have to force turn on `disableOptimizedLoading` when `concurrentFeatures` is enabled to opt-out of deferred script tags.

## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-13 10:48:18 +00:00
Jiachi Liu
59a4432318
Rename experimental vital hook (#32343)
* Rename vital hook

* update taskfile

* disable hook rule for unstable prefix

* rename at exports

* fix typing

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-12 21:14:12 +01:00
JJ Kasper
83e661031c
v12.0.8-canary.4 2021-12-10 10:08:40 -06:00
Donny/강동윤
6015f3c332
fix(next-swc/styled-jsx): Fix nth (#32358)
## 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`
2021-12-10 13:22:09 +00:00
Jiachi Liu
c21806e54f
fix unstable_useRefreshRoot typing (#32364)
align with re-exports in entry file
2021-12-10 12:45:55 +00:00
Donny/강동윤
7df7c5e805
Upate swc (#32365)
## 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`


This PR applies

 - https://github.com/swc-project/swc/pull/3000

This is a patch for self-referencing typescript enums.

 - https://github.com/swc-project/swc/pull/3003

This is a fix for source map shifting.
2021-12-10 11:42:10 +00:00
Jiachi Liu
6f8cf675d3
Add unstable_useRefreshRoot (#32342)
## Feature

Resolves #32332

- [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`
- [ ] 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`
2021-12-10 10:22:31 +00:00
Pieter Bogaerts
0b1c9ec47d
Compile escape-string-regexp (#32310)
* Update index.js

* Update taskfile.js

* Revert "Update index.js"

This reverts commit 8106c076f92e961cdaeb0431812f676ea219b1ee.

* update compiled

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-09 13:31:53 -06:00
Jiachi Liu
b044f42334
Fix RSC link navigation (#32303)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-09 14:45:22 +01:00
JJ Kasper
7e055dddbb
v12.0.8-canary.3 2021-12-08 18:01:57 -06:00
JJ Kasper
5011937aff
chore(deps): upgrade browserslist (#32300)
* chore(deps): upgrade `browserlist`

* update compiled

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2021-12-08 17:51:35 -06:00
Steven
0b86bfa590
Revert "Replace raw-body with get-stream and bytes" (#32305)
Reverts vercel/next.js#21915 since it cannot handle max buffer size.

See https://github.com/sindresorhus/get-stream/issues/42
2021-12-08 22:28:17 +00:00
Maia Teegarden
0f7f3323c1
Add shake exports transform to next-swc (#32253)
* Add shake exports transform to next-swc

* Less cloning

* Use JsWord instead of String
2021-12-08 11:04:13 -08:00
Gerald Monaco
aa32deb467
Simplify custom Writable (#32247)
* Simplify custom writable

* Fix draining
2021-12-08 12:03:07 -06:00
Donny/강동윤
4ce49b79a2
Update swc (#32210)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-12-08 18:54:21 +01:00
JJ Kasper
345956f1d2
v12.0.8-canary.2 2021-12-08 10:58:41 -06:00
JJ Kasper
8fb5ef18e7
Update to latest ncc and ensure caniuse-lite data is external (#32064)
* Ensure caniuse-lite data is external for nccing

* lint

* ensure assetBuilds config is set

* update compiled
2021-12-08 10:41:35 -06:00
Bogdan Chadkin
6687b09011
Replace raw-body with get-stream and bytes (#21915)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-08 11:34:31 +01:00
JJ Kasper
1a6a1e5fdf
Add docs for leveraging outputStandalone config (#32255)
This adds documentation to explain how the `outputStandalone` config can be leveraged to reduce production deployment size and leverage the output file traces.  This also adds a note for the `outputFileTracingRoot` config as it may be needed in some monorepo setups. 

A follow-up PR will update our Docker example to leverage this config as well. 

## Documentation / Examples

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

x-ref: https://github.com/vercel/next.js/pull/31003
x-ref: https://github.com/vercel/next.js/issues/32252
Closes: https://github.com/vercel/next.js/issues/30822
2021-12-07 23:22:21 +00:00
Bryan Smith
b7eeb6c582
Fix crash in no-page-custom-font eslint rule when default export is unnamed. (#32251)
fixes #32250
2021-12-07 19:04:24 +00:00
Axel Mohamed SADAT
d459b5f99a
fix(NODE_ENV): Warn when launching start or build on development (#14033)
The PR aims to fix [#14022](https://github.com/vercel/next.js/issues/14022)

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2021-12-07 14:25:39 +00:00
Maia Teegarden
21f8c6a7c3
Chore/load bindings improvements (#32191)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-07 11:14:38 +01:00
JJ Kasper
2e530ee299
v12.0.8-canary.1 2021-12-06 20:49:13 -06:00
Keen Yee Liau
53e52fefc3
telemetry: collect feature usage for linting during build (#32022)
Currently, we have telemetry to measure how ESLint is invoked,
but we do not have telemetry that tells us how many users have
disabled ESLint during build.

This commit adds a new feature, `build lint` to track this metric.



## 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`
2021-12-07 02:41:31 +00:00
Shu Ding
db773c4aca
Refactor FS references in the Base Server (#32179)
* move fs

* fix failing tests; remove unused imports
2021-12-07 02:14:55 +01:00
Gerald Monaco
9bcf678e64
Revert support for render prop in <Main /> (#32184)
Reverts support for render prop in `<Main />` in `Document`. This was added just to support the `useFlushEffect` hook, but we've tweaked the design a bit, moving it to `App`.
2021-12-06 21:22:05 +00:00
Shu Ding
c004322d13
Create Base Server (#32154)
Same as #32105 (closed due to conflicts):

> Explained in #32066, rename next-server as base-server and extend NextNodeServer on top of it.
>
> Note that this is just an initial PR so no method is ported.

## 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`
2021-12-05 21:53:11 +00:00
Tim Neutkens
0f0c28a45f v12.0.8-canary.0 2021-12-05 15:44:48 +01:00