| use turbo_tasks::{ResolvedVc, Vc}; | |
| use turbo_tasks_fs::FileSystemPath; | |
| use turbopack_core::{ | |
| asset::{Asset, AssetContent}, | |
| output::OutputAsset, | |
| source::Source, | |
| }; | |
| /// A static asset that is served at a fixed output path. It won't use | |
| /// content hashing to generate a long term cacheable URL. | |
| pub struct FixedStaticAsset { | |
| output_path: FileSystemPath, | |
| source: ResolvedVc<Box<dyn Source>>, | |
| } | |
| impl FixedStaticAsset { | |
| pub fn new(output_path: FileSystemPath, source: ResolvedVc<Box<dyn Source>>) -> Vc<Self> { | |
| FixedStaticAsset { | |
| output_path, | |
| source, | |
| } | |
| .cell() | |
| } | |
| } | |
| impl OutputAsset for FixedStaticAsset { | |
| fn path(&self) -> Vc<FileSystemPath> { | |
| self.output_path.clone().cell() | |
| } | |
| } | |
| impl Asset for FixedStaticAsset { | |
| fn content(&self) -> Vc<AssetContent> { | |
| self.source.content() | |
| } | |
| } | |