Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a FileSystemPathOption::none for cached cell reuse #5717

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions crates/turbo-tasks-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,14 @@ impl FileSystemPath {
#[turbo_tasks::value(transparent)]
pub struct FileSystemPathOption(Option<Vc<FileSystemPath>>);

#[turbo_tasks::value_impl]
impl FileSystemPathOption {
#[turbo_tasks::function]
pub fn none() -> Vc<Self> {
Vc::cell(None)
}
}

#[turbo_tasks::value_impl]
impl FileSystemPath {
/// Create a new Vc<FileSystemPath> from a path withing a FileSystem. The
Expand Down Expand Up @@ -1112,7 +1120,7 @@ impl FileSystemPath {
Self::new_normalized(this.fs, path).resolve().await?,
)))
} else {
Ok(Vc::cell(None))
Ok(FileSystemPathOption::none())
}
}

Expand All @@ -1128,7 +1136,7 @@ impl FileSystemPath {
)));
}
}
Ok(Vc::cell(None))
Ok(FileSystemPathOption::none())
}

#[turbo_tasks::function]
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-css/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl CssChunk {
while !*path.is_inside(current).await? {
let parent = current.parent().resolve().await?;
if parent == current {
return Ok(Vc::cell(None));
return Ok(FileSystemPathOption::none());
}
current = parent;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-ecmascript/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl EcmascriptChunk {
while !*path.is_inside_or_equal(current).await? {
let parent = current.parent().resolve().await?;
if parent == current {
return Ok(Vc::cell(None));
return Ok(FileSystemPathOption::none());
}
current = parent;
}
Expand Down
Loading