Commit graph

18135 commits

Author SHA1 Message Date
Tobias Koppers
4a75e71d25
prefer Option<Vc<IssueSource>> over Vc<OptionIssueSource> (#57104)
### What?

see https://github.com/vercel/turbo/pull/6229

### Why?

### How?


Closes WEB-1808
2023-10-20 18:06:23 +00:00
Tobias Koppers
a63c74924a
make test case less flaky (#57138)
### What?

test case is flaky

### Why?

### How?


Closes WEB-1813
2023-10-20 19:46:02 +02:00
Josh Story
920a7e8ba6
Update React from a41957507 to d803f519e (#57015)
## React upstream Changes

- https://github.com/facebook/react/pull/27542
- https://github.com/facebook/react/pull/27551
- https://github.com/facebook/react/pull/27537
- https://github.com/facebook/react/pull/27549
- https://github.com/facebook/react/pull/27544
- https://github.com/facebook/react/pull/27543
- https://github.com/facebook/react/pull/27541
- https://github.com/facebook/react/pull/27538
- https://github.com/facebook/react/pull/27536
2023-10-20 17:42:27 +00:00
vercel-release-bot
2b60475c2b v13.5.7-canary.12 2023-10-20 17:19:41 +00:00
berlysia
c84f5ed794
Add retry for fetching subsetted Google Fonts (#56583)
### What?
Add the same re-retrieval process for subseted font files of Google Font as for CSS files.

+ make use of [async-retry](https://github.com/vercel/async-retry)

### Why?
It was reported in #45080 that Japanese fonts such as Noto Sans JP were frequently `Failed to fetch`.
A retry process was added in #51890, but it did not resolve the issue completely ( https://github.com/vercel/next.js/pull/51890#issuecomment-1614558064 ).

Here is my reproduction code with 13.5.5-canary.4 (please run locally).
https://stackblitz.com/edit/stackblitz-starters-n8zxlq?file=app%2Fpage.tsx

<details>
<summary>And my local error log is here(folded)</summary>

```
$ npm run -- dev

> nextjs@0.1.0 dev
> next dev

 ⚠ Port 3000 is in use, trying 3001 instead.
  ▲ Next.js 13.5.5-canary.4
  - Local:        http://localhost:3001

 ✓ Ready in 23.9s
 ○ Compiling /page ...
FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.4.woff2 failed, reason: 
    at ClientRequest.<anonymous> (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
 ⨯ Failed to download `Noto Sans JP` from Google Fonts. Using fallback font instead.

Failed to fetch `Noto Sans JP` from Google Fonts.}
FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.28.woff2 failed, reason: 
    at ClientRequest.<anonymous> (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
...(15 errors emitted)
```
</details>

I've found that the issue is not limited to fetching CSS, fetching subset font files is also failing.
By adding retry handling to the fetch of individual subseted font files as well, I (almost) never see `Failed to fetch` anymore.

The issue tends to become more apparent when downloading a larger number of subsetted fonts.
This suggests that the problem is more likely to occur with larger fonts, such as those designed for CJK languages.

### How?
Add the same re-retrieval process for subseted font files of Google Font as for CSS files.


Related to #51890 #53239 #45080 #53279
2023-10-20 17:10:53 +00:00
Shu Ding
0a7dd4ac8a
Remove warning messages (#57087)
We no longer need these for the next major.
2023-10-20 14:42:07 +00:00
Jiachi Liu
5d6592d895
Upgrade edge-runtime/cookies (#57124)
Backport fix on 13.5.6 to canary

x-ref: #57021
2023-10-20 13:56:04 +00:00
Vercel Release Bot
6ad017d23f
Update font data (#57094)
This auto-generated PR updates font data with latest available
2023-10-20 04:44:45 +00:00
Sebastian Markbåge
c41debd23a
Expose Experimental Taint APIs (#56507)
Exposes the new experimental Taint APIs using the `taint` flag which
enables experimental React.

As an example for how we can use it, I use it to taint `process.env`
with a better error message. I'm not sure where this should live since
it's a global init but it needs access to the global config. It's
unnecessary to retaint it for every render but not sure if there's a
better place for it.

---------

Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-19 19:02:37 -07:00
Jimmy Lai
6d2df8636a
build: don't error when bundling optional peer deps (#57073)
This PR adds a resolver plugin to verify during bundling that when a module is unresolved, that it is not an optional peer dependency specified in the package.json of the caller. An error would happen if you try to bundle packages like `typeorm` since there are `require` calls in the code to those dependencies.

Also, swallow dynamic dependencies warnings in `require` calls error if they come from `node_modules`. They are not actionable at all generally.
2023-10-20 00:57:06 +00:00
Tobias Koppers
040a4f75e8
update test manifest (#56938)
Update test manifest from daily test run

Closes WEB-1792
2023-10-20 00:43:56 +00:00
JJ Kasper
a8bc1a1cf2
Update runner for e2e deploy tests (#57089)
This attempts to fix our tests timing out from an obscure lost
connection to runner message


![CleanShot 2023-10-19 at 16 29
50@2x](https://github.com/vercel/next.js/assets/22380829/594b21c4-4df9-418b-afbb-5e290020d25d)
2023-10-19 17:34:18 -07:00
JJ Kasper
2faacf17fc
Update flakey build trace case (#57092)
This updates to tolerate ENOENT during build tracing as this can expectedly occur since we run static optimization in parallel to the tracing which static generation can remove server files and replace them with their HTML files. 

x-ref: https://github.com/vercel/next.js/actions/runs/6581290033/job/17880939489?pr=57088
2023-10-20 00:17:25 +00:00
JJ Kasper
477cf794e1
Update CNA tests more (#57088)
Follow-up to https://github.com/vercel/next.js/pull/57025 this updates other places we run the `create-next-app` CLI in tests.
2023-10-19 23:49:31 +00:00
vercel-release-bot
e437f72662 v13.5.7-canary.11 2023-10-19 23:22:57 +00:00
vercel-release-bot
143d79f733 v13.5.7-canary.10 2023-10-19 22:41:38 +00:00
OJ Kwon
68edcc3e37
build(cargo): bump up turbopack (#57081)
### What?

Picks up latest turbopack to get some changes.

Closes WEB-1802
2023-10-19 22:21:27 +00:00
Will Binns-Smith
0e4fe2ffe3
Code frame and sourcemapped error support for Turbopack (#56727)
This implements support for properly tracing sourcemaps when presenting
error stacks to the user. It also adds code frames when possible.


Closes WEB-1764

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-19 14:51:40 -07:00
Steven
a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +00:00
Jiachi Liu
194e94ed6e
codemod: migrate ImageResponse imports (#57074)
Adding codemod for #56662 for easier migration of `ImageResponse` from `"next/server"` to `"next/og"`
2023-10-19 20:02:25 +00:00
vercel-release-bot
ed6b60c55a v13.5.7-canary.9 2023-10-19 19:15:58 +00:00
Jiachi Liu
a6aae865c4
Bump packages version to match canary versions (#57071)
We released 13.5.6 as stable patch, need to bump the canary version
higher than stable to match the semantics
2023-10-19 12:09:06 -07:00
Balázs Orbán
4c46ddd92a
chore: drop undici (#56899)
### What?

Note: This is not a breaking change, just removing some unused code.

### Why?

Since #56896 we don't need this, as Node.js 18+ has `fetch` exposed by default.

### How?

Depends on #56896, #56909

We already didn't load `fetch` if `globalThis` had it (ie. Node.js 18+ environments), and since we are dropping support for Node.js 16, these code paths should have no effect on runtime behavior.
2023-10-19 18:35:12 +00:00
Balázs Orbán
33db463fe4
chore: upgrade jest (#56909)
### What?

Upgrade jest to its latest version

### Why?

#56899 fails because historically Jest stripped the globals in Node.js, but 28+ isn't doing that anymore. If we upgrade, we don't have to keep track of Node.js globals and when they are added. This will be useful in removing even more polyfills for things that are natively shipped in Node.js now.

### How?

Jest 29 introduced a change to the snapshot format: https://jestjs.io/blog/2022/08/25/jest-29

First, I tried setting the old compat option to not require updating snapshots, but some tests were still failing: https://dev.azure.com/nextjs/next.js/_build/results?buildId=70633&view=logs&j=8af7cf9c-43a1-584d-6f5c-57bad8880974&t=7ae70e63-3625-50f4-6764-5b3e72b4bd7a&l=273 So going through the pain now instead.
2023-10-19 17:38:24 +00:00
vercel-release-bot
dc7bc70d4d v13.5.6-canary.8 2023-10-19 16:49:59 +00:00
Jiachi Liu
a6d4c77f41
Prefer module over main on main fields for app router server compiler (#56960)
Reverts vercel/next.js#56766
Reland vercel/next.js#56532 

x-ref: https://vercel.slack.com/archives/C04DUD7EB1B/p1697576563771229?thread_ts=1697146531.305779&cid=C04DUD7EB1B

This change was breaking package which was actually a dual package but marked as esm module, and when the package is ESM but import a CJS dependency without fully spepcified file path it will fail to resolve. The way is to either remove the esmodule type in package.json or change the import to full path import with extension for the package
2023-10-19 16:06:47 +00:00
Jiachi Liu
a3e56c9c1e
Move ImageResponse to next/og (#56662)
### Story

Since we introduced `ImageResponse` into `next/server` export, there're a few libraries relying on `next/server` that accidentally ended up with bundling og image into the bundle. As og package is quite large that could easily raise the size concern for middleware, edge runtime routes.

### Struggles
 We've done optimizations. The tree-shaking strategies are tricky, we tried modularize imports and also optimize cjs require/exports to make sure you're not including og package into bundle if it's not being used. However, it's still not 100% can handle all the bundle optimization cases, such as `import {..} from "next/server.js"` could also ended up with the cjs bundle that failed the tree-shaking.

### Move on
So we decide to move og `ImageResponse` into a separate export `next/og`

Closes NEXT-1660
2023-10-19 14:26:48 +00:00
JJ Kasper
3010ae10e1
Update CNA tests to avoid publish conflict (#57025)
This avoids testing against latest exact canary version as this causes these tests to fail while the publish is still in progress. As a follow-up we can investigate moving this post publish or packing/deploying tarballs to use. 

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-10-19 13:52:10 +00:00
Bsodoge
1d9ddfca14
Fix typos in duplicate-sass.mdx (#57045) 2023-10-19 13:32:47 +00:00
Sukka
ebcc855af6
chore: revert back to moving files w/ fs-extra (#57030)
Follows #56917, revert back to moving files using `fs-extra`. This should help with the flaky `fs.rename` operation on Windows.

cc @styfle
2023-10-19 13:29:19 +00:00
Nilesh Suthar
ab7b0f59fb
chore: support progressive jpg with sharp (#56617)
### What?
Use Progressive JPG when optimizing images using Sharp with Sqooush we
are already using [progressive
jpg](9b2f29ebaf/packages/next/src/server/lib/squoosh/codecs.ts (L232))

Co-authored-by: Steven <steven@ceriously.com>
2023-10-18 23:05:11 -04:00
Quentin
abe8b1e0a8
Improve performance of String.prototype.split uses (#56746)
This PR adds the optional `limit` parameter on String.prototype.split uses.

> If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. Any leftover text is not included in the array at all.

[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split#syntax)

While the performance gain may not be significant for small texts, it can be huge for large ones.

I made a benchmark on the following repository : https://github.com/Yovach/benchmark-nodejs

On my machine, I get the following results:
`node index.js`
> normal 1: 570.092ms
> normal 50: 2.284s
> normal 100: 3.543s

`node index-optimized.js`
> optmized 1: 644.301ms
> optmized 50: 929.39ms
> optmized 100: 1.020s

The "benchmarks" numbers are : 
- "lorem-1" file contains 1 paragraph of "lorem ipsum"
- "lorem-50" file contains 50 paragraphes of "lorem ipsum"
- "lorem-100" file contains 100 paragraphes of "lorem ipsum"
2023-10-19 00:25:15 +00:00
Steven
8e2034573e
Revert "chore(next/image): remove deprecation of onLoadingComplete temporarily" (#57024)
Reverts vercel/next.js#57020

This should be safe to land again after the patch release
2023-10-19 00:15:31 +00:00
vercel-release-bot
4c2b34ea7c v13.5.6-canary.7 2023-10-18 23:24:25 +00:00
Steven
67781ee34e
chore(next/image): remove deprecation of onLoadingComplete temporarily (#57020)
- Temporary revert of #56944
2023-10-18 21:58:07 +00:00
Wyatt Johnson
07c434d54b
Web Streams cleanup (#56819)
This updates some code related to web streams and encoding.

- Removes some unused code related to base64 encoding/decoding (Edge runtime currently supports it natively via `Buffer`)
- Prefer readable stream `pull` versus `.on("data", (chunk) => { ... })` event handlers (simplifies execution)
- Utilize `pipeTo` and `pipeThrough` on web streams to remove custom code related to stream pumping
- Updates pipe readable function to utilize web streams first class rather than relying on manual pumping + stream management
  - This also takes advantage of the `AbortController` when piping so that the response can use it to cancel the stream
2023-10-18 21:38:28 +00:00
Wyatt Johnson
40dd14ff98
Handle Promise Rejections for Streams (#56976)
This handles the promise rejection for chained streams better and the other case in the server setup when `prepre()` is fired off early.
2023-10-18 20:25:57 +00:00
Steven
27b89e4aaf
chore(docs): fix missing fallback on next/image sizes example (#56718)
This example use of `sizes` was missing the fallback.

Its best to review with [`?w=1`](https://github.com/vercel/next.js/pull/56718/files?w=1)
2023-10-18 17:55:46 +00:00
Steven
92cccfb47b
chore(test): add logs for create-next-app tests (#56957)
This will help us debug why these tests sometimes flake by logging which command was running last.
2023-10-18 17:39:49 +00:00
leung018
66597be8a7
Add .yarn/install-state.gz to .gitignore (#56637)
### Reason for making this change
https://yarnpkg.com/getting-started/qa#:~:text=yarn%2Finstall%2Dstate.,your%20workspaces%20all%20over%20again.
In the official documentation of `yarn`, it is stated that `.yarn/install-state.gz` is an optimization file that developer shouldn't ever have to commit. However, currently, when running `create-next-app`, `.yarn/install-state.gz` is being commited.

### Remaining work
I apologize for only modifying one template initially to initiate the discussion first.

If this change is agreed upon,  it should be synchronized with other `.gitignore` templates. Would it be possible to follow a similar approach as in https://github.com/vercel/next.js/pull/47241? I would appreciate any assistance in syncing this change.
2023-10-18 16:34:48 +00:00
Zack Tanner
c2ac8df073
add better logs around worker restarts (#57004)
We currently log when a worker is restarted but not when we send the kill signal, which can create a delta in logs of cryptic errors while the worker is exiting. This explicitly logs when we're terminating the static worker prior to a restart, and also adds an optional logger fn so that we pretty-print the messages. 

[slack x-ref](https://vercel.slack.com/archives/C061DJBG8PN/p1697491350970269)
2023-10-18 16:11:40 +00:00
vercel-release-bot
2c8606e596 v13.5.6-canary.6 2023-10-18 06:59:43 +00:00
Shu Ding
63284721be
Add @mui/icons-material to the default optimizePackageImports list (#56801)
Feedback from https://twitter.com/younguyen95/status/1712850891521568896. Tested locally.
2023-10-18 06:31:38 +00:00
Tobias Koppers
607ba02a26
Reland "feat(turbopack): support basic next/dynamic" (#56934)
This reverts commit 8a51ebcb67.

### What?

see #56389 


Closes WEB-1791
2023-10-18 02:53:40 +00:00
Zack Tanner
975c999451
Update React from 09fbee89d to a41957507 (#56970)
Update React from from 09fbee89d to a41957507.

### React upstream changes

- https://github.com/facebook/react/pull/27472
- https://github.com/facebook/react/pull/27512
- https://github.com/facebook/react/pull/27509
- https://github.com/facebook/react/pull/27517
- https://github.com/facebook/react/pull/27523
- https://github.com/facebook/react/pull/27516
- https://github.com/facebook/react/pull/27505
2023-10-18 01:15:55 +00:00
xiaolou86
b95474a9d2
fix typos (#56870) 2023-10-18 00:46:47 +00:00
vercel-release-bot
318cbbf9b1 v13.5.6-canary.5 2023-10-17 23:22:33 +00:00
vercel-release-bot
f19dabbc6d v13.5.6-canary.4 2023-10-17 21:22:19 +00:00
Balázs Orbán
523474c8be
chore: lower Node.js version requirement (#56943) 2023-10-17 23:15:31 +02:00
Steven
3a459ca986
chore(next/image)!: mark onLoadingComplete as deprecated in favor of onLoad (#56944)
## History

We used to pass `onLoad` through directly to the underlying img so `onLoadingComplete` was introduced in order to handle the case when `placeholder="blur"` was used and `onLoad` would trigger before the placeholder was removed.

We have since changed the behavior of `onLoad` so that it acts the same as `onLoadingComplete` and therefore `onLoadingComplete` is no longer needed.

## What is this PR doing?

This PR marks `onLoadingComplete` as deprecated in favor of `onLoad`. In the future, we may remove `onLoadingComplete`.
2023-10-17 21:12:22 +00:00