turbopack_node/
execution_context.rs

1use turbo_tasks::{ResolvedVc, Vc};
2use turbo_tasks_env::ProcessEnv;
3use turbo_tasks_fs::FileSystemPath;
4use turbopack_core::chunk::ChunkingContext;
5
6#[turbo_tasks::value]
7pub struct ExecutionContext {
8    pub project_path: ResolvedVc<FileSystemPath>,
9    pub chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
10    pub env: ResolvedVc<Box<dyn ProcessEnv>>,
11}
12
13#[turbo_tasks::value_impl]
14impl ExecutionContext {
15    #[turbo_tasks::function]
16    pub fn new(
17        project_path: ResolvedVc<FileSystemPath>,
18        chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
19        env: ResolvedVc<Box<dyn ProcessEnv>>,
20    ) -> Vc<Self> {
21        ExecutionContext {
22            project_path,
23            chunking_context,
24            env,
25        }
26        .cell()
27    }
28
29    #[turbo_tasks::function]
30    pub fn project_path(&self) -> Vc<FileSystemPath> {
31        *self.project_path
32    }
33
34    #[turbo_tasks::function]
35    pub fn chunking_context(&self) -> Vc<Box<dyn ChunkingContext>> {
36        *self.chunking_context
37    }
38
39    #[turbo_tasks::function]
40    pub fn env(&self) -> Vc<Box<dyn ProcessEnv>> {
41        *self.env
42    }
43}