Commit graph

2319 commits

Author SHA1 Message Date
vercel-release-bot
93fb762fc6 v14.1.1-canary.19 2024-01-29 05:29:58 +00:00
vercel-release-bot
98be3ba23e v14.1.1-canary.18 2024-01-28 23:21:57 +00:00
vercel-release-bot
f61b382f12 v14.1.1-canary.17 2024-01-27 23:21:15 +00:00
Shu Ding
ecef83ac61
Fix Server Reference being double registered (#61244)
When we apply `createActionProxy` twice to the same value, it currently
errors because we can't override the ID of it.

This PR makes sure that 1) when the value already have an ID defined, we
skip setting it again; 2) all the action IDs are being tracked even for
duplicated ones.

Note that it's technically impossible to "detect" the duplication here
(via static analyzation) and only set it once. For example:

```ts
'use server'

export async function foo () {}
export const bar = a_value_we_dont_know_yet ? foo : async () => {}
```

So, the compiler will always wrap `createActionProxy` for every exported
value and assume they're different Server Actions (hence different IDs).
With this fix, if we find that it's already defined before, we just
return the defined reference as they're strictly identical so the ID
does't matter.

Closes #54655, closes #61183.

Closes NEXT-2264
2024-01-27 14:15:24 +01:00
vercel-release-bot
98795f0737 v14.1.1-canary.16 2024-01-27 10:08:59 +00:00
Donny/강동윤
7b9d90bcdc
Update swc_core to v0.89.x (#61086)
## Turbopack

* https://github.com/vercel/turbo/pull/7092 <!-- Donny/강동윤 - Update `swc_core` to `v0.89.x` -->


### What?

Update SWC crates

### Why?

To fix some issues

### How?

Fixes #59805
Fixes #56144


Closes PACK-2222
Closes PACK-2285
2024-01-27 09:43:57 +00:00
vercel-release-bot
b81ce7256b v14.1.1-canary.15 2024-01-26 23:22:18 +00:00
vercel-release-bot
a655645bcb v14.1.1-canary.14 2024-01-26 16:25:21 +00:00
vercel-release-bot
5d0b29c046 v14.1.1-canary.13 2024-01-26 10:27:31 +00:00
vercel-release-bot
6391e1d820 v14.1.1-canary.12 2024-01-26 01:57:35 +00:00
vercel-release-bot
e2ca4e2228 v14.1.1-canary.11 2024-01-25 23:22:28 +00:00
vercel-release-bot
9da4edaf64 v14.1.1-canary.10 2024-01-24 22:02:36 +00:00
Leah
21c2f85805
fix(turbopack): custom page extensions for _app (#60789)
### What?
The import alias had no way to resolve the page extensions and we
already have them resolved in the `PagesStructure`, so with this PR we
use the already resolved paths.

Closes PACK-2085
Fixes #59264
2024-01-24 22:15:21 +01:00
Leah
17cc6437c9
fix: emotion import source should be enabled in SSR contexts (#61099)
### What?

Due to probably a confusing argument name the correct import source for
emotion wasn't used.

Closes PACK-2084
Fixes #59269
2024-01-24 20:19:55 +01:00
Leah
10ca4346f2
fix(turbopack): use correct layout for 404 page (#61032)
### What?

This fixes 2 issues with app 404 pages.
1. The root layout in a group was previously ignored when hitting the
404 page.
2. The default app 404 page was missing the correct path for dev
`/not-found` so it would fall back to the pages 404 page.

Closes PACK-2241
Fixes #60688
2024-01-24 20:07:06 +01:00
Shu Ding
3db8e9b035
Improve the Server Actions SWC transform (#61001)
This PR improves the Server Actions SWC transform to make it able to
handle nested Action declarations (check
`fixture/server-actions/server/28/input.js` for more details).

It is also a simplification of that transform's internal states and
methods, with the removal of an extra AST pass
(`stmts.visit_mut_with(&mut ClosureActionReplacer {
replaced_action_proxies: &self.replaced_action_proxies, })`). The
generated code is also smaller in some cases. So overall I'd expect the
compilation and runtime performance to improve as well.

## Details

With this change, we're now using `self.declared_idents` and
`self.names` to track closure arguments. `declared_idents` keeps the
identifiers **declared** in the current closure and above. `names` keeps
identifiers **appeared** in the current closure and above. In an example
of the following cursor:

```ts
let x

async function foo() {
  "use server"
  let y

  async function bar() {
    "use server"
    let z
    console.log(x, y, z)
  }

  // <- cursor
}
```

`declared_idents` would be `y` (`x` isn't in a closure), and `names`
would be `x, y, z`. By manipulating these two states we're able to track
closure closed-up variables recursively.

Closes NEXT-2189
2024-01-24 10:33:22 -08:00
vercel-release-bot
0e1aa71616 v14.1.1-canary.9 2024-01-24 10:27:13 +00:00
Donny/강동윤
014b212388
Update swc_core to v0.87.28 (#60876)
# Turbopack

* https://github.com/vercel/turbo/pull/7027 <!-- Donny/강동윤 - Update `swc_core` to `v0.87.28` -->

---

### What?

Update swc crates

### Why?

Required for #57718.
`styled-jsx` crate now has a hook to transform CSS code using a
Rust-side API

### How?

Fixes #57718



Closes PACK-2256
2024-01-24 08:05:05 +00:00
vercel-release-bot
b2b654dba7 v14.1.1-canary.8 2024-01-23 23:23:10 +00:00
Tim Neutkens
59e042a9a7
Implement client_root for edge in Turbopack (#61024)
## What?

Implements https://github.com/vercel/turbo/pull/7081. Ensures image
imports in the edge runtime have the correct asset url. Previously it
would be `/assets/file.hash.png` but it should be
`/_next/static/media/file.hash.png`.

Updates the image tests to correctly compare the values in Turbopack and
the values in Webpack. Currently it only checks webpack values, causing
the tests to fail in Turbopack.

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

-->


Closes NEXT-2194
2024-01-23 18:41:02 +01:00
vercel-release-bot
fc7a28a0dd v14.1.1-canary.7 2024-01-23 11:04:26 +00:00
Tobias Koppers
3a7fea4034
Revert "refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc" (#61021)
Reverts vercel/next.js#59300

Breaks `app/page.mdx` files

Closes PACK-2279
2024-01-23 12:00:36 +01:00
vercel-release-bot
bb2aaf74e8 v14.1.1-canary.6 2024-01-22 22:46:28 +00:00
OJ Kwon
9d5f62eb4a
refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc (#59300)
### Description

This PR refactors existing `analysis/get-static-page-info`, moves over
most of parse / ast visiting logic into next-swc's rust codebase. By
having this, turbopack can reuse same logic to extract info for the
analysis. Also as a side effect, this removes JS side parse which is
known to be inefficient due to serialization / deserialization.

The entrypoint `getPageStaticInfo` is still in the existing
`get-page-static-info`, only for extracting / visiting logic is moved.
There are some JS specific context to postprocess extracted information
which would require additional effort to move into.


Closes PACK-2088
2024-01-22 14:42:28 -08:00
vercel-release-bot
e5e33d4d21 v14.1.1-canary.5 2024-01-21 23:22:29 +00:00
vercel-release-bot
48533617d1 v14.1.1-canary.4 2024-01-20 23:23:00 +00:00
vercel-release-bot
5c0e1419ef v14.1.1-canary.3 2024-01-19 23:39:47 +00:00
Will Binns-Smith
7b9e711ed5
Report HMR latency as trace spans for Turbopack (#60799)
This:
- Makes makes reporting hmr changes more accurate by emitting an
explicit start event and lowering the aggregation period for reporting
completed turbo tasks
- Parameterizes the aggregation period, allowing JS subscribers to
request different intervals, such as for the next-rs-api test
- Aligns path pattern with webpack by normalizing its layer names
- Fixes a bug in `drainAndGetNext` where the stream never could drain
past the first item
- Sends `client-hmr-latency` spans from Turbopack in both page and app
router pages


Closes PACK-2252

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-01-19 15:34:17 -08:00
vercel-release-bot
f6da5a0fe2 v14.1.1-canary.2 2024-01-19 23:21:34 +00:00
vercel-release-bot
0fc29480fc v14.1.1-canary.1 2024-01-19 06:02:07 +00:00
vercel-release-bot
fcfa45cd8e v14.1.1-canary.0 2024-01-18 23:23:12 +00:00
vercel-release-bot
16e7a5bd93 v14.1.0 2024-01-18 21:41:02 +00:00
vercel-release-bot
1b255a6c5b v14.0.5-canary.68 2024-01-18 20:14:53 +00:00
vercel-release-bot
2096dfa687 v14.0.5-canary.67 2024-01-18 17:48:11 +00:00
Jiachi Liu
c192f4ec2f
turbopack: rename custom cache handler configs (#60828)
Follow up for #57953 for turbopack side

Closes NEXT-2153
2024-01-18 18:10:10 +01:00
Leah
c2473471e2
feat: support custom image loaders in turbopack (#60736)
### What?
We were missing the alias (and config field) for custom image loaders.

Closes PACK-2190
Fixes #60097
2024-01-18 16:23:06 +00:00
vercel-release-bot
8179e7008e v14.0.5-canary.66 2024-01-18 12:52:28 +00:00
Shu Ding
fd59a007e1
Fix Server Actions compiler bug (#60794)
This PR fixes the issue where an inline Server Action gets exported. As
this isn't the designed use case for inline Server Actions (they're
supposed to be defined and used inside another closure, such as
components), we are not handling the export cases currently:

```ts
export async function action() {
  "use server"
  ...
}

<form action={action}/>
```

...which gets compiled into:

```ts
export async function action() {} // No-op function

<form action={...actionReference...}/>
```

Note that everything works inside this module until you `import` that
action and use it in another module.

To tackle that, this PR changes how that works as described in
`server/27/output.js`.

Closes NEXT-2140
2024-01-18 01:29:07 +01:00
vercel-release-bot
70fc4028eb v14.0.5-canary.65 2024-01-17 23:23:34 +00:00
vercel-release-bot
8d4e5be736 v14.0.5-canary.64 2024-01-17 17:59:57 +00:00
Tobias Koppers
861b472b12
fix layout segment key to match up with manifest (#60783)
### What?

When webpack loaders are applied on a page file and it's renamed with
the `as` key, layout segment key no longer matches. This fixes that

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes PACK-2251
2024-01-17 17:11:50 +00:00
vercel-release-bot
a211566655 v14.0.5-canary.63 2024-01-17 15:14:46 +00:00
Tobias Koppers
b24ba17cc7
apply page transforms only on pages (#60779)
### What?

apply page transforms only on pages as intended

### Why?

Before they were applied on all files


Closes PACK-2250
2024-01-17 16:11:09 +01:00
Tim Neutkens
4548fed1cf
Skip postcss config location resolving in node_modules (#60697)
## What?

Skip postcss config resolving in node_modules for Turbopack. This
matches current Next.js on webpack closer as that only resolves the
postcss config from the project root. The additional feature Turbopack
has is that it can find a postcss config relative to the css being
compiled. This is useful for e.g. reducing the amount of overhead
certain postcss plugins that only have to run against a single file take
(i.e. Tailwindcss).


Depends on github.com/vercel/turbo/pull/7012 landing first.

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

-->


Closes NEXT-2109

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-01-17 13:54:17 +00:00
vercel-release-bot
c583528116 v14.0.5-canary.62 2024-01-17 11:37:23 +00:00
vercel-release-bot
7f3d9099c2 v14.0.5-canary.61 2024-01-17 10:16:12 +00:00
OJ Kwon
5956ff76b5
feat(next-core): port remaining next.js custom transforms (#60498)
<!-- 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?



-->

This PR ports over all of the remaining custom transforms for next-swc
into turbopack, and apply it into client / server rules accordingly.

Closes PACK-2225
2024-01-17 10:32:58 +01:00
Tobias Koppers
16d009ef1b
separate chunking per layout parts (#60569)
### What?

* creates a separate chunk group for client components per layout
segment (before it was per page)

### Why?

This fixes a bug with css loading on client transitions as next.js
assumes that the chunk group for the unchanged layout segments are
already loaded (fixes PACK-2163)


Closes PACK-2232
2024-01-17 08:18:59 +00:00
Tobias Koppers
4597ff35da
allow to pass available chunk items when creating a chunk group (#60554)
### What?

api changes for https://github.com/vercel/turbo/pull/6988

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6886 <!-- Tobias Koppers -
improve nesting of tracing for invalidations -->
* https://github.com/vercel/turbo/pull/6866 <!-- Tobias Koppers - trace
memory allocations and show in tracing -->
* https://github.com/vercel/turbo/pull/6988 <!-- Tobias Koppers - allow
to pass available chunk items when creating a chunk group -->
* https://github.com/vercel/turbo/pull/7013 <!-- Leah - fix: make CSS
reloading work on firefox -->
* https://github.com/vercel/turbo/pull/7004 <!-- Tobias Koppers -
improve error message when no config is exported from postcss.config.js
-->




Closes PACK-2231
2024-01-17 08:58:02 +01:00
vercel-release-bot
7341149c21 v14.0.5-canary.60 2024-01-16 23:22:30 +00:00