Commit graph

11865 commits

Author SHA1 Message Date
Tim Neutkens
aa664868c1 v12.2.3-canary.13 2022-07-18 19:20:48 +02:00
Sam Becker
82c1e00c17
Add dark mode to default templates for Create Next App (#38671)
* Add dark mode to Create Next App

* Lint create-next-app css

* Widen boxes to optimize linebreaks

* Add color scheme to html, remove layout edits
2022-07-18 11:40:51 -05:00
Jiachi Liu
7e5cb510c4
Fix CSSM loader applying for both pages and app (#38761)
## Bug

x-ref: #38691

* Previous configured loader.issue results into a single function and will bail during next build, tune the rule set conditions to make it work for both pages and app dir
* prefer to use `mod.resourceResolveData?.path` instead of `mod.userRequest` since userRquest contains the applied loaders info

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-07-18 15:27:48 +00:00
Lee Robinson
54f87245dc
Update MongoDB example to use integration for deploy button. (#38738)
Rather than manually adding the environment variable.
2022-07-18 13:42:06 +00:00
Sukka
97df2bb095
refactor: rewrite etag (#38568)
x-ref: https://github.com/vercel/next.js/issues/38235#issuecomment-1182283358

Rewrite ETag generate function with `fnv1a` hash.

FNV hashes are designed to be fast while maintaining a low collision rate. The FNV speed allows one to quickly hash lots of data while maintaining a reasonable collision rate (https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed/145633).

[fastify-etag](https://github.com/fastify/fastify-etag) also uses `fnv1a` algorithm by default.

cc @shuding: Should `experimental-edge` also switch to `fnv1a` for ETag, for consistency?
2022-07-18 09:20:44 +00:00
Tim Neutkens
0610f9ac0d v12.2.3-canary.12 2022-07-18 10:32:26 +02:00
Jiachi Liu
653d5e7148
Fix missing client entry matcher and simplify imports path (#38691)
### Changes

#### Add missing virtual client entry matcher for css modules
client entry module has no file path, add the missing file matcher for client css modules loader

#### Use relative paths for imports in client entry to avoid module resolving failure.

if it's `next/head` or other 3rd party installed path, just import it instead of the resolved file path
2022-07-16 22:49:28 +00:00
JJ Kasper
67e10a7052
Ensure flight manifest is correct with app and pages dir (#38716)
This fixes the failing test case on canary in the `app-dir` test suite which is caused by the flight-manifest including references to the `pages/index` chunk and it being attempted to be loaded for a page in `app` which causes a webpack error in development. 

This also fixes an error from missing `getDerivedStateFromError` in our error boundary in development. 

## Bug

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

x-ref: https://github.com/vercel/next.js/runs/7360713710?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/7361755629?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/7361755806?check_suite_focus=true
2022-07-16 22:07:37 +00:00
Dorian
7280c3ced1
Update get-static-props.md (#38703)
Update the file name in the import statement in the "write server-side code directly" section in the documentation
2022-07-16 04:05:33 +00:00
Katie Byers
4a774a4864
feat(examples): Use helper function in with-sentry example _error.js (#37866)
This updates the `with-sentry` example to use the new helper function `captureUnderscoreErrorException` in its `_error.js` page. This new function both adds more data to sentry events and allows the code to be cleaned up quite a bit.

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

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

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-07-15 21:02:13 +00:00
eminvergil
0e6c63f26a
add user check in auth-with-stytch. (#38648)
* add user check in `auth-with-stytch`.

* Revert "delete auto.js in pollyfills"

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-07-15 12:02:18 -05:00
JJ Kasper
48401ec3a1
Update version for yarn pnp tests (#38688) 2022-07-15 11:41:53 -05:00
You Nguyen
bbbbe20c99
Add bundlejs site (#38677)
Add [bundlejs](https://bundlejs.com/) site - an online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.

The lowercase name is intentional.
2022-07-15 16:06:54 +00:00
Tim Neutkens
3017b606e0 v12.2.3-canary.11 2022-07-15 17:09:39 +02:00
Tim Neutkens
dbf94c5718
Fix check for optimistic routing and handle loading in server-patch (#38687) 2022-07-15 17:06:27 +02:00
Balázs Orbán
2da0ca2138 chore: tweak issue validator action 2022-07-15 14:36:06 +02:00
Tim Neutkens
e685214cec v12.2.3-canary.10 2022-07-15 14:21:49 +02:00
Tim Neutkens
c820fca3f0
Remove obsolete code from loader (#38681)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-15 14:21:06 +02:00
Tim Neutkens
916d20b5a8
Improve element detection further (#38684)
Follow-up to #38682. Instead of checking if the full element is in the viewport we only check if the top of the element is in the viewport. If it is not we have to scroll back up in cases of navigating between items in the same layout for example.
2022-07-15 14:19:21 +02:00
Tim Neutkens
3ebdf1988a v12.2.3-canary.9 2022-07-15 13:44:11 +02:00
Tim Neutkens
083f0523d8
Refine scrolling into view in new router (#38682) 2022-07-15 13:43:23 +02:00
Tim Neutkens
f05cee2d85
Rename query to searchParams for getServerSideProps in new Router (#38654) 2022-07-15 13:02:37 +02:00
Wyatt Johnson
3430ac1505
New Router Tests (#38390)
* test: added some test cases for new client side router

* tests: added additional test cases

* test: improved test support

* feat: added support for `<Link soft />`

* tests: improved test reliability

* tests: added more cases for catch-all routes

* tests: added app -> pages -> app tests

* tests: add tests for useCookies + useHeaders

* tests: added tests for usePreviewData

* tests: added more tests for hooks and client components

* tests: added tests for query/params handling

* tests: fix tests for param/query to use props

* tests: added some skipped tests for unimplemented features

* tests: linting

* refactor: updated TODO -> TODO-APP

* tests: added some more test cases

* tests: skipped failing test
2022-07-14 18:51:57 +02:00
Tim Neutkens
c1ce6bfe1b v12.2.3-canary.8 2022-07-14 17:06:56 +02:00
Tim Neutkens
fae919c2c6
Add focus and scroll management for new router (#38642) 2022-07-14 17:05:01 +02:00
Tim Neutkens
e06983bf74
Ensure selected segment is the value of dynamic routes (#38644) 2022-07-14 16:30:08 +02:00
Lee Robinson
b1bb3d94c6
Add documentation on accessibility. (#38522)
This PR outlines the built-in features of Next.js that help make your application accessible, and will also include some resources for testing/improving accessibility in your app.

Related: https://github.com/vercel/next.js/pull/20428
2022-07-14 13:05:39 +00:00
Tim Neutkens
f5af5bb0db v12.2.3-canary.7 2022-07-14 12:58:55 +02:00
Balázs Orbán
ef7c9a4080 chore: improve issue validator logs 2022-07-14 12:39:12 +02:00
Shu Ding
8a2bb49d6d
Fix failed to hydrate error with global CSS (#38626)
Temporarily we need to ensure that `<link>` tags are injected to `<head>` in the stream.

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-14 10:26:25 +00:00
Tim Neutkens
2473280f41
Fix reloading Client Component require.cache (#38633)
@delbaoliveira caught an issue where if you edit a client component multiple times it would cause a hydration error when reloading. Root cause of this was that the `require.cache` entry for `.__sc_client__` did not get removed, which this PR fixes.



## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-14 10:01:29 +00:00
JJ Kasper
ff148a0fb4
Update to latest version of turbo (#38629)
Updates to latest turbo which includes patches for cached files. 

x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1657767763630359?thread_ts=1657757803.039099&cid=C02CDC2ALJH)

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-14 09:03:35 +00:00
Balázs Orbán
0ac8ad07cb
chore: tweak issue validator (#38600)
- Do not comment/label if `next info` wasn't used, as we might not be able to detect the versions reliably.
- Ignore all issues that do not have the `template: bug` label or weren't labeled manually. (This might slip through a few issues that did not follow our template like [Reference in new issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-comment) but that's minimal overhead already)
- Added note when the reproduction URL is unreachable to invite me to the private repository.
- Turned on DEBUG mode (no comments/labels, only logs) for now, so we can verify the behavior and find issues.

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 23:15:25 +00:00
Shu Ding
5841aac8f5
Remove the hide-fouc tag earlier (#38614)
fix: remove hide-fouc tag earlier
2022-07-13 23:57:03 +02:00
OJ Kwon
102cef0f7b
refactor(next/telemetry): use basename for the absolute plugin path (#38473)
Minor changes to SWC plugin telemetry payload. SWC's plugin can be either resolvable npm pkg, or absolute path. If it's an absolute path, try to grab actual plugin name only as we do not need any 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 21:24:12 +00:00
Steven
53bc5b3dd3
Fix next/jest when testing next/future/image (#38569)
- Fixes #38383 
- Similar to a previous fix in #26502
2022-07-13 19:45:09 +00:00
JJ Kasper
62f3f87891
Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv

* update manifest

* update lib type

* remove old tests

* update to pre-build validation code

* ensure validate output is ncced

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Add example of typing next.config.js

Co-authored-by: Steven <steven@ceriously.com>
2022-07-13 13:31:55 -05:00
Jiachi Liu
5a15c5fb85 v12.2.3-canary.6 2022-07-13 19:33:11 +02:00
Tim Neutkens
b507e75e00
Remove implemented todos (#38610)
Went through the todos I had added while implementing the new router and removes everything that is now covered.


## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 16:51:55 +00:00
Tim Neutkens
7cb92a6e95
Add heuristic for optimistic push (#38599)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-13 17:52:52 +02:00
Trevor Finn
b9ad4aa579
Update Fauna examples to support new FAUNA_DB_DOMAIN environment variable (#38434)
* Update Fauna examples to support new FAUNA_DB_DOMAIN environment variable.

* Address PR feedback. Reduce interface refactoring

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-07-13 10:26:12 -05:00
Balázs Orbán
b0d64d647a
docs: clarify that matcher needs to be constant values (#38597)
Ref: #38461, #37346

As [introduced](https://github.com/vercel/next.js/pull/37177/files#diff-7ec7f47987bd890b5b47f6cf101398cd22fa37f874348d70036f85309a040c92
) in #37177, we statically analyze the `matcher` values, so we should make it clear.


## 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 `pnpm 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-07-13 14:36:10 +00:00
Myeonghwan Cho
9664c8d054
Add missing closing curly bracket in compiler option example (#38586)
This PR adds a missing closing curly bracket in the compiler option example of the [Styled Components](https://nextjs.org/docs/advanced-features/compiler#styled-components).

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 14:16:00 +00:00
Shu Ding
b8ed30648d
Remove the hide-fouc tags after hydration (#38592)
The current timing (after chunk loaded) isn't accurate enough because React hydrates asynchronously.

## 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 `pnpm 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: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-07-13 13:37:12 +00:00
Tim Neutkens
1e09d9bd40 v12.2.3-canary.5 2022-07-13 14:45:36 +02:00
Tim Neutkens
db4f032d57
Ensure .client.tsx/.ts/.jsx Client Components can be imported (#38591) 2022-07-13 14:43:37 +02:00
Tim Neutkens
722e64f06d v12.2.3-canary.4 2022-07-13 12:01:33 +02:00
Tim Neutkens
1e2b30dd51
Pass server context to Flight render (#38582)
Ensures you can use server context when navigating.


## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 09:40:09 +00:00
Tim Neutkens
13557eac6f
Handle server context being refreshed (#38580)
Temporary fix for refreshing of serverContext. We'll want to make a change for development with `createServerContext` to React itself in the future.


## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 08:48:01 +00:00
Tim Neutkens
842541250f
Add error when createServerContext is not available (#38578)
Ensures you get a clearer error when createServerContext is missing.


## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-13 08:20:51 +00:00