Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] canary from vercel:canary #566

Merged
merged 702 commits into from
Sep 12, 2023
Merged

[pull] canary from vercel:canary #566

merged 702 commits into from
Sep 12, 2023

Conversation

pull[bot]
Copy link

@pull pull bot commented Jul 21, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot requested a review from timneutkens as a code owner July 21, 2023 14:24
@pull pull bot added the ⤵️ pull label Jul 21, 2023
leerob and others added 28 commits August 24, 2023 17:19
Gives us more insight into turbo runs when building swc
Speeds up our stats generation by swapping out the underlying runner,
previously this took 13+ minutes now it's around 5 minutes.
This is the first step to enable the automatic "modularize imports"
optimization for some libraries. It transforms named imports like
`import { A, B, C as F } from 'foo'` to a special loader string: `import
{ A, B, C as F } from "barrel-optimize-loader?names=A,B,C!foo"`.

In a follow-up PR we'll apply corresponding optimization with another
SWC transformer.
The values of `NEXT_TEST_MODE` and `HEADLESS` can impact the test results so we should capture these values when CI runs.
…eSelectedLayoutSegments` (#53602)

This PR adds missing parameters to the `useSelectedLayoutSegment` & `useSelectedLayoutSegments` hooks since they take *optional* `parallelRoutesKey`.

Co-authored-by: Lee Robinson <[email protected]>
When `fallback: false` is set and you visit a dynamic segment (e.g. `/[slug]`), the router server was getting stuck in a `x-no-fallback` loop and eventually would fail because it was matching the output at `check_fs` before attempting to resolve dynamic routes in the `check: true` block.

Closes NEXT-1557
### What?

* add support for middleware manifest and edge adapter for pages API
routes
* improve the error reporting a tiny bit

### Why?

### How?


Closes WEB-1428
This ensures we don't pass through the signal field when revalidating a
fetch as that can be delayed and we don't want to abort the
revalidation.

Closes: #54045
When logging are sending from worker they're missing new line, that
could be directly added after to spinner

#### After

![image](https://github.com/vercel/next.js/assets/4800338/c4494ff8-0335-49e3-8cce-2f9dc1fe7975)

#### Before

![image](https://github.com/vercel/next.js/assets/4800338/bcf3e27d-de39-4e27-ac57-09c922c09ecc)
* vercel/turborepo#5723 <!-- Alex Kirszenberg - Misc
comments in turbo_tasks -->
* vercel/turborepo#5714 <!-- OJ Kwon - test(ci):
update datadog-ci -->
* vercel/turborepo#5705 <!-- Justin Ridgewell -
Transformation code necessary to support Server Actions -->
* vercel/turborepo#5739 <!-- Justin Ridgewell -
Update rust toolchain -->
* vercel/turborepo#5785 <!-- Tobias Koppers - add
evaluatables to chunk list ident -->
* vercel/turborepo#5783 <!-- Tobias Koppers -
Tracing improvements -->
* vercel/turborepo#5738 <!-- Alex Kirszenberg -
Generic types over Vcs -->
* vercel/turborepo#5795 <!-- Leah - fix: snapshot
test path canonicalization -->
* vercel/turborepo#5794 <!-- Tobias Koppers - fix
"any" context condition implementation -->
* vercel/turborepo#5800 <!-- Tobias Koppers - add
middleware entry type -->
* vercel/turborepo#5786 <!-- Tobias Koppers -
perform invalidation directly on writes -->

Closes WEB-1446
Hello!

I recently tried to cache the `.next/cache` directory in a GitHub action following what was said in the documentation and realized that hashing the source files didn't work properly.

This problem also occured in [next-cache](https://github.com/jongwooo/next-cache) and was fixed by [this PR](jongwooo/next-cache#17).

This PR simply changes the example from the documentation to apply the same fix (stop using brackets in the patterns passed to `hashFiles`).

Hope it helps!

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide
…ion (#54492)

Before:
```
Error: `export const config` in /vercel/path0/src/app/api/route.js is deprecated. Please change `runtime` property to segment export config. See https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
```

After:
```
Error: `export const config` in /vercel/path0/src/app/api/route.js is deprecated:
  - Change `config.runtime…` to `export const runtime = "edge"`
  - Change `config.regions…` to `export const preferredRegion = ["us-east-1"]`
Visit https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config for more information.
```

The values proposed in Change.. are the actual ones from the customers, they can just copy paste.

Closes NEXT-1560
This PR is a larger change to documentation to make the following
updates:

- Deconstructs [Server
Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions)
into "Forms and Mutations" and an API reference
- Removes content in place of future React API documentation pages
- Removes outdated [Building
Forms](https://nextjs.org/docs/pages/building-your-application/data-fetching/building-forms)
docs from the Pages Router and adds conditional content for both routes
in "Forms and Mutations"
- Adds TypeScript code blocks to API Routes page, recommends Route
Handlers for isomorphic signatures.
- Updates `revalidatePath` and `revalidateTag` docs to have a Server
Actions example.

---------

Co-authored-by: Delba de Oliveira <[email protected]>
Aims to make debugging the release stats failure easier as currently we
don't see the logs are the command is executing

x-ref:
https://github.com/vercel/next.js/actions/runs/5976635577/job/16221230094
x-ref: #54536
…ig (#54572)

## Implementation

Base on #54530, we're implementing a `optimize_barrel` transform to
optimize barrel files to only export the names we need. If the
transformed file isn't a "barrel file", we just re-export the names from
it without any transformation.

Take `lucide-react` as an example, with #54530 we are able to transform

```js
import { IceCream } from 'lucide-react'
```

to 

```js
import { IceCream } from '__barrel_optimize__?names=IceCream!=!lucide-react?__barrel_optimize_noop__=IceCream'
```

And then, we apply that new request with a new Webpack module rule to
use the SWC loader with option `optimizeBarrelExports: ['IceCream']`,
which eventually got passed to this new `optimize_barrel` transform and
does the optimization.

## Notes

We'll have to add a new `getModularizeImportAliases` alias list to map
`lucide-react` to the ESM version, as we have the `['main', 'module']`
resolve order for the server compiler. Otherwise this optimization
doesn't work in that compiler.

There's no e2e test added because it's already covered by the
`modularize-imports` test as we removed the default `lucide-react`
transform rules and it still works.

We'll need to test other libs before migrating them to the new
`optimizePackageImports` option.

---

Closes #54571, closes #53605, closes #53789, closes #53894, closes
#54063.
This should fix the stalled action as it seems we aren't skipping this postinstall step when we should be which explains why it was passing for PR stats but not release stats

x-ref: https://github.com/vercel/next.js/actions/runs/5980582756/job/16227150469
Small change to reuse the same array defined right above.

<!-- 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
ForsakenHarmony and others added 29 commits September 8, 2023 21:35
This auto-generated PR updates font data with latest available
Update to fix vulnerability in @builder.io/[email protected] 

Co-authored-by: Snyk bot <[email protected]>
Seems to be rendering fine here (https://nextjs.org/docs/messages/react-hydration-error) with actual numbering
Snyk has created this PR to upgrade @makeswift/runtime from 0.2.2 to 0.10.13.




Co-authored-by: Snyk bot <[email protected]>
…55226)

This PR tweaks the webpack config so that when we compile user code with webpack, we remove all branches of code that are guarded with `process.env.TURBOPACK`. I noticed that the bundle runtime was not tree-shaken correctly, this fixes that.
upgrade recoil from 0.7.6 to 0.7.7

Co-authored-by: snyk-bot <[email protected]>
Co-authored-by: Steven <[email protected]>
### Why?

The `ImageResponse` class constructor returns a `Response` instance, but doesn't extend `Response`, so it doesn't pass the type check introduced in #51394.

### How?

Make the `ImageResponse` class a subclass of `Response`.

### Notes

I can't find any tests to check for the types so didn't add any tests here; but shouldn't there be one?
### What?

https://vercel.slack.com/archives/C04KC8A53T7/p1694190462958199

I realized we throws an error attempt to destory against undefined instance when `beforeAll` fails in any reason. This is quite redundant error since if next instance doesn't exist, likely there's an upstream test failures already and destory against undefined error is not useful to debug anyway.

PR replaces `nextTestSetup`'s teardown first, for the remaining places calling `next.destory` explicitly will be amended later.
Closes WEB-1518

### What?

This PR refactors test cases from next-dev, tests basic tailwind rendering with turbopack. It still runs against plain next.js too. While checking, noticed there's a stub fixture (css-fixture/with-tailwindcss) but those fixture seems not being used in the test. Moved those and utilized. Since this test runs against next.js / turbopack both anyway, moving fixture should not be a huge regression I believe.
This PR fixes a single character typo.
Currently we create separate workers to isolate `pages` and `app`
routers due to differing react versions being used between the two. This
adds overhead and complexity in the rendering process which we can avoid
by leveraging an `esm-loader` similar to our `require-hook` to properly
alias `pages` router to the bundled react version to match `app` router
when both are leveraged together.

This aims to seamlessly inject the `esm-loader` by restarting the
process with the loader arg added whenever `next` is imported so that
this also works with custom-servers and fixes the issue with custom
req/res fields not working after upgrading.


x-ref: #53883
x-ref: #54288
x-ref: #54129
x-ref: #54435
closes: #54440
closes: #52702
x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1693348443932499?thread_ts=1693275196.347509&cid=C03KAR5DCKC)

---------

Co-authored-by: Tim Neutkens <[email protected]>
Co-authored-by: Zack Tanner <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
### What

Found a flaky test like https://github.com/vercel/next.js/actions/runs/6125719281/job/16628276301?pr=55118#step:29:174, `get-port` throws by port is not available. Peeking bit, there seems an upstream fix hope to improve the situation but unfortunately it happened after get-port switched to native esm only, so bumping is non trivial work. Instead adapting get-port-please as a replacwement but leave get-port as fallback for a while to verify its stability. Once we are certain, we can remove old get-port entirely.
### Fixing a bug

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

Closes NEXT-
Fixes #55050 


Co-authored-by: Steven <[email protected]>
Co-authored-by: Tim Neutkens <[email protected]>
This fixes a "bug" where Sentry was trying to access some of the internal async storages and it would fail because their imports would be compiled as-is instead of using the special rules for Next externals as we are short-cutting it for `next/dist` requests for some reason.

Not a bug per se because this is technically an undocumented API but I think it's a reasonable fix since we don't provide an API for that. The alternative for them would be to try to play around with the bundling, which is not a good use of anyone's time.
In error overlay when the error trace file path is too long, the open editor icon on the right side get shrinked to very small. Mark it as `flex-shrink: 0` to avoid the unexpected size change

### After

![image](https://github.com/vercel/next.js/assets/4800338/31d93520-ee82-4867-97b3-9e22e5f71da7)


### Before

![image](https://github.com/vercel/next.js/assets/4800338/57c27636-b9e6-4e1d-b68b-0247dbd882cd)
This PR fixes a small issue where we would not save nor read the minimal
server trace file from the cache, meaning that whenever you would do two
builds in a row, the build would skip the tracing of the server as
expected but not include a minimal server trace in the dist folder.

<!-- 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 #

-->
to upgrade date-fns from 2.28.0 to 2.30.0.



Co-authored-by: Snyk bot <[email protected]>
upgrade sharp from 0.29.3 to 0.32.5.

Fix Remote Code Execution (RCE)
[SNYK-JS-SHARP-2848109](https://snyk.io/vuln/SNYK-JS-SHARP-2848109)




Co-authored-by: Snyk bot <[email protected]>
@pull pull bot merged commit 9f85240 into MLH-Fellowship:canary Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.