Commit graph

11369 commits

Author SHA1 Message Date
Ryan
f4dcb81d61
[docs] Clarify "When does getStaticProps run" note (#37289)
Changed bullet points to say "getStaticPaths" instead of "getStaticProps".

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

## Feature

- [x] Related issues linked using `fixes #number`
- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-05-29 22:17:29 +00:00
JJ Kasper
d1b7e7f696
Update swc builds (#37285)
* Update swc builds

* test builds

* use alias for now

* fix typo

* handle existing case

* update windows and bsd

* fix

* re-add publish check
2022-05-29 17:12:04 -05:00
ArianHamdi
0d2121db1f
change map function to forEach function (#37284)
close #37283
2022-05-29 20:23:04 +00:00
Lee Robinson
c4fdfcb7f1
Update GitHub Pages deployment example. (#37282)
Verified it's working: https://leerob.github.io/gh-pages-test/
2022-05-29 20:12:37 +00:00
JJ Kasper
23013674a1
v12.1.7-canary.21 2022-05-29 15:00:22 -05:00
JJ Kasper
df2f1f01fa
add version step for publish 2022-05-29 14:59:38 -05:00
Tim Neutkens
85871e80ee v12.1.7-canary.20 2022-05-29 21:22:25 +02:00
Tim Neutkens
31500ba2e0
Refactor client component out of client runtime (#37238)
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-05-29 20:53:12 +02:00
JJ Kasper
bbcfc0d2f4
Ensure all bench dependencies are added (#37278)
* Ensure all bench dependencies are added

* bump

* another dep

* add env
2022-05-29 12:17:42 -05:00
Remco Haszing
a7eb6695aa
Add type definitions for next/mdx (#36815)
Although it’s not intended for use in TypeScript, TypeScript still offers some nice features when it’s used in next.config.js (completion, hovers, `"checkJs": true`).

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 05:21:25 +00:00
JJ Kasper
f7b81316ae
Update to leverage pnpm for monorepo (#37259)
* Update to leverage pnpm for monorepo

* update compiled

* update stats action

* update ci install step

* update ci

* add test dep

* update invoking scripts

* update caching

* skip cache for now

* update dep

* update packages and fix babel

* update compiled

* update lint

* update test

* update ci

* update pnpm store caching

* update path for windows

* update restore-key config

* update caching

* remove extra build azure stage

* re-add checkout

* update setting pnpm store

* bump

* remove azure caching as pnpm is faster to download

* update contributing

* apply suggestions

* remove install-peers

* prepublish -> prepublishOnly

* prepublish -> prepublishOnly more

* more yarn -> pnpm references

* more yarn -> pnpm references take 2

* use workspace protocol for root package.json

Co-authored-by: Steven <steven@ceriously.com>
2022-05-28 23:35:16 -05:00
Donny/강동윤
748ce123b2
Add swcMinifyDebugOptions (#37172)
This also updates swc crates to 7eac561639

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 03:53:57 +00:00
Cozy Indigo
c7ab218db2
Updated graphql API to support v1.7.2 (#35896)
## Documentation / Examples
- [X] Make sure the linting passes by running `yarn lint`
Graphql API has updated with use of nodes, this bugfix updates these specifications.


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 02:49:59 +00:00
Saullo Almeida
69cc9b3633
chore: update with-tailwindcss example to TypeScript (#37208)
## 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)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 01:54:04 +00:00
Shyam Gupta
39302141b5
Show warning during build if page is returning a large amount of data (#37264)
## 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 #33829
- [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`

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 01:39:48 +00:00
Hannes Bornö
5739edc7cf
Ignore popstate with invalid state (#37110)
* Ignore popstate with invalid state

* Make tests pass

* i18n case fixed

* Fix lint error

* Unhandled Promise Rejection

* Revert "Unhandled Promise Rejection"

This reverts commit ac4fde7654ed549822185ab0229a6d01c6ea194f.

* fix type check

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-28 20:07:44 -05:00
JJ Kasper
88b1f7d50a
Refactor incremental cache to be extensible (#37258)
This refactors the `incremental-cache` and moves the file-system cache handling to it's own cache handler allowing it to be replaced by a custom cache handler (experimental). 

Closes: https://github.com/vercel/next.js/pull/22619

## 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-28 00:50:21 +00:00
Imad Atyat-Allah
3c295f0017
Fix with-contentlayer example build error (#37257)
## 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-27 22:11:50 +00:00
Steven
57dcc9d329
Update pnpm create next-app for latest pnpm 6 and 7 (#37254)
This command changed in pnpm [6.32.13](https://github.com/pnpm/pnpm/releases/tag/v6.32.13) and [7.1.1](https://github.com/pnpm/pnpm/releases/tag/v7.1.1) so lets update it since its been a few weeks and we can expect pnpm users to update more regularly than npm users.

- Fixes https://github.com/vercel/next.js/pull/37240 
- Fixes https://github.com/vercel/next.js/pull/37045
- Fixes https://github.com/vercel/next.js/pull/37032
- Fixes https://github.com/vercel/next.js/pull/36602
- Fixes https://github.com/vercel/next.js/pull/36496
2022-05-27 21:21:40 +00:00
JJ Kasper
ae67f2821f
v12.1.7-canary.19 2022-05-27 15:29:17 -05:00
Jiachi Liu
df77964e3d
Preload chunks for next/dynamic in suspense mode (#37245)
When using `next/dynamic` with `suspense: true`, the API will opt into `React.lazy` with react 18. But previously it doesn't preload the dynamic chunks. This pr will include the chunks into initial html for faster hydration instead of loading the chunk until the script is executed. This makes `next/dynamic` has a significant difference from `React.lazy` api

x-ref: https://github.com/vercel/next.js/issues/37197#issuecomment-1138496911
x-ref: https://github.com/vercel/next.js/pull/37244
2022-05-27 20:11:34 +00:00
Tom
3e178bb801
add pnpm link to docs (#37221)
## Documentation / Examples

- [x] 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)


Co-authored-by: Steven <steven@ceriously.com>
2022-05-27 15:46:38 -04:00
Tom
4f4c507064
add supported API's link to middleware docs (#37251)
Fixes #37064

## Documentation / Examples

- [x] 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)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-27 18:36:14 +00:00
Javi Velasco
523704b83f
Execute middleware on Next.js internal requests (#37121)
* Do not exclude internal _next request in middleware

* Allow for `NextURL` to parse prefetch requests

* Add test for middleware data prefetch

* Refactor `hasBasePath` and `replaceBasePath`

* Refactor `removeTrailingSlash`

* Refactor parsed next url to use `getNextPathnameInfo`

* Allow to configure `NextURL`

* Ensure middleware rewrites with always with a locale

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-27 13:29:04 -05:00
Shu Ding
0613f76f38
Use deterministic module IDs in the client bundle (#37249)
Another strategy to do achieve the goal of #36995. With this PR the module IDs will be:
- (1) RSC: named (_this one doesn't matter_)
- (2) SSR: named
- (3) Client: deterministic

And we include the client module IDs in the flight manifest, as well as an extra mapping of 3) → 2) so during SSR it can require the correct module still.

## 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-27 17:43:42 +00:00
Balázs Orbán
7ac7ae62b0
chore: simplify with-styled-components (#37237)
Fixes https://github.com/vercel/next.js/issues/37230

## 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-27 15:27:35 +00:00
LongYinan
381b8618ee
Fix memory allocation issue on linux gnu platform (#37243) 2022-05-27 14:54:34 +00:00
JJ Kasper
20ee57e0ad
v12.1.7-canary.18 2022-05-26 20:37:17 -05:00
OJ Kwon
951b29e5cc
build(actions): skip plugin features for non supported platform (#37229)
* build(actions): skip plugin features for non supported platform

* test builds

* update turbo config

* Revert "test builds"

This reverts commit 50bdb9765b9fcd4c09e4dcf6566f512ac1a30da0.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-26 20:32:43 -05:00
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