Skip to main content

turbopack_core/
server_fs.rs

1use anyhow::{Result, bail};
2use turbo_tasks::{ValueToString, Vc};
3use turbo_tasks_fs::{
4    FileContent, FileMeta, FileSystem, FileSystemPath, LinkContent, RawDirectoryContent,
5    WriteLinkContent,
6};
7
8#[turbo_tasks::value]
9#[derive(ValueToString)]
10#[value_to_string("root-of-the-server")]
11pub struct ServerFileSystem {}
12
13#[turbo_tasks::value_impl]
14impl ServerFileSystem {
15    #[turbo_tasks::function]
16    pub fn new() -> Vc<Self> {
17        Self::cell(ServerFileSystem {})
18    }
19}
20
21#[turbo_tasks::value_impl]
22impl FileSystem for ServerFileSystem {
23    #[turbo_tasks::function]
24    fn read(&self, _fs_path: FileSystemPath) -> Result<Vc<FileContent>> {
25        bail!("Reading is not possible from the marker filesystem for the server")
26    }
27
28    #[turbo_tasks::function]
29    fn read_link(&self, _fs_path: FileSystemPath) -> Result<Vc<LinkContent>> {
30        bail!("Reading is not possible from the marker filesystem for the server")
31    }
32
33    #[turbo_tasks::function]
34    fn is_junction_point(&self, _fs_path: FileSystemPath) -> Result<Vc<bool>> {
35        bail!("Reading is not possible from the marker filesystem for the server")
36    }
37
38    #[turbo_tasks::function]
39    fn raw_read_dir(&self, _fs_path: FileSystemPath) -> Result<Vc<RawDirectoryContent>> {
40        bail!("Reading is not possible from the marker filesystem for the server")
41    }
42
43    #[turbo_tasks::function]
44    fn write(&self, _fs_path: FileSystemPath, _content: Vc<FileContent>) -> Result<Vc<()>> {
45        bail!("Writing is not possible to the marker filesystem for the server")
46    }
47
48    #[turbo_tasks::function]
49    fn write_link(
50        &self,
51        _fs_path: FileSystemPath,
52        _target: Vc<WriteLinkContent>,
53    ) -> Result<Vc<()>> {
54        bail!("Writing is not possible to the marker filesystem for the server")
55    }
56
57    #[turbo_tasks::function]
58    fn metadata(&self, _fs_path: FileSystemPath) -> Result<Vc<FileMeta>> {
59        bail!("Reading is not possible from the marker filesystem for the server")
60    }
61}