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