Commit graph

182 commits

Author SHA1 Message Date
Leah
e9ac616414
chore: update Turbopack (#59589)
### Changes

* https://github.com/vercel/turbo/pull/6777 <!-- Leah -
fix(turbopack-ecmascript-runtime): handle non encoded CSS paths -->
* https://github.com/vercel/turbo/pull/6785 <!-- Tim Neutkens - Ensure
turbopack-trace-server doesn't send message in a loop -->



Closes PACK-2147
2023-12-13 18:25:37 +01:00
Donny/강동윤
d5291fad49
Update swc_core to v0.86.98 and turbopack (#59393)
### What?

Update SWC crates.

### Why?

To fix OOM bug of `inputSourceMap`.

Patch: https://github.com/swc-project/swc/pull/8402

### How?

Closes PACK-2123



# Turbopack updates

* https://github.com/vercel/turbo/pull/6733 <!-- Thomas Knickman -
chore(ignore): exclude rustic-ice files -->
* https://github.com/vercel/turbo/pull/6731 <!-- Leah -
fix(turbopack-ecmascript-runtime): don't use `path.relative` for
absolute paths -->
* https://github.com/vercel/turbo/pull/6745 <!-- Donny/강동윤 - Update
`swc_core` to `v0.86.98` -->
2023-12-08 19:34:02 +09:00
Tobias Koppers
26b8caaa29
Turbopack: switch to a single client components entrypoint (#59352)
### What?

switch turbopack to use a single client components entrypoint for all
client components on a page for development. This aligns it with the
webpack behavior.

### Why?

compiling a separate entrypoint for every client component is pretty
expensive in regards of compilation, chunking, code generation, file
writing and number of requests.

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6713 <!-- Tobias Koppers - use
real emojis -->
* https://github.com/vercel/turbo/pull/6728 <!-- Tobias Koppers - fix
order of reverse topologic iteration -->


Closes PACK-2115
2023-12-08 08:24:08 +01:00
Tobias Koppers
34e9d65d29
update turbopack (#59334)
* https://github.com/vercel/turbo/pull/6716 <!-- Tobias Koppers - add
support for export renaming in side effects optimization -->
* https://github.com/vercel/turbo/pull/6718 <!-- Tobias Koppers - cache
the chunking work -->
2023-12-06 17:20:52 +01:00
Tobias Koppers
0082d54893
side effects optimization (#58972)
### What?

Code update for refactoring in https://github.com/vercel/turbo/pull/6590


Closes PACK-2043
2023-12-06 08:23:46 +00:00
Tobias Koppers
2b473970ef
update turbopack (#59285)
* https://github.com/vercel/turbo/pull/6588 <!-- Leah - ci: remove daily
turbopack next.js integration test workflow -->
* https://github.com/vercel/turbo/pull/6666 <!-- Will Binns-Smith -
Turbopack css: treat `composes` and `@import` as urls when resolving -->
* https://github.com/vercel/turbo/pull/6701 <!-- Tobias Koppers - add
user level tracing -->
* https://github.com/vercel/turbo/pull/6616 <!-- Leah - feat(turbopack):
support "loading" WebAssembly injected as global varables in edge
runtime -->

Closes PACK-2086
2023-12-05 14:06:49 +01:00
Tobias Koppers
669a48cb4d
fix tsconfig alias cycle (#59232)
### What?

fixes https://github.com/vercel/next.js/issues/59195
fixes PACK-450

### Why?

### How?

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

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6627 <!-- Tobias Koppers - fix
stack trace of errors -->
* https://github.com/vercel/turbo/pull/6646 <!-- OJ Kwon -
fix(turbo-tasks-fs): support unicode segment for glob -->
* https://github.com/vercel/turbo/pull/6672 <!-- OJ Kwon -
fix(ecmascript): dbg assert for the globals -->
* https://github.com/vercel/turbo/pull/6687 <!-- Tobias Koppers - fix
tsconfig alias cycle -->
2023-12-04 10:50:15 +01:00
OJ Kwon
72af59a1c1
build(cargo): bump up turbopack (#59032)
### What?

Bump up turbopack which includes url rewrite related improvements. This makes `test/integration/url` test passes.

Note there are some lacking behavior around edge runtime + url behavior, it is being tracked in PACK-2014.

Closes PACK-2051
2023-11-28 20:42:26 +00:00
OJ Kwon
048ab21f6b
fix(turbopack): treat .mdx as valid ecma asset (#58985)
### What

Pairing with https://github.com/vercel/turbo/pull/6602, enables
ecma-related transform support in mdx. notably fixes test cases in
https://github.com/vercel/next.js/pull/58968 .

With turbopack side fix, still modularize imports are not being applied
as we limite it to .js* extension only. PR expands it to include mdx if
mdx is enabled. PR is failling until turbopack side fix lands.

Closes PACK-2045

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-28 13:54:46 +01:00
Tobias Koppers
f1511515fd
Trace server updates (#58694)
### What?

some refactoring updates


Closes PACK-1994
2023-11-27 15:29:41 +01:00
Donny/강동윤
8e6d51f4fa
Update swc_core to v0.86.81 (#58517)
### What?

Update swc crates.

Diff:
09b3003e58...c566b73bfb

### Why?

To fix bugs, and improve minification.

### How?

turbopack counterpart: https://github.com/vercel/turbo/pull/6472

- Closes PACK-1972

- Closes #30802

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-27 11:02:25 +01:00
Tobias Koppers
9f69766cfa
Turbopack: enable some node.js builtin in edge runtime (#58850)
### What?

Edge runtime allow additional node.js builtins

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


Closes PACK-2031

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-11-26 19:55:23 +01:00
Tim Neutkens
c3c006d9f0
Upgrade Turbopack (#58859)
* https://github.com/vercel/turbo/pull/6540 
* https://github.com/vercel/turbo/pull/6549 
* https://github.com/vercel/turbo/pull/6554 
* https://github.com/vercel/turbo/pull/6561 
* https://github.com/vercel/turbo/pull/6563 
* https://github.com/vercel/turbo/pull/6562 
* https://github.com/vercel/turbo/pull/6544
2023-11-24 12:33:50 +00:00
Will Binns-Smith
b3914f6175
Turbopack: update to turbopack-231122.3 (#58784)
Includes vercel/turbo#6525
2023-11-22 22:22:26 +01:00
Will Binns-Smith
154268a144
Turbopack: Use styled issue titles and details (#58743)
This uses styled issue titles and details introduced in
vercel/turbo#6535, which also moves "Module not found" messaging to the
title field for those issues.


Closes PACK-2013

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Leah <github.leah@hrmny.sh>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-11-22 13:39:24 +01:00
Tobias Koppers
3467116794
fix node externals resolving (#58129)
### What?

Various fixes in handling of externals in node.js

* add extensions to builtin externals to allow node.js ESM to work
* improve the auto-externals logic to detect more edge cases
* prepare for `esmExternals` support, but that's blocked by client
manifest missing the async flag
* currently only `esmExternals: false` is supported

### Why?

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6531 <!-- Leah - fix(turbopack):
postcss should be applied to `@import`ed CSS files -->
* https://github.com/vercel/turbo/pull/6530 <!-- Tobias Koppers - fix
node.js externals -->

---------

Co-authored-by: Leah <github.leah@hrmny.sh>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-11-21 23:58:14 +01:00
Donny/강동윤
94771bf3cc
refactor: Add lightningcss mode for turbopack-css (#58471)
### What?

We are experimenting with `lightningcss`. This is about replacing
`swc_css` with `lightningcss` in turbopack, and the main reason for this
is to reduce the maintenance burden.
But when I tried, it introduced several regressions, so I'm putting it
behind an experimental flag.

You can enable `lightningcss` mode for **turbopack** by adding a flag to
the next config file.

```js
/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  experimental: {
    useLightningcss: true,
  },
}

module.exports = nextConfig

```

Note that this is only for turbopack because we were not using `swc_css`
for non-turbopack mode of next.js



x-ref:
https://vercel.slack.com/archives/C03EWR7LGEN/p1700025496732229?thread_ts=1700019629.866549&cid=C03EWR7LGEN


### Why?

We should avoid regressions.

### How?

---

turbopack PR: https://github.com/vercel/turbo/pull/6456


Closes PACK-1966

---------

Co-authored-by: Leah <github.leah@hrmny.sh>
2023-11-20 18:09:36 +01:00
Will Binns-Smith
024a0ef24d
Update rust-toolchain to 2023-11-16 (#58558)
This updates the rust toolchain to 2023-11-16 and:

- Removes now-unnecessary `#![feature(async_fn_in_trait)]`
- Applies auto-fixable lint fixes
- Uses `Cargo.toml` new `lint` section instead of command line rustc flags

Test Plan: Tested with updated turbo in a create-next-app


Closes PACK-1979

Co-authored-by: OJ Kwon <1210596+kwonoj@users.noreply.github.com>
2023-11-18 00:29:50 +00:00
Will Binns-Smith
5f8be1f0d3
Turbopack: Use structured styled text in issue descriptions (#58156)
Requires vercel/turbo#6388

This uses the structure implemented in vercel/turbo#6388 to support formatted text when reporting. Right now only the `Line` and basic `String` cases are handled.
2023-11-15 22:33:14 +00:00
Donny/강동윤
f99242baca
Update turbopack (#58408)
* https://github.com/vercel/turbo/pull/6424 
* https://github.com/vercel/turbo/pull/6433 

Closes PACK-1967
2023-11-15 11:48:31 +00:00
Tobias Koppers
bf966e370e
update turbopack (#58243)
* https://github.com/vercel/turbo/pull/6399 
* https://github.com/vercel/turbo/pull/6393 
* https://github.com/vercel/turbo/pull/6403 
* https://github.com/vercel/turbo/pull/6404 
* https://github.com/vercel/turbo/pull/6394 
* https://github.com/vercel/turbo/pull/6405 
* https://github.com/vercel/turbo/pull/6351
2023-11-09 09:52:22 +00:00
Tobias Koppers
9d3b94b449
update turbopack (#58172)
* https://github.com/vercel/turbo/pull/6376 <!-- OJ Kwon -
feat(turbopack): support url rewrite behavior options -->
* https://github.com/vercel/turbo/pull/6386 <!-- OJ Kwon -
feat(turbopack-ecmascript): support relative url asset ref -->
* https://github.com/vercel/turbo/pull/6382 <!-- Tobias Koppers -
refactor and fix CssEmbed for url() -->
2023-11-08 08:54:36 +01:00
Donny/강동윤
c370c179b5
build: Update swc_core to v0.86.40 and update turbopack (#57904)
### What?

* https://github.com/vercel/turbo/pull/6286 
* https://github.com/vercel/turbo/pull/6367 
* https://github.com/vercel/turbo/pull/6354 
* https://github.com/vercel/turbo/pull/6343 

---

 - Update `swc_core` to `v0.86.40`

 - Revert #56281 and fix `node-fetch` by disabling inlining
   - Use `inline: 2` instead of `keep_fnames: true`

### Why?

`keep_fnames` increases the bundle size too much.

### How?

 - Fixes #56612

 - Fixes #57886 

 - Fixes #55682 (by https://github.com/swc-project/swc/pull/8205)

 - Reverts #56281


 - Closes PACK-1902
2023-11-07 15:26:28 +00:00
Tobias Koppers
883ab22157
update turbopack (#58080)
* https://github.com/vercel/turbo/pull/6325 <!-- OJ Kwon - build(cargo):
skip external build script with rust-analyzer -->
* https://github.com/vercel/turbo/pull/6318 <!-- OJ Kwon -
feat(turbopack-ecmascript): calculate import.meta.url as an absolute
path -->
* https://github.com/vercel/turbo/pull/6359 <!-- Will Binns-Smith -
Turbopack: Defer calculating source positions until needed -->
* https://github.com/vercel/turbo/pull/6274 <!-- Tobias Koppers - add
backtrace for trait calls -->
* https://github.com/vercel/turbo/pull/6305 <!-- Tobias Koppers - Triple
chunk size heuristic -->
* https://github.com/vercel/turbo/pull/6304 <!-- Tobias Koppers -
improve resolving performance -->
2023-11-06 18:05:13 +01:00
Tobias Koppers
936b953eda
update turbopack (#57487)
* https://github.com/vercel/turbo/pull/6290 <!-- Tobias Koppers - fix
hmr client to be actually reliable -->

Closes WEB-1887

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-26 10:39:33 +02:00
Tobias Koppers
581b1be064
update turbopack (#57485)
* https://github.com/vercel/turbo/pull/6289 <!-- Tobias Koppers - Revert
"normalize pattern correctly to avoid slow path in matching" -->

Closes WEB-1885
2023-10-26 09:13:00 +02:00
Tobias Koppers
7c3511cd99
update turbopack (#57469)
* https://github.com/vercel/turbo/pull/6268 <!-- Maia Teegarden - Update
Turbopack Docs -->
* https://github.com/vercel/turbo/pull/6278 <!-- Anthony Shew - Clearer
Remote Cache upload spinner message. -->
* https://github.com/vercel/turbo/pull/6288 <!-- Tobias Koppers -
normalize pattern correctly to avoid slow path in matching -->

Closes WEB-1877
2023-10-26 07:41:16 +02:00
Tobias Koppers
5f0cfd41be
update turbopack (#57420)
* https://github.com/vercel/turbo/pull/6269 <!-- Tobias Koppers - Upload
data even for non-scheduled runs -->
* https://github.com/vercel/turbo/pull/6270 <!-- Tobias Koppers - Put
ESM in strict mode -->

Closes WEB-1855

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-25 21:53:31 +02:00
Tobias Koppers
a929bf7c04
update turbopack and add HMR test case (#57304)
### What?

adds a test case for HMR, which is fixed by the turbopack update

### Why?

### How?

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6245 
* https://github.com/vercel/turbo/pull/6212 
* https://github.com/vercel/turbo/pull/6255 
* https://github.com/vercel/turbo/pull/6259 
* https://github.com/vercel/turbo/pull/6261 
* https://github.com/vercel/turbo/pull/6260 

Closes WEB-1836
2023-10-24 04:38:05 +00:00
Donny/강동윤
652a553a13
Update swc_core to v0.86.10 (#57121)
### What?

Update SWC crates. This PR fixes a regression of `swc_core`.
The important PR: https://github.com/swc-project/swc/pull/8153

### Why?

There was a regression in `swc_core`.

### How?

-  Fixes #56408

Closes WEB-1811

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-23 05:01:31 +02:00
Tobias Koppers
b64c0426bc
update turbopack (#57176)
* https://github.com/vercel/turbo/pull/6241 <!-- Tobias Koppers - make
the daily ci faster -->
* https://github.com/vercel/turbo/pull/6242 <!-- Justin Ridgewell - Add
caching to `chunk_content`'s graph walking -->
* https://github.com/vercel/turbo/pull/6228 <!-- Tobias Koppers - Reduce
resolve and resolving tasks -->
* https://github.com/vercel/turbo/pull/6244 <!-- Tobias Koppers - avoid
cloning list -->
* https://github.com/vercel/turbo/pull/6246 <!-- Tobias Koppers - fix
symlink handling -->

Closes WEB-1819
2023-10-23 02:42:29 +02:00
Will Binns-Smith
1ffef0f1a3
Turbopack: support more server code in tracing error stack frames (#57156)
This:
- Uses `isServer` to use the appropriate Turbopack `FileSystem` when
creating `FileSystemPath`s
- Properly uri decodes path segments originating from `file://` uris
- Correctly reads chunks starting at the project path instead of the
root path


Closes WEB-1815

---------

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

This PR also removes a bunch of unused code

### Why?

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

Closes NEXT-1814

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

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-21 02:05:00 +02:00
Tobias Koppers
4a75e71d25
prefer Option<Vc<IssueSource>> over Vc<OptionIssueSource> (#57104)
### What?

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

### Why?

### How?


Closes WEB-1808
2023-10-20 18:06:23 +00:00
OJ Kwon
68edcc3e37
build(cargo): bump up turbopack (#57081)
### What?

Picks up latest turbopack to get some changes.

Closes WEB-1802
2023-10-19 22:21:27 +00:00
Will Binns-Smith
0e4fe2ffe3
Code frame and sourcemapped error support for Turbopack (#56727)
This implements support for properly tracing sourcemaps when presenting
error stacks to the user. It also adds code frames when possible.


Closes WEB-1764

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-19 14:51:40 -07:00
Tobias Koppers
607ba02a26
Reland "feat(turbopack): support basic next/dynamic" (#56934)
This reverts commit 8a51ebcb67.

### What?

see #56389 


Closes WEB-1791
2023-10-18 02:53:40 +00:00
Donny/강동윤
4b3dfdaa95
build: Update swc_core to v0.86.1 (#56770)
### What?

Update SWC crates, to apply bugfixes.

### Why?

We adjusted the mangling option to make it identical with `swcMinify:
false` with https://github.com/vercel/next.js/pull/56281, and it
revealed some bugs of the name mangler of the SWC minifier.

### How?


 - Fixes #56550
 - Fixes #56614

 - Turbopack counterpart: https://github.com/vercel/turbo/pull/6171

### Other Turbopack Changes

* https://github.com/vercel/turbo/pull/6177 <!-- Tim Neutkens - Add
support for FreeVarReference::Error -->
* https://github.com/vercel/turbo/pull/6180 <!-- Tobias Koppers - fix
chunk loading in build runtime -->
* https://github.com/vercel/turbo/pull/6191 <!-- Justin Ridgewell -
Deduplicate referenced_output_assets -->
* https://github.com/vercel/turbo/pull/6171 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.86.1` -->

Closes WEB-1775

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-17 15:19:28 +02:00
Tobias Koppers
8a51ebcb67
Revert "feat(turbopack): support basic next/dynamic" (#56885) 2023-10-16 06:37:41 -07:00
OJ Kwon
5b52e7772d
feat(turbopack): support basic next/dynamic (#56389)
Closes WEB-1702

This PR implements initial support for the `next/dynamic` in Turbopack,
more specifically resolving some hydration errors and other components
boot up cases.

Previously, turbopack had partial next/dynamic support via its own mode
(https://github.com/vercel/next.js/pull/56389/files#diff-e1af4f79cb88a73f819a25443d15ed4b1ffabcbb879256caa59b751fad46d7c4L68),
which does a transform against `next/dynamic` wrapped import to embed
dynamically resolvable chunk ids like
(ad42b610c2/packages/next-swc/crates/next-transform-dynamic/tests/fixture/wrapped-import/output-turbo-dev-server.js).

However, since next.js relies on static path to the chunks to the
dynamic import and passing those ids in between client-server to ensure
component load (and avoid hydration errors), it doesn't work out of the
box. This PR changes turbopack's behavior to closely mimic what current
next.js's webpack plugin does, by

1. Traverse the module graph, find out `dynamic(import())`
2. Generate chunks for those imports, creates a partial LoadableManifest
per each imports
3. Merge partial manifest into a single `react-loadable-manifest.json`
4. For the id, use static (Webpack mode) instead of dynamic so we can
embed it in `react-loadable-manifest` as well as next.js can use it to
pass it between server-client context.

I left a small comment to the implementation
(https://github.com/vercel/next.js/pull/56389/files#diff-bf12ed2c69d0bc89a06884779da4ae44967eb8becada031dea12bedef28e2622R155)
for the lifecycle of this feature in case to fix further.

This makes to pass most of the basic next-dynamic related integration
tests, except if the import have webpack specific features like
ad42b610c2/test/development/basic/next-dynamic/pages/dynamic/multiple-modules.js (L5).

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-10-16 10:24:54 +02:00
Tobias Koppers
a40a350155
Chunking Refactoring followup fixes (#56789)
### What?

fix some minor bugs
Make the page-loader reuse the client chunks

Closes WEB-1777
2023-10-13 12:38:59 +00:00
Tobias Koppers
04bad16bf4
Turbopack: Chunking Refactoring (#56756)
### What?

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

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6116 
* https://github.com/vercel/turbo/pull/6140 
* https://github.com/vercel/turbo/pull/6118 
* https://github.com/vercel/turbo/pull/6128 
* https://github.com/vercel/turbo/pull/6129 
* https://github.com/vercel/turbo/pull/6160 


Closes WEB-1772

Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-10-13 11:44:44 +00:00
Justin Ridgewell
c6f5089ef2
turbopack: Extract as_chunk into shared ChunkType trait (#56506)
### What?

Step 3 in our chunking refactors extracts ChunkItem::as_chunk into a new ChunkType trait. This new trait isn't useful yet, but will eventually allow us to collect ChunkItems of a similar type into a lists, and perform chunking over all similar items at once.

### Why?

In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

https://github.com/vercel/turbo/pull/6123

Re: https://github.com/vercel/next.js/pull/56504

Closes WEB-1724

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2023-10-06 15:28:57 +00:00
Tobias Koppers
c95e4b7841
update turbopack, fix sass peer dependency (#56508)
* https://github.com/vercel/turbo/pull/6076 <!-- Tobias Koppers -
Performance Improvements (5) !-->

Closes WEB-1725
2023-10-06 10:59:43 +02:00
Justin Ridgewell
2af1e784c2
turbopack: Chunking Refactor Step 2 (#56504)
### What?

The second step in our chunking refactoring, this removes our use of Module::as_chunk and Module::as_root_chunk. Instead, the only way to generate a chunk is directly from a root ChunkItem.

### Why?

In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

https://github.com/vercel/turbo/pull/6120

Re: https://github.com/vercel/next.js/pull/56467
Closes WEB-1721

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2023-10-06 06:29:14 +00:00
Tobias Koppers
666ce7bd8b
Chunking Refactor Step 1 (#56467)
### What?

This change moves a few methods around.

Module::as_chunk is moved to ChunkItem::as_chunk as temporary intermediate state.
EcmascriptPlaceable::as_chunk_item is moved to ChunkableModule::as_chunk_item. This generalizes the concept of converting a Module into a ChunkItem


### Why?

This is the first step of refactoring the chunking. In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

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

Closes WEB-1715

Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-10-05 20:05:05 +00:00
Justin Ridgewell
feca3ce21c
Turbopack: Implement Server Actions (#53890)
### What?

This implements Server Actions inside the new Turbopack next-api bundles.

### How?

Server Actions requires:
1. A `.next/server/server-reference-manifest.json` manifest describing what loader module to import to invoke a server action
2. A "loader" entry point that then imports server actions from our internal chunk items
3. Importing the bundled `react-experimental` module instead of regular `react`
4. A little 🪄 pixie dust
5. A small change in the magic comment generated in modules that export server actions

I had to change the magic `__next_internal_action_entry_do_not_use__` comment generated by the server actions transformer. When I traverse the module graph to find all exported actions _after chunking_ has been performed, we no longer have access to the original file name needed to generate the server action's id hash. Adding the filename to comment allows me to recover this without overcomplicating our output pipeline.

Closes WEB-1279
Depends on https://github.com/vercel/turbo/pull/5705

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-04 23:33:21 +00:00
Leah
515784c277
chore: pass defineEnv from next.js to rust directly (#56216)
### What?

Deduplicates our env var injection between the JS and rust side

Closes WEB-937

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-03 22:43:21 +02:00
Tobias Koppers
8d18ad60d7
update webp crate (#56307)
### What?

update dependencies

Closes WEB-1696
2023-10-02 16:16:26 +00:00
Tobias Koppers
e043e1f1c6
update turbopack (#56285)
* https://github.com/vercel/turbo/pull/6062 
* https://github.com/vercel/turbo/pull/6061 
* https://github.com/vercel/turbo/pull/6045 

Closes WEB-1695
2023-10-02 07:38:44 +00:00