Commit graph

1292 commits

Author SHA1 Message Date
Tobias Koppers
d4d779145c
refactor shared logic for turbopack-cli (#48307)
### What?

* move some shared runtime logic to turbopack
* use relative imports from internal code when possible
* move react-refresh logic to turbopack
* move benchmark code logic to turobpack

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

### Why?

We want to have benchmarking again for turbopack PRs
We want to have a standalone turbopack cli (eventually)
We want to avoid duplicating the runtime code

### How?

refactoring, moving code
2023-04-13 14:54:34 +02:00
OJ Kwon
e21b93b523
feat(turbopack): initial mdxrs config support (#47886)
<!-- 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 or adding/fixing 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 #

-->

### What?
Part of WEB-488.

This PR implements path to the `experimental.mdxRs` config in
next.config.js pass into turbopack. Also adds a test cases supposed to
pass with turbopack when mdxRs is enabled. PR requires to land
https://github.com/vercel/turbo/pull/4442 first, so it is expected to
fail for now.

One thing this PR (and its counterpart in turbopack) did not resolve yet
is classic runtime's runtime import (import react ..)


https://github.com/vercel/next.js/compare/mdx-rs-turbopack?expand=1#diff-9c0234d0299e461e59c7cdcb853d11624fc287243a8941a61a15e4ad926be8c0R1

which is not being explicitly applied in existing test cases
(https://github.com/vercel/next.js/blob/canary/test/integration/plugin-mdx-rs/components/button.js#L1).
Bit unclear where / how does injection currently occurs, would need a
followup changes if we'd like to properly support.
2023-04-13 08:17:28 +02:00
JJ Kasper
e8f6ddcae8 v13.3.1-canary.6 2023-04-13 01:22:55 +00:00
OJ Kwon
e97100c5ea
feat(turbopack): support initial compiler.emotion / compiler.styledComponents flag (#47991)
<!-- 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 or adding/fixing 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?

Related with WEB-669 and initial support for
[WEB-670](https://linear.app/vercel/issue/WEB-670), allows to consume
compiler.emotion with latest turbopack.

I was trying to make additional changes to make test fully pass, but
there are some other failures around so this change cannot able to pass
existing tests yet.

Turbopack changes: https://github.com/vercel/turbo/pull/4482
2023-04-12 22:05:18 +02:00
JJ Kasper
8273ba5660 v13.3.1-canary.5 2023-04-12 13:16:22 +00:00
Alex Kirszenberg
ce42173eae
Chunking Refactor pt. 2 (#47961)
See https://github.com/vercel/turbo/pull/4450

This PR updates Turbopack to turbopack-230411.2:

## Miscellaneous

* https://github.com/vercel/turbo/pull/4450 <!-- Alex Kirszenberg -
Chunking Refactor pt. 2 -->
2023-04-11 11:08:37 -07:00
JJ Kasper
b896a12867 v13.3.1-canary.4 2023-04-10 17:07:34 +00:00
JJ Kasper
2bcdfbb6ab v13.3.1-canary.3 2023-04-08 01:47:09 +00:00
JJ Kasper
b5f785aab1 v13.3.1-canary.2 2023-04-07 18:04:26 +00:00
JJ Kasper
0097c12a92 v13.3.1-canary.1 2023-04-07 13:29:08 +00:00
JJ Kasper
883933b6c5 v13.3.1-canary.0 2023-04-07 03:15:57 +00:00
Justin Ridgewell
10b9355781
turbopack: pass ENV vars to route handlers (#48048)
Same as https://github.com/vercel/next.js/pull/47767, we need to pass
the full list of `process.env` keys to the edge invocation so that the
ENV vars are available to the route handlers.

Fixes https://github.com/vercel/turbo/issues/4489
Fixes https://github.com/vercel/next.js/issues/48036
Fixes WEB-869
Fixes NEXT-961
fix #48036

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-06 19:33:55 -07:00
Justin Ridgewell
8d3e42e556
turbopack: bind server to IPv6 loopback (#47948)
This accomplishes 2 things:
1. binds the turbopack dev server to the IPv6 unspecified address
2. initializes our router with the same hostname/port of the turobpack
server

The first matches the behavior of the Node.js dev server. The IPv6
unspecified address is similar to IPv4's `0.0.0.0` address, allowing us
to accept connection from anywhere. Importantly, it _also_ allows
accepting IPv4 connections, making this address truly universal.

The second means the `request` parameter to any middleware will have the
correct origin, and the request's URL can be used to craft fetch
requests to API endpoints. `new URL(req.url).origin` will be the origin
of the turbopack dev server.

Fixes https://github.com/vercel/turbo/issues/4456
Fixes WEB-855
2023-04-06 17:58:26 -07:00
JJ Kasper
79031e608a
v13.3.0 2023-04-06 13:47:03 -07:00
JJ Kasper
b8e7646fdc v13.2.5-canary.34 2023-04-06 19:48:01 +00:00
Tobias Koppers
95e46f73e4
report error when using "use server" on module level (#47967)
### What?

Add a error message when using "use server".

* https://github.com/vercel/turbo/pull/4477 <!-- Tobias Koppers - add
ServerDirective transform which reports unsupported -->


### Why?

Turbopack doesn't support "use server" yet.

### Other turbopack updates

* https://github.com/vercel/turbo/pull/4464 <!-- Justin Ridgewell -
Better dotenv error messages -->
* https://github.com/vercel/turbo/pull/4485 <!-- Justin Ridgewell - Add
ServerAddr::hostname method -->
2023-04-06 17:23:37 +00:00
JJ Kasper
200e83245c v13.2.5-canary.33 2023-04-06 14:52:28 +00:00
Tobias Koppers
ad75394a22
fix code generation for loader tree (#47987)
### What?

Fix missing `,` in loader tree code.

also adds `unsupported` as category of implicit metadata issue

### Why?

The loader tree to JS generated invalid code when there there where two
non-page files in a directory.

fixes WEB-861
2023-04-06 10:31:34 +00:00
Tobias Koppers
9b0af04649
update turbopack (#48006)
see #47994
2023-04-06 09:50:04 +00:00
JJ Kasper
5eec452f78 v13.2.5-canary.32 2023-04-06 06:23:44 +00:00
JJ Kasper
3b78c683ad
Revert "update turbopack" (#48001)
Looks like this is failing to build the native dev binary 

Reverts vercel/next.js#47994
2023-04-05 22:40:48 -07:00
Tobias Koppers
ebdc8903cf
update turbopack (#47994)
* https://github.com/vercel/turbo/pull/4480 <!-- Tobias Koppers - fix
CSS HMR for pages -->
* https://github.com/vercel/turbo/pull/4473 <!-- Tobias Koppers - use
error pretty printer for code gen errors -->
* https://github.com/vercel/turbo/pull/4476 <!-- Tobias Koppers - handle
module evaluation errors in the runtime correctly -->
* https://github.com/vercel/turbo/pull/4471 <!-- Justin Ridgewell - Add
ServerAddr ip/port methods -->
* https://github.com/vercel/turbo/pull/4475 <!-- Tobias Koppers - ignore
external chunks -->
* https://github.com/vercel/turbo/pull/4474 <!-- Tobias Koppers - avoid
panic in EsmModuleItem -->
* https://github.com/vercel/turbo/pull/4443 <!-- OJ Kwon -
test(turbopack): add one more test for flaky subsets -->
* https://github.com/vercel/turbo/pull/4424 <!-- OJ Kwon - ci(workflow):
apply latest turbopack when build next-swc -->
2023-04-05 21:42:45 -07:00
Leah
6466538033
allow turbopack HMR to recover from react errors without hard refresh (#47771) 2023-04-06 00:19:08 +00:00
JJ Kasper
be2237fc92 v13.2.5-canary.31 2023-04-05 23:30:33 +00:00
Justin Ridgewell
fde065b94a
turbopack: add vary header to app routes (#47946)
Next.js adds a `Vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch`
to app routes for both rendering and flight requests. Without this, the
browser can mistakenly serve the flight request to the app render, and
vice versa.

This only adds `Vary: RSC` for the moment, I'm not sure what the others
are used for. We also don't add a `Cache-Control: max-age=0` header, but
I'm not sure if that's necessary either.

Fixes NEXT-657
fix #45595
2023-04-05 21:08:11 +00:00
Wyatt Johnson
1fbbba6ffe
Unify Request types (#47884)
This serves to start the transition of replacing the following:

- Replace `BaseNextRequest`, `WebNextRequest`, and `NodeNextRequest`
with `NextRequest`
- Replace `BaseNextResponse`, `WebNextResponse`, and `NodeNextResponse`
with `Response`

This will currently only apply to app routes, enabling the following:

```ts
////////////////////////////////////////////////////////////////////////////////
// Use `Request` and `Response`
////////////////////////////////////////////////////////////////////////////////

import { NextRequest, NextResponse } from 'next/server'

export function GET(request: Request): Response {
  return new Response(
    JSON.stringify({
      hello: request.headers.get('user-agent'),
    }),
    { headers: { 'content-type': 'application/json' } }
  )
}

////////////////////////////////////////////////////////////////////////////////
// Use `NextRequest` and `NextResponse`
////////////////////////////////////////////////////////////////////////////////

import { NextRequest, NextResponse } from 'next/server'

export function GET(request: NextRequest): NextResponse {
  return NextResponse.json({ hello: request.headers.get('user-agent') })
}

////////////////////////////////////////////////////////////////////////////////
// Use `NextRequest` and `Response`
////////////////////////////////////////////////////////////////////////////////

import { NextRequest, NextResponse } from 'next/server'

// `NextRequest` extends `Request`.
export function GET(request: NextRequest): Response {
  return new Response(
    JSON.stringify({ hello: request.headers.get('user-agent') }),
    { headers: { 'content-type': 'application/json' } }
  )
}

////////////////////////////////////////////////////////////////////////////////
// Use `NextRequest`, `NextResponse`, and `Response`
////////////////////////////////////////////////////////////////////////////////

import { NextRequest, NextResponse } from 'next/server'

export function GET(request: NextRequest): Response {
  // `NextResponse` extends `Response`.
  return NextResponse.json({ hello: request.headers.get('user-agent') })
}

////////////////////////////////////////////////////////////////////////////////
// Use `Request` and `NextResponse`
////////////////////////////////////////////////////////////////////////////////

import { NextRequest, NextResponse } from 'next/server'

export function GET(request: Request): NextResponse {
  return NextResponse.json({ hello: request.headers.get('user-agent') })
}

```

fix NEXT-713
2023-04-05 18:24:08 +00:00
Tobias Koppers
a7837bd090
add a warning when using implicit metadata (#47928)
### What?

add a warning until it's supported

### Why?

to avoid unexpected behavior for the user when things are not working

fixes WEB-840
2023-04-05 15:09:28 +00:00
Tobias Koppers
3be9430e24
avoid duplicated error output (#47954)
### What?

avoid including the error twice in the output

### Why?

`.context()` already keeps the previous error, no need to include in the
error message again
2023-04-05 14:54:52 +00:00
Tobias Koppers
e643d52eb3
Run bench tests as part of CI (#47849)
### What?

enables the benchmark tests from turbopack again

### Why?

It tests common scenarios like HMR

fixes WEB-792

---------

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
2023-04-05 14:54:08 +00:00
Alex Kirszenberg
10dbcc6fe7
ChunkingContext refactor pt. 1 (#47693)
This is the Next.js side of https://github.com/vercel/turbo/pull/4397

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-05 09:08:03 +00:00
JJ Kasper
199aa3c8f5
Add strict next head handling (#47938)
This adds an `experimental.strictNextHead` flag to allow updating head
tags tracking for pages to resolve the issue with runtime scripts being
appended to the head element breaking the head tracking.

Fixes: https://github.com/vercel/next.js/issues/11012
Fixes: https://github.com/vercel/next.js/issues/20682
x-ref: [slack
thread](https://vercel.slack.com/archives/C051B8JAPQ9/p1680156608831939)
2023-04-05 08:29:36 +00:00
Tobias Koppers
06fea4d663
add test case for ignore modules (#47758)
### What?

test case for https://github.com/vercel/turbo/pull/4411
2023-04-04 22:20:23 +00:00
Tobias Koppers
c18889b6a0
add test case for alias field (#47856)
### What?

tests for https://github.com/vercel/turbo/pull/4434
2023-04-04 21:07:04 +00:00
JJ Kasper
95ca6f48c6 v13.2.5-canary.30 2023-04-04 19:41:51 +00:00
Justin Ridgewell
77b0c7b72c
turbopack: defer dev code evaluation until after page render IPC connects (#47888)
When the devs have a parse/module-eval error in their Page/App module, Turbopack's rendering process will fail to connect the IPC. This is because the entrypoint statically imports the dev module. If either fails, then we'll never reach the code to set up the IPC. This leads to a "timeout while receiving message from process" timeout error after 30s, instead of receiving an exact message/stack detailing the dev's error.

By wrapping the import code in a deferred dynamic-import closure, we're able to connect the IPC first, then evaluate the dev code. This wrapping style is a little awkward, but it's necessary with the way to inject virtual modules into our graph.

Fixes WEB-850
2023-04-04 19:24:31 +00:00
Leah
53ddfc833e
mark resolve issues inside a try block as warnings (#47763)
## Description

A require call inside a try block will only emit a warning instead of an error now.

I also added source information to the resolve issues where possible

### Example
```js
try {
  require("missing-module");
} ...
```
previously this would show an error in the overlay, now it's just a warning

## Additional Turbopack Updates

* https://github.com/vercel/turbo/pull/4414 (requirement for this)
* https://github.com/vercel/turbo/pull/4434
* https://github.com/vercel/turbo/pull/4447
* https://github.com/vercel/turbo/pull/4448
* https://github.com/vercel/turbo/pull/4446
2023-04-04 17:49:43 +00:00
JJ Kasper
43ff6cfd99 v13.2.5-canary.29 2023-04-04 13:44:22 +00:00
Shu Ding
a22d6a181e
Change package path from gitpkg.now.sh to gitpkg.vercel.app (#47879)
Avoids a couple of hops when installing packages as `.now.sh` returns a
redirection.
2023-04-03 17:21:15 -07:00
OJ Kwon
036f540bb4
feat(turbopack): support transform options (#47365)
<!-- 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



-->

### What?

This PR implements a feature for the turbpack to support (partial)
transform configuration inherited from ts/jsconfigs, notably for the
legacy decorators and jsx runtimes.

### Why?

### How?
- Closes WEB-667
2023-04-03 10:32:13 -07:00
Tim Neutkens
06d60ac140
New app routes resolving logic for turbopack (#47737)
### What?

Refactors the resolving logic for the `app` loader tree. This PR ensures
it's used to create entrypoints in turbopack. Next up is integrating it
into the webpack build too.

These changes also ensure that parallel routes resolving is applied,
which previously wasn't supported in turbopack.

### Why?

Part of the effort to deduplicate critical logic between
turbopack/webpack in Next.js, this will help land features in
turbopack/webpack at the same time.

### How?

Quite a few changes. @sokra helped a ton on this PR. `app_structure.rs`
was changed to the new resolving logic so most of the logic is there.

Additionally we added support for calling the same function in two ways
from Node.js: `turbo.entrypoints.get` and `turbo.entrypoints.getStream`.
`get` can be used by `next build` to get the full list of
entrypoints/loadertrees once. `getStream` has watching built-in and
calls a callback function with the new list anytime a file is added that
would change the loadertree.



<!-- 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 or adding/fixing 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-04-03 13:07:28 +02:00
JJ Kasper
e034df0b13 v13.2.5-canary.28 2023-04-03 07:16:33 +00:00
JJ Kasper
26e8197d7b v13.2.5-canary.27 2023-04-02 13:22:34 +00:00
Jiachi Liu
fae94416ff
Move modularize imports for next/server to next-swc (#47788)
Follow up for #47715 

Moving modularize imports handlign for next/server into `next-swc` side
2023-04-02 13:00:26 +02:00
JJ Kasper
90ac02f7be
Fix failing rust-check (#47811)
This corrects a failing rust-check that slipped through in
https://github.com/vercel/next.js/pull/47677 due to the check not being
marked as required which it now is.

x-ref:
https://github.com/vercel/next.js/actions/runs/4587341207/jobs/8100906394
2023-04-02 01:03:46 -07:00
JJ Kasper
c1a2b4f15e v13.2.5-canary.26 2023-04-02 06:31:25 +00:00
Justin Ridgewell
2abc824869
Turbopack: Use SharedError for body streaming (#47677)
Pending https://github.com/vercel/turbo/pull/4392 landing in Turbopack (and https://github.com/vercel/next.js/pull/47476 landing here), this removes `BodyError` and switches to `SharedError`. That should allow us to preserve the source chain of errors for when we finally display it to the dev, aiding debugging.
2023-04-01 11:37:17 +00:00
Tobias Koppers
f978e70053
provide full polyfill for process (#47764)
### What?

see also https://github.com/vercel/turbo/pull/4415

We need a full process polyfill to fix some edge cases

Also disables SourceMap for edge chunks, since they are not used

### Why?

Some packages do weird things, e. g.

```
var isBrowser = process.title === 'browser'
```
2023-04-01 12:06:36 +02:00
JJ Kasper
7c189c5c08 v13.2.5-canary.25 2023-04-01 03:32:33 +00:00
Maia Teegarden
7d27895c57
Fix typo in error overlay (#47762)
<!-- 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 or adding/fixing 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-03-31 19:08:01 -07:00
Justin Ridgewell
82787dba9d
turbopack: ensure ENV values are available in middleware (#47767)
Turbopack starts up the router process with all ENV values, but the edge
function definition didn't list any `env` keys for the function
invocation. So, middleware couldn't access any ENV values.

Turbopack doesn't currently have a way to determine what ENV keys are
actually used by the source program, so I'm just passing everything
defined. I'm not sure if that's an issue during dev (I could see it
being one for the build process, but that doesn't matter for this case).

Fixes #47766
Fixes WEB-831
Fixes WEB-834
2023-03-31 17:22:27 -07:00