Commit graph

16966 commits

Author SHA1 Message Date
Tobias Koppers
ff5338ce03
disable cache compression (#53427)
### What?

Disables webpacks cache compression

### Why?

CI already compresses the cache. No need for next.js to do that. In fact this actually causes worse experience in multiple ways:

* CI compresses the cache after the build has finished. So compressing inline slows down the build.
* gzip compression runs with BEST_SPEED optimization, which creates larger cache files. This leads to running into potential cache size limits easier.
* Two layers for compression are not efficient in size and speed.

Trade-off:

* The whole cache will be decompressed on every build, which is less efficient.

In a few tests the benefits are greater than the trade offs.
2023-08-01 08:51:03 +00:00
lijianan
a462a1583f
fix: update lost dependencies for examples (#53419)
update lost dependencies for examples
2023-08-01 04:06:07 +00:00
Lee Robinson
19c4eec064
docs: fix broken diagram in caching docs (#53414)
Follow up from https://github.com/vercel/next.js/pull/52514.

We're still missing the static and dynamic diagram, it was missed in the PR to `front` to add the original diagrams. We'll need to get that in as well, could be here, or in a follow up.
2023-08-01 03:21:00 +00:00
Steven
cdbea3e7da
chore(ci): remove console.log() (#53413)
Follow up to #53408
2023-08-01 01:32:11 +00:00
JJ Kasper
975fb1f466
Fix windows unit tests (#53412)
Fixes differences in tests to handle windows now that we've fixed them
not being run.

x-ref:
https://github.com/vercel/next.js/pull/53408/checks?check_run_id=15501915673
2023-07-31 18:06:18 -07:00
Steven
8c6da3f72d
chore(test): move build-spinners node-pty test to isolated (#53408)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-01 00:30:22 +00:00
Zack Tanner
3b1ccbf996
additional test runner refactoring (#53406)
This relocates the regex patterns that were being used for `test-dev`, `test-prod`, and `test-integration` actions to be part of `run-tests`. Also fixes e2e tests since they were expected to be found in `e2e` rather than `test/e2e`, and updated it exit with a failure code in case of no tests being found 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-01 00:04:45 +00:00
Josh Goldberg ✨
fc52e02787
chore: enable typescript-eslint's recommended and stylistic configs internally (#52948)
Spinning out from #37151 and my draft PR #52845, this enables the two
basic recommended rulesets from
[typescript-eslint](https://typescript-eslint.io) for the Next.js
monorepo source code:

*
[`plugin:@typescript-eslint/recommended`](https://typescript-eslint.io/linting/configs#recommended):
Our base recommended rules that detect common bugs or _(non-stylistic)_
TypeScript bad practices
*
[`plugin:@typescript-eslint/stylistic`](https://typescript-eslint.io/linting/configs#stylistic):
Our base starting stylistic recommended for keeping codebases visually
consistent and avoiding out-of-practice visual constructs

The process I used is pretty standard (see
https://github.com/typescript-eslint/typescript-eslint/issues/6760 for
other repos it was done on):

1. Enable those base recommended presets
2. Remove any rule settings that are now redundant
3. Reconfigure any rule whose default settings didn't seem to make sense
for this codebase
4. Add a `// Todo: ...` comment, and under it, add a disable for any
rule that immediately reported a lot of complaints

Note that this only enables the presets internally. It doesn't impact
what end-users of published packages such as Next.js or
`create-next-app` experience. That's a separate task in #52845.

I also didn't fix any existing warning from the `canary` branch. Would
you like me to do that? My preference would be a separate PR to get it
in more quickly.

Any code changes are commented inline.

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-07-31 16:32:54 -07:00
Shu Ding
7182d4dd2a
Always add ?ts= query for scripts during development (#53411)
Safari caches scripts during the same browsing session no matter what cache headers are set. This makes it impossible to update our runtime bundles (e.g. Webpack's runtime) during development as the legacy bundle might be cached and still served. If an updated client bundle uses a feature (e.g. `__webpack_require__.n`) that causes a change of the runtime, it triggers an error.

The most straightforward solution would be adding a query to prevent caching.

Fixes #53281.
2023-07-31 22:32:28 +00:00
vercel-release-bot
caf5ee80be v13.4.13-canary.8 2023-07-31 20:06:20 +00:00
Tim Neutkens
a721a749d8
router: apply server actions in a similar way to router.refresh() (#53373)
## What?

I was investigating reports of server actions with `revalidatePath` /
`revalidateTag` not invalidating the client-side router cache. Managed
to reproduce the issue here:
https://github.com/timneutkens/server-actions-test (requires Vercel KV
to run).

While looking at the reducer I noticed a few things that seemed off:

- setTimeout to trigger another `dispatch` on the same reducer with the
fetched data. This means that it would not be part of the same React
Transition.
- redirects weren't applying the data that comes back from the server
(that allows for single hop navigation)
- prefetchCache was invalidated, but the router cache which is used for
back/forward navigation was not invalidated, causing back/forward to not
get the new data.
- all changes in the action-reducer mutate. The part that shouldn't
mutate was part of that setTimeout dispatch.

This PR aims to solve all of these by reworking the actions reducer to
be handled similarly to `router.refresh()`. Since `router.refresh()` was
already modeled to be similar to `revalidatePath('/')`.

The flow is now more like the other reducers:
- Fetch data
- Wait for the data to come back
- Apply the data to the cache and keep it in a mutable variable
- Return the new cache and otherwise values like the url

In particular the actions reducer handles a few extra specifics:
- Resolving the server action promise, so that the value is passed to
the application code waiting for the result.
- Applying redirects from `redirect()` calls.
- Invalidating the router cache

## Followup changes

- Currently when calling `revalidatePath('/dashboard')` the entire
router cache is invalidated instead of only `/dashboard` and further
down, this is not in scope for this PR but still has to be added.
- `notFound()`, I'm not sure how this is supposed to work exactly, it
doesn't really make sense to me to allow it in server actions.

Kudos @feedthejim for helping investigate for this PR 😌 

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-07-31 21:52:31 +02:00
Wyatt Johnson
03a09ba1e6
Shared Loaders for Webpack and Turbopack (#52846)
This updates the Turbopack build code to provide the same `routeModule` export for App Pages as the Webpack loader does. This also adapts the Turbopack and Webpack loaders to use a shared loader file that is templated.

Fixes NEXT-1469

The template supports the following styles:

# Injections

```ts
declare const tree: LoaderCode
```

Allows you to define the variable in scope in TS, this lets you reference it with correct types within the rest of the file.

```ts
// INJECT:tree
```

Is replaced by the variable that's injected. This lets you ensure the correct invocation/initilization order.

# Variables

Variables will be substituted in the TS code when found. It's only really useful for strings, as the definition looks for the following in the outputted JS code:

```ts
"VAR_REPLACE_ME"
```

So you can have something like:

```ts
const thing = new AmazingThing({ page: "VAR_PAGE" })
```

And it'll be replaced by:

```ts
const thing = new AmazingThing({ page: "/thing" })
```

Where `VAR_PAGE` is `JSON.stringify("/thing")`.
2023-07-31 19:20:04 +00:00
vercel-release-bot
82e3d5126a v13.4.13-canary.7 2023-07-31 17:31:05 +00:00
JJ Kasper
d8d45a9843
Remove fibers from peerDependencies (#53395)
We don't need this peerDependency as it's no longer recommended and only
added for specific cases. This avoids us having to run `node-gyp` just
for this peer dep.

> NOTE OF OBSOLESCENCE -- The author of this project recommends you
avoid its use if possible.

x-ref:
https://github.com/vercel/next.js/actions/runs/5716924037/job/15489725344?pr=53391
2023-07-31 10:12:42 -07:00
Delba de Oliveira
98c3076eb4
Docs: Document caching mechanisms (#52514)
This PR document the caching semantics in Next.js, how they interact, and what APIs affect them. We're also taking the opportunity to consolidate terminology, remove duplicate content, and update sections of the docs that relate to caching. 

### Documentation

- [x] Create a new section for caching
- [x] Explain how the different caching mechanisms work
   - [x] Request Memoization (React Cache)
   - [x] Persistent Data Cache 
   - [x] Persistent Full Route Cache 
   - [x] In-memory, client-side Router Cache 
- [x] Document how different APIs affect caching
- [x] Document cache interactions 
- [x] Clean up stale information in the other docs sections
   - [x] Routing Section
      - [x] Move advanced navigation topics from fundamentals to **How Navigation Works** section
      - [x] Rewrite the **How Navigation Works** section
   - [x] Rendering Section
      - [x] Simplify fundamentals page
      - [x] Rewrite the **Static and Dynamic Rendering** pages
      - [ ] ~Create a page to explain how **Client and Server Components** are rendered~. Moved to this PR: https://github.com/vercel/next.js/pull/51579
   - [x] Data fetching section 
      - [x] Consolidate data fetching story for fetching, caching, and revalidating
      - [x] Clarify data fetching story with 3rd party libraries and React `cache`
      - [x] Create **Data Fetching Patterns** page
- [x] Document other related behaviors: 
   - [x] Update information on scroll position for back/forward navigation 
   - [x] Remove the concepts of **soft and hard navigation**
   - [x] Remove the concepts of **static and dynamic data fetching**
   - [x] Use consistent terminology **runtime** 👉🏼  **request time**. Runtime for Edge and Node.js, request time to describe when dynamic stuff happens
   - [x] `generateStaticParams` being able to seed the Full Route Cache
- [x] Polish 💅🏼 

---
### Related PRs:

- Diagrams: https://github.com/vercel/front/pull/24142
- Redirects: https://github.com/vercel/front/pull/24179
2023-07-31 17:03:26 +00:00
JJ Kasper
35e16f75bc
Tweak flakey prefetch test handling (#53391)
Seems this one is still finicky so re-works it some more. 

x-ref: https://github.com/vercel/next.js/actions/runs/5716005333/job/15486690109
2023-07-31 16:20:43 +00:00
Jiachi Liu
de873d02b3
Prefer svg icon instead favicon if possible (#53343)
### What?

Change the `favicon.ico` metadata `sizes` property from always `"any"`
to using the actual size possible

### Why?

When chrome/firefox browsers search for icon it needs the proper
metadata to determine which one to use, giving `favicon.ico` sizes with
`"any"` will prevent it loading the `icon.svg` as default icon when
available.

Changing to set proper size of `favicon.ico` (as the `favicon.ico` sizes
could be 16x16, 32x32, etc.) fixes the issue.

It works (loading svg icon) for chrome and firefox:

Firefox
<img width="505" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/6873e595-479d-4d9e-ae5c-39e5f938fcf5">

Chrome
<img width="460" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/03bbe4c7-ef76-4f34-a611-337b0d4b97a3">

It loads favicon.ico for Safari:
Using the `test/e2e/app-dir/metadata` app it shows the favicon.ico for
Safari
<img width="1000" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/92cc8714-ea5e-432d-8144-2a4a42ee4ce2">

Can't have it as an e2e test as I tested it always loads the
`favicon.ico` in headless mode which can't determine the behaviors

Fixes #52002

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-31 07:32:39 -07:00
JJ Kasper
0c70b9fff6
Fix build-native turbo config (#53380)
The turbo cache is currently not being invalidated for our `build-native` jobs when the root `Cargo.lock` is changed so https://github.com/vercel/next.js/pull/53308 never actually got re-built/applied in CI and tests are unexpectedly passing. 

x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1690808468319679)

- Related to https://github.com/vercel/next.js/pull/52414
2023-07-31 14:00:30 +00:00
JJ Kasper
e1a10c60f8
Revert "Update swc_core to v0.79.33 (#53308)" (#53381)
This reverts commit da043b5535.

x-ref: https://github.com/vercel/next.js/pull/53380
2023-07-31 06:35:38 -07:00
Jimmy Lai
f2c5eb840f
actions: fix revalidate after redirect (#53368)
This PR reverts a change that removed the `content-length` header filtering from the req made by the actions when redirecting. This change made some tests flaky and presumably also broke server actions in subtle ways.

There's still one other bug when redirecting after revalidating that will happen in you revalidate a page that was already rendered before where we will still show stale content. @timneutkens is fixing that one.

NEXT-1483
2023-07-31 10:08:52 +00:00
lijianan
a0d1d728b9
examples: update examples with-ant-design (#52896)
demo: update examples with-ant-design

- https://github.com/ant-design/ant-design/pull/43663
2023-07-30 23:35:46 +00:00
Ozan Sevkin
97a0a3373f
docs: update active link code snippet for better equality check (#53327)
Update pathname and href matching check from startsWith() method to strict equality. startsWith() method causes all paths to match with root link "/"
2023-07-30 23:21:59 +00:00
JJ
d3b0c7bb42
[Docs] remove x-xss-protection-header (#53362)
The x-xss-protection header is a non-standardized http header with low browser-capability.
If it is likely to be supported in the future, it can be treated as experimental, but since it is not, it is preferable to remove it.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
https://caniuse.com/mdn-http_headers_x-xss-protection
2023-07-30 20:12:41 +00:00
JJ Kasper
4a926efb83
Update flakey app-action and prerender-prefetch tests (#53340)
x-ref:
https://github.com/vercel/next.js/actions/runs/5699334417/job/15448149485#step:27:600
x-ref:
https://github.com/vercel/next.js/actions/runs/5702064037/job/15453403529?pr=53340
2023-07-30 12:51:24 -07:00
Donny/강동윤
da043b5535
Update swc_core to v0.79.33 (#53308)
### What?

Update `swc_core` to 00a0575408

### Why?

To fix minifier regression.

### How?

 - Closes WEB-1326
 - Fixes #53151
 - Fixes #53286
 - Fixes #53273
2023-07-29 07:58:03 +00:00
Steven Tey
ed35e2a6ea
Added docs on async not-found.js server components (#51999)
While `not-found.js` components do not accept any props, you can still turn the `not-found.js` component into an async server component to fetch dynamic data:


```tsx filename="app/blog/not-found.tsx" switcher
import Link from 'next/link'
import { headers } from "next/headers";

export default async function NotFound() {
  const headersList = headers();
  const domain = headersList.get("host")
  const data = await getSiteData(domain)
  return (
    <div>
      <h2>Not Found: {data.name}</h2>
      <p>Could not find requested resource</p>
      <p>
        View <Link href="/blog">all posts</Link>
      </p>
    </div>
  )
}
```

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-29 07:33:28 +00:00
Dom Sip
b149fb7009
docs: Update Route Handlers AI example code snippet (#52127)
changing AI example model from `text-davinci-003` to `gpt-3.5-turbo`
which is in a `chat/route.ts` format.

The alternative but with "completition" style would be a bit longer code
like:

```
// app/api/completion/route.ts

import { Configuration, OpenAIApi } from 'openai-edge'
import { OpenAIStream, StreamingTextResponse } from 'ai'

export const runtime = 'edge'

const apiConfig = new Configuration({
  apiKey: process.env.OPENAI_API_KEY!,
})

const openai = new OpenAIApi(apiConfig)

function buildPrompt(prompt: string) {
  return prompt.split('\n').map((message) => ({
    role: 'user',
    content: message,
  }));
}

export async function POST(req: Request) {
  
  // Extract the `prompt` from the body of the request
  const { prompt } = await req.json();

  // Request the OpenAI API for the response based on the prompt
  const response = await openai.createChatCompletion({
    model: 'gpt-3.5-turbo',
    stream: true,
    messages: buildPrompt(prompt),
    max_tokens: 500,
    temperature: 0.7,
    top_p: 1,
    frequency_penalty: 1,
    presence_penalty: 1,
  })

  // Convert the response into a friendly text-stream
  const stream = OpenAIStream(response)

  // Respond with the stream
  return new StreamingTextResponse(stream)
}

```

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-29 00:25:48 -07:00
Julien Bouquillon
71f08ef873
docs: fix typo (#53100)
just a typo in next/jest docs
2023-07-29 07:12:33 +00:00
Shunya Hayashi
dffafdecd3
Update nginx.conf example in documentation for improved flexibility and clarity (#53135)
## Description

This PR updates the provided example of nginx.conf in the documentation. The changes introduce more flexibility and clarity, making the example easier to understand and more suited for general use.

## What?

Changes include ↓

- Modifying the root directory to `/var/www/out`. This aligns more closely with typical server configurations and separates the public web content from other parts of the server.

- Updating the try_files directive for the `/` location block. The directive now attempts to serve `$uri`, `$uri.html`, and `$uri/` in that order. This setup caters to the common pattern in static websites of serving files derived directly from the URL and correctly handles URLs that omit the .html extension.

- The `/blog/` location block is retained as is, with the rewrite directive still relevant and not requiring changes.

## Why?

These modifications aim to improve the applicability of the example to a wider range of use cases and make it more comprehensible for new users.

## How?

The changes were made directly to the `nginx.conf` example provided in the docs, following the standard syntax and conventions of Nginx configuration files.


Please let me know if there are any questions, or if further modifications are needed !!

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-29 07:03:14 +00:00
Balázs Orbán
5bccef85f2
chore(examples): fall back to English dictionary in i18n example (#53207)
If an unknown locale is detected, we should fall back to English

Fixes #53201


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-29 06:38:26 +00:00
Mayank
c7f9ffac5a
Clarify requirements for running examples (#53143)
- to avoid #53037 kind of issues.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-07-28 22:59:16 -07:00
Tobias Koppers
3abaa85977
update turbopack (#53291)
* https://github.com/vercel/turbo/pull/5626 <!-- Tobias Koppers - remove
require.cache clear from chunk loading -->
2023-07-28 22:57:36 -07:00
Zack Tanner
50f963f704
remove --force from install-native postinstall (#53320)
This was leftover from when we were using yarn but `--force` has different behavior in pnpm (it will install all optionalDependencies regardless of the current environment), which was causing tests to slowdown
2023-07-28 23:54:48 +00:00
Justin Ridgewell
3906374740
Try to fix flakey socket hang up failures in stream cancel tests (#53318)
### What?

I think the flakiness from the new stream cancel tests is due to a uncaught error thrown from the priming. If it is during the priming, then we need to also explicitly check if we restart the test and reset the `streamable`.

### Why?

Flakey tests suck.

### How?

- Adds a `on('error', reject)` to catch the socket error and associate it with the test
- Explicitly checks for the `?write=` param to see if we're priming or getting results
2023-07-28 22:59:24 +00:00
Andrew Garvin
ce29de25e4
Fixed simple typo in documentation (#53317)
I think this is a typo, at the very least I found the sentence a little clunky.
2023-07-28 21:22:37 +00:00
Steven Tey
7f77f427d2
docs: Add next-international to examples list (#53303) 2023-07-28 21:04:22 +00:00
Felipe Oliveira
46677ccda6
fix: (README.md) Fix typing error (#53311)
Fix typing error on documentation where 'deploying' it was written as 'deloying'
2023-07-28 20:43:43 +00:00
Zack Tanner
afa9f96515
add a "skip" cache type to verbose logging mode (#53275)
When verbose logging is enabled and a cache MISS is logged due to either `revalidate: 0`,`cache: no-store` or `cache-control: no-store`, this logs a slightly different message, ie:

```
- GET / 200 in 804ms
   ├─── GET <url> in 205ms (cache: SKIP, reason: cache: no-cache)
   ├────── GET <url> 200 in 0ms (cache: HIT)
   ├────── GET <url> 200 in 373ms (cache: SKIP, reason: revalidate: 0)
   └────── GET <url> 200 in 111ms (cache: SKIP, reason: cache-control: no-cache (hard refresh))
 ```
 
 Closes NEXT-1412
2023-07-28 20:01:31 +00:00
Li Ming
16a5aa74d0
feature: Update cases in [Incorrect nesting of HTML tags] (#53282)
It took me much time to debug this issue during my development process, and since the error logs(you can see below) given are not very clear, I hope it will help others who encounter the same problem.

<img width="954" alt="image" src="https://github.com/vercel/next.js/assets/1228449/69fd949e-f396-44e3-833c-8e7bbf080492">

ref: 
- [Are you allowed to nest a link inside of a link?](https://stackoverflow.com/questions/9882916/are-you-allowed-to-nest-a-link-inside-of-a-link)
- [Interactive Content](https://html.spec.whatwg.org/#interactive-content-2)
<img width="1283" alt="image" src="https://github.com/vercel/next.js/assets/1228449/db864080-14fd-45e1-9468-54365c6afddc">


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-07-28 18:12:15 +00:00
Sukka
127e30ed42
refactor(cna): make create-next-app even smaller (#53241)
The PR follows #53146 and #53115.

The PR does 3 things:

- Replaces a [very heavy dependency `cpy`](https://github.com/vercel/next.js/pull/53146#issuecomment-1649193789) with a more lightweight copy helper.
  - The `fs.cp(src, dest, {recursive: true})` API is not used, as it is still experimental:
  <img width="1630" alt="image" src="https://github.com/vercel/next.js/assets/40715044/c61a454a-3a96-4658-a389-fbb68c241f18">
- Update `cross-spawn` to the latest version `7.0.3`
  - The only breaking change introduced in `cross-spawn@7.x` is dropping Node.js 8 supports, which allows `cross-spawn` to drop a dependency. Since `create-next-app` requires Node.js 16.8.0, I assume bumping `cross-spawn` would be safe.
- Update `fast-glob` to the latest version `3.3.1` to remove more KiBs (pointed out by @imranbarbhuiya)
  - The breaking change introduced in `fast-glob@3.x` is dropping Node.js 8 supports and some options changes.

Together the PR removes another 202 KiB from the `create-next-app/dist/index.js`. The size of `create-next-app/dist/index.js` is now 616 KiB.

<img width="583" alt="image" src="https://github.com/vercel/next.js/assets/40715044/4deb5e36-a63b-4501-b67c-29ea06e30578">
2023-07-28 17:21:58 +00:00
Zack Tanner
604681912b
ensure colocated unit tests run in CI & fix various failing tests (#53270)
Colocated unit tests (such as ones in `packages/next` and `packages/font`) weren't running in CI since `run-tests` marks the glob cwd as `<root>/tests`. This modifies the working directory to be the root so the new expanded test pattern will pick up files outside of `test/`.

Several of these tests were failing so there are updates in here to fix them. Specifically:

- Source Sans Pro font was renamed to Source Sans 3
- `fillCacheWithDataProperty` test was hitting the `bailOptimistic` code path
- `resolve-metadata` had an invalid assertion (`rel: icon` gets added as part of `IconsMetadata`)
- `resolve-opengraph` wasn't handling undefined images
- `server-patch-reducer` now use inline snapshots as one was failing since it now has a prefetchCache
2023-07-28 13:54:15 +00:00
vercel-release-bot
e575179b3e v13.4.13-canary.6 2023-07-28 12:32:12 +00:00
Tobias Koppers
09a5521c89
Turbopack: clear require.cache after writing files (Next.rs API) (#53285)
### What?

make sure to clear require.cache when writing files again

### Why?

changes should be reflected on reloads
2023-07-28 12:48:55 +02:00
Balázs Orbán
aaa94cd6e0
fix(font): expose loading error for debugging (#53284)
### What?

Exposing the original error message.

### Why?

While looking at #53279, I noticed that we don't show the original error message, which makes it hard to guess why the error was thrown in the first place.

### How?

Related #53279
2023-07-28 08:19:50 +00:00
vercel-release-bot
0814c82d0b v13.4.13-canary.5 2023-07-28 00:50:18 +00:00
JJ Kasper
aed332b2f6
Implement Next.rs API (#52983)
This implements the handling for the new `--experimental-turbo` flag
that keeps the Next.js routing handling in front of turbopack and
leverages the new Next.rs API.

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
2023-07-27 16:15:31 -07:00
Tobias Koppers
7c67b1216c
fix route groups in app_structure (#53247)
### What?

the key shouldn't include route groups
2023-07-27 22:22:18 +00:00
Oyebadejo Michael
37bb09d36a
chore(docs): remove repeated closing bracket (#53268)
### Adding or Updating Examples

- The repeated closing bracket that comes just after "Server Actions" has been removed

### Fixing a bug

- fixes #53267
2023-07-27 19:35:34 +00:00
Alex Kirszenberg
f8107f0abb
Turbopack: Update Turbopack (#53266)
* https://github.com/vercel/turbo/pull/5621 <!-- Tobias Koppers - fix
esm export in build runtime -->
* https://github.com/vercel/turbo/pull/5620 <!-- Tobias Koppers - Revert
"export namespace object instead commonjs interop object" -->
2023-07-27 12:00:13 -07:00
JJ Kasper
70039c984b
Remove arbitrary timeout in pr/release stats (#53194)
Removes our arbitrary 3 minute timeout on commands in next-stats-action
which may be contributing to the recent failures for release stats to
run

x-ref:
https://github.com/vercel/next.js/actions/runs/5664570067/job/15348170497
x-ref:
https://github.com/vercel/next.js/actions/runs/5650726841/job/15307909184
x-ref:
https://github.com/vercel/next.js/actions/runs/5658309370/job/15329650002
2023-07-27 11:58:41 -07:00