Niklas Mischkulnig
6617057757
Turbopack: emit/collect ( #96631 )
...
Only add this for using it for Server Actions for now
Undocumented, not API stable. But we can't really put it behind a flag,
because the next-custom-transform is going to add it
New traits:
```rust
/// A module that can collect other modules during the collect phase.
#[turbo_tasks::value_trait]
pub trait CollectingModule: Module {
/// The namespace that this module is interesed in
#[turbo_tasks::function]
fn namespace(self: Vc<Self>) -> Vc<RcStr>;
#[turbo_tasks::function]
fn as_chunk_item(
self: Vc<Self>,
module_graph: Vc<ModuleGraph>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
entry_chunk_group: Vc<Modules>,
) -> Vc<Box<dyn ChunkItem>>;
}
#[turbo_tasks::value_trait]
pub trait EmittedModuleReference: ModuleReference + ValueToString {
#[turbo_tasks::function]
fn data(self: Vc<Self>) -> Vc<CompileTimeDefineValue>;
}
```
Example:
```javascript
__turbopack_emit__('./c.js', {
namespace: 'my-test',
data: 'data-for-c', // optional
exports: ['c'], // optional
with: ... // optional, import attributes like with ESM
})
// -------------------------
const getList = __turbopack_collect__({
namespace: 'my-test',
})
const list = getList();
```
Shortcomings in the current version (which are not a blocker for now
however):
- data-only emit not implemented
- stylegroups aren't properly implemented. emitting styles is probably
broken
- pages router is still a problem: it has two separate
ChunkGroup::Entry, so you only see what was emitted on the current
runtime, not both
Recreation of https://github.com/vercel/next.js/pull/91100
2026-08-24 18:39:28 +02:00
..
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-07-24 12:00:49 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-24 13:14:31 +02:00
2026-07-23 23:25:55 +02:00
2026-04-14 16:45:23 -07:00
2026-08-21 17:37:46 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-24 11:41:05 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-05-12 13:16:31 +02:00
2026-03-20 09:03:06 +01:00
2026-03-13 17:25:59 +00:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-06 09:53:09 +00:00
2026-05-12 13:16:31 +02:00
2026-08-21 15:07:42 +01:00
2026-05-11 13:55:47 +02:00
2026-07-01 15:51:33 +00:00
2026-05-22 14:01:58 +02:00
2026-03-24 14:57:10 -07:00
2026-05-22 14:01:58 +02:00
2026-06-03 12:23:36 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-15 13:07:22 +02:00
2026-05-11 13:55:47 +02:00
2026-08-12 08:01:46 -07:00
2026-04-13 12:00:38 -07:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-10 12:11:26 -07:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-03-20 09:37:42 +01:00
2026-05-12 13:16:31 +02:00
2026-05-12 13:16:31 +02:00
2026-03-25 08:27:30 +01:00
2026-05-12 13:16:31 +02:00
2026-05-11 13:55:47 +02:00
2026-03-17 23:28:08 +01:00
2026-05-11 13:55:47 +02:00
2026-04-30 10:01:06 +02:00
2026-06-15 23:19:53 +00:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-06-12 21:28:39 +00:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-21 22:45:12 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-02 11:33:33 -07:00
2026-06-03 12:23:36 +02:00
2026-05-11 13:55:47 +02:00
2026-07-13 09:56:16 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-14 14:29:26 +02:00
2026-08-18 10:20:11 +02:00
2026-05-26 16:50:38 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-12 13:16:31 +02:00
2026-07-24 12:00:49 +02:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-22 14:01:58 +02:00
2026-07-28 14:05:06 -04:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-10 12:11:26 -07:00
2026-07-28 17:34:04 +00:00
2026-08-11 12:05:56 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-06-19 14:13:33 -04:00
2026-07-07 14:02:02 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-02-27 10:06:14 +01:00
2026-02-27 10:06:14 +01:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-21 22:45:12 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-13 14:50:03 +02:00
2026-05-12 13:16:31 +02:00
2026-05-12 13:16:31 +02:00
2026-08-19 17:57:53 +02:00
2026-07-21 18:46:47 +02:00
2026-05-22 14:01:58 +02:00
2026-05-12 13:16:31 +02:00
2026-05-12 13:16:31 +02:00
2026-07-13 06:36:36 +00:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-15 15:16:42 +00:00
2026-08-19 17:57:53 +02:00
2026-05-11 13:55:47 +02:00
2026-03-04 15:59:07 -08:00
2026-08-21 22:45:12 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-27 10:25:54 -04:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-07-21 19:52:09 +00:00
2026-07-21 19:52:09 +00:00
2026-08-21 22:45:12 +02:00
2026-05-22 14:01:58 +02:00
2026-07-21 17:25:13 +00:00
2026-05-11 13:55:47 +02:00
2026-02-27 09:52:44 +01:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-22 14:01:58 +02:00
2026-08-18 16:54:45 +02:00
2026-05-11 13:55:47 +02:00
2026-08-05 15:13:24 +00:00
2026-08-18 12:33:22 +01:00
2026-05-11 13:55:47 +02:00
2026-08-14 11:53:24 +02:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-08-20 11:57:04 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-10 15:55:29 +02:00
2026-05-12 13:16:31 +02:00
2026-06-15 15:31:02 -07:00
2026-05-11 21:31:40 +02:00
2026-06-30 01:27:24 +00:00
2026-06-30 01:27:24 +00:00
2026-05-22 14:01:58 +02:00
2026-05-22 14:01:58 +02:00
2026-05-18 09:51:36 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-21 18:46:45 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-09 16:26:18 -07:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-05-11 13:55:47 +02:00
2026-05-18 09:51:36 +02:00
2026-04-07 17:02:37 +02:00
2026-04-08 22:54:08 +02:00
2026-04-08 22:54:08 +02:00
2026-06-16 21:29:37 +02:00
2026-04-15 14:55:20 +02:00
2026-05-12 13:16:31 +02:00
2026-05-22 14:01:58 +02:00
2026-06-15 23:19:53 +00:00
2026-08-13 04:05:37 +02:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-05-22 14:01:58 +02:00
2026-06-16 21:29:37 +02:00
2026-08-24 18:39:28 +02:00
2026-07-08 18:02:21 +02:00
2026-06-09 17:08:03 +00:00
2026-08-05 07:41:54 +02:00
2026-03-24 02:33:05 +00:00
2026-05-22 14:01:58 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-04-10 14:42:40 +02:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-05-12 13:16:31 +02:00
2026-04-08 22:54:08 +02:00
2026-06-15 23:19:53 +00:00
2026-03-16 21:07:56 +00:00
2026-03-04 15:59:07 -08:00
2026-08-06 09:53:09 +00:00
2026-05-11 13:55:47 +02:00
2026-05-11 13:55:47 +02:00
2026-07-21 14:54:01 -07:00
2026-05-12 13:16:31 +02:00
2026-08-20 11:57:04 +02:00
2026-07-24 12:00:49 +02:00