Commit graph

155 commits

Author SHA1 Message Date
JJ Kasper
d2b0d43eb9
Update incremental adoption in rewrites doc (#24186)
This updates the incremental adoption section in the rewrites docs to mention the new fallback rewrites instead of the no-op rewrite and also points to the incrementally adopting Next.js doc. 

## Documentation / Examples

- [x] Make sure the linting passes

Closes: https://github.com/vercel/next.js/pull/23700
Closes: https://github.com/vercel/next.js/issues/23699
2021-04-18 08:26:08 +00:00
Julien Benchetrit
646a881183
Docs update: Redirect paths with parentheses (#24062)
It took me quite a while to understand that in order to redirect from `/english(default)/:path` to `/en-us/:path`, I have to escape the parentheses in the source with double backslashes so I thought I'd suggest it as a small doc update.


## Documentation / Examples

- [x] Make sure the linting passes
2021-04-17 19:40:35 +00:00
Steven Tey
6e22a440e2
Updated prefetch documentation (#24171)
Added the fact that when `prefetch` is set to `false`, Next will prefetch the link when an `onMouseEnter` is triggered. Response to issue #11793



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

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

## Documentation / Examples

- [X] Make sure the linting passes

Closes: https://github.com/vercel/next.js/issues/23525
2021-04-17 16:08:06 +00:00
Alex Vilchis
8df5fc5a8e
docs: Fix TypeScript casing (#24040) 2021-04-14 08:16:20 +00:00
JJ Kasper
4d291bd810
Use regex lexer for gathering named groups from has (#23626)
This is a follow-up to https://github.com/vercel/next.js/pull/23588 to update to use a regex lexer to gather the named regex groups instead of attempting to gather them through executing the regex since it can fail to gather the regex groups when they are using specific matching. This also ensures we don't pass the value as a segment when value is defined and it doesn't use a capture group. Additional tests are added to cover these cases and documentation updated to reflect this. 

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

## Bug

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

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-13 12:34:51 +00:00
JJ Kasper
de567d91d7
Update incremental migration doc and add version for new rewrites (#23859)
This updates the incremental migration doc to mention the new fallback rewrites over the previous no-op rewrite behavior. This also mentions the version the new rewrites modes were added to the rewrites doc.  

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-09 18:59:59 +00:00
JJ Kasper
1cf7360788
Add experimental note to docs for has (#23835)
This adds a note the `has` documentation mentioning the feature is still experimental as we currently show a warning when the feature is used stating the same. 

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-08 18:39:25 +00:00
Tim Neutkens
d2dc91c80c
Add note about prefetching (#23732)
Fixes #23687



## Bug

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

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

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-07 16:07:32 +00:00
Sam Robbins
4de984ca23
Update router.md to improve a11y (#23611)
Code examples used `span`, change to use `button` for better accessibility 

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-01 18:26:19 +00:00
Joe Haddad
eecc3342cb
Temporarily remove experimental ESLint integration (#23521)
This pull request **temporarily** removes ESLint, as it was not landed in accordance with our standard experimental policies. We are fully committed to landing this change again.

This is being reverted because:

- Next.js has very strict goals for its install size. This feature resulted in adding over 17MB, or a 43.6% increase.
- The feature was not first landed under the `experimental` key in `next.config.js`, rather, it was added under the stable namespace (top-level)
- Using the feature doesn't do a "guided setup" like TypeScript, it should ask you to "bring your own" dependencies for ESLint
- It uses a undesirable ESLint plugin name: `plugin:@next/next/recommended`. This should read out as strictly `next`, or as short as we can get it.
- Does not provide actionable warnings (missing link to resolve issue)
- Does not follow appropriate console output styling. We need to revisit how these are presented.

To re-land this, we need to ensure the following minimums are met:
- Very minor change in install size
- Fully experimental (i.e. flagged) with warnings
- Finalized package name and configuration shape, preferably so we can do ` { extends: 'next' } `.
2021-03-30 08:26:35 +00:00
Jiachi Liu
737c25edd8
doc: fix ActiveLink detection condition (#23472)
## Documentation / Examples

- [x] Make sure the linting passes


`router.pathname` can be dynamic routes like `/posts/[slug]`, use `router.asPath` instead to detect anchor is active
2021-03-28 14:17:50 +00:00
JJ Kasper
d130f63c41
Add handling fo beforeFiles, afterFiles, and fallback rewrites (#23407)
This adds support for returning an object from `rewrites` in `next.config.js` with `beforeFiles`, `afterFiles`, and `fallback` to allow specifying rewrites at different stages of routing. The existing support for returning an array for rewrites is still supported and behaves the same way. The documentation has been updated to include information on these new stages that can be rewritten and removes the outdated note of rewrites not being able to override pages. 



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-03-26 15:19:48 +00:00
JJ Kasper
75c721c583
Add has route field (#22341)
This adds support for a `has` field to `rewrites`, `redirects`, and `headers` to allow matching against `header`, `cookie`, and `query` values. Documentation and additional tests for the feature is also added in this PR. 

Closes: https://github.com/vercel/next.js/issues/22345
2021-03-24 16:50:16 +00:00
Houssein Djirdeh
e5ef60fecb
Add ESLint to Next.js (#22437)
For #22228

This PR:

- Adds ESLint to toolchain
  - Included by default for builds (`next build`)
  - Can be enabled for development (`next dev`)
  - Custom formatter built for output
- Adds appropriate tests
- Adds two documentation pages
2021-03-23 21:32:42 +00:00
Josh Flayhart
34e9409770
[Docs] Update next.config.js link to default config (#22989)
It's currently misleading and I chose to freeze to a particular version since pointing to canary every time is likely to break (as is happening prior to this PR).

The link will now go to: https://github.com/vercel/next.js/blob/v10.0.8/packages/next/next-server/server/config-shared.ts#L33
2021-03-17 20:21:39 +00:00
Lee Robinson
f3cbdf0b02
Document how to use basePath with next/image. (#23123)
Supersedes https://github.com/vercel/next.js/pull/23115 for more clarity and a better recommendation.
2021-03-16 19:56:41 +00:00
Abdullah Mzaien
e36eb381da
Duplicate scroll description (#23103)
- `scroll` - Optional boolean, controls scrolling to the top of the page after navigation. Defaults to `true` and 
  - `scroll`: Scroll to the top of the page after a navigation. Defaults to `true`
as options for router.push
2021-03-16 16:39:14 +00:00
Yuki Takemoto
635a98e2fd
Fix typo (#22891)
This PR fixed a typo in api reference.
2021-03-09 01:37:52 +00:00
Jason Emery
81b05256dd
Update router.md (#21899)
include scroll option documentation for router.push
2021-03-08 13:52:37 +00:00
Ålex
5b0ed99093
Fix grammar in next/amp API reference (#22653)
Change 'an' of "The page has an user-accessible" to 'a'.
2021-03-02 00:33:09 +00:00
Lee Robinson
eb79218b7d
Add note about other redirects to next.config.js docs. (#22640)
In case a user lands on this page via search or from Google, we should mention the other ways you can redirect with Next.js.
2021-03-01 16:33:04 +00:00
JJ Kasper
d9bb645c03
Mention regex route behavior with i18n (#22500)
This mentions how locale routes are transformed when `locale: false` is not used to explain why regex routes might not match with i18n. 

Closes: https://github.com/vercel/next.js/issues/21507
2021-02-24 19:04:30 +00:00
JJ Kasper
9793e9004f
Add isPreview field to router (#21638)
This adds an `isPreview` field to the `next/router` to allow detecting when in preview mode. 

Closes: https://github.com/vercel/next.js/issues/14903
2021-02-18 18:34:33 +00:00
Mike Jerome
1c3ac0e3eb
Document scroll option for router.push (#22275)
Clarify in the docs that scroll is an option for router.push() and it defaults to true.
2021-02-17 16:02:18 +00:00
Flavio Wuensche
ee184a11d8
Add example for headers and link in the docs (#21821) 2021-02-05 09:07:22 -06:00
mcha
c619f41f92
Doc: pageExtensions - note regarding affected files (#21326)
#21279 

This is just a comment explaining that changing `pageExtensions` not only applies to `pages/*` but other files as well.
2021-01-26 11:49:36 +00:00
Faizan Virani
6c51ad96ac
Added Typescript example for withRouter (#18116)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-25 14:48:28 +01:00
Justin Smith
8d92010979
Update headers.md to clarify Cache-Control gets overwritten in prod (#19967)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-24 17:14:19 +01:00
Lee Robinson
9afc0f58c4
Add docs for custom image loaders. (#20788)
Docs for https://github.com/vercel/next.js/pull/20216/.
2021-01-06 02:16:09 +00:00
JJ Kasper
f8e44b9425
Add documentation for rewrite params query passing behavior (#20757)
Closes: https://github.com/vercel/next.js/issues/20197
2021-01-05 14:47:08 +00:00
Tim Neutkens
a1a4af2d32 Bring back indicator documentation with a note that the feature has been removed 2021-01-05 12:47:52 +01:00
Tim Neutkens
74166ea7e8
Remove outdated documentation (#20714)
Fixes #20487
2021-01-04 10:45:57 +01:00
Frédéric Montet
98752eb0f1
Update link.md (#20435)
Added the `locale` prop in the Link documentation. At the moment it is only stated in the i18n doc.
2021-01-03 14:48:54 +00:00
JJ Kasper
fad3256091
Update docs for basePath: false rewrite (#20663) 2021-01-01 12:40:25 -05:00
JJ Kasper
3a9d18b549
Add isReady field on router (#20628)
Adds an `isReady` field on `next/router` specifying whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server.

Closes: https://github.com/vercel/next.js/issues/8259
Closes: https://github.com/vercel/next.js/pull/9370
2020-12-31 16:54:32 +00:00
Lee Robinson
380afbfba2
Add docs on authentication patterns. (#16277)
Building off [this Slack conversation](https://vercel.slack.com/archives/CGD3XGSD7/p1597329727013900), this PR adds a top-level section to the documentation on authentication patterns.

Please provide any and all comments! A few open thoughts I have:

- ~Should this include code snippets from the related providers or stay very high-level? At what point do we delegate to the examples folder?~ Keep things high level and delegate to examples folder 
- ~Should this include any related cards at the bottom?~ Added to the bottom
- ~Should other places in the documentation link back to here?~ Added link from routing
- Should it be a top-level route, or be underneath advanced?
2020-12-31 08:28:11 +00:00
Joe Haddad
74693810d0
docs: update image docs for consistency (#20621) 2020-12-30 16:33:21 -05:00
Joe Haddad
45b87aa23a
feat(next/image): preload priority images (#20615)
The HTML Living Standard explicitly says `href` should be omitted to prevent the loading of an incorrectly sized image:
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset

![image](https://user-images.githubusercontent.com/616428/103378205-8a013800-4aaf-11eb-9085-10f547263fed.png)

Since it's in the spec, I assume this is valid-enough HTML.

This also dedupes preloads which the old implementation did not.

---

Fixes #18756
x-ref #19118
Fixes #18720
2020-12-30 21:10:28 +00:00
Lee Robinson
a03f1f3847
Add version history for API changes to documentation. (#20604)
Closes https://github.com/vercel/next.js/issues/20036.
2020-12-30 15:06:34 +00:00
Daniel Yefet
69ff649999
Remove "priority" prop from Image docs (#20471)
I don't think the docs should still mention the `priority` prop because the feature no longer exists since this was merged -  https://github.com/vercel/next.js/pull/19118

It certainly caught me out! 😬 https://github.com/vercel/next.js/issues/20438
2020-12-29 00:29:32 +00:00
Leo Toneff
25cb43a73b
Added flag to identify shallow router events (#19802)
This PR is an implementation of RFC #13276 (more specifically @banerjeesouvik's [suggestion](https://github.com/vercel/next.js/discussions/13276#discussioncomment-17874)) which solves #3322 by adding an extra parameter to the router events that'll allow you to see whether or not the route is shallow.

This is a recreation of PR #13243.
2020-12-17 09:14:50 +00:00
Tuan Nguyen
977b3ed769
Correct a typo (#20183) 2020-12-14 21:43:12 +00:00
Dmitry Belyaev
a442841517
Update Link documentation (#19980)
Mention onClick property for next/link wrapping custom components
2020-12-14 10:02:10 +00:00
Bruno Antunes
8340e6d345
[Image Component] image sizes property becomes 100vw by default (#20067)
Currently if sizes is not defined, Next.js is setting sizes as:
```
(max-width: 640px) 640px, (max-width: 750px) 750px, (max-width: 828px) 828px, (max-width: 1080px) 1080px, (max-width: 1200px) 1200px, (max-width: 1920px) 1920px, (max-width: 2048px) 2048px, 3840px'
```

This pull request will make sizes be `100vw` by default, which will allow us to download "smaller" images than what's currently happening. 

In a demo app I have, the difference is between downloading 488KB vs 1.4MB (in images)
2020-12-10 21:29:37 +00:00
JJ Kasper
e6c1aa6483
Add locale: false custom route prefix note (#19765)
This makes sure to note how custom-routes need to be prefixed when `locale: false` is used for routes to be matched correctly. 

Closes: https://github.com/vercel/next.js/issues/19703
2020-12-04 13:32:50 +00:00
Curt Siffert
f4bf8a4696
Update getInitialProps.md (#19506)
To clarify what I've noticed as a common source of confusion in discussions online. Fixes https://github.com/vercel/next.js/issues/19426 

If you wish to know whether the code is running as part of a client-side page transition, in either `getInitialProps` or `getServerSideProps`, you can check to see if `context.req.url` starts with `/_next/data`.
2020-11-25 11:23:04 +00:00
Luis Alvarez D
0ed8152858
Update documentation links (#19502)
- Updated some links in docs that don't have the `.md` extension. Not required for our live docs but useful for the GitHub view.
- Updated links that go to https://nextjs.org/docs to a relative path, that way they'll work for versioned docs
- Updated the `Regex Path Matching` example to be consistent with the paragraph above and with the official example in /examples.
2020-11-25 00:00:06 +00:00
Shihabudheen US
fc9fa10618
Add note about disabling prefetching (#19299)
Added the line _Prefetch can be disabled by passing `prefetch={false}`._
2020-11-20 14:44:29 +00:00
Luis Alvarez D
b955268dbb
Update next/link docs to not include example without href (#19247)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-18 13:39:35 +01:00
JJ Kasper
1e61b69e31
Add locale: false for custom-routes + i18n (#19164)
This mirrors the `basePath: false` behavior for custom-routes with `locale: false` to allow users to configure the locales manually (`locale: false`) or have the locales be handled automatically for custom-routes. 

Fixes: https://github.com/vercel/next.js/issues/18927
Fixes: https://github.com/vercel/next.js/issues/18795
2020-11-14 03:35:42 +00:00