From bcd458ebc2f43a7ad24684619c8cb4016491c8b5 Mon Sep 17 00:00:00 2001 From: Alex Kirszenberg Date: Thu, 13 Jul 2023 14:36:04 +0200 Subject: [PATCH] any_content_changed_of_output_assets Co-authored-by: Tobias Koppers --- crates/turbopack-core/src/changed.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/turbopack-core/src/changed.rs b/crates/turbopack-core/src/changed.rs index e640f35de2631..5a7a3f204dae7 100644 --- a/crates/turbopack-core/src/changed.rs +++ b/crates/turbopack-core/src/changed.rs @@ -6,6 +6,7 @@ use turbo_tasks::{ use crate::{ asset::{Asset, AssetVc}, + output::OutputAssetsVc, reference::all_referenced_assets, }; @@ -33,6 +34,20 @@ pub async fn any_content_changed(root: AssetVc) -> Result { Ok(CompletionsVc::cell(completions).completed()) } +/// Returns a completion that changes when any content of any asset in the given +/// output asset graphs changes. +#[turbo_tasks::function] +pub async fn any_content_changed_of_output_assets(roots: OutputAssetsVc) -> Result { + Ok(CompletionsVc::cell( + roots + .await? + .iter() + .map(|&a| any_content_changed(a.into())) + .collect(), + ) + .completed()) +} + /// Returns a completion that changes when the content of the given asset /// changes. #[turbo_tasks::function]