Commit graph

10182 commits

Author SHA1 Message Date
vercel-release-bot
e5c082418d v13.5.7-canary.14 2023-10-21 23:23:17 +00:00
OJ Kwon
3c3744631e
fix(loader_tree): propagate metadata to corresponding layout (#56956)
### What?

- fixes test 17553c5e25/test/e2e/app-dir/metadata/metadata.test.ts (L487)

The way next.js collects static metadata is read static metadata, and then read layout metadata to merge multiple metadatas into a single layout path (17553c5e25/packages/next/src/lib/metadata/resolve-metadata.ts (L347-L352))

When turbopack creates LoaderTree for the corresponding directory tree, it extracts `page` but skips metadata  in result there are orphan components that have a metadata doesn't have layout metadata, as well as a component have a layout doesn't have metadata. Latter is being rendered as a page (since it have correct layout), which eventually falls back to the default metadata instead.

PR trickles down the metadata when extracting page (creating a new component with `page`) to consolidates those.

Also PR expands Metadata to have base_page property to capture where it has been originally exists, as we clone down metadata then do `fillMetadataSegment` against the current page where LoaderTree is being created it creates a wrong relative path. For example, currently

```
/icon.svg
 - opengragph/
      - static -> path being `/opengraph/.../icon.svg` instead of `/icon.svg`
```

When recursively traverse directory tree, capture each components with corresponding base_page to calculate instead.

Unfortunately this doesn't make pass all of the metadata tests; there are lot to dig more. Would like to scope PR in a reasonable size.


Closes WEB-1795
2023-10-21 21:24:40 +00:00
Tim Neutkens
2bb9b2a7c2
Fix two tests that use exportPathMap for Turbopack (#57194)
More Turbopack test fixes.

<!-- 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-10-21 13:32:48 -07:00
Zack Tanner
eae65fa7b9
improve server actions error when on unsupported node version (#57191)
When using server actions on an unsupported version of Node, you might see the following errors:

> NotSupportedError: multipart/form-data not supported

Support in Undici was landed in 5.11.0 which made it into Node v18.11.0

> TypeError: e._formData.forEach is not a function

Earlier versions of v18 (such as 18.0.0) did not have a `.forEach` implementation on FormData

This throws a better error before the user can get to the point of seeing these more confusing errors.

Closes NEXT-1658
Fixes #55932
2023-10-21 19:32:46 +00:00
Jiachi Liu
c43c915961
Polish auto create layout warning color (#57190)
### After
<img width="643" alt="image" src="https://github.com/vercel/next.js/assets/4800338/254f2ecf-1a22-4756-baf8-d497fa9485ee">

### Before
![image](https://github.com/vercel/next.js/assets/4800338/8acf8c6e-690f-4827-a8fb-bd729e276f0f)
2023-10-21 19:21:22 +00:00
Shu Ding
458e1998e1
Refactor code (#57189)
Refactored some code.
2023-10-21 18:50:56 +00:00
Tim Neutkens
d99602da87
Remove printing fixed issues for Turbopack (#57188)
We'll revisit this after Turbopack is stable.
2023-10-21 18:30:23 +00:00
Shu Ding
a383b93556
Encoding and decoding variables of Server Actions from the closure (#56377)
This PR implements encryption and decryption for Server Action bound values that are from the closure level. Explicit `.bind` values, function arguments and module-level values are NOT handled.

### Compiler

The compiler now groups all closure bound values to an array which gets wrapped with `encrypt`. And then inside the action body, it prepends an expression to recreate the values via `await decrypt`.

Since closure-closed variables will only exist on the server layer, the encryption utility has `"server-only"` annotated.

### Encryption

During build time, a private AES-GCM encryption key is randomly generated and stored in the built server manifest. Before encrypting/decrypting, an extra round of Flight server and client will be used to serialize/deserialize the value.

When encrypting, a salt that contains the action ID is provided to prevent replay attack towards different API endpoints. The encryption key can be overridden via the `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` env variable so it can be built on multiple machines on scale.

A global singleton for storing the client reference manifest was made for Flight's serialization/deserialization as that might happen outside of rendering.

After encryption, we then serialize the ArrayBuffer as Base64 to send it to the client.
2023-10-21 17:52:06 +00:00
Jimmy Lai
4e27b908fe
misc: fix injecting --inspect with NODE_OPTIONS (#57159)
This PR fixes the passing of the `--inspect` option when calling Next.js with it. It's still not great because you need to target the next file in node_modules directly but I'll add a `next --inspect` option in the future.
2023-10-21 00:49:41 +00:00
Will Binns-Smith
1ffef0f1a3
Turbopack: support more server code in tracing error stack frames (#57156)
This:
- Uses `isServer` to use the appropriate Turbopack `FileSystem` when
creating `FileSystemPath`s
- Properly uri decodes path segments originating from `file://` uris
- Correctly reads chunks starting at the project path instead of the
root path


Closes WEB-1815

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-20 17:09:10 -07:00
Leah
0d2edbb23f
chore: move layer from chunking context to asset context (#57149)
The asset context is a better place to store the layer, because it's
affected by transitions unlike the chunking context

This PR also removes a bunch of unused code

### Why?

See https://github.com/vercel/turbo/pull/6237 for the rationale
Also needs to wait for that PR to be merged

Closes NEXT-1814

#### Turbopack Changes
* https://github.com/vercel/turbo/pull/6237 <!-- Leah - chore: move
layer from chunking context to asset context -->

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-21 02:05:00 +02:00
Wyatt Johnson
8afbce84de
Cleanup Request Meta (#57144)
This cleans up the meta for requests by removing the legacy `_next` prefixes and removing some unused ones.
2023-10-20 23:40:37 +00:00
vercel-release-bot
d0a1199a36 v13.5.7-canary.13 2023-10-20 23:23:41 +00:00
Jiachi Liu
e6fbeabd1a
Display experimental features for next build (#57152)
Display full information of experimental features in `next build`, so we'll have full insights for build logs


Close NEXT-1697

* `next build`
<img width="668" alt="image" src="https://github.com/vercel/next.js/assets/4800338/6ab75923-0336-4624-905f-347fedbff5a9">
2023-10-20 22:37:23 +00:00
Steven
4d31506960
Revert "Add retry for fetching subsetted Google Fonts" (#57154)
Reverts vercel/next.js#56583 due to missing dependency

```
app/layout.jsx
An error occured in 'next/font'.
Error: Cannot find module 'async-retry'
Require stack:
- node_modules/•pnpm/next@13.5.7-canary.12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/@next/font/dist/google/retry.js
- node_modules/-pnpm/next@13.5.7-canary-12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js
```
2023-10-20 22:14:24 +00:00
Wyatt Johnson
354705d1c3
Route Handler Types (#57070)
This updates the handle functions on the server to share a common type that simplifies the signature.
2023-10-20 21:21:18 +00:00
Phil Wolstenholme
aa1ee5995c
Mark most GTMParams as optional (#57153)
Fixes #57126

The `<GoogleTagManager>` types in `@next/third-parties` seem incorrect compared to [e2e test usage](https://github.com/vercel/next.js/blob/canary/test/e2e/third-parties/pages/gtm.js#L11) where only the `gtmId` is shown/needed.

```
<GoogleTagManager gtmId="GTM-XYZ" />
```


The extra options (datalayer name etc) are not needed as the `GoogleTagManager` has defaults: https://github.com/vercel/next.js/blob/v13.5.7-canary.11/packages/third-parties/src/google/gtm.tsx#L24-L32
2023-10-20 21:04:00 +00:00
Josh Story
5528cc6d4e
Remove the experimental serverActions flag (#57145)
Remove the experimental `serverActions` flag

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-20 20:45:25 +00:00
Leah
2f2e8e26e2
chore: create template from next-edge-ssr-loader (#56715)
### Description

- Splits the generated code of the `next-edge-ssr-loader` out into 2 templates
- This PR also adds support for optional imports in templates

Closes WEB-1761
2023-10-20 20:19:49 +00:00
Balázs Orbán
f9bd6f7621
chore: drop web streams polyfilling on globalThis (#57077)
### What?

`globalThis.ReadableStream` and `globalThis.WriteableStream` has been exposed since Node.js 18, which is our new default requirement. (#56943)

### Why?

This simplifies the code and might result in slightly better performance.

### How?

Drop any checks of `globalThis` properties that are always defined now.
2023-10-20 19:38:35 +00:00
Balázs Orbán
2277797dc2
chore: drop form-data (#57141)
### What?

Dropping `form-data` polyfill as Node.js 18+ versions all expose it on `globalThis`

### Why?

Reduce the amount of shipped code in Next.js

### How?

Similar to #56899

See: https://nodejs.org/docs/latest-v18.x/api/globals.html#class-formdata
2023-10-20 19:25:42 +00:00
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
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
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
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
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
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