Commit graph

15178 commits

Author SHA1 Message Date
Tobias Koppers
ebe0686a9d
Run turbopack integration tests for next.js changes too (#47608)
### What?

Turbopack tests need to run on any change

### Why?

Next.js changes might break turbopack and we want to avoid that.

### How?

Change CI job

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-30 18:21:19 +02:00
Balázs Orbán
cbb8486afa
docs: clarify returning response in Middleware (#47696)
I noticed that the wording was still suggesting that you needed to
"enable" this, but since
[`13.1`](https://nextjs.org/blog/next-13-1#nextjs-advanced-middleware),
`experimental.allowMiddlewareResponseBody` is not needed anymore.

Ref: #44224
2023-03-30 09:13:14 -07:00
Jan Kaifer
80ebfad19d
Handle async require when importing ESM in instrumentation.ts (#47658)
Fixed issue where `require` will return a Promise if (and only if) there
is an ESM module imported in `instrumentation.ts`:
61cd219f15/packages/next/src/server/next-server.ts (L212)

Had to move stuff to async function from constructor, but luckily we
already have `prepare`.
2023-03-30 16:05:26 +00:00
Jiachi Liu
16badb40c1
test: disable the flaky test for parallel-routes-and-interception (#47694)
x-ref: https://github.com/vercel/next.js/actions/runs/4548265038/jobs/8019160929?pr=47630
2023-03-30 15:25:51 +00:00
Karl Horky
e7371bc3b7
Fix next-types-plugin generated files for Node16/NodeNext (#47571)
### What / Why / How?

In a project with `"type": "module"` in `package.json` and a `compilerOptions.moduleResolution` of `Node16` or `NodeNext` in `tsconfig.json`, running `tsc` will yield errors like the following:

```
.next/types/app/[...not_found]/page.ts:1:40 - error TS2307: Cannot find module 'next/dist/lib/metadata/types/metadata-interface' or its corresponding type declarations.

1 import type { ResolvingMetadata } from 'next/dist/lib/metadata/types/metadata-interface';
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.next/types/app/layout.ts:2:24 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../../../app/layout.jsx'?

2 import * as entry from '../../../app/layout'
                         ~~~~~~~~~~~~~~~~~~~~~

.next/types/app/layout.ts:3:40 - error TS2307: Cannot find module 'next/dist/lib/metadata/types/metadata-interface' or its corresponding type declarations.

3 import type { ResolvingMetadata } from 'next/dist/lib/metadata/types/metadata-interface'
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

These files are checked because of the following `tsconfig.json` line which Next.js adds:

```diff
{
  "include": [
+    ".next/types/**/*.ts",
  ]
}
```

Adding the extensions will make it work with these projects and still maintain backwards compatibility with other TypeScript / module configurations.
2023-03-30 14:43:27 +00:00
Jiachi Liu
99cdb36663
Vendor @vercel/og and expose ImageResponse (#47657
### What?

This PR vendors @vercel/og and export `ImageResponse` from
`next/server`. When you render a opengraph image the below code snippets
will be legit:

```tsx
import { ImageResponse } from 'next/server'

export default function og() {
  return new ImageResponse(<div style={{ width: '100%', height: '100%' }}>hello</div>)
}
```

### Why?

To make development more easier, user can directly use `@vercel/og`
Image Response with nextjs instead of install it and use it. This makes
building metadata icons, og or twitter images more convenient.

### How?

Closes NEXT-899
2023-03-30 13:06:30 +02:00
Shu Ding
90922acd73
Revert "Update vendored react to 18.3.0-next-85de6fde5-20230328" (#47687)
Reverts vercel/next.js#47675
2023-03-30 11:06:04 +00:00
JJ Kasper
4803102a24 v13.2.5-canary.21 2023-03-30 05:16:37 +00:00
JJ Kasper
ed156fa18f
Update pnpm version for trigger release 2023-03-29 22:01:40 -07:00
JJ Kasper
6e8ee78dfa
Fix rust-check 2023-03-29 20:27:01 -07:00
OJ Kwon
7e70ac64b3
build(next-swc): introduce turbo-binding (#47512)
<!-- 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-736.

This PR refactors imports to turbopack to turbo-binding, as same as we
used to do with next-binding. Current next-binding in this repo doesn't
make sense anymore and removed. There are no functional changes. This'll
reducwe surface for the imports and also will make easier to run
integration test over latest turbopack.

Note swc dependency is not reflected in this PR yet - following PR will
update those imports.
2023-03-29 20:25:11 -07:00
Leah
0ed46203aa
resolve browser modules for edge api in turbopack (#47604) 2023-03-30 01:58:51 +00:00
Ngô Đức Anh
ca56e4fb26
Fix(next-types-plugin): remove unused imports (#47667)
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?

This PR fixes the issue where `next-types-plugin`'s typeguard files include unused imports, which was introduced by #47185 and might be problematic with certain configuration.

### Why?

We don't need `ResolvingMetadata` when `options.type` is `'route'` and `NextRequest` when `options.type` is `'page'`/`'layout'`, and so caused the issue.

### How?

Simply check whether `options.type` is `'route'` or `'page'`/`'layout'`.

Fixes #47646
2023-03-30 00:21:52 +00:00
isaackatayev
e9085efe47
Grammar fix (#47600)
<!-- 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 #

-->
Change are -> is in docs (check commits).

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-29 16:43:26 -07:00
Steven
b1cbb4c466
fix: improve type of ExportPathMap (#47676)
This is a new PR with only the typescript changes from previous closed
PR #47628
2023-03-29 16:35:31 -07:00
Jiachi Liu
0a94e2221f
Update vendored react to 18.3.0-next-85de6fde5-20230328 (#47675)
Changelog from react side

```
-  85de6fde5 Refactor DOM special cases per tags including controlled fields (#26501) (Sebastian Markbåge)
-  5cbe6258b Remove unnecessary CIRCLE_CI_API_TOKEN checks (#26499) (Mengdi Chen)
-  1f5cdf8c7 Update Suspense fuzz tests to use `act` (#26498) (Andrew Clark)
-  f62cb39ee Make disableSchedulerTimeoutInWorkLoop a static ff (#26497) (Ricky)
-  f71819931 [DevTools] browser extension: improve script injection logic (#26492) (Mengdi Chen)
-  41b4714f1 Remove disableNativeComponentFrames (#26490) (Ricky)
-  fc90eb636 Codemod more tests to waitFor pattern (#26494) (Andrew Clark)
-  e0bbc2662 Improve tests that deal with microtasks (#26493) (Andrew Clark)
-  8faf75193 Codemod some expiration tests to waitForExpired (#26491) (Andrew Clark)
-  8342a0992 Remove unused feature flag disableSchedulerTimeoutBasedOnReactExpirationTime (#26488) (Jan Kassens)
-  afea1d0c5 [flow] make Flow suppressions explicit on the error (#26487) (Jan Kassens)
-  768f965de Suspensily committing a prerendered tree (#26434) (Andrew Clark)
-  d12bdcda6 Fix Flow types of useEffectEvent (#26468) (Sebastian Silbermann)
-  73b6435ca [Float][Fiber] Implement waitForCommitToBeReady for stylesheet resources (#26450) (Josh Story)
-  175962c10 Fix remaining CommonJS imports after Rollup upgrade (#26473) (dan)
-  3fcf209ea React DevTools 4.27.3 -> 4.27.4 (#26470) (Mengdi Chen)
-  bde974ae4 [DevTools] missing file name in package.json (#26469) (Mengdi Chen)
-  909c6dacf Update Rollup to 3.x (#26442) (Mark Erikson)
-  9c54b29b4 Remove ReactFabricPublicInstance and used definition from ReactNativePrivateInterface (#26437) (Rubén Norte)
-  f77099b6f Remove layout effect warning on the server (#26395) (Ricky)
-  51a7c45f8 Bugfix: SuspenseList incorrectly forces a fallback (#26453) (Andrew Clark)
-  afb3d51dc Fix enableClientRenderFallbackOnTextMismatch flag (#26457) (Sebastian Markbåge)
-  8e17bfd14 Make InternalInstanceHandle type opaque in ReactNativeTypes (#26461) (Rubén Norte)
-  8bdf162bc React DevTools 4.27.2 -> 4.27.3 (#26459) (Mengdi Chen)
-  b93b4f074 Should not throw for children of iframe or object (#26458) (Sebastian Markbåge)
-  c0b34bc5f chore: update links of docs and api (#26455) (Leedom)
-  56f7a90e6 chore: update new docs links for react-dom (#26456) (Leedom)
-  bd5e32309 Small Flow upgrade to 0.202.0 (#26435) (Jan Kassens)
-  ffb6733ee fix docs link for useSyncExternalStore (#26452) (Valor(华洛))
-  0018cf224 Add REVISION file to react-fbsource-import (#26448) (Samuel Susla)
```

Also merge react and react-server-dom-webpack vendor job into one
2023-03-29 23:21:33 +00:00
Steven
d19617e9c7
fix: image loaderFile with edge runtime (#47659)
- Fixes #47168 
- fix NEXT-909 ([link](https://linear.app/vercel/issue/NEXT-909))
2023-03-29 15:08:36 -07:00
Tobias Koppers
f44e214ff1
provide Buffer polyfill to client and edge (#47610)
### What?

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

Polyfill Buffer

### Why?

Legacy reasons

fixes WEB-642
2023-03-29 21:33:30 +00:00
Steven
b55633fe1c
fix: handle output: export with use client (#47635)
This PR removes usage of `appPaths` in favor of `hasAppDir` to avoid the
issue where export does not read app manifest.

Fixes the error:

```
TypeError: Cannot read properties of undefined (reading 'cssModules')
```

fix NEXT-885 ([link](https://linear.app/vercel/issue/NEXT-885))
2023-03-29 13:55:32 -07:00
Wyatt Johnson
aca83d2a09
Move App Route handler logic into bundle (#47633)
Previously the app route handler was included in the server bundle, and called into user code to execute the underlying handler logic. This PR serves to move the handler code into the bundle so that the Node.js environment more closely matches the Edge environment.

This also updates the Rust code for the new loader.
fix NEXT-712 ([link](https://linear.app/vercel/issue/NEXT-712))
2023-03-29 19:31:30 +00:00
Leah
13f21520c2
show most recent error first in turbopack error overlay (#47414)
Also refactors the `Errors` state into a reducer, which makes things a bit easier to reason about (in my opinion)


I tried adding an ID to the issue, so we don't have to stringify the whole issue, but unfortunately that duplicates (parsing issues)

the reason is probably that files get parsed twice, once for the client and once for the server side
2023-03-29 16:05:31 +00:00
Jiachi Liu
facea99f0e
Expose metadata types (#47630)
### What?

- Besides existing `Metadata` type, expose `ResolvingMetadata` and `ResolvedMetadata` to `'next'`.
- Group `Robots` / `Sitemap` / `Manifest` these dynamic data routes types as `MetadataRoute` type and expose to `'next'`

### Why?

Allow users to type the more API easily, and grouping them to avoid type conflicts (e.g. we have `Robots` in metadata interface field, `MetadataRoute.Robots` can avoid conflicts)

### How?

Closes NEXT-908
2023-03-29 11:16:47 +00:00
Leah
46151dd68b
fix typescript errors in next-core (#47607)
Fixes WEB-809
2023-03-29 02:53:32 +00:00
Max Gudkov
9d9bd8be15
Fix typo (#47634) 2023-03-28 23:08:40 +00:00
Jiachi Liu
f6e6c2f01a
Fix robots.txt generation (#47625)
### What?
Fix robots.txt generation

### Why?

Should support multiple allow/disallow rules, they should be generated in different lines

### How?

Closes NEXT-905
Fixes #47224

fix NEXT-905 ([link](https://linear.app/vercel/issue/NEXT-905))
2023-03-28 21:22:37 +00:00
Shu Ding
54fce53dd9
Make sure the global not found route doesn't conflict with existing /not-found route (#47619)
In #47328 we made the root level `/not-found.js` a special entry, to
override the page 404 during builds. However, it's possible that the
user has a valid `/not-found/page.js` route that might conflict with
this special entry. This PR changes the entry to be `/_not-found` so it
will never conflict with existing valid entries.
2023-03-28 21:54:58 +02:00
JJ Kasper
28d56ec95f
Update test create-next-app running (#47611)
This re-enables running the CNA tests for all non-docs changes as it's now ensuring we don't regress on turbopack or our default templates. 

Also fixes the main repo's package.json files from being modified during tests.
2023-03-28 17:39:00 +00:00
JJ Kasper
4d0f5a0503
Revert "Move App Route handler logic into bundle" (#47614)
Reverts vercel/next.js#47582

This breaks turbopack support so we should address that before landing.
Potentially we can re-use the same loader for both which would eliminate
this issue.

x-ref:
https://github.com/vercel/next.js/actions/runs/4544370605/jobs/8010399819
x-ref:
https://github.com/vercel/next.js/actions/runs/4545240650/jobs/8012475072?pr=47611
fix NEXT-712 ([link](https://linear.app/vercel/issue/NEXT-712))
2023-03-28 10:12:03 -07:00
Wyatt Johnson
5dc31354b9
Move App Route handler logic into bundle (#47582)
Previously the app route handler was included in the server bundle, and
called into user code to execute the underlying handler logic. This PR
serves to move the handler code into the bundle so that the Node.js
environment more closely matches the Edge environment.
fix NEXT-712 ([link](https://linear.app/vercel/issue/NEXT-712))
2023-03-28 16:38:17 +02:00
Wyatt Johnson
bf52c25497
Underscore Handling Fixes (#47581)
Previously to this PR, if an absolute path contained an `_` it would
ignore all app files. If for example the Next.js app was in a folder
named `/some/_directory` then today:

```
/some/_directory/app/page.js <- should 200, currently 404
/some/_directory/app/route.js <- should 200, currently 404
/some/_directory/app/_internal/route.js <- should 404, currently 200 in development
```

This also enables the same `_` functionality for app routes in
development. After this PR, we get:


```
/some/_directory/app/page.js <- 200
/some/_directory/app/route.js <- 200
/some/_directory/app/_internal/route.js <- 404
```
2023-03-28 12:19:01 +02:00
Tobias Koppers
18131c7dab v13.2.5-canary.20 2023-03-28 08:18:00 +00:00
Tobias Koppers
e5eba6181f
add test case for nested imports (#47580)
### What?

Test case for https://github.com/vercel/turbo/pull/4349

### Why?

It should continue working 

### How?

Test case added
2023-03-28 00:26:41 -07:00
Shu Ding
1cebb74462
Fix race condition of invalidation (#47586)
Currently, we always invalidate the compiler during `ensurePage` but that might cause an issue when the compilation is slow (and other cases too):

<img width="836" alt="CleanShot-2023-03-28-B4dOAWJU@2x" src="https://user-images.githubusercontent.com/3676859/228087347-0b0eff94-d920-47b3-97b3-894272672e74.png">

So this PR modifies the `ensurePage` promise after invalidation to always wait for that additional rebuilds, if that's also caused by this invalidation.

fix NEXT-893 ([link](https://linear.app/vercel/issue/NEXT-893))
2023-03-28 06:13:30 +00:00
Will Binns-Smith
80d6c69867
Document various structs and methods in next/font (#47588) 2023-03-28 04:56:52 +00:00
Will Binns-Smith
56ebe97ae4
Implement automatic font fallback support for next/font/local (#47463)
Fixes WEB-787.

This implements automatic font fallbacks for `next/font/local`. It uses the `allsorts` library to query font metrics across woff and ttf fonts.

Test Plan: Now passes 24 Next.js integration tests, up from 14.
2023-03-28 01:22:48 +00:00
Ian Macartney
38953adb11
Update Convex example to convex@0.12.0 (#47175)
Updates Convex to 0.12.0

### Improving Documentation or adding/fixing Examples

- [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

Co-authored-by: Alex Cole <2695197+alexcole@users.noreply.github.com>
2023-03-28 00:32:20 +00:00
Karl Horky
45e2c1e064
Switch to ESM Jest config in docs (#42144)
Thanks again for Next.js 13! Finding a bunch of new ways to improve things 🙌 

Just a quick PR to switch the Jest configuration file with `next/jest` to ESM to eliminate another instance of CommonJS.

ESM requires a `.js` extension on the import.

An alternative would be to switch to a TypeScript config file (`jest.config.ts`) which would (I am guessing) not require this file extension (but still allow switching to an ESM-style `import` syntax).

New version in the diff:

```js
// jest.config.mjs
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
  // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
  dir: './',
})

// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const config = {
  // Add more setup options before each test is run
  // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  // if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
  moduleDirectories: ['node_modules', '<rootDir>/'],
  testEnvironment: 'jest-environment-jsdom',
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config)
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-28 00:10:58 +00:00
Lachlan Campbell
461617bc70
docs(image): Update browser bugs section for Safari 16.4 release (#47577)
### What?

Safari 16.4, released today, fixed a known browser bug [around lazy-loading images](https://webkit.org/blog/13966/webkit-features-in-safari-16-4/#:~:text=Now%20in%20Safari%2016.4%2C%20a%20gray%20line%20no%20longer%20appears%20to%20mark%20the%20space%20where%20a%20lazy%2Dloaded%20image%20will%20appear%20once%20it%E2%80%99s%20been%20loaded.).

### Why?

This bug is mentioned in the docs & the fix has been long-awaited by @styfle & users.

### How?

I've updated the next/image doc with this link.
2023-03-28 00:02:27 +00:00
Lee Robinson
7c44cf0a3b
Use App Router for static export example. (#47584)
To aid the new docs, stable static export in the next release.

https://beta.nextjs.org/docs/configuring/static-export
2023-03-27 23:11:47 +00:00
OJ Kwon
553cf48acb
ci(workflow): run checks for the test specific features (#47572)
This PR is minor update to ci workflow to verify test-only features are
being compilable correctly.
2023-03-27 14:31:45 -07:00
Jan Kaifer
54a08ebe77
Fix instrumentation not being called on edge in some cases (#47495)
- Modified tests to catch issue with instrumentation not being invoked
for edge api calls
- Add tests for middleware
- Add instrumentation into middleware bundle

<!-- 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-27 20:54:43 +00:00
JJ Kasper
4a2df3c375
Fix fetch cache config and fetch revalidates (#47573)
This ensures we properly honor config and fetch based revalidate on the
same page in fetch cache.

Fixes:
https://github.com/vercel/next.js/actions/runs/4529647521/jobs/7978177827
2023-03-27 13:08:23 -07:00
Dante
a0c2703245
Handle unknown platform triples in next-swc (#47570)
Adding OpenBSD and NetBSD platforms

Fixes: #44058

Probably needs more review I tried compiling the codebase as instructed
with pnpm
[here](https://github.com/dante-robinson/next.js/blob/canary/contributing/core/developing.md),
but turbo (a dependency of pnpm) has no BSD binary so I can't compile
the code on OpenBSD to test it however @gjskha mentioned in the issue he
added openbsd as a platform to get it working so in theory this change
should work and shouldn't break anything.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-27 11:39:53 -07:00
Shu Ding
b28cd21ee5
Improve client boundary source type detection (#47532)Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Currently in a client boundary file, we only explicitly export
individual fields in ESM (`export foo`) when the source type is
`module`. However in most of the time SWC gives the `auto` source type.
This PR improves the type detection a bit so if it's `auto` and we do
see ESM exports collected, we assume it's ESM and re-export these
fields.

Fixes #41940, fix NEXT-796
([link](https://linear.app/vercel/issue/NEXT-796)).

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-27 19:16:23 +02:00
Will Binns-Smith
e3875d7421
next/font/local support for Turbopack (#47369)
Fixes WEB-249

Depends on vercel/turbo#4288

This implements support for `next/font/local` for Turbopack. It:

* Removes the compile-time feature restricting access to `next/font/local`
* Implements `NextFontLocalReplacerVc` and `NextFontLocalCssModuleReplacerVc`, similar to their `next/font/google` equivalents, and adds them as ImportMappings to handle requests for `next/font/local/target.css` and `@vercel/turbopack-next/internal/font/local/cssmodule.module.css` (these requests are created by the JavaScript returned by the requests for the `target.css` module)
* Implements fallback support for Times New Roman and Arial via `adjust_font_fallback` as the webpack implementation does. Font metric override adjustment will be added in a future PR.

Test Plan: New passes 14 next-font integration tests in the Next.js integration test suite, up from 8.
2023-03-27 16:30:25 +00:00
Tobias Koppers
4c2ad81ea7
Add initial tree shaking refactorings (#47559)
### What?

Changes for https://github.com/vercel/turbo/pull/3338
2023-03-27 15:18:04 +00:00
Jan Kaifer
1cea1c22bc
Remove unneeded waiting in otel tests (#47431)
- wip
- remove waiting for otel before tests
- remove useless timeout in test



fix NEXT-815 ([link](https://linear.app/vercel/issue/NEXT-815))
2023-03-27 10:50:06 +00:00
Tobias Koppers
2eee4aad95
remove unused turbo dependencies (#47557)
### What?

These dependencies are not used

### Why?

Automatically updating them fails as they are unused
2023-03-27 09:56:31 +00:00
Donny/강동윤
688d8253da
refactor(relay): Use transform from swc/plugins repository (#47441)
Previously `next-swc` had relay transform inline, but it makes
maintenance harder. So this PR patches next-swc to use relay plugin from
`swc-project/plugins` repository.

Closes WEB-782
Fixes #47239

fix NEXT-883 ([link](https://linear.app/vercel/issue/NEXT-883))
2023-03-27 09:34:09 +02:00
JJ Kasper
53bcdea01c v13.2.5-canary.19 2023-03-27 07:05:28 +00:00