Commit graph

4550 commits

Author SHA1 Message Date
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
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
Jiachi Liu
c21806e54f
fix unstable_useRefreshRoot typing (#32364)
align with re-exports in entry file
2021-12-10 12:45:55 +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
Gerald Monaco
aa32deb467
Simplify custom Writable (#32247)
* Simplify custom writable

* Fix draining
2021-12-08 12:03:07 -06: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
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
JJ Kasper
ebf509539c
v12.0.7 2021-12-04 18:21:43 -06:00
JJ Kasper
1e21c7df13
v12.0.7-canary.0 2021-12-04 17:03:15 -06:00
JJ Kasper
769d68047b
Ensure conf type for createServer is not changed (#32134)
This reverts the type for the `conf` field in `ServerOptions` isn't changed to require all `NextConfig` values as this is a breaking change from what was previously required. We should investigate making sure this field is normalized when it is provided via a user. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/32123
x-ref: https://github.com/vercel/next.js/pull/31858
2021-12-04 22:57:54 +00:00
Tim Neutkens
c1a1aa4ae2
Add test for TailwindCSS JIT mode reloading (#32130)
Test for https://github.com/tailwindlabs/tailwindcss/discussions/6265 

Issue started with https://github.com/vercel/next.js/pull/31798



## 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-04 21:59:32 +00:00
Tim Neutkens
56c68dba51 v12.0.6 2021-12-04 13:12:21 +01:00
Tim Neutkens
e257dbfad5 v12.0.6-canary.0 2021-12-04 11:26:57 +01:00
Tim Neutkens
980e16998c
Fix document type import path (#32117)
There was a mistake in #32077 which imported a different module than _document in the _document .d.ts file. I found that we didn't have a test for a custom _document.tsx and _app.tsx with TypeScript, so I've added one that fails on canary and passes with this fix to ensure this does not happen in the future.

Fixes #32110




## 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-04 10:23:15 +00:00
JJ Kasper
b6162bb6b6
v12.0.5 2021-12-03 16:45:00 -06:00
JJ Kasper
1705020808
v12.0.5-canary.19 2021-12-03 15:32:42 -06:00
JJ Kasper
f0fd4962e9
Revert "Fix running server with Polyfilled fetch (#31935)" (#32100)
This reverts commit 1c199a5e4a.
2021-12-03 15:31:52 -06:00
JJ Kasper
b194664d8d
v12.0.5-canary.18 2021-12-03 13:25:35 -06:00
Tim Neutkens
bc429f50c2
Remove future.strictPostcssConfiguration config (#32098) 2021-12-03 13:25:05 -06:00
Tim Neutkens
e58e7b17aa v12.0.5-canary.17 2021-12-03 19:22:03 +01:00
JJ Kasper
6d98b4fb43
Ensure invalid URLs respond with 400 correctly (#32092)
This ensures we catch any errors in `handleRequest` so that we can respond with a 400 for invalid requests. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/32075
Closes: https://github.com/vercel/next.js/pull/32080
2021-12-03 17:31:09 +00:00
Javi Velasco
1c199a5e4a
Fix running server with Polyfilled fetch (#31935)
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-03 16:35:28 +00:00
Tim Neutkens
41f87abdf7 v12.0.5-canary.16 2021-12-03 12:30:59 +01:00
Tim Neutkens
c1f6abbe54 v12.0.5-canary.15 2021-12-03 12:30:14 +01:00
Luis Alvarez D
647c06b339
Improve exported root definitions (#32077)
Fixes https://github.com/vercel/next.js/issues/32045

doing `export { default } from 'module'` has some unexpected results for autocompletion in TypeScript, this PR changes root definitions to have a named default export where needed.

## Bug

- [x] Related issues linked using `fixes #number`
2021-12-03 07:16:29 +00:00
Lucas Wiener
80ec93d1bb
Skip warnings for Image not rendered to the dom (#32049)
Some libraries, like react-slick, render their content to a detached element before attaching it to the dom. If the content of such libraries is Image components, they will report warnings because the display/position properties are undefined. This PR squelch the warnings for such cases.
2021-12-03 06:40:45 +00:00
Tobias Koppers
eb65ed37b0
avoid retaining webpack config too long (#32053)
avoids keeping the webpack compiler during after webpack build build steps like SSG etc.

(review with ignore whitespace)

## 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-03 00:47:16 +00:00
JJ Kasper
5763a33a03
v12.0.5-canary.14 2021-12-02 14:55:53 -06:00
JJ Kasper
abe53727b0
Include page for export errors for easier debugging (#32013)
This makes sure to include the `page` for dynamic routes when they encounter an error during prerendering as we currently only include the `path`, e.g. before we would only show `/blog/first` and now we show `/blog/[slug]: /blog/first` 

## 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-02 19:31:36 +00:00
JJ Kasper
cc9e1ea3a1
Fix middleware types with skipLibCheck: false (#32025)
This ensures type checking passes correctly for middleware types when `skipLibCheck: false` is set in `tsconfig.json`. This also moves the `middleware-types` to be an isolated test to ensure it isn't relying on any monorepo dependencies. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/31992#issuecomment-984174872
2021-12-02 18:49:49 +00:00
Tobias Koppers
494e37c026
add experimental.swcFileReading flag to disable file reading in swc (#31995)
automatically disable swc file reading when wasm builds are used and for virtual or yarn cache paths



## 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: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
2021-12-02 04:16:15 +00:00
Eric Matthys
f225179378
fix(Link): Do not ignore onMouseEnter prop with absolute href (#32012)
Fixes #22733

Regardless of whether it's recommended that Link be used with external href values or not, they can be used and `onMouseEnter` being swallowed with an external href value is unexpected behavior.

## Bug

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-01 18:32:27 +00:00
C. T. Lin
332cd06c7d
Allow pre-release React 18 as peer (#31991) 2021-12-01 17:30:22 +01:00
JJ Kasper
32ac918672
v12.0.5-canary.13 2021-12-01 10:07:32 -06:00
Jiachi Liu
928c77958e
Resolve streaming data for flight requests (#32010)
## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-12-01 15:48:31 +00:00
Shu Ding
b7fb315cd7
Ensure that external modules are not bundled into the client for RSC (#31968)
If importing an external module inside a Server Component (`.server.js`), it shouldn't be bundled into the client. Only client components should be kept.

## 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-11-30 22:54:47 +00:00
Jeff
a2fa637ab3
fix(types): add missing ua types for NextRequest (#31901)
* fix(types): add missing ua type for NextRequest

add missing ua string type on NextRequest["ua"], returns full agent as string

* Update UserAgent type

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-30 15:59:02 -06:00
Steven
b01a6ba665
Add TS types for NextMiddleware (#30578)
This allows TypeScript users to have type safety for middleware functions.

- Closes #30490 

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-30 20:43:40 +00:00
JJ Kasper
4410de9ff3
v12.0.5-canary.12 2021-11-30 13:33:32 -06:00
Tim Koopman
8784682a74
Escape string when converting to regexp (#31791)
fixes #31411

## Bug

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-30 19:15:13 +00:00
Jiachi Liu
d2cef24d5d
Fix image related link prop warning with react 18 beta (#31895)
## Bug

Fixes #31892 

react 18: requires camelcase for those props 
```
Warning: Invalid DOM property `imagesrcset`. Did you mean `imageSrcSet`
```
react 17: requires lowercase for those props

```
Warning: React does not recognize the `imageSrcSet` prop on a DOM element.
```

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


### Utils

* Add command `yarn next-react-18 test/integration/any-react-18-app/`
* Add util `withReact18`

```js
const withReact18 = require('../../react-18/test/with-react-18')

module.exports = withReact18({
  experimental: {
    concurrentFeatures: true,
  },
})
```
2021-11-30 18:37:22 +00:00
Gerald Monaco
2b5d62dcad
Stop using environment variables in pages/_document (#31946)
Since #31939 is going to move the `Document` components, we can't rely on `DefinePlugin` to provide environment variables. This PR passes them as render opts instead. We can't just force this to be bundled like e.g. `next/dynamic`, because we use it internally.
2021-11-30 17:14:28 +00:00
Jiachi Liu
85e578a906
Enable default functional document when concurrentFeatures is enabled (#31954)
## Bug

Fixes: #31675 

Functional document without gIP should be enabled when streaming is enabled, even without rsc

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-30 12:52:14 +00:00
Jiachi Liu
c78930111d
Removng prop writable checking in prod (#31929)
x-ref: #28498, #31784

I can repro the issue #24783 with `next-boost` 0.10.1 and it was fixed in 0.10.2 (ref: eba6d10aab). The actual case is missing setting node env to `"production"`.

React freeze element props and element itself in dev mode (ref: a724a3b578/packages/react/src/ReactElement.js (L194-L196))

Then next.js will reassign props with react development bundle while next-boost is enabled. Those operations are only happened in non-dev mode so it's good to remove now.

This PR + #31898 == revert #31784

cc @styfle @awareness481
2021-11-30 00:56:02 +00:00
Maia Teegarden
0ef87397da
Account for platform/arch not supported by napi (#31938) 2021-11-29 18:05:35 -06:00
JJ Kasper
3b089ae18f
v12.0.5-canary.11 2021-11-29 16:18:39 -06:00
Michel Krämer
c8457e3abf
Fix disabling of built-in CSS support if there is a custom loader (#31078)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-11-29 15:19:39 +01:00
Steven
b1be180d7d
Fix: Cannot assign to read only property 'children' (#31784)
- Closes #28498 

Co-authored-by: Jesse Jafa <12380586+awareness481@users.noreply.github.com>
2021-11-28 21:19:57 +00:00
Javi Velasco
85cc454023
Add port and hostname options to Next Server (#31858)
A middleware can work as a proxy intercepting requests and then performing a `fetch` to the destination adding headers to the request / response as a "man in the middle". When using `fetch` from a middleware we are not in the context of a browser so we can't really use relative URLs, they must be always absolute.

Now consider the previous case when middleware is running in *server mode*. Typically in order to know the host where we are fetching we can use the `request.nextUrl` which is given to the middleware but in this case the invoker (which is next-server) has no context of the hostname, nor the port. To solve this use case we must make the invoker of the middleware aware of the origin hostname and port.

This PR: 

- Introduces `hostname` and `port` as options for `NextServer`.
- Refactors types in `NextServer` and `NextDevServer` moving type only imports to the top of the file.
- Refactors `startServer` to do a best guess on the `hostname` and `port`, passing them down.
- Exposes `.port` and `.hostname` to be retrieved from the `app`.

In an upcoming PR we will pass the host guess to the middleware to solve the relative URL issue.
2021-11-28 16:48:43 +00:00
Jiachi Liu
cf64e9130e
fix: rsc headers (#31854)
`headers` type should align with `NodeHeaders`
2021-11-26 18:04:36 +00:00
Maia Teegarden
112ca407c0
Do not load external binding if local was found (#31853) 2021-11-26 17:39:05 +01:00
Shu Ding
d577edd206
Fix auto export condition in edge SSR (#31845)
`isAutoExport` should be `false` when `concurrentFeatures` is enabled.

## 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-11-26 15:53:38 +00:00
Juny
4c05de3c7e
fix amp validator message format (#31018)
## Bug

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

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

I referred to the previous code.

```
    if (errors == null) {
      if (Object.keys(amp).length > 0) {
        warnings = (warnings || []).concat(formatAmpMessages(amp) || [])
        if (!warnings.length) warnings = null
      }
    }
```

https://github.com/vercel/next.js/pull/29753/files
2021-11-26 15:13:09 +00:00
Tim Neutkens
e9e8e8b423
Move require.resolve into the module scope (#31799)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-26 15:30:32 +01:00
Luis Alvarez D
77150dac79
Include submodules in exported type definition (#28316) 2021-11-26 14:46:56 +01:00
Heyang Zhou
809d0155ff
Add support for removing React properties. (#31606) 2021-11-26 14:45:03 +01:00
Javi Velasco
2e5218c778
Fix hydration middleware effects (#31800)
Whenever we trigger a route change in the client we check if there route we are navigating to is affected by a middleware. When this is the case we run a preflight and in case there is an effect that tells us that the middleware is responding with content we force a _refresh_. This is fine for navigation in general but it is not ok when the change is triggered for hydration. For example, in cases where the rendered page is a dynamic page this triggers an infinite reload.

In this PR we add a test where we add a `_middleware` that proxies to a dynamic path. When making a request to `/interface/root-subrequest` there will be a middleware that simply performs a fetch against localhost for the same `/interface/root-subrequest`. The new request will skip the middleware to avoid loops and then render the dynamic page. Then client will force a change for hydration resulting in a preflight request that tells that the client must refresh because for that path there is a middleware writing content.

Then we add a fix which simply consist of checking the internal option that tells when a change is triggered for hydration and skip the preflight in such scenario.

## 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-11-26 12:46:57 +00:00
Javi Velasco
e52bee37af
Refactor sandbox module cache (#31822)
To run middleware we are using a **sandbox** that emulates the web runtime and keeps a module cache. This cache is shared for all of the modules that we run using the sandbox while there are some module-level APIs that must be scoped depending on the module we are running.

One example of this is `fetch` where we want to always inject a special header that indicate the module that is performing the fetch and use it to avoid getting into infinite loops for middleware. For those cases the cached implementation will be the first one that instantiates the module and therefore we can actually get into infinite loops. This is the reason why #31800 is failing.

With this PR we refactor the sandbox so that the module cache is scoped per module name. This means that one execution of a middleware will preserve its cache only for that module so that each execution will still have its own `fetch` implementation, fixing this issue. Also, with this refactor the code is more clear and we also provide an option to avoid using the cache.

## 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-11-26 12:06:41 +00:00
Tim Neutkens
b2acdbb788 v12.0.5-canary.10 2021-11-25 20:45:30 +01:00
Javi Velasco
f536376f03
Ensure middleware order is preserved (#31801)
The order in which middleware must be invoked conditions its behaviour. Currently, this is not being taken into consideration for server since we are generating the array of middleware based on an arbitrary order of the middleware existing in the filesystem. This PR ships a change to generate the array of middleware preserving the order defined in the manifest.

## 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-11-25 19:13:27 +00:00
Tobias Koppers
db099c5668
update webpack (#31798)
https://github.com/webpack/webpack/releases/tag/v5.64.4
2021-11-25 18:31:25 +00:00
Tim Neutkens
92b397f2b7
Lazy-load postcss (#31762)
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-11-25 18:41:20 +01:00
Tobias Koppers
a4159321b2
read file in swc when no loaders follow the next-swc-loader (#31682)
Fixes #31685


## 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: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2021-11-25 14:00:14 +00:00
Javi Velasco
d1a1a4c0f7
Improve and refactor some types (#31704) 2021-11-25 10:46:00 +01:00
Tobias Koppers
03ecbcf182
Remove some watcher hacks and update version (#31768)
## 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-11-25 08:31:20 +00:00
Maia Teegarden
1bc9b1ac02
Fix wasm loading (#31772)
* Fix wasm loading

* Remove consoles
2021-11-24 15:33:34 -08:00
Tobias Koppers
719fe5291c
update webpack (#31759)
https://github.com/webpack/webpack/releases/tag/v5.64.2
https://github.com/webpack/webpack/releases/tag/v5.64.3
2021-11-24 15:22:24 +00:00
Tim Neutkens
ff816d4bb0
Remove noop import (#31722) 2021-11-24 15:40:58 +01:00
Tim Neutkens
a4cd48e51a
Lazily init getStaticPathsWorker (#31760) 2021-11-24 13:40:08 +01:00
Tim Neutkens
e95c9caca3 v12.0.5-canary.9 2021-11-23 18:51:52 +01:00
Tim Neutkens
fccaa8e27f
Fix initial compile timing incorrect measurment (#31733)
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-23 18:47:36 +01:00
JJ Kasper
4b538e9879
Add error link when hydration error occurs (#31519)
This adds an error document/link for hydration errors to help users debug these easier. While looking at adding this also noticed a typo in the dev-overlay which is fixed. 

<details>

<summary>screenshot</summary>

<img width="1109" alt="Screen Shot 2021-11-16 at 15 56 29" src="https://user-images.githubusercontent.com/22380829/142078200-6c036ed9-ca7f-4d26-ae07-eb9bd89e991a.png">

</details>

## Documentation / Examples

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


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2021-11-23 13:10:56 +00:00
Tim Neutkens
f584722fcb
Remove trace_target env var in favor of .next/trace (#31697) 2021-11-22 20:58:49 +01:00
Jiachi Liu
7f58a2e49f
Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP
2021-11-22 18:53:22 +00:00
Dominik Ferber
feabd54f6b
avoid mutating response.cookie options (#31679)
Previously `response.cookie(name, value, options)` would mutate the passed in `options` which lead to unexpected behaviour as described in #31666.

This PR clones the `options` argument before mutating it.

## 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.
- [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 / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-22 11:20:01 +00:00
Tim Neutkens
21cb8a1fe8 v12.0.5-canary.8 2021-11-21 15:51:15 +01:00
JJ Kasper
9d699cb11a
Fix dev router usage before router initializing (#31632) 2021-11-21 15:42:19 +01:00
Tim Neutkens
ba89d204e8 v12.0.5-canary.7 2021-11-21 13:07:17 +01:00
Maia Teegarden
a79d4fc366
Extract next-swc Rust code into its own package (#31635)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-21 12:59:56 +01:00
Tim Neutkens
ad6ef01edc v12.0.5-canary.6 2021-11-20 20:27:02 +01:00
Donny/강동윤
3146ed37f8
Update swc (#31639)
The purpose of this PR is to apply

 - https://github.com/swc-project/swc/pull/2779
   - Fixes #31291.
   - Not sure if it's fully fixed, but fixes some bugs related to #31391 

 - https://github.com/swc-project/swc/pull/2818
   - Fixes #31627


I'll undraft this PR once https://github.com/swc-project/swc/pull/2818 is fixed.
2021-11-20 19:25:52 +00:00
Kiko Beats
f52211bad3
fix(middleware): consider localhost variations (#31603)
Since `localhost` is actually an alias for `127.0.0.1` that points to loopback, we should take that into consideration at `NextURL` when we handle local URLs.

The implementation is based on [is-localhost-url](https://github.com/Kikobeats/is-localhost-url); I added some tests over local URLs variations present at the library to ensure other variations are working fine.

Additionally, I refactor some things over the code to avoid doing the same twice and added some legibility that is always welcome when you are working with URLs stuff.

 closes https://github.com/vercel/next.js/issues/31533
2021-11-19 21:24:22 +00:00
JJ Kasper
9652bdd653
v12.0.5-canary.5 2021-11-19 14:44:42 -06:00
Mateusz Burzyński
9ba31bbd77
Remove outdated comment about string children being deprecated in next/link (#30606)
* Bring back accidentally lost deprecation warning for using string as a children for `next/link`

* Wrap warning with the env check

* Remove warning, just go with removed comment about deprecation
2021-11-19 13:58:33 -06:00
JJ Kasper
e8ca334d42
Fix non-concurrent function _document (#31628)
This ensures functional `_document` is rendered correctly when not using concurrent mode. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/31593
x-ref: https://github.com/vercel/next.js/pull/30156
2021-11-19 19:41:19 +00:00
Jiachi Liu
dab7b40618
Add types for geo lat and long (#31624)
Fixes #31620

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-19 17:09:52 +00:00
Gerald Monaco
ab712ef310
Move root div to an app wrapper (#31596)
Extracted from #31223.

We need to move the root `<div id="__next">` wrapper to be rendered as part of the page content, rather than the`Document`, so that flush effects (like styles) are flushed before (or after) the div, rather than inside, where they would cause hydration mismatches.
2021-11-19 08:16:05 +00:00
Hannes Bornö
1d2ac3b225
Implement SWC port of next-page-disallow-re-export-all-exports (#31582)
Fixes #30810

Added tests similar to the fixture ones, but the output is stderr. That way the test can make sure the error message and span is correct. Let me know if you think this is a bad idea.
2021-11-19 00:11:25 +00:00
jj@jjsweb.site
a363a4ff6c
v12.0.5-canary.4 2021-11-18 16:30:23 -06:00
JJ Kasper
1d9007307f
Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping

* update test name

* lint-fix
2021-11-18 16:23:21 -06:00
Gerald Monaco
9f7c774665
Minor simplifications to renderToWebStream (#31553)
Simplifies `renderToWebStream` a little bit for #31223
2021-11-18 19:46:15 +00:00
Javi Velasco
5a3d558c9f
Fix HMR for middleware #30791 (#31548)
Fixes #30791

The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full reload.

This also brings tests for HMR:
- Refresh on a Middleware change
- HMR works after a middleware compilation change.

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2021-11-18 18:23:52 +00:00
jj@jjsweb.site
01cf08e288
v12.0.5-canary.3 2021-11-18 09:25:26 -06:00
jj@jjsweb.site
2a5e605ab3
v12.0.5-canary.2 2021-11-17 20:33:04 -06:00
JJ Kasper
be2e863dde
Re-add native package folders and ensure wasm artifacts are downloaded (#31561)
* Re-add native package folders and update publish-native

* update jobs

* ensure wasm-binaries are downloaded

* only build-wasm on release
2021-11-17 20:23:02 -06:00
jj@jjsweb.site
eaf6e27deb
v12.0.5-canary.1 2021-11-17 17:15:04 -06:00
JJ Kasper
36d3198e39
Fix unhandled rejection on route change in dev (#31554)
This ensures we properly catch the rejection on route change failure in development so the dev overlay doesn't flash with the unhandled rejection. A test case isn't able to be added for this specific scenario as the unhandled rejection is fired right before the page is navigated so we can't consistently check if the rejection was unhandled or not. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/28560
2021-11-17 21:33:56 +00:00
Steven
44b4dbcd41
Adjust AVIF size so that its smaller than WebP size (#31494)
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes #31254 
- Related to https://github.com/lovell/sharp/issues/2850
2021-11-17 20:31:16 +00:00
Gerald Monaco
0cf7061859
Make missing Document components an error (#31505)
* Make missing document components an error

* Fix broken tests
2021-11-17 13:34:16 -06:00
Keen Yee Liau
9ab1709175
telemetry: track usage of 'optimizeFonts' (#31522)
`optimizeFonts` is enabled by default, but the Aurora team would like
to find out how many users explicitly turn it off.
2021-11-17 13:33:37 -06:00
Maia Teegarden
b80c378975
Add/wasm build (#31470) 2021-11-17 20:01:02 +01:00
Donny/강동윤
2df861ac12
Update swc (#31540)
This PR applies
 - https://github.com/swc-project/swc/pull/2784

Closes #31479
2021-11-17 16:51:00 +00:00
Jiachi Liu
055e28ef81
Ensure only one doctype is rendered (#31534)
React-dom renders doctype automatically when `<html>` is detected. We should append `DOCTYPE` prefix only when necessary.
x-ref: https://github.com/facebook/react/pull/21680

## Bug

![image](https://user-images.githubusercontent.com/4800338/142215292-4af4a61d-2d75-48ae-a31a-0af641c72dcf.png)

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-17 14:57:48 +00:00
Steven
d87dc2b5a0
Add detection for Google-PageRenderer bot (#31521)
- Fixes https://github.com/vercel/next.js/discussions/31482
2021-11-17 03:49:37 +00:00
jj@jjsweb.site
2ad9dac873
v12.0.5-canary.0 2021-11-16 16:48:33 -06:00
Shu Ding
4ea7d7b177
Refactor the middleware SSR loader (#31508)
Initial step for #31506, to move the adapter logic out of the loader output string so it will be easier to reuse code in the future. Also, more options are passed to the loader to align with the serverless loader.

## 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-11-16 20:43:57 +00:00
Jiachi Liu
55ab4f06b7
Use _error for development in streaming (#31466)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-16 20:18:57 +01:00
Kiko Beats
593d943cd0
NextResponse: add .json static method (#31483)
closes: https://github.com/vercel/next.js/issues/31196

This new API was suggested in a previous version of this feature:
https://github.com/vercel/next.js/pull/31024#discussion_r745035448

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-16 18:38:47 +00:00
Tobias Koppers
bf973165fe
update webpack (#31455)
https://github.com/webpack/webpack/releases/tag/v5.64.1
2021-11-16 17:28:42 +00:00
Tobias Koppers
b79591cdaf
simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used.
2021-11-16 15:57:30 +00:00
Javi Velasco
9375485969
Remove TextEncoder and TextDecoder wrappers (#31490)
This PR removes the class wrapper that we have for `TextEncoder` and `TextDecoder`. Since this is merged we will be using directly the Node version in the sandbox.
2021-11-16 14:12:22 +00:00
stefanprobst
f195650f74
fix: allow next lint without eslint-config-next installed (#29823) 2021-11-16 14:07:31 +01:00
Yamagishi Kazutoshi
32f0c9a403
Support ESLint v8 (#29865)
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-16 10:18:27 +01:00
Heyang Zhou
a39a8969d3
Add a swc transform for removal of console.* calls. (#31449) 2021-11-16 10:18:05 +01:00
jj@jjsweb.site
abd87a515e
v12.0.4 2021-11-15 14:43:54 -06:00
jj@jjsweb.site
b204640008
v12.0.4-canary.15 2021-11-15 14:07:57 -06:00
Kiko Beats
b51a020941
middleware: add request referrer support (#31343)
closes: https://github.com/vercel/next.js/issues/30353

According with spec, `'about:client'` is the default value is the user doesn't provide it.

It needs to add a test there, looks like there no unit tests for these classes 🤔
2021-11-15 19:52:44 +00:00
jj@jjsweb.site
66d9b4e14a
v12.0.4-canary.14 2021-11-15 12:54:42 -06:00
Jiachi Liu
ef5795327a
Close stream when fatal error occurs (#31164)
* support custom 500 error in streaming

* remove unused imports
2021-11-15 11:49:50 -06:00
Steven
eb0bd63af4
Fix basePath replacing server-side and normalizeLocalePath() when path is empty string (#30978)
This fixes our `basePath` detection/replacing server-side as we were incorrectly considering `/docss` a match for a `basePath` of `/docs` which caused us to have an unexpected value in the `normalizeLocalePath` function. 

- Fixes #22429
- Regression introduced in #17757 
- Fixes: https://github.com/vercel/next.js/issues/31423

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-15 17:33:21 +00:00
Tim Neutkens
2d9ac399c1
Remove moment locale replace from craCompat as it's a default in Next.js 12 (#31431) 2021-11-15 10:36:53 -06:00
Shu Ding
16d56e2c49
Refactor server/render for SSR streaming (#31231)
Initial step to refactor the rendering logic by decoupling the handler and renderer:
1. Delegate Flight rendering to server/render
2. Reuse the piper glue code for both Fizz and Flight streams
3. Add buffering for ReadableStream

In 1), this PR also makes sure that gSSP/gSP are correctly executed before the Flight stream and `pageProps` and `router` are correctly delivered to the component.

Related to #30994.

## 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-11-15 15:29:34 +00:00
Byron
8c547139e4
add filename to babel warning about anonymous function default exports (#31322)
fixes #29667

I didn't add an integration test, but I can take a stab at it if you point me in the right direction!
2021-11-15 14:01:20 +00:00
Tim Neutkens
e5171758d3 v12.0.4-canary.13 2021-11-15 14:19:55 +01:00
Tim Neutkens
9da8d65632
Add minify debug env var to investigate minifier bugs (#31417) 2021-11-15 14:15:18 +01:00
Tobias Koppers
644d361c98
show (middleware only) when a middleware is added to the compiler (#31409)
## 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-11-15 09:20:27 +00:00