Commit graph

16796 commits

Author SHA1 Message Date
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
Zack Tanner
0d2c5520ed
refactor smooth scroll bailout logic in app navigations (#53186)
This refactors the changes from my previous PR to allow smooth scrolling for the appDir case -- `componentDidUpdate` isn't a reliable way to check if only the hash has changed. This adds a property to `focusAndScrollRef` and compares canonicalUrls (sans hash fragment)

- Original https://github.com/vercel/next.js/pull/52915

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-07-27 14:39:51 +00:00
Shu Ding
d15fd76ef7
Avoid bundling react-dev-overlay for dev (#53259)
Mark `react-dev-overlay` as an external for the client layer. This
reduces the server bundle by 1 MB (2.5 MB → 1.5 MB) during dev with
fewer resolve calls. Note that it applies to all pages, so this will
have a non-trivial memory improvement potentially.
2023-07-27 16:13:41 +02:00
Shu Ding
555ff3bcdb
Improved modularizeImports rules (#53051)
This PR adds some improved `modularizeImports` rules to ensure that some
of the popular UI libraries (mostly icons) can be correctly optimized
instead of creating thousands of modules. Here's an example of applying
this to `lucide-react`:

![CleanShot 2023-07-22 at 19 34
15@2x](https://github.com/vercel/next.js/assets/3676859/cf9ef13f-1d5d-4df6-9097-364983ea7b8b)

With https://github.com/swc-project/plugins/pull/196 being landed, we
can add different transform rules for specific names in the import. For
example, for `lucide-react` there're now 3 transforms:
- `'Lucide(.*)': ...`
- `'(.*)Icon': ...`
- `'*': ...`

On top of that, another critical change made in this PR is the
introducing of `modularize-import-loader`. With this new loader, we can
delegate the task of re-exporting the value to Webpack, where we can
adjust the type of the export and the target path. This is very
necessary and can't be done in SWC alone because libs like
`lucide-react` is using `.mjs` and don't have `exports` values for the
individual icons in the package.json files.

Because of that, if we simply transform the expression to `import Icon
from 'lucide-react/esm/icons/foo` it will fail because:
1. It's missing a `.mjs` extension
2. It doesn't have `/esm/icons/foo.mjs` in package.json `exports`

For 1), in fact that they moved to `.mjs` only in a recent upgrade so we
can't even hard code it to be `.mjs` in the transform (breaks old
versions).

Because of all the above, I decided to go with Webpack's own resolution
logic with the loader as a _temporary_ solution. It's temporary because
it's still assuming that the file structure of these libs doesn't
change.
2023-07-27 16:08:25 +02:00
Balázs Orbán
7721b9ba64
docs: match image example with code (#53254)
Closes NEXT-1761
Fixes #52037
2023-07-27 12:27:50 +00:00
Jiachi Liu
c5308eb4a8
Respect fetching logging config and Polish logs format (#52973)
Respect to the logging option which was introduced in #49250 that only logs when `experimental.logging` set to `"verbose"`

Polish the logging format a bit that make it more compact and lit
![image](https://github.com/vercel/next.js/assets/4800338/7b41424b-1215-415b-84c9-4619512ba0b4)


Related NEXT-1357
2023-07-27 09:02:42 +00:00
Tobias Koppers
911ba88888
some bugfixes to resolving and context creation (#53219)
### What?

pulled out of #52983
2023-07-27 07:46:50 +00:00
vercel-release-bot
127c5bbf80 v13.4.13-canary.4 2023-07-27 00:17:07 +00:00
Zack Tanner
c73fdfd87c
Fix file tracing issues for not-found pages (#53231)
This fixes the `.nft.json` output for not-found pages to correctly grab the client reference manifest. We were checking for `entryPoint.name.startsWith('app/')` but then asserting on `entryPoint.name === '/_not-found'` when determining the manifest path.

This also fixes the build output to mark pages with `λ` if the corresponding page has dynamic data. This revealed a separate issue that de-opts all pages into dynamic rendering if the root `NotFound` page bails, tracked in [NEXT-1474](https://linear.app/vercel/issue/NEXT-1474/if-the-root-notfound-page-opts-into-dynamic-rendering-all-pages-do-too)

[slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1683763412272429)
2023-07-27 00:08:53 +00:00
Zack Tanner
22ca85946e
Wrap incremental cache in an IPC server (#53030)
This uses an IPC server (if available) for incremental cache methods to help prevent race conditions when reading/writing from cache and also to dedupe requests in cases where multiple cache reads are in flight. This cuts down on data fetching across the different build-time workers.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-26 23:19:46 +00:00
OJ Kwon
0d4ec1047d
fix(next-swc): exclude raw target triples without native bindings (#53230)
<!-- 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



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?
context: https://vercel.slack.com/archives/C04KC8A53T7/p1690403434786639

We've been using raw target triples from napi-rs directly. It includes
all of the platforms napi-rs lists, however next-swc have narrower
support for native bindings. PR omits target triples that doesn't have
corresponding next-swc binary, then try to pick up triples from there.
Also leaves small logs if triples are missing from the list for further
debugging.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-26 15:32:08 -07:00
JJ Kasper
e4573a0513
Add CI label (#53229)
x-ref: [slack
thread](https://vercel.slack.com/archives/C053824BELQ/p1690401578968429?thread_ts=1689880792.600909&cid=C053824BELQ)
2023-07-26 14:50:04 -07:00
Grace Yun
6c3560dbbd
[create-next-app] fix template css for top / bottom alignment (#53227)
Fixes a small CSS regression with the `create-next-app` template(s). Especially evident with templates using Tailwind CSS.

Before:
<img width="1047" alt="image" src="https://github.com/vercel/next.js/assets/74513600/9d3e8ef4-52b9-4590-be26-ee91f4bd65dd">

After:
![image](https://github.com/vercel/next.js/assets/74513600/952ca166-59df-40d1-bb6d-cb2fbc592c3b)
2023-07-26 20:41:08 +00:00
OJ Kwon
f814fb8046
feat(next-swc): log swc download url if fails (#53176)
<!-- 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



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

Minor addition to download swc package to log url if fails.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-26 13:13:37 -07:00
Justin Ridgewell
31d2b720d9
Reimplement stream cancellation (#52281)
### What?

This reimplements our stream cancellation code for a few more cases:
1. Adds support in all stream-returning APIs
2. Fixes cancellation detection in node 16
3. Implements out-of-band detection, so can cancel in the middle of a
read

It also (finally) adds tests for all the cases I'm aware of.

### Why?

To allow disconnecting from an AI service when a client disconnects. $$$

### How?

1. Reuses a single pipe function in all paths to push data from the
dev's `ReadableStream` into our `ServerResponse`
2. Uses `ServerResponse` to detect disconnect, instead of the
`IncomingMessage` (request)
    - The `close` event fire once all incoming body data is read
- The request `abort` event will not fire after the incoming body data
has been fully read
3. Using `on('close')` on the writable destination allows us to detect
close
- Checking for `res.destroyed` in the body of the loop meant we had to
wait for the `await stream.read()` to complete before we could possibly
cancel the stream

- - -

#52157 (and #51594) had an issue with Node 16, because I was using
`res.closed` to detect when the server response was closed by the client
disconnecting. But, `closed` wasn't
[added](https://github.com/nodejs/node/pull/45672) until
[v18.13.0](https://nodejs.org/en/blog/release/v18.13.0#:~:text=%5Bcbd710bbf4%5D%20%2D%20http%3A%20make%20OutgoingMessage%20more%20streamlike%20(Robert%20Nagy)%20%2345672).
This fixes it by using `res.destroyed`.

Reverts #52277
Relands #52157
Fixes #52809

---------
2023-07-26 12:57:34 -07:00
Tobias Koppers
39fd9177ef
Split into dev server and next.rs api mode (#53220)
### What?

* split into two dev modes
* split app-index into webpack and turbopack
* add two different entrypoints

### Why?

### How?
2023-07-26 19:21:49 +00:00
Tobias Koppers
a1adaf89ef
update turbopack (#53221)
* https://github.com/vercel/turbo/pull/5619 <!-- Tobias Koppers - export
namespace object instead commonjs interop object -->
2023-07-26 11:56:08 -07:00
Zack Tanner
ea4f6a0258
add hydration error testcase when using useId() in a client component (#53223)
Quick follow up to https://github.com/vercel/next.js/pull/53216 to add a missing test case
2023-07-26 18:46:42 +00:00
Zack Tanner
b0c1697f1e
Fix hydration errors caused by root ErrorOverlay (#53216)
A bug was introduced in #52843 that causes hydration issues -- this
fixes that by moving the previous logic into the existing `isError` path
that doesn't trigger a call to `hydrateRoot` ensuring we are only doing
this on the client tree

Fixes #53110 and Fixes #53006
Closes NEXT-1470
2023-07-26 20:17:59 +02:00
Sukka
66ffc3cd39
refactor(cna): replace chalk with picocolors, glob with fast-glob@2.2.7 (#53146)
Follows #53115

- Replace `chalk` with `picocolors`
  - Note that `chalk.hex('#007acc')` has been replaced with `picocolors.blue`
- Replace `glob` with `fast-glob@2.2.7`
  - Not only does `fast-glob` is a faster drop-in replacement of `glob` with first-party `Promise`-based API support, but also `fast-glob` is already a dependency of `cpy`:
 
  <img width="812" alt="image" src="https://github.com/vercel/next.js/assets/40715044/8efa24c4-5312-4b1c-bf8d-68255ca30b60">


Together the PR removes about `50 KiB` from the `create-next-app/dist/index.js`:

<img width="570" alt="image" src="https://github.com/vercel/next.js/assets/40715044/db2f3723-14cc-48ce-9cb2-8aa1fb1d5e95">


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-07-26 18:16:13 +00:00
OJ Kwon
974accc2c7
feat(turbopack): embed build time info, emits next features telemetry event (#53028)
### What?

closes WEB-1301. To collect some information inside of rust binary, embed it as build-time constant. It supersedes existing target triple embedding as well.
2023-07-26 17:49:34 +00:00