Commit graph

11340 commits

Author SHA1 Message Date
JJ Kasper
d5706dc417
v12.1.7-canary.17 2022-05-26 18:52:20 -05:00
Shu Ding
37b859f36d
Small code improvements (#37227)
Two small things noticed today. When calling `getDependencies` concurrently (which is happening right now) the cache doesn't work as it's after the `await`, so here we move it to cache the promise instead. Also `NUM_OF_MICROSEC_IN_SEC` isn't accurate and it should be `NANOSEC` actually.

## 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`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-05-26 23:19:47 +00:00
Lee Robinson
8aa15a21f8
Add note that next build output is compressed. (#37228)
When you run `next build`, the sizes you're seeing in the output are the compressed sizes with gzip.
2022-05-26 22:53:17 +00:00
OJ Kwon
fc61428db1
feat(next/swc): support experimental swc plugins (#36790)
* build(cargo): build swc with plugin support

* feat(next): expose experimental swcplugins config

* docs(compiler): add description

* build(cargo): resolve feature conflicts

* build(cargo): resolve build conflict

* Update docs/advanced-features/compiler.md

Co-authored-by: Maia Teegarden <dev@padmaia.rocks>

Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
2022-05-26 15:16:26 -07:00
Stanley Hong
e4a9f09d45
Fix broken links in image.md (#37223)
**Broken** 
(#local-images)

**Updated**
(/docs/basic-features/image-optimization.md#local-images)
2022-05-26 18:10:12 +00:00
JJ Kasper
a4f94e5278
Update test config to only install pnpm when needed (#37222) 2022-05-26 12:23:03 -05:00
Jiachi Liu
4340b4e647
build: import useSyncExternalStore from react when using react 18 (#37212)
Fixes #37197 

tested with `examples/analyze-bundles/`, stripped off 300b of the the use-sync-external-store shim when applied the code change. 

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-05-26 16:07:37 +00:00
Tom Marshall
6a5bdb5d80
Update cms-kontent example to action PR feedback (#37206)
* Updates the `cms-kontent` example `Image` component to implement the
  suggested improvements from @styfle in #37188.
* Simplifies the Kontent loader host checking.
* Reduces the default image quality to from `100` to `75`.
* Add `tslib` dependency to fix `Module not found: Can't resolve 'tslib'`
  error when importing `transformImageUrl` in the `Image` component.
  It looks like this might be a bug in v11 of the Kontent Delivery SDK,
  as it appears `tslib` needs to be included as dependency, rather than
  dev dependency. I missed this originally as the example runs fine in
  the Next repo as the root `yarn.lock` has `tslib`. It's only when the
  example is used via `yarn create next-app` that the issue occurs. We
  can likely remove this in future alongside an upgrade to the SDK
  package once this issue has been fixed and released there.

https://github.com/vercel/next.js/pull/37188
2022-05-26 10:29:16 -05:00
Balázs Orbán
3c764fc143
Update contributing doc and PR template for examples (#37215)
Follow-up on https://github.com/vercel/next.js/pull/37193

## 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`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-05-26 15:18:42 +00:00
Tim Neutkens
a863652893
Refactor fetchFlight (#37213)
* Remove __props__

* Remove refreshCache function
2022-05-26 16:35:09 +02:00
Tim Neutkens
3f088592d7
Split useServerResponse for initial responses (#37209)
Small refactor that splits initial response from fetching a changed response for Flight.


## 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`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-05-26 10:37:49 +00:00
JJ Kasper
7206614d0b
Update contributing doc and PR template for examples (#37193)
* Update contributing doc and PR template for examples

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
2022-05-25 20:24:53 -05:00
Steven
0d95886815
Fix experimental remotePatterns wildcard (#37137)
- Follow up to #36245 
- Closes #37026
2022-05-25 20:25:06 +00:00
Tom Marshall
82a9d21809
Fix cms-kontent example Next/Image domain error (#37188)
* Fixes the following error in the `cms-kontent` example by implementing
  an `Image` component to wrap `Next/Image` with a custom loader.

```
Invalid src prop ... hostname "assets-eu-01.kc-usercontent.com" is not configured under images in your `next.config.js`
```

* This error is affecting both the `pages/index.js` and
  `pages/posts/[slug].js` routes.
* Uses a custom loader rather than adding the Kontent asset domains to
  `next.config.js` as we can transform the images using the Kontent
  Delivery API directly rather than delegating this to the Next app web
  server.

Ref:
* https://nextjs.org/docs/messages/next-image-unconfigured-host
* https://nextjs.org/docs/basic-features/image-optimization
* https://meeg.dev/blog/using-the-next-image-component-with-kentico-kontent-assets
* b7c9ef588c/components/Image.js
* https://kontent.ai/learn/reference/image-transformation/
2022-05-25 10:40:18 -05:00
Tom Marshall
d9b6d99625
Update cms-kontent example SDK package to v11 (#37187)
* Updates the Kontent Delivery SDK from v9 to v11.
* Updates the `lib/api.js` code that utilises the SDK accordingly.
* Removes `rxjs` as this is no longer a dependency of the Kontent
  Delivery SDK in v11.
* Updates other packages to the latest versions, including `react`.

Ref:
* https://kontent.ai/blog/news-in-javascript-sdks/

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-25 15:36:40 +00:00
Tim Neutkens
3a6bd135dd v12.1.7-canary.16 2022-05-25 11:46:55 +02:00
JJ Kasper
b68d9eafa4
Rename app paths folder (#37146) 2022-05-25 11:46:26 +02:00
Dilwoar Hussain
1cd34dd640
Use appropriate className attribute for JSX (#37168)
## What

This changes the` class` attribute with `className`

## Why

Class is a reserved word in JavaScript. The appropriate attribute to use is `className`.



## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-24 23:15:06 +00:00
Shu Ding
cc254cc19c
Use customized chunk loading implementation (#37163)
Follow-up PR for #37134, this PR adds back the hash in each chunk's filename. This `chunks` in the flight manifest will now be `chunkId:chunkFilename` with this PR, and `globalThis.__next_chunk_load__` then handles the chunk registration (uses chunkId) and chunk loading (uses chunkFilename). (Q: how can we port this to React?)

We can't use `[contenthash]` but only `[chunkhash]` because at the stage of generating the flight manifest, the content isn't finalized and the hash changes after that.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-24 22:04:27 +00:00
JJ Kasper
780be60d23
v12.1.7-canary.15 2022-05-24 15:50:04 -05:00
JJ Kasper
9063b19c0b
Fix build-wasm CI job (#37165)
* Fix build-wasm CI job

* use macos

* re-add release check
2022-05-24 15:49:20 -05:00
d-suke
13747476b8
should render the correct sizes passed when a noscript is rendered (#37161)
## Bug

- [x] Fixes #36807
- [x] Unit tests added

Please review this PR.

As shown in [this Issue](https://github.com/vercel/next.js/issues/36807), the noscript element does not render sizes correctly during SSR.
This change adds `noscriptSizes` to the props passed to `ImageElement` to generate the same `sizes` and `srcset` as the normal img tag that is actually rendered in the browser.
2022-05-24 19:25:05 +00:00
JJ Kasper
18dc7e1a49
v12.1.7-canary.14 2022-05-24 13:34:36 -05:00
stefanprobst
1cd76b9e66
Avoid anonymous function in next/link (#37154)
Avoid anonymous function in `next/link` so DevTools show `Link` instead of `Anonymous`:

Before:

![Screenshot_20220524_123016](https://user-images.githubusercontent.com/20753323/170018947-2d9bdd58-5311-4bba-ab6b-4dc9547092f6.png)

After:

![Screenshot_20220524_122946](https://user-images.githubusercontent.com/20753323/170018968-2993a24a-5518-4de1-b7a4-75cc6d6562f2.png)

## Bug

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

## Feature

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

## Documentation / Examples

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-24 16:00:22 +00:00
Alexandru Tasica
e4bf1a515c
Docs: missing parenthesis on example (#37156)
Missing close parenthesis on docs example from page custom-document-image-import.md

## Bug

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

## Feature

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

## Documentation / Examples

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-24 15:01:56 +00:00
Shu Ding
2a89c1926d
Fix client component hydration (#37134)
This PR makes sure that chunks of client components can be loaded via `__webpack_chunk_load__`, and hydrated correctly inside `viewsDir`.

Side note: we have to get rid of `[contenthash]` from the chunk filename because of a conflict currently which can be resolved later.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-24 14:54:26 +00:00
Naing
6736041d51
Update incremental-static-regeneration.md (#37159)
I couldn't understand well this sentence at the first time of reading as a non native english speaker. I think 'that' is needed here.



## Bug

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

## Feature

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-24 14:27:17 +00:00
Tim Neutkens
e636234b2c v12.1.7-canary.13 2022-05-24 12:21:19 +02:00
Donny/강동윤
a463553da2
Update swc (#37149)
* Update swc

* Update test refs

* Update test refs
2022-05-24 00:56:45 -05:00
Donny/강동윤
76fbae93fc
Update swc (#37148) 2022-05-23 23:50:25 -05:00
JJ Kasper
b77ac14529
v12.1.7-canary.12 2022-05-23 19:29:03 -05:00
Andrew Matthews
f1d1c46b99
Fix example extraction when branch name contains slash (#37140)
* convert slashes to dashes for accurate filename

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-23 18:54:07 -05:00
JJ Kasper
81850eb295
Update deploy E2E test setup (#37126)
* Update deploy E2E test setup
2022-05-23 17:37:21 -05:00
Sukka
e57e2753f1
fix(typescript): worker execution failed with custom next.config.js (#37125)
## Bug

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

The PR fixes #37122, an issue introduced by #37105.

`next.config.js` might/will include functions (custom `webpack`, `generateBuildId`, `exportPathsMap`, etc.) that are not able to pass from the main thread to a worker. The PR fixes the issue by only passing primitive args to the worker.
2022-05-23 20:30:48 +00:00
Sukka
d64512f02f
chore(devDeps): bump @vercel/ncc to 0.33.4 (#37113)
## 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`

`yarn dev` failed (exit 1) on Node.js 17 & Node.js 18:

```
ncc_amp_optimizer failed because error:0308010C:digital envelope routines::unsupported
[...]
ncc_next__react_dev_overlay failed because error:0308010C:digital envelope routines::unsupported
```

The issue was reported to `@vercel/ncc` (https://github.com/vercel/ncc/issues/805) and fixed by https://github.com/vercel/ncc/pull/868, and `@vercel/ncc@0.33.2` includes the fix. However, Next.js still uses `@vercel/ncc@0.33.1` in `devDependencies`.

The PR bump `@vercel/ncc` to the latest version (which is 0.33.4).
2022-05-23 20:02:44 +00:00
JJ Kasper
2b93e38d67
Add libc field to swc packages (#37131) 2022-05-23 14:18:40 -05:00
Steven
0ac0f594dc
Bump @vercel/nft to 0.19.1 (#37129)
Bump `@vercel/nft` to 0.19.1 https://github.com/vercel/nft/releases/tag/0.19.1

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-23 18:33:55 +00:00
Jiachi Liu
fc06fe6562
Remove process.cwd usage from path polyfill (#37130)
Avoid process usage detection warning for edge runtime bundle
2022-05-23 17:56:00 +00:00
Charly POLY
565a2fafac
refactor(examples/with-typescript-graphql): use codegen TypedDocumentNode and GraphQL Yoga for better DX and smaller bundle size (#36240)
Improve the Next.js with TypeScript + GraphQL example:

- [x] use GraphQL Code Generator instead of `graphql-let`: more widespread tool and smaller bundle size (types only generation vs code generation)
- [x] use GraphQL Yoga instead of Apollo Server Micro: for lighter bundle size as [stated here](https://github.com/vercel/next.js/pull/36155)
- [x] introduces GraphQL Code Generator on the API side for Resolvers typing

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-23 16:58:27 +00:00
Charly POLY
874957e767
feat(examples): refactor api-routes-graphql to GraphQL Yoga (#36155)
GraphQL Yoga provides a more extensible experience ([Envelop plugins](https://envelop.dev/)) and lighter bundle than the previously showcased `apollo-server-micro` ([64.5kB](https://bundlephobia.com/package/@graphql-yoga/node@2.2.1) vs [196.2kB](https://bundlephobia.com/package/apollo-server-micro@3.6.7) - min & GZiped)

Similar to Next.js, GraphQL Yoga comes with strong defaults and out-of-the-box support for modern GraphQL features (File uploads, subscriptions, and more).

Strong of many years of existence and a large community, GraphQL Yoga 2.0 comes with Next.js support with no additional package or configuration 📦 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-23 16:27:41 +00:00
Charly POLY
cf0158ce8d
feat(examples): build a GraphQL Gateway with GraphQL Mesh and Next.js API routes (#36439)
* feat(examples): GraphQL Mesh Gateway example

* doc(examples/with-graphql-gateway): README

* fix(examples/with-graphql-gateway): ignore `.mesh/`

* Apply suggestions from code review

* lint-fix

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-23 11:02:21 -05:00
Tim Neutkens
1b4e2ccd63 v12.1.7-canary.11 2022-05-23 13:35:21 +02:00
Sukka
d1122f8282
perf: run type check and eslint in parallel (#37105) 2022-05-23 11:25:09 +02:00
Damien Simonin Feugas
4e6b6a5b86
feat(middleware): issues warnings when using node.js global APIs in middleware (#36980) 2022-05-23 11:07:26 +02:00
Tim Neutkens
6f2a8d33e2
Add tests for getStaticProps and getServerSideProps (#37014)
* Add tests for getStaticProps and getServerSideProps

* Add test for revalidate

* Add additional test

* Add gitkeep
2022-05-23 09:41:09 +02:00
Charles Stover
f9ed7954bf
Support TS exactOptionalPropertyTypes (fixes #35280) (#35281)
fixes #35280

Before:

![image](https://user-images.githubusercontent.com/343837/158047041-d4b65f19-c090-496b-b0c1-75faa388ea66.png)

After:

![image](https://user-images.githubusercontent.com/343837/158046975-7393f818-be1a-4d03-99db-643e88595657.png)
2022-05-23 05:26:44 +00:00
Eric Matthys
0d80b113a3
Warn when building a TS project with composite: true and fallback to incremental (#35270)
* Warn when building a TS project with composite: true and fallback to incremental

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-23 00:04:00 -05:00
Corbin Crutchley
fb23f7b642
chore: add test for in-fragment HEAD reflection (#35320) 2022-05-22 23:35:53 -05:00
José Fernando Höwer Barbosa
01629113bd
Fix Type to solve issue found in #36008 (#36671)
* Fix Type to solve issue found in #36008

It seems the types inside of `DocumentInitialProps` have inconsistencies with the type coming from a fragment 

The issue is documented here https://github.com/vercel/next.js/issues/36008

* Add test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 23:25:38 -05:00
Dawson Booth
88747a2653
Add JSX.Element to styles type in DocumentInitialProps (#36392)
* Change styles element fragment to array

* update type

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 23:00:36 -05:00