turbopack_node/
embed_js.rs

1use turbo_rcstr::RcStr;
2use turbo_tasks::Vc;
3use turbo_tasks_fs::{FileContent, FileSystem, FileSystemPath, embed_directory};
4
5#[turbo_tasks::function]
6pub fn embed_fs() -> Vc<Box<dyn FileSystem>> {
7    embed_directory!("turbopack-node", "$CARGO_MANIFEST_DIR/js/src")
8}
9
10#[turbo_tasks::function]
11pub(crate) fn embed_file(path: RcStr) -> Vc<FileContent> {
12    embed_fs().root().join(path).read()
13}
14
15#[turbo_tasks::function]
16pub(crate) fn embed_file_path(path: RcStr) -> Vc<FileSystemPath> {
17    embed_fs().root().join(path)
18}