Commit graph

10978 commits

Author SHA1 Message Date
Steven
78831c3c84 v12.1.1-canary.17 2022-03-22 09:00:31 -04:00
JJ Kasper
a2accb2299
Update trace ignore check to check reasons correctly (#35511) 2022-03-22 00:03:42 -05:00
OJ Kwon
c261924756
feat(telemetry): report swc target triple to telemetry (#35420) 2022-03-21 17:09:03 -07:00
Luka Hartwig
af95b0cb8d
Server component docs use wrong next version (#35313)
The docs for the react server components preview refer refer to `next@latest` which doesn't work. The linked demo uses `canary` so I replaced it in the install command.
2022-03-21 23:54:43 +00:00
JJ Kasper
92da36f1e0
v12.1.1-canary.16 2022-03-21 18:33:48 -05:00
Thiago M
cd47984152
clarify use of Script (#35491)
Leave more clear that <Script> component can't be used inside Head. Current it says "without need", which don't implies it can't be used.



## Bug

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

## Feature

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-21 17:06:04 +00:00
JJ Kasper
da3760bbf5
Use check on prerender test assertion (#35482) 2022-03-21 10:00:07 -05:00
Nelo
40a5c94ca7
Fix typo in getServerSideProps doc page (#35467)
While reading the documentation, I noticed that this paragraph was not correctly written and was hard to read. I fixed it adding a dot.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-03-21 14:24:19 +00:00
Xairoo
2ecfa6aec3
Typo in URL removed (#35472) 2022-03-20 22:50:33 +00:00
Rich Haines
6f24c200db
Added note about why Next.js used 307 and 308 status codes (#35325)
This PR looks to clear up some confusion users are having around our decision to use 307 and 308 redirects, instead of 301 and 302

## 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
- [x] 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-03-19 16:49:24 +00:00
OJ Kwon
9be56aa622
feat(next-swc): embed target triple string (#35416)
This PR straightly port over swc's target triple metadata (https://github.com/swc-project/swc/pull/4058) into next-swc, mainly for the tracking purpose of usages.

## 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`
2022-03-19 15:26:59 +00:00
Steven
73b83a0b88
Add test to ensure fs.readFile() works with Output File Tracing (#35338)
Add test for `fs.readFile()`

- Related to https://github.com/vercel/vercel/issues/7256
- Related to https://github.com/vercel/next.js/discussions/32236

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-18 22:51:26 +00:00
JJ Kasper
7ca958de88
Update to latest @vercel/nft and leverage new reason types (#35446)
Currently we ignore any files that are traced and handled by a webpack loader to prevent including webpack specific files although users may attempt reading files directly using `fs` even if they are handled by webpack so this leverages the new reason types in `@vercel/nft` to only ignore if it is solely imported. 

## Bug

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

x-ref: https://github.com/vercel/next.js/pull/35338
2022-03-18 21:18:24 +00:00
Jiachi Liu
f62766f364 v12.1.1-canary.15 2022-03-18 11:25:16 +01:00
Thibaut SABOT
084e00016f
use initial state for rootReducer in with-redux-saga example (#35406) 2022-03-18 11:20:20 +01:00
Jiachi Liu
910c48f52b
test: add document head multi child prod test (#35426)
Add production test for #35424
2022-03-18 10:19:55 +00:00
OJ Kwon
9c2949a950
fix(document): accepts nodearray for head's children (#35424)
This PR attempts to amends #35390. 

There's new property 'children' in `OriginProps` : https://github.com/vercel/next.js/blob/canary/packages/next/pages/_document.tsx#L22 which overwrites default prop's children defined at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L504. Those 2 are incompatible, especially new one doesn't allow iterable children which results multiple children in head tag makes compilation fails.

PR matches type of new property same as default, then apply some workaround to bend over internal check logics. I'm not sure if it's worth to apply strict types as much or just bend it via `any` casting, PR tried to be strict as much.

## Bug
- closes https://github.com/vercel/next.js/issues/35390

- [ ] 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-03-18 09:44:56 +00:00
Jiachi Liu
f2fee3d6ec
Fix: change the timing for clearing the inlined data buffer (#35413)
Fix error of `Unexpected server data: missing bootstrap script` when the initial rendering is streaming rsc.

Introduced in #35344, the buffer might still keep flushing after on mount.


Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
2022-03-18 01:55:59 +00:00
Jiachi Liu
279f47b9ca
Keep fouc tags for streaming (#35417)
Basically the revert change of #31187

The fouc tag are rendered in first place, and the removing fouc tags script is executed before hydration which is early enough. This will unblock the dev mode of global CSS development

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-03-18 00:19:03 +00:00
Shu Ding
757a0c7082
Abstract out stream related utils from render and web/utils (#35372)
The `readableStreamTee` util is only used by server/render.tsx, but ended up in the middleware runtime bundle. So it's better to add all the utils in one place, and we can remove them once upstream implementation of ReadableStream is ready.

## 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-03-17 23:21:16 +00:00
JJ Kasper
4365463fd9
Run tests against node LTS (v16) and current (v17) (#35414)
* Run tests against node LTS (v16) and current (v17)

* update pnp tests
2022-03-17 17:47:59 -05:00
Steven
bc460229ab
Update next/image docs for width & height (#35188)
- Fixes #30219 

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2022-03-17 15:16:15 -04:00
JJ Kasper
9129bb9a05
v12.1.1-canary.14 2022-03-17 12:51:26 -05:00
Shu Ding
62b46772a0
Use hasConcurrentFeatures instead of reactRoot as the condition of Fizz (#35407)
We should use the `hasConcurrentFeatures` as the condition to enable Fizz, instead of reactRoot, otherwise just by installing React 18 will break stuff such as CSS imports.

Currently `hasConcurrentFeatures` still needs to opt-in via the global `runtime` option. Once we fixed all the CSS bugs and add back #35245, we can flip the condition here again.

## 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-03-17 17:40:13 +00:00
JJ Kasper
d3a53a6f01
Update on-demand ISR to skip fetch locally (#35386) 2022-03-17 12:06:44 -05:00
Shu Ding
24f450e8aa
Revert "Make concurrent features independent from the global runtime option" (#35405)
Reverts vercel/next.js#35245
2022-03-17 16:31:46 +00:00
JJ Kasper
52e34cede8
v12.1.1-canary.13 2022-03-16 18:46:19 -05:00
Lee Robinson
43941d2475
[docs] Update going to production docs around caching headers (#35374)
Follow up on https://github.com/vercel/next.js/pull/35336 based on suggestions I would have made pre-merge.
2022-03-16 22:11:06 +00:00
Jiachi Liu
60ad1dee76
Make router able to navigate between rsc pages (#35344)
### Bugfix
Made some changes for the data register buffer flushing in #34631 and #34475 that tried to delete the buffer or flush them only once. But turns out it will break the navigation between RSC pages.


### Enhancements
Simplify the inline response writer and inline response data for the initial render. Since they're only for the initial render, navigations will leverage the serialized data fetched from router and construct the react tree.


## Bug

Fixes #35135

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-03-16 22:04:34 +00:00
Hassan El Mghari
33aa51ab26
Change README structure in examples (#35349)
Changed the README structure in all examples to take out the Stackblitz button and include it as a link instead using a [bash script](https://gist.github.com/Nutlope/a8f3556a5a401e32a8c6278b782ebf8a/revisions).

I also added the Vercel deploy button to 15 READMEs that didn't have it.
2022-03-16 21:39:26 +00:00
JJ Kasper
4c6443ba1c
v12.1.1-canary.12 2022-03-16 11:23:01 -05:00
Jiachi Liu
efdb87d134
Drop browser field for edge runtime (#35335)
Related to #31678 

For streaming pages,

Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser specific things like DOM api could breaks cause edge runtime is more like worker without dom runtime.

This PR is to revert the main field resolution behavior. And if you have a library targeting multiple runtime with different fields, ideally is to make it more isomorphic and will be easy to use in edge runtime
2022-03-16 15:14:49 +00:00
LongYinan
98d7ee3a06
Add libc fields to Linux platform packages (#35354)
Related: https://github.com/yarnpkg/berry/pull/3981

With `yarn 3.2` +, developers will install one less package on the Linux platform
2022-03-16 09:19:42 -04:00
Shu Ding
91136d231e
Update comments for the web server (#35366)
The web server is used as minimal mode, whereas public file handling, envs and compression are both handled by the upper layer (edge runtime if deployed serverlessly, or node server if self-hosted).

## 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-03-16 12:32:30 +00:00
Shu Ding
853442dfc3
Make concurrent features independent from the global runtime option (#35245)
This PR depends on #35242 and #35243. It allows the global runtime to be unset, as well as enables static optimization for Fizz and RSC pages in the Node.js runtime. Currently for the Edge runtime pages are still always SSR'd.

Closes #31317.

## Bug

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

## Feature

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

## Documentation / Examples

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


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-03-16 12:11:57 +00:00
Antonio Young
86c1bf6d2b
[docs] Update docs about Cache-Control default headers. (#35336)
* Update docs about Cache-Control default headers.

* Update docs: Override the default in case of gSSP

* Apply suggestions from code review

* Update going-to-production.md

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-03-16 11:48:45 +01:00
Sam Ko
0a416acdcf
Remove with-custom-reverse-proxy example (#35340)
Removing a dated Next.js example.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-03-16 08:01:00 +00:00
Kyle Holmberg
ed1eedaa97
Encourage installation of sass as a devDep (#35323) 2022-03-15 15:42:36 +01:00
Aman Mittal
7891645d4b
Add info on context.ctx argument (#35303) 2022-03-15 15:34:49 +01:00
Jiachi Liu
99aea513bf
enhance: cover re-exported gsp cases for runtime fallback (#35326)
Cover re-exported gsp cases from #35011
2022-03-15 13:14:18 +00:00
LongYinan
2e16d02faa
SWC emotion transform plugin (#34687) 2022-03-15 08:51:15 +01:00
Steven
6611bfd31c v12.1.1-canary.11 2022-03-14 10:26:50 -04:00
Alex Castle
76bad07bdf
Add new 'raw' image layout (#34339)
This PR adds a new layout mode for images called `raw`, as discussed with the core team a while back. This mode has the following characteristics:
 - No wrapper `span` around the `img` element
 - No sizer svg
 - Almost no styles automatically added to the `img` element
 - `style` parameter is allowed and is passed through to the underlying `img` element

This also adds documentation changes to describe the new component.

There are a few tradeoffs and DX decisions that may warrant discussion/revision before merging. I'll add a few comments to highlight those issues.

- Related to #18637
2022-03-14 10:25:23 -04:00
Bernard Lin
9f54b56bde
examples: update instructions for create-strapi-app (#35288)
Not sure how you want to handle this, but the current instructions aren't compatible with the latest version of strapi and migration steps aren't super clear yet. It does work flawlessly with v3 of Strapi though.



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

## Documentation / Examples

- [X ] Make sure the linting passes by running `yarn lint`
2022-03-13 20:52:38 +00:00
Jiachi Liu
edce68b40c
Bump styled-jsx to 5.0.1 (#35290)
x-ref: https://github.com/vercel/next-react-server-components/issues/35
x-ref: https://github.com/vercel/styled-jsx/pull/788

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-03-13 20:31:53 +00:00
Houssein Djirdeh
79016b879f
Adds web worker support to <Script /> using Partytown (#34244)
## Summary

This PR adds a new `worker` strategy to the `<Script />` component that automatically relocates and executes the script in a web worker.

```jsx
<Script 
  strategy="worker"
  ...
/>
```

[Partytown](https://partytown.builder.io/) is used under the hood to provide this functionality.

## Behavior

- This will land as an experimental feature and will only work behind an opt-in flag in `next.config.js`:

  ```js
  experimental: {
    nextScriptWorkers: true
  }
  ```

- This setup use a similar approach to how ESLint and Typescript is used in Next.js by showing an error to the user to install the dependency locally themselves if they've enabled the experimental `nextScriptWorkers` flag.

  <img width="1068" alt="Screen Shot 2022-03-03 at 2 33 13 PM" src="https://user-images.githubusercontent.com/12476932/156639227-42af5353-a2a6-4126-936e-269112809651.png">
- For Partytown to work, a number of static files must be served directly from the site (see [docs](https://partytown.builder.io/copy-library-files)). In this PR, these files are automatically copied to a `~partytown` directory in `.next/static` during `next build` and `next dev` if the `nextScriptWorkers` flag is set to true.

## Checklist

- [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
- [X] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

This PR fixes #31517.
2022-03-11 22:26:46 +00:00
Shu Ding
3b9864d4f4
Remove the special _document-concurrent component (#35242)
This PR removes the `` const documentPage = `_document${globalRuntime ? '-concurrent' : ''}` `` condition from the config resolution phrase, and only use the built-in one. And later when rendering, we can conditionally convert the default class component into a function component. This change is necessary for the switchable runtime feature (#31506).

## 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-03-11 20:38:09 +00:00
C. T. Lin
bc0816f936
fix(Script): allow passing defer=false to Script component (#34850)
## Bug

```jsx
<Script
  async
  defer={false}
  strategy='beforeInteractive'
  src='https://securepubads.g.doubleclick.net/tag/js/gpt.js'
/>
```

output:

```html
<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" async="" defer="" data-nscript="beforeInteractive"></script>
```

The `defer` prop is overridden by `!disableOptimizedLoading`, so can't disable it on the particular script.
2022-03-11 16:53:09 +00:00
Balázs Orbán
91455653fe
chore: upgrade cssnano-simple (#35258)
Fixes #35219

## 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-03-11 16:25:18 +00:00
JJ Kasper
d7deb852bd
v12.1.1-canary.10 2022-03-11 08:53:10 -06:00