Download next.js/crates/next-core/src/embed_js.rs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/crates/next-core/src/embed_js.rs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/crates/next-core/src/embed_js.rs
-
curl -L -o embed_js.rs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/crates/next-core/src/embed_js.rs
1.01 kB
| use anyhow::Result; | |
| use turbo_rcstr::RcStr; | |
| use turbo_tasks::Vc; | |
| use turbo_tasks_fs::{FileContent, FileSystem, FileSystemPath}; | |
| use turbopack_core::{file_source::FileSource, source::Source}; | |
| pub const VIRTUAL_PACKAGE_NAME: &str = "@vercel/turbopack-next"; | |
| pub(crate) fn next_js_fs() -> Vc<Box<dyn FileSystem>> { | |
| // [TODO]: macro need to be refactored to be used via turbopack-binding | |
| turbo_tasks_fs::embed_directory!("next", "$CARGO_MANIFEST_DIR/js/src") | |
| } | |
| pub(crate) async fn next_js_file(path: RcStr) -> Result<Vc<FileContent>> { | |
| Ok(next_js_fs().root().await?.join(&path)?.read()) | |
| } | |
| pub(crate) async fn next_js_file_path(path: RcStr) -> Result<Vc<FileSystemPath>> { | |
| Ok(next_js_fs().root().await?.join(&path)?.cell()) | |
| } | |
| pub(crate) async fn next_asset(path: RcStr) -> Result<Vc<Box<dyn Source>>> { | |
| Ok(Vc::upcast(FileSource::new( | |
| next_js_file_path(path).owned().await?, | |
| ))) | |
| } | |