diff --git a/crates/next-api/src/middleware.rs b/crates/next-api/src/middleware.rs index 720881f9aae34..cec6f13f16cde 100644 --- a/crates/next-api/src/middleware.rs +++ b/crates/next-api/src/middleware.rs @@ -255,8 +255,8 @@ impl MiddlewareEndpoint { } #[turbo_tasks::function] - async fn userland_module(self: Vc) -> Result>> { - let this = self.await?; + async fn userland_module(&self) -> Result>> { + let this = self; Ok(this .asset_context diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index bfe4aecf1ffa4..e647a46381955 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -640,8 +640,8 @@ impl PageEndpoint { } #[turbo_tasks::function] - async fn source(self: Vc) -> Result>> { - let this = self.await?; + async fn source(&self) -> Result>> { + let this = self; Ok(Vc::upcast(FileSource::new(this.page.project_path()))) } @@ -946,10 +946,10 @@ impl PageEndpoint { #[turbo_tasks::function] async fn pages_manifest( - self: Vc, + &self, entry_chunk: Vc>, ) -> Result>> { - let this = self.await?; + let this = self; let node_root = this.pages_project.project().node_root(); let chunk_path = entry_chunk.ident().path().await?; @@ -991,10 +991,10 @@ impl PageEndpoint { #[turbo_tasks::function] async fn build_manifest( - self: Vc, + &self, client_chunks: Vc, ) -> Result>> { - let this = self.await?; + let this = self; let node_root = this.pages_project.project().node_root(); let client_relative_path = this.pages_project.project().client_relative_path(); let client_relative_path_ref = client_relative_path.await?; diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs index 65e07fe2026cf..1a149cf7277c2 100644 --- a/crates/next-api/src/project.rs +++ b/crates/next-api/src/project.rs @@ -301,8 +301,8 @@ impl ProjectContainer { #[turbo_tasks::value_impl] impl ProjectContainer { #[turbo_tasks::function] - pub async fn project(self: Vc) -> Result> { - let this = self.await?; + pub async fn project(&self) -> Result> { + let this = self; let env_map: Vc; let next_config; @@ -385,11 +385,11 @@ impl ProjectContainer { /// disabled, this will always return [`OptionSourceMap::none`]. #[turbo_tasks::function] pub async fn get_source_map( - self: Vc, + &self, file_path: Vc, section: Option, ) -> Result> { - Ok(if let Some(map) = self.await?.versioned_content_map { + Ok(if let Some(map) = self.versioned_content_map { map.get_source_map(file_path, section) } else { OptionSourceMap::none() @@ -517,8 +517,8 @@ impl Project { } #[turbo_tasks::function] - async fn project_fs(self: Vc) -> Result> { - let this = self.await?; + async fn project_fs(&self) -> Result> { + let this = self; let disk_fs = DiskFileSystem::new( PROJECT_FILESYSTEM_NAME.into(), this.root_path.clone(), @@ -537,15 +537,15 @@ impl Project { } #[turbo_tasks::function] - pub async fn output_fs(self: Vc) -> Result> { - let this = self.await?; + pub async fn output_fs(&self) -> Result> { + let this = self; let disk_fs = DiskFileSystem::new("output".into(), this.project_path.clone(), vec![]); Ok(disk_fs) } #[turbo_tasks::function] - pub async fn dist_dir(self: Vc) -> Result> { - Ok(Vc::cell(self.await?.dist_dir.clone())) + pub async fn dist_dir(&self) -> Result> { + Ok(Vc::cell(self.dist_dir.clone())) } #[turbo_tasks::function] @@ -589,23 +589,23 @@ impl Project { } #[turbo_tasks::function] - pub(super) async fn env(self: Vc) -> Result>> { - Ok(self.await?.env) + pub(super) async fn env(&self) -> Result>> { + Ok(self.env) } #[turbo_tasks::function] - pub(super) async fn next_config(self: Vc) -> Result> { - Ok(self.await?.next_config) + pub(super) async fn next_config(&self) -> Result> { + Ok(self.next_config) } #[turbo_tasks::function] - pub(super) async fn next_mode(self: Vc) -> Result> { - Ok(self.await?.mode) + pub(super) async fn next_mode(&self) -> Result> { + Ok(self.mode) } #[turbo_tasks::function] - pub(super) async fn js_config(self: Vc) -> Result> { - Ok(self.await?.js_config) + pub(super) async fn js_config(&self) -> Result> { + Ok(self.js_config) } #[turbo_tasks::function] diff --git a/crates/next-api/src/versioned_content_map.rs b/crates/next-api/src/versioned_content_map.rs index a16ed6fd13bb0..189a968534d89 100644 --- a/crates/next-api/src/versioned_content_map.rs +++ b/crates/next-api/src/versioned_content_map.rs @@ -95,7 +95,7 @@ impl VersionedContentMap { /// operation. When assets change, map_path_to_op is updated. #[turbo_tasks::function] async fn compute_entry( - self: Vc, + &self, assets_operation: Vc, node_root: Vc, client_relative_path: Vc, @@ -118,7 +118,7 @@ impl VersionedContentMap { } let entries = get_entries(assets).await.unwrap_or_default(); - self.await?.map_path_to_op.update_conditionally(|map| { + self.map_path_to_op.update_conditionally(|map| { let mut changed = false; // get current map's keys, subtract keys that don't exist in operation diff --git a/crates/next-core/src/app_structure.rs b/crates/next-core/src/app_structure.rs index 5fbf6104587f3..5cfe1bc6057ef 100644 --- a/crates/next-core/src/app_structure.rs +++ b/crates/next-core/src/app_structure.rs @@ -732,8 +732,8 @@ struct DuplicateParallelRouteIssue { #[turbo_tasks::value_impl] impl Issue for DuplicateParallelRouteIssue { #[turbo_tasks::function] - async fn file_path(self: Vc) -> Result> { - let this = self.await?; + async fn file_path(&self) -> Result> { + let this = self; Ok(this.app_dir.join(this.page.to_string().into())) } diff --git a/crates/next-core/src/next_client/runtime_entry.rs b/crates/next-core/src/next_client/runtime_entry.rs index 2bba0e124677c..719d8895ed506 100644 --- a/crates/next-core/src/next_client/runtime_entry.rs +++ b/crates/next-core/src/next_client/runtime_entry.rs @@ -69,12 +69,12 @@ pub struct RuntimeEntries(Vec>); impl RuntimeEntries { #[turbo_tasks::function] pub async fn resolve_entries( - self: Vc, + &self, asset_context: Vc>, ) -> Result> { let mut runtime_entries = Vec::new(); - for reference in &self.await? { + for reference in &self.0 { let resolved_entries = reference.resolve_entry(asset_context).await?; runtime_entries.extend(&resolved_entries); } diff --git a/crates/next-core/src/next_config.rs b/crates/next-core/src/next_config.rs index 1b63a4cf1b95c..c3f8174f699e6 100644 --- a/crates/next-core/src/next_config.rs +++ b/crates/next-core/src/next_config.rs @@ -792,10 +792,9 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn server_external_packages(self: Vc) -> Result>> { + pub async fn server_external_packages(&self) -> Result>> { Ok(Vc::cell( - self.await? - .server_external_packages + self.server_external_packages .as_ref() .cloned() .unwrap_or_default(), @@ -803,12 +802,11 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn env(self: Vc) -> Result> { + pub async fn env(&self) -> Result> { // The value expected for env is Record, but config itself // allows arbitrary object (https://github.com/vercel/next.js/blob/25ba8a74b7544dfb6b30d1b67c47b9cb5360cb4e/packages/next/src/server/config-schema.ts#L203) // then stringifies it. We do the interop here as well. let env = self - .await? .env .iter() .map(|(k, v)| { @@ -828,28 +826,28 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn image_config(self: Vc) -> Result> { - Ok(self.await?.images.clone().cell()) + pub async fn image_config(&self) -> Result> { + Ok(self.images.clone().cell()) } #[turbo_tasks::function] - pub async fn page_extensions(self: Vc) -> Result>> { - Ok(Vc::cell(self.await?.page_extensions.clone())) + pub async fn page_extensions(&self) -> Result>> { + Ok(Vc::cell(self.page_extensions.clone())) } #[turbo_tasks::function] - pub async fn transpile_packages(self: Vc) -> Result>> { + pub async fn transpile_packages(&self) -> Result>> { Ok(Vc::cell( - self.await?.transpile_packages.clone().unwrap_or_default(), + self.transpile_packages.clone().unwrap_or_default(), )) } #[turbo_tasks::function] pub async fn webpack_rules( - self: Vc, + &self, active_conditions: Vec, ) -> Result> { - let this = self.await?; + let this = self; let Some(turbo_rules) = this .experimental .turbo @@ -937,8 +935,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn resolve_alias_options(self: Vc) -> Result> { - let this = self.await?; + pub async fn resolve_alias_options(&self) -> Result> { + let this = self; let Some(resolve_alias) = this .experimental .turbo @@ -952,8 +950,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn resolve_extension(self: Vc) -> Result> { - let this = self.await?; + pub async fn resolve_extension(&self) -> Result> { + let this = self; let Some(resolve_extensions) = this .experimental .turbo @@ -966,8 +964,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn import_externals(self: Vc) -> Result> { - Ok(Vc::cell(match self.await?.experimental.esm_externals { + pub async fn import_externals(&self) -> Result> { + Ok(Vc::cell(match self.experimental.esm_externals { Some(EsmExternals::Bool(b)) => b, Some(EsmExternals::Loose(_)) => bail!("esmExternals = \"loose\" is not supported"), None => true, @@ -975,8 +973,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn mdx_rs(self: Vc) -> Result> { - let options = &self.await?.experimental.mdx_rs; + pub async fn mdx_rs(&self) -> Result> { + let options = &self.experimental.mdx_rs; let options = match options { Some(MdxRsOptions::Boolean(true)) => OptionalMdxTransformOptions(Some( @@ -1005,8 +1003,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn react_compiler(self: Vc) -> Result> { - let options = &self.await?.experimental.react_compiler; + pub async fn react_compiler(&self) -> Result> { + let options = &self.experimental.react_compiler; let options = match options { Some(ReactCompilerOptionsOrBoolean::Boolean(true)) => { @@ -1028,24 +1026,20 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn sass_config(self: Vc) -> Result> { - Ok(Vc::cell( - self.await?.sass_options.clone().unwrap_or_default(), - )) + pub async fn sass_config(&self) -> Result> { + Ok(Vc::cell(self.sass_options.clone().unwrap_or_default())) } #[turbo_tasks::function] - pub async fn skip_middleware_url_normalize(self: Vc) -> Result> { + pub async fn skip_middleware_url_normalize(&self) -> Result> { Ok(Vc::cell( - self.await?.skip_middleware_url_normalize.unwrap_or(false), + self.skip_middleware_url_normalize.unwrap_or(false), )) } #[turbo_tasks::function] - pub async fn skip_trailing_slash_redirect(self: Vc) -> Result> { - Ok(Vc::cell( - self.await?.skip_trailing_slash_redirect.unwrap_or(false), - )) + pub async fn skip_trailing_slash_redirect(&self) -> Result> { + Ok(Vc::cell(self.skip_trailing_slash_redirect.unwrap_or(false))) } /// Returns the final asset prefix. If an assetPrefix is set, it's used. @@ -1069,10 +1063,9 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn enable_ppr(self: Vc) -> Result> { + pub async fn enable_ppr(&self) -> Result> { Ok(Vc::cell( - self.await? - .experimental + self.experimental .ppr .as_ref() .map(|ppr| match ppr { @@ -1086,22 +1079,19 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn enable_taint(self: Vc) -> Result> { - Ok(Vc::cell(self.await?.experimental.taint.unwrap_or(false))) + pub async fn enable_taint(&self) -> Result> { + Ok(Vc::cell(self.experimental.taint.unwrap_or(false))) } #[turbo_tasks::function] - pub async fn enable_dynamic_io(self: Vc) -> Result> { - Ok(Vc::cell( - self.await?.experimental.dynamic_io.unwrap_or(false), - )) + pub async fn enable_dynamic_io(&self) -> Result> { + Ok(Vc::cell(self.experimental.dynamic_io.unwrap_or(false))) } #[turbo_tasks::function] - pub async fn use_swc_css(self: Vc) -> Result> { + pub async fn use_swc_css(&self) -> Result> { Ok(Vc::cell( - self.await? - .experimental + self.experimental .turbo .as_ref() .and_then(|turbo| turbo.use_swc_css) @@ -1110,10 +1100,9 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn optimize_package_imports(self: Vc) -> Result>> { + pub async fn optimize_package_imports(&self) -> Result>> { Ok(Vc::cell( - self.await? - .experimental + self.experimental .optimize_package_imports .clone() .unwrap_or_default(), @@ -1122,11 +1111,10 @@ impl NextConfig { #[turbo_tasks::function] pub async fn tree_shaking_mode_for_foreign_code( - self: Vc, + &self, is_development: bool, ) -> Result> { let tree_shaking = self - .await? .experimental .turbo .as_ref() @@ -1159,8 +1147,8 @@ impl NextConfig { } #[turbo_tasks::function] - pub async fn module_id_strategy_config(self: Vc) -> Result> { - let this = self.await?; + pub async fn module_id_strategy_config(&self) -> Result> { + let this = self; let Some(module_id_strategy) = this .experimental .turbo @@ -1194,10 +1182,8 @@ impl JsConfig { } #[turbo_tasks::function] - pub async fn compiler_options(self: Vc) -> Result> { - Ok(Vc::cell( - self.await?.compiler_options.clone().unwrap_or_default(), - )) + pub async fn compiler_options(&self) -> Result> { + Ok(Vc::cell(self.compiler_options.clone().unwrap_or_default())) } } diff --git a/crates/next-core/src/next_dynamic/dynamic_module.rs b/crates/next-core/src/next_dynamic/dynamic_module.rs index 5837bfd7b713a..225d431132a7a 100644 --- a/crates/next-core/src/next_dynamic/dynamic_module.rs +++ b/crates/next-core/src/next_dynamic/dynamic_module.rs @@ -30,10 +30,10 @@ impl NextDynamicEntryModule { #[turbo_tasks::function] pub async fn client_chunks( - self: Vc, + &self, client_chunking_context: Vc>, ) -> Result> { - let this = self.await?; + let this = self; let Some(client_entry_module) = Vc::try_resolve_sidecast::>(this.client_entry_module).await? diff --git a/crates/next-core/src/next_font/google/options.rs b/crates/next-core/src/next_font/google/options.rs index f2f62b0726b96..1ecc78bfdaac2 100644 --- a/crates/next-core/src/next_font/google/options.rs +++ b/crates/next-core/src/next_font/google/options.rs @@ -35,8 +35,8 @@ impl NextFontGoogleOptions { } #[turbo_tasks::function] - pub async fn font_family(self: Vc) -> Result> { - Ok(Vc::cell((*self.await?.font_family).into())) + pub async fn font_family(&self) -> Result> { + Ok(Vc::cell((*self.font_family).into())) } } diff --git a/crates/next-core/src/next_font/local/mod.rs b/crates/next-core/src/next_font/local/mod.rs index 3662051a419f5..d3fd243d09028 100644 --- a/crates/next-core/src/next_font/local/mod.rs +++ b/crates/next-core/src/next_font/local/mod.rs @@ -321,8 +321,8 @@ impl Issue for FontResolvingIssue { } #[turbo_tasks::function] - async fn file_path(self: Vc) -> Result> { - Ok(self.await?.origin_path) + async fn file_path(&self) -> Result> { + Ok(self.origin_path) } #[turbo_tasks::function] diff --git a/crates/next-core/src/next_font/local/options.rs b/crates/next-core/src/next_font/local/options.rs index cd1198f975a89..2e06626db987b 100644 --- a/crates/next-core/src/next_font/local/options.rs +++ b/crates/next-core/src/next_font/local/options.rs @@ -41,8 +41,8 @@ impl NextFontLocalOptions { } #[turbo_tasks::function] - pub async fn font_family(self: Vc) -> Result> { - Ok(Vc::cell(self.await?.variable_name.clone())) + pub async fn font_family(&self) -> Result> { + Ok(Vc::cell(self.variable_name.clone())) } } diff --git a/crates/next-core/src/next_server_component/server_component_module.rs b/crates/next-core/src/next_server_component/server_component_module.rs index 4f1b49637f2c9..69411c20e3961 100644 --- a/crates/next-core/src/next_server_component/server_component_module.rs +++ b/crates/next-core/src/next_server_component/server_component_module.rs @@ -46,8 +46,8 @@ impl NextServerComponentModule { } #[turbo_tasks::function] - pub async fn server_path(self: Vc) -> Result> { - let this = self.await?; + pub async fn server_path(&self) -> Result> { + let this = self; Ok(this.module.ident().path()) } } @@ -143,8 +143,8 @@ impl EcmascriptChunkItem for NextServerComponentChunkItem { } #[turbo_tasks::function] - async fn content(self: Vc) -> Result> { - let this = self.await?; + async fn content(&self) -> Result> { + let this = self; let inner = this.inner.await?; let module_id = inner diff --git a/crates/next-core/src/page_loader.rs b/crates/next-core/src/page_loader.rs index 006fcf2d4c243..7f3d0ff0a7b35 100644 --- a/crates/next-core/src/page_loader.rs +++ b/crates/next-core/src/page_loader.rs @@ -96,10 +96,10 @@ impl PageLoaderAsset { #[turbo_tasks::function] async fn chunks_data( - self: Vc, + &self, rebase_prefix_path: Vc, ) -> Result> { - let this = self.await?; + let this = self; let mut chunks = this.page_chunks; // If we are provided a prefix path, we need to rewrite our chunk paths to diff --git a/crates/next-core/src/pages_structure.rs b/crates/next-core/src/pages_structure.rs index ae5586b36e050..1a27898110d6a 100644 --- a/crates/next-core/src/pages_structure.rs +++ b/crates/next-core/src/pages_structure.rs @@ -102,8 +102,8 @@ impl PagesDirectoryStructure { /// Returns the path to the directory of this structure in the project file /// system. #[turbo_tasks::function] - pub async fn project_path(self: Vc) -> Result> { - Ok(self.await?.project_path) + pub async fn project_path(&self) -> Result> { + Ok(self.project_path) } } diff --git a/turbopack/crates/turbo-tasks-env/src/dotenv.rs b/turbopack/crates/turbo-tasks-env/src/dotenv.rs index 9f65765cf7001..53a12776f75b2 100644 --- a/turbopack/crates/turbo-tasks-env/src/dotenv.rs +++ b/turbopack/crates/turbo-tasks-env/src/dotenv.rs @@ -24,8 +24,8 @@ impl DotenvProcessEnv { } #[turbo_tasks::function] - pub async fn read_prior(self: Vc) -> Result> { - let this = self.await?; + pub async fn read_prior(&self) -> Result> { + let this = self; match this.prior { None => Ok(EnvMap::empty()), Some(p) => Ok(p.read_all()), diff --git a/turbopack/crates/turbo-tasks-fs/src/lib.rs b/turbopack/crates/turbo-tasks-fs/src/lib.rs index 3844aac915c37..da7a00c50dd03 100644 --- a/turbopack/crates/turbo-tasks-fs/src/lib.rs +++ b/turbopack/crates/turbo-tasks-fs/src/lib.rs @@ -1170,8 +1170,8 @@ impl FileSystemPath { /// Similar to [FileSystemPath::join], but returns an Option that will be /// None when the joined path would leave the filesystem root. #[turbo_tasks::function] - pub async fn try_join(self: Vc, path: RcStr) -> Result> { - let this = self.await?; + pub async fn try_join(&self, path: RcStr) -> Result> { + let this = self; if let Some(path) = join_path(&this.path, &path) { Ok(Vc::cell(Some( Self::new_normalized(this.fs, path.into()).resolve().await?, @@ -1184,8 +1184,8 @@ impl FileSystemPath { /// Similar to [FileSystemPath::join], but returns an Option that will be /// None when the joined path would leave the current path. #[turbo_tasks::function] - pub async fn try_join_inside(self: Vc, path: RcStr) -> Result> { - let this = self.await?; + pub async fn try_join_inside(&self, path: RcStr) -> Result> { + let this = self; if let Some(path) = join_path(&this.path, &path) { if path.starts_with(&*this.path) { return Ok(Vc::cell(Some( @@ -1211,31 +1211,31 @@ impl FileSystemPath { } #[turbo_tasks::function] - pub async fn fs(self: Vc) -> Result>> { - Ok(self.await?.fs) + pub async fn fs(&self) -> Result>> { + Ok(self.fs) } #[turbo_tasks::function] - pub async fn extension(self: Vc) -> Result> { - let this = self.await?; + pub async fn extension(&self) -> Result> { + let this = self; Ok(Vc::cell(this.extension_ref().unwrap_or("").into())) } #[turbo_tasks::function] - pub async fn is_inside(self: Vc, other: Vc) -> Result> { - Ok(Vc::cell(self.await?.is_inside_ref(&*other.await?))) + pub async fn is_inside(&self, other: Vc) -> Result> { + Ok(Vc::cell(self.is_inside_ref(&*other.await?))) } #[turbo_tasks::function] - pub async fn is_inside_or_equal(self: Vc, other: Vc) -> Result> { - Ok(Vc::cell(self.await?.is_inside_or_equal_ref(&*other.await?))) + pub async fn is_inside_or_equal(&self, other: Vc) -> Result> { + Ok(Vc::cell(self.is_inside_or_equal_ref(&*other.await?))) } /// Creates a new [`Vc`] like `self` but with the given /// extension. #[turbo_tasks::function] - pub async fn with_extension(self: Vc, extension: RcStr) -> Result> { - let this = self.await?; + pub async fn with_extension(&self, extension: RcStr) -> Result> { + let this = self; let (path_without_extension, _) = this.split_extension(); Ok(Self::new_normalized( this.fs, @@ -1257,8 +1257,8 @@ impl FileSystemPath { /// * The entire file name if the file name begins with `.` and has no other `.`s within; /// * Otherwise, the portion of the file name before the final `.` #[turbo_tasks::function] - pub async fn file_stem(self: Vc) -> Result>> { - let this = self.await?; + pub async fn file_stem(&self) -> Result>> { + let this = self; let (_, file_stem, _) = this.split_file_stem_extension(); if file_stem.is_empty() { return Ok(Vc::cell(None)); @@ -1483,8 +1483,8 @@ pub struct RealPathResult { #[turbo_tasks::value_impl] impl RealPathResult { #[turbo_tasks::function] - pub async fn path(self: Vc) -> Result> { - Ok(self.await?.path) + pub async fn path(&self) -> Result> { + Ok(self.path) } } diff --git a/turbopack/crates/turbo-tasks-memory/tests/task_statistics.rs b/turbopack/crates/turbo-tasks-memory/tests/task_statistics.rs index ac19c3b53a148..8a3687f221333 100644 --- a/turbopack/crates/turbo-tasks-memory/tests/task_statistics.rs +++ b/turbopack/crates/turbo-tasks-memory/tests/task_statistics.rs @@ -224,8 +224,8 @@ impl Doublable for WrappedU64 { } #[turbo_tasks::function] - async fn double_vc(self: Vc) -> Result> { - let val = self.await?.0; + async fn double_vc(&self) -> Result> { + let val = self.0; Ok(WrappedU64(val * 2).cell()) } } diff --git a/turbopack/crates/turbo-tasks-testing/tests/call_types.rs b/turbopack/crates/turbo-tasks-testing/tests/call_types.rs index 41ebeafe265bc..227e99a0b84ad 100644 --- a/turbopack/crates/turbo-tasks-testing/tests/call_types.rs +++ b/turbopack/crates/turbo-tasks-testing/tests/call_types.rs @@ -99,8 +99,8 @@ impl Value { } #[turbo_tasks::function] - async fn async_vc_method(self: Vc) -> Result> { - Ok(Vc::cell(self.await?.0)) + async fn async_vc_method(&self) -> Result> { + Ok(Vc::cell(self.0)) } } diff --git a/turbopack/crates/turbo-tasks/src/completion.rs b/turbopack/crates/turbo-tasks/src/completion.rs index 71afe672f296a..acbfeb724220c 100644 --- a/turbopack/crates/turbo-tasks/src/completion.rs +++ b/turbopack/crates/turbo-tasks/src/completion.rs @@ -59,8 +59,8 @@ impl Completions { /// Merges the list of completions into one. #[turbo_tasks::function] - pub async fn completed(self: Vc) -> anyhow::Result> { - self.await? + pub async fn completed(&self) -> anyhow::Result> { + self.0 .iter() .map(|&c| async move { c.await?; diff --git a/turbopack/crates/turbo-tasks/src/primitives.rs b/turbopack/crates/turbo-tasks/src/primitives.rs index 0d433ed7e376d..ada2e9393e802 100644 --- a/turbopack/crates/turbo-tasks/src/primitives.rs +++ b/turbopack/crates/turbo-tasks/src/primitives.rs @@ -86,8 +86,8 @@ impl Bools { } #[turbo_tasks::function] - async fn into_bools(self: Vc) -> Result>> { - let this = self.await?; + async fn into_bools(&self) -> Result>> { + let this = &self.0; let bools = this .iter() diff --git a/turbopack/crates/turbopack-browser/src/chunking_context.rs b/turbopack/crates/turbopack-browser/src/chunking_context.rs index eb9d03f3fc17d..963b98fee1c6e 100644 --- a/turbopack/crates/turbopack-browser/src/chunking_context.rs +++ b/turbopack/crates/turbopack-browser/src/chunking_context.rs @@ -485,11 +485,8 @@ impl ChunkingContext for BrowserChunkingContext { } #[turbo_tasks::function] - async fn chunk_item_id_from_ident( - self: Vc, - ident: Vc, - ) -> Result> { - Ok(self.await?.module_id_strategy.get_module_id(ident)) + async fn chunk_item_id_from_ident(&self, ident: Vc) -> Result> { + Ok(self.module_id_strategy.get_module_id(ident)) } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs index f74dad4f42fe4..4bf5cdc84f74d 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs @@ -47,18 +47,16 @@ impl EcmascriptDevChunkContent { } #[turbo_tasks::function] - pub async fn entries( - self: Vc, - ) -> Result> { - Ok(self.await?.entries) + pub async fn entries(&self) -> Result> { + Ok(self.entries) } } #[turbo_tasks::value_impl] impl EcmascriptDevChunkContent { #[turbo_tasks::function] - pub(crate) async fn own_version(self: Vc) -> Result> { - let this = self.await?; + pub(crate) async fn own_version(&self) -> Result> { + let this = self; Ok(EcmascriptDevChunkVersion::new( this.chunking_context.output_root(), this.chunk.ident().path(), diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs b/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs index 57b5bc6390f8a..40be6b3de0f06 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs @@ -57,8 +57,8 @@ impl EcmascriptDevEvaluateChunk { } #[turbo_tasks::function] - async fn chunks_data(self: Vc) -> Result> { - let this = self.await?; + async fn chunks_data(&self) -> Result> { + let this = self; Ok(ChunkData::from_assets( this.chunking_context.output_root(), this.other_chunks, diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/list/content.rs b/turbopack/crates/turbopack-browser/src/ecmascript/list/content.rs index 478de6c10d54c..ecbeb51532552 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/list/content.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/list/content.rs @@ -70,8 +70,8 @@ impl EcmascriptDevChunkListContent { /// Computes the version of this content. #[turbo_tasks::function] - pub async fn version(self: Vc) -> Result> { - let this = self.await?; + pub async fn version(&self) -> Result> { + let this = self; let mut by_merger = IndexMap::<_, Vec<_>>::new(); let mut by_path = IndexMap::<_, _>::new(); diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/merged/content.rs b/turbopack/crates/turbopack-browser/src/ecmascript/merged/content.rs index a852ca7d90f9f..7324242e0d539 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/merged/content.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/merged/content.rs @@ -23,10 +23,9 @@ pub(super) struct EcmascriptDevMergedChunkContent { #[turbo_tasks::value_impl] impl EcmascriptDevMergedChunkContent { #[turbo_tasks::function] - pub async fn version(self: Vc) -> Result> { + pub async fn version(&self) -> Result> { Ok(EcmascriptDevMergedChunkVersion { versions: self - .await? .contents .iter() .map(|content| async move { content.own_version().await }) diff --git a/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs b/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs index 8d20decbdb90b..80003bb992480 100644 --- a/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs +++ b/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs @@ -69,12 +69,12 @@ pub struct RuntimeEntries(Vec>); impl RuntimeEntries { #[turbo_tasks::function] pub async fn resolve_entries( - self: Vc, + &self, asset_context: Vc>, ) -> Result> { let mut runtime_entries = Vec::new(); - for reference in &self.await? { + for reference in &self.0 { let resolved_entries = reference.resolve_entry(asset_context).await?; runtime_entries.extend(&resolved_entries); } diff --git a/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs b/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs index 35444b9500957..c92a2c4a3a190 100644 --- a/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs +++ b/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs @@ -65,8 +65,8 @@ impl AvailableChunkItems { } #[turbo_tasks::function] - pub async fn hash(self: Vc) -> Result> { - let this = self.await?; + pub async fn hash(&self) -> Result> { + let this = self; let mut hasher = Xxh3Hash64Hasher::new(); if let Some(parent) = this.parent { hasher.write_value(parent.hash().await?); @@ -88,10 +88,10 @@ impl AvailableChunkItems { #[turbo_tasks::function] pub async fn get( - self: Vc, + &self, chunk_item: Vc>, ) -> Result> { - let this = self.await?; + let this = self; if let Some(&info) = this.chunk_items.await?.get(&chunk_item) { return Ok(Vc::cell(Some(info))); }; diff --git a/turbopack/crates/turbopack-core/src/chunk/data.rs b/turbopack/crates/turbopack-core/src/chunk/data.rs index 900ebd9edff5c..4d482835406e6 100644 --- a/turbopack/crates/turbopack-core/src/chunk/data.rs +++ b/turbopack/crates/turbopack-core/src/chunk/data.rs @@ -137,7 +137,7 @@ impl ChunkData { /// Returns [`OutputAsset`]s that this chunk data references. #[turbo_tasks::function] - pub async fn references(self: Vc) -> Result> { - Ok(self.await?.references) + pub async fn references(&self) -> Result> { + Ok(self.references) } } diff --git a/turbopack/crates/turbopack-core/src/chunk/module_id_strategies.rs b/turbopack/crates/turbopack-core/src/chunk/module_id_strategies.rs index f3368bad3eac7..fa9bfb900a5cb 100644 --- a/turbopack/crates/turbopack-core/src/chunk/module_id_strategies.rs +++ b/turbopack/crates/turbopack-core/src/chunk/module_id_strategies.rs @@ -43,9 +43,9 @@ impl GlobalModuleIdStrategy { #[turbo_tasks::value_impl] impl ModuleIdStrategy for GlobalModuleIdStrategy { #[turbo_tasks::function] - async fn get_module_id(self: Vc, ident: Vc) -> Result> { + async fn get_module_id(&self, ident: Vc) -> Result> { let ident_string = ident.to_string().await?.clone_value(); - if let Some(module_id) = self.await?.module_id_map.get(&ident_string) { + if let Some(module_id) = self.module_id_map.get(&ident_string) { // dbg!(format!("Hit {}", ident.to_string().await?)); return Ok(*module_id); } diff --git a/turbopack/crates/turbopack-core/src/code_builder.rs b/turbopack/crates/turbopack-core/src/code_builder.rs index 8c39858a74b1c..54433d1b649d3 100644 --- a/turbopack/crates/turbopack-core/src/code_builder.rs +++ b/turbopack/crates/turbopack-core/src/code_builder.rs @@ -191,8 +191,8 @@ impl GenerateSourceMap for Code { impl Code { /// Returns the hash of the source code of this Code. #[turbo_tasks::function] - pub async fn source_code_hash(self: Vc) -> Result> { - let code = self.await?; + pub async fn source_code_hash(&self) -> Result> { + let code = self; let hash = hash_xxh3_hash64(code.source_code()); Ok(Vc::cell(hash)) } diff --git a/turbopack/crates/turbopack-core/src/compile_time_info.rs b/turbopack/crates/turbopack-core/src/compile_time_info.rs index 1a514c30dfe45..561088f5493c2 100644 --- a/turbopack/crates/turbopack-core/src/compile_time_info.rs +++ b/turbopack/crates/turbopack-core/src/compile_time_info.rs @@ -263,8 +263,8 @@ impl CompileTimeInfo { } #[turbo_tasks::function] - pub async fn environment(self: Vc) -> Result> { - Ok(self.await?.environment) + pub async fn environment(&self) -> Result> { + Ok(self.environment) } } diff --git a/turbopack/crates/turbopack-core/src/environment.rs b/turbopack/crates/turbopack-core/src/environment.rs index 3f612b192393e..ab21995b97049 100644 --- a/turbopack/crates/turbopack-core/src/environment.rs +++ b/turbopack/crates/turbopack-core/src/environment.rs @@ -66,8 +66,8 @@ pub enum ExecutionEnvironment { #[turbo_tasks::value_impl] impl Environment { #[turbo_tasks::function] - pub async fn compile_target(self: Vc) -> Result> { - let this = self.await?; + pub async fn compile_target(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(node_env, ..) | ExecutionEnvironment::NodeJsLambda(node_env) => node_env.await?.compile_target, @@ -78,8 +78,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn runtime_versions(self: Vc) -> Result> { - let this = self.await?; + pub async fn runtime_versions(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(node_env, ..) | ExecutionEnvironment::NodeJsLambda(node_env) => node_env.runtime_versions(), @@ -95,8 +95,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn node_externals(self: Vc) -> Result> { - let this = self.await?; + pub async fn node_externals(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(true) @@ -108,8 +108,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn supports_esm_externals(self: Vc) -> Result> { - let this = self.await?; + pub async fn supports_esm_externals(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(true) @@ -121,8 +121,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn supports_commonjs_externals(self: Vc) -> Result> { - let this = self.await?; + pub async fn supports_commonjs_externals(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(true) @@ -134,8 +134,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn supports_wasm(self: Vc) -> Result> { - let this = self.await?; + pub async fn supports_wasm(&self) -> Result> { + let this = self; Ok(match this.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(true) @@ -147,8 +147,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn resolve_extensions(self: Vc) -> Result>> { - let env = self.await?; + pub async fn resolve_extensions(&self) -> Result>> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(vec![".js".into(), ".node".into(), ".json".into()]) @@ -161,8 +161,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn resolve_node_modules(self: Vc) -> Result> { - let env = self.await?; + pub async fn resolve_node_modules(&self) -> Result> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(true) @@ -175,8 +175,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn resolve_conditions(self: Vc) -> Result>> { - let env = self.await?; + pub async fn resolve_conditions(&self) -> Result>> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => { Vc::cell(vec!["node".into()]) @@ -190,8 +190,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn cwd(self: Vc) -> Result>> { - let env = self.await?; + pub async fn cwd(&self) -> Result>> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(env) | ExecutionEnvironment::NodeJsLambda(env) => env.await?.cwd, @@ -200,8 +200,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn rendering(self: Vc) -> Result> { - let env = self.await?; + pub async fn rendering(&self) -> Result> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(_) | ExecutionEnvironment::NodeJsLambda(_) => { Rendering::Server.cell() @@ -213,8 +213,8 @@ impl Environment { } #[turbo_tasks::function] - pub async fn chunk_loading(self: Vc) -> Result> { - let env = self.await?; + pub async fn chunk_loading(&self) -> Result> { + let env = self; Ok(match env.execution { ExecutionEnvironment::NodeJsBuildTime(_) | ExecutionEnvironment::NodeJsLambda(_) => { ChunkLoading::NodeJs.cell() @@ -251,8 +251,8 @@ impl Default for NodeJsEnvironment { #[turbo_tasks::value_impl] impl NodeJsEnvironment { #[turbo_tasks::function] - pub async fn runtime_versions(self: Vc) -> Result> { - let str = match *self.await?.node_version.await? { + pub async fn runtime_versions(&self) -> Result> { + let str = match *self.node_version.await? { NodeJsVersion::Current(process_env) => get_current_nodejs_version(process_env), NodeJsVersion::Static(version) => version, } diff --git a/turbopack/crates/turbopack-core/src/issue/mod.rs b/turbopack/crates/turbopack-core/src/issue/mod.rs index 90f97aae7454d..fbb95b8a2a06a 100644 --- a/turbopack/crates/turbopack-core/src/issue/mod.rs +++ b/turbopack/crates/turbopack-core/src/issue/mod.rs @@ -223,8 +223,8 @@ impl ValueToString for IssueProcessingPathItem { #[turbo_tasks::value_impl] impl IssueProcessingPathItem { #[turbo_tasks::function] - pub async fn into_plain(self: Vc) -> Result> { - let this = self.await?; + pub async fn into_plain(&self) -> Result> { + let this = self; Ok(PlainIssueProcessingPathItem { file_path: if let Some(context) = this.file_path { Some(context.to_string().await?) @@ -369,8 +369,8 @@ pub struct CapturedIssues { #[turbo_tasks::value_impl] impl CapturedIssues { #[turbo_tasks::function] - pub async fn is_empty(self: Vc) -> Result> { - Ok(Vc::cell(self.await?.is_empty_ref())) + pub async fn is_empty(&self) -> Result> { + Ok(Vc::cell(self.is_empty_ref())) } } @@ -762,8 +762,8 @@ impl PlainIssue { /// same issue to pass from multiple processing paths, making for overly /// verbose logging. #[turbo_tasks::function] - pub async fn internal_hash(self: Vc, full: bool) -> Result> { - Ok(Vc::cell(self.await?.internal_hash_ref(full))) + pub async fn internal_hash(&self, full: bool) -> Result> { + Ok(Vc::cell(self.internal_hash_ref(full))) } } @@ -777,8 +777,8 @@ pub struct PlainIssueSource { #[turbo_tasks::value_impl] impl IssueSource { #[turbo_tasks::function] - pub async fn into_plain(self: Vc) -> Result> { - let this = self.await?; + pub async fn into_plain(&self) -> Result> { + let this = self; Ok(PlainIssueSource { asset: PlainSource::from_source(this.source).await?, range: match this.range { diff --git a/turbopack/crates/turbopack-core/src/output.rs b/turbopack/crates/turbopack-core/src/output.rs index 020acad64e670..ad6797d82e686 100644 --- a/turbopack/crates/turbopack-core/src/output.rs +++ b/turbopack/crates/turbopack-core/src/output.rs @@ -33,8 +33,8 @@ impl OutputAssets { } #[turbo_tasks::function] - pub async fn concatenate(self: Vc, other: Vc) -> Result> { - let mut assets: IndexSet<_> = self.await?.iter().copied().collect(); + pub async fn concatenate(&self, other: Vc) -> Result> { + let mut assets: IndexSet<_> = self.0.iter().copied().collect(); assets.extend(other.await?.iter().copied()); Ok(Vc::cell(assets.into_iter().collect())) } diff --git a/turbopack/crates/turbopack-core/src/reference/mod.rs b/turbopack/crates/turbopack-core/src/reference/mod.rs index f167ecd603b76..09f44a9821b75 100644 --- a/turbopack/crates/turbopack-core/src/reference/mod.rs +++ b/turbopack/crates/turbopack-core/src/reference/mod.rs @@ -86,8 +86,8 @@ impl SingleModuleReference { /// The [Vc>] that this reference resolves to. #[turbo_tasks::function] - pub async fn asset(self: Vc) -> Result>> { - Ok(self.await?.asset) + pub async fn asset(&self) -> Result>> { + Ok(self.asset) } } @@ -132,8 +132,8 @@ impl SingleOutputAssetReference { /// The [Vc>] that this reference resolves to. #[turbo_tasks::function] - pub async fn asset(self: Vc) -> Result>> { - Ok(self.await?.asset) + pub async fn asset(&self) -> Result>> { + Ok(self.asset) } } diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 80d2ce0e7bcd3..180ab844baef9 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -319,14 +319,14 @@ impl ModuleResolveResult { } #[turbo_tasks::function] - pub async fn is_unresolveable(self: Vc) -> Result> { - let this = self.await?; + pub async fn is_unresolveable(&self) -> Result> { + let this = self; Ok(Vc::cell(this.is_unresolveable_ref())) } #[turbo_tasks::function] - pub async fn first_module(self: Vc) -> Result> { - let this = self.await?; + pub async fn first_module(&self) -> Result> { + let this = self; Ok(Vc::cell(this.primary.iter().find_map( |(_, item)| match item { &ModuleResolveResultItem::Module(a) => Some(a), @@ -338,8 +338,8 @@ impl ModuleResolveResult { /// Returns a set (no duplicates) of primary modules in the result. All /// modules are already resolved Vc. #[turbo_tasks::function] - pub async fn primary_modules(self: Vc) -> Result> { - let this = self.await?; + pub async fn primary_modules(&self) -> Result> { + let this = self; let mut iter = this.primary_modules_iter(); let Some(first) = iter.next() else { return Ok(Vc::cell(vec![])); @@ -360,8 +360,8 @@ impl ModuleResolveResult { } #[turbo_tasks::function] - pub async fn primary_output_assets(self: Vc) -> Result> { - let this = self.await?; + pub async fn primary_output_assets(&self) -> Result> { + let this = self; Ok(Vc::cell( this.primary .iter() @@ -746,9 +746,8 @@ impl ResolveResult { #[turbo_tasks::value_impl] impl ResolveResult { #[turbo_tasks::function] - pub async fn as_raw_module_result(self: Vc) -> Result> { + pub async fn as_raw_module_result(&self) -> Result> { Ok(self - .await? .map_module(|asset| async move { Ok(ModuleResolveResultItem::Module(Vc::upcast(RawModule::new( asset, @@ -852,14 +851,14 @@ impl ResolveResult { } #[turbo_tasks::function] - pub async fn is_unresolveable(self: Vc) -> Result> { - let this = self.await?; + pub async fn is_unresolveable(&self) -> Result> { + let this = self; Ok(Vc::cell(this.is_unresolveable_ref())) } #[turbo_tasks::function] - pub async fn first_source(self: Vc) -> Result> { - let this = self.await?; + pub async fn first_source(&self) -> Result> { + let this = self; Ok(Vc::cell(this.primary.iter().find_map(|(_, item)| { if let &ResolveResultItem::Source(a) = item { Some(a) @@ -870,8 +869,8 @@ impl ResolveResult { } #[turbo_tasks::function] - pub async fn primary_sources(self: Vc) -> Result> { - let this = self.await?; + pub async fn primary_sources(&self) -> Result> { + let this = self; Ok(Vc::cell( this.primary .iter() @@ -892,11 +891,11 @@ impl ResolveResult { /// some, they are discarded. #[turbo_tasks::function] pub async fn with_replaced_request_key( - self: Vc, + &self, old_request_key: RcStr, request_key: Value, ) -> Result> { - let this = self.await?; + let this = self; let request_key = request_key.into_value(); let new_primary = this .primary @@ -928,13 +927,13 @@ impl ResolveResult { /// if there are still some, they are discarded. #[turbo_tasks::function] pub async fn with_replaced_request_key_pattern( - self: Vc, + &self, old_request_key: Vc, request_key: Vc, ) -> Result> { let old_request_key = &*old_request_key.await?; let request_key = &*request_key.await?; - let this = self.await?; + let this = self; let new_primary = this .primary .iter() @@ -962,8 +961,8 @@ impl ResolveResult { /// Returns a new [ResolveResult] where all [RequestKey]s are set to the /// passed `request`. #[turbo_tasks::function] - pub async fn with_request(self: Vc, request: RcStr) -> Result> { - let this = self.await?; + pub async fn with_request(&self, request: RcStr) -> Result> { + let this = self; let new_primary = this .primary .iter() diff --git a/turbopack/crates/turbopack-core/src/resolve/options.rs b/turbopack/crates/turbopack-core/src/resolve/options.rs index 6dd0b1d373850..eac1ac620d64c 100644 --- a/turbopack/crates/turbopack-core/src/resolve/options.rs +++ b/turbopack/crates/turbopack-core/src/resolve/options.rs @@ -444,12 +444,12 @@ impl ImportMap { impl ResolvedMap { #[turbo_tasks::function] pub async fn lookup( - self: Vc, + &self, resolved: Vc, lookup_path: Vc, request: Vc, ) -> Result> { - let this = self.await?; + let this = self; let resolved = resolved.await?; for (root, glob, mapping) in this.by_glob.iter() { let root = root.await?; diff --git a/turbopack/crates/turbopack-core/src/resolve/plugin.rs b/turbopack/crates/turbopack-core/src/resolve/plugin.rs index 4bfa3306b59c9..b7662705ea1a0 100644 --- a/turbopack/crates/turbopack-core/src/resolve/plugin.rs +++ b/turbopack/crates/turbopack-core/src/resolve/plugin.rs @@ -22,8 +22,8 @@ impl AfterResolvePluginCondition { } #[turbo_tasks::function] - pub async fn matches(self: Vc, fs_path: Vc) -> Result> { - let this = self.await?; + pub async fn matches(&self, fs_path: Vc) -> Result> { + let this = self; let root = this.root.await?; let glob = this.glob.await?; diff --git a/turbopack/crates/turbopack-core/src/source_transform.rs b/turbopack/crates/turbopack-core/src/source_transform.rs index 205d2abbed1d8..64ea4f1311d60 100644 --- a/turbopack/crates/turbopack-core/src/source_transform.rs +++ b/turbopack/crates/turbopack-core/src/source_transform.rs @@ -14,12 +14,9 @@ pub struct SourceTransforms(Vec>>); #[turbo_tasks::value_impl] impl SourceTransforms { #[turbo_tasks::function] - pub async fn transform( - self: Vc, - source: Vc>, - ) -> Result>> { + pub async fn transform(&self, source: Vc>) -> Result>> { Ok(self - .await? + .0 .iter() .fold(source, |source, transform| transform.transform(source))) } diff --git a/turbopack/crates/turbopack-core/src/version.rs b/turbopack/crates/turbopack-core/src/version.rs index fb624844bc2f9..d2df7dbf8b5eb 100644 --- a/turbopack/crates/turbopack-core/src/version.rs +++ b/turbopack/crates/turbopack-core/src/version.rs @@ -250,8 +250,8 @@ pub struct VersionState { #[turbo_tasks::value_impl] impl VersionState { #[turbo_tasks::function] - pub async fn get(self: Vc) -> Result>> { - let this = self.await?; + pub async fn get(&self) -> Result>> { + let this = self; let version = TraitRef::cell(this.version.get().clone()); Ok(version) } diff --git a/turbopack/crates/turbopack-css/src/asset.rs b/turbopack/crates/turbopack-css/src/asset.rs index 6ad1ef026f42c..fe4c9a21a059a 100644 --- a/turbopack/crates/turbopack-css/src/asset.rs +++ b/turbopack/crates/turbopack-css/src/asset.rs @@ -65,8 +65,8 @@ impl CssModuleAsset { /// Retrns the asset ident of the source without the "css" modifier #[turbo_tasks::function] - pub async fn source_ident(self: Vc) -> Result> { - Ok(self.await?.source.ident()) + pub async fn source_ident(&self) -> Result> { + Ok(self.source.ident()) } } diff --git a/turbopack/crates/turbopack-css/src/chunk/mod.rs b/turbopack/crates/turbopack-css/src/chunk/mod.rs index 1fdeec0983794..f9b9cb71092f4 100644 --- a/turbopack/crates/turbopack-css/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-css/src/chunk/mod.rs @@ -232,8 +232,8 @@ fn chunk_item_key() -> Vc { #[turbo_tasks::value_impl] impl OutputAsset for CssChunk { #[turbo_tasks::function] - async fn ident(self: Vc) -> Result> { - let this = self.await?; + async fn ident(&self) -> Result> { + let this = self; let mut assets = Vec::new(); diff --git a/turbopack/crates/turbopack-css/src/module_asset.rs b/turbopack/crates/turbopack-css/src/module_asset.rs index d4331e7e94450..f07e713d2e02f 100644 --- a/turbopack/crates/turbopack-css/src/module_asset.rs +++ b/turbopack/crates/turbopack-css/src/module_asset.rs @@ -152,8 +152,8 @@ struct ModuleCssClasses(IndexMap>); #[turbo_tasks::value_impl] impl ModuleCssAsset { #[turbo_tasks::function] - async fn inner(self: Vc) -> Result> { - let this = self.await?; + async fn inner(&self) -> Result> { + let this = self; Ok(this.asset_context.process( this.source, Value::new(ReferenceType::Css(CssReferenceSubType::Internal)), diff --git a/turbopack/crates/turbopack-dev-server/src/html.rs b/turbopack/crates/turbopack-dev-server/src/html.rs index fdd2d2f3188d4..8262cf70463db 100644 --- a/turbopack/crates/turbopack-dev-server/src/html.rs +++ b/turbopack/crates/turbopack-dev-server/src/html.rs @@ -126,8 +126,8 @@ impl DevHtmlAsset { } #[turbo_tasks::function] - async fn chunks(self: Vc) -> Result> { - let this = self.await?; + async fn chunks(&self) -> Result> { + let this = self; let all_assets = this .entries @@ -180,8 +180,8 @@ impl DevHtmlAssetContent { #[turbo_tasks::value_impl] impl DevHtmlAssetContent { #[turbo_tasks::function] - async fn content(self: Vc) -> Result> { - let this = self.await?; + async fn content(&self) -> Result> { + let this = self; let mut scripts = Vec::new(); let mut stylesheets = Vec::new(); diff --git a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs index 9d95aa7d644ca..bca9f18dbd516 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs @@ -88,8 +88,8 @@ impl AssetGraphContentSource { } #[turbo_tasks::function] - async fn all_assets_map(self: Vc) -> Result> { - let this = self.await?; + async fn all_assets_map(&self) -> Result> { + let this = self; Ok(Vc::cell( expand( &*this.root_assets.await?, diff --git a/turbopack/crates/turbopack-ecmascript/src/async_chunk/chunk_item.rs b/turbopack/crates/turbopack-ecmascript/src/async_chunk/chunk_item.rs index 6fd76155f6e6b..2d3773d2ac03e 100644 --- a/turbopack/crates/turbopack-ecmascript/src/async_chunk/chunk_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/async_chunk/chunk_item.rs @@ -30,8 +30,8 @@ pub struct AsyncLoaderChunkItem { #[turbo_tasks::value_impl] impl AsyncLoaderChunkItem { #[turbo_tasks::function] - pub(super) async fn chunks(self: Vc) -> Result> { - let this = self.await?; + pub(super) async fn chunks(&self) -> Result> { + let this = self; let module = this.module.await?; if let Some(chunk_items) = module.availability_info.available_chunk_items() { if chunk_items diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs index e97ed1d057f24..68339aa15b635 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs @@ -78,8 +78,8 @@ impl EcmascriptChunkItemContent { } #[turbo_tasks::function] - pub async fn module_factory(self: Vc) -> Result> { - let this = self.await?; + pub async fn module_factory(&self) -> Result> { + let this = self; let mut args = vec![ "r: __turbopack_require__", "f: __turbopack_module_context__", diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs index a45ad1374fe72..e802b23cbdf8c 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs @@ -76,8 +76,8 @@ fn availability_root_key() -> Vc { #[turbo_tasks::value_impl] impl Chunk for EcmascriptChunk { #[turbo_tasks::function] - async fn ident(self: Vc) -> Result> { - let this = self.await?; + async fn ident(&self) -> Result> { + let this = self; let mut assets = Vec::new(); @@ -135,8 +135,8 @@ impl Chunk for EcmascriptChunk { } #[turbo_tasks::function] - async fn references(self: Vc) -> Result> { - let this = self.await?; + async fn references(&self) -> Result> { + let this = self; let content = this.content.await?; Ok(Vc::cell(content.referenced_output_assets.clone())) } diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs b/turbopack/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs index b02d89c551f85..7efa05d73489f 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs @@ -124,8 +124,8 @@ struct ChunkGroupFilesChunkItem { #[turbo_tasks::value_impl] impl ChunkGroupFilesChunkItem { #[turbo_tasks::function] - async fn chunks(self: Vc) -> Result> { - let this = self.await?; + async fn chunks(&self) -> Result> { + let this = self; let inner = this.inner.await?; let chunks = if let Some(ecma) = Vc::try_resolve_sidecast::>(inner.module).await? @@ -250,11 +250,11 @@ impl Introspectable for ChunkGroupFilesAsset { } #[turbo_tasks::function] - async fn children(self: Vc) -> Result> { + async fn children(&self) -> Result> { let mut children = IndexSet::new(); children.insert(( Vc::cell("inner asset".into()), - IntrospectableModule::new(Vc::upcast(self.await?.module)), + IntrospectableModule::new(Vc::upcast(self.module)), )); Ok(Vc::cell(children)) } diff --git a/turbopack/crates/turbopack-ecmascript/src/lib.rs b/turbopack/crates/turbopack-ecmascript/src/lib.rs index f171c318e886c..8dd6ae8752de0 100644 --- a/turbopack/crates/turbopack-ecmascript/src/lib.rs +++ b/turbopack/crates/turbopack-ecmascript/src/lib.rs @@ -357,8 +357,8 @@ impl EcmascriptParsable for EcmascriptModuleAsset { } #[turbo_tasks::function] - async fn ty(self: Vc) -> Result> { - Ok(self.await?.ty.cell()) + async fn ty(&self) -> Result> { + Ok(self.ty.cell()) } } @@ -461,8 +461,8 @@ impl EcmascriptModuleAsset { } #[turbo_tasks::function] - pub async fn source(self: Vc) -> Result>> { - Ok(self.await?.source) + pub async fn source(&self) -> Result>> { + Ok(self.source) } #[turbo_tasks::function] @@ -471,8 +471,8 @@ impl EcmascriptModuleAsset { } #[turbo_tasks::function] - pub async fn options(self: Vc) -> Result> { - Ok(self.await?.options) + pub async fn options(&self) -> Result> { + Ok(self.options) } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs b/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs index deacb22cfa791..e3bbb6cb699ee 100644 --- a/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs +++ b/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs @@ -52,8 +52,8 @@ impl ManifestAsyncModule { } #[turbo_tasks::function] - pub(super) async fn chunks(self: Vc) -> Result> { - let this = self.await?; + pub(super) async fn chunks(&self) -> Result> { + let this = self; Ok(this .chunking_context .chunk_group_assets(Vc::upcast(this.inner), Value::new(this.availability_info))) diff --git a/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_item.rs b/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_item.rs index 9080b7558857c..8d7e985fdf80c 100644 --- a/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/manifest/chunk_item.rs @@ -29,8 +29,8 @@ pub(super) struct ManifestChunkItem { #[turbo_tasks::value_impl] impl ManifestChunkItem { #[turbo_tasks::function] - async fn chunks_data(self: Vc) -> Result> { - let this = self.await?; + async fn chunks_data(&self) -> Result> { + let this = self; Ok(ChunkData::from_assets( this.chunking_context.output_root(), this.manifest.chunks(), diff --git a/turbopack/crates/turbopack-ecmascript/src/manifest/loader_item.rs b/turbopack/crates/turbopack-ecmascript/src/manifest/loader_item.rs index 5c9fc07495288..69a5c76a01d68 100644 --- a/turbopack/crates/turbopack-ecmascript/src/manifest/loader_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/manifest/loader_item.rs @@ -58,8 +58,8 @@ impl ManifestLoaderChunkItem { } #[turbo_tasks::function] - pub async fn chunks_data(self: Vc) -> Result> { - let this = self.await?; + pub async fn chunks_data(&self) -> Result> { + let this = self; let chunks = this.manifest.manifest_chunks(); Ok(ChunkData::from_assets( this.chunking_context.output_root(), diff --git a/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs b/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs index b371c14f5af43..22ae8dff2ac89 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs @@ -174,7 +174,7 @@ impl AsyncModule { /// Returns #[turbo_tasks::function] pub async fn module_options( - self: Vc, + &self, async_module_info: Option>, ) -> Result> { if async_module_info.is_none() { @@ -182,7 +182,7 @@ impl AsyncModule { } Ok(Vc::cell(Some(AsyncModuleOptions { - has_top_level_await: self.await?.has_top_level_await, + has_top_level_await: self.has_top_level_await, }))) } diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs index 4e3b9c8dd1fdc..5f485981dd520 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs @@ -151,10 +151,10 @@ impl EsmBinding { impl CodeGenerateable for EsmBindings { #[turbo_tasks::function] async fn code_generation( - self: Vc, + &self, _context: Vc>, ) -> Result> { - let this = self.await?; + let this = self; let mut visitors = Vec::new(); let bindings = this.bindings.clone(); diff --git a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs index 51853796f0a25..9546c7e0dd436 100644 --- a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs +++ b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs @@ -40,9 +40,9 @@ impl EcmascriptModuleFacadeModule { } #[turbo_tasks::function] - pub async fn async_module(self: Vc) -> Result> { + pub async fn async_module(&self) -> Result> { let (import_externals, has_top_level_await) = - if let Some(async_module) = *self.await?.module.get_async_module().await? { + if let Some(async_module) = *self.module.get_async_module().await? { ( async_module.await?.import_externals, async_module.await?.has_top_level_await, diff --git a/turbopack/crates/turbopack-ecmascript/src/static_code.rs b/turbopack/crates/turbopack-ecmascript/src/static_code.rs index 450e8e7788c8c..14080967bec54 100644 --- a/turbopack/crates/turbopack-ecmascript/src/static_code.rs +++ b/turbopack/crates/turbopack-ecmascript/src/static_code.rs @@ -47,8 +47,8 @@ impl StaticEcmascriptCode { /// Computes the contents of the asset and pushes it to /// the code builder, including the source map if available. #[turbo_tasks::function] - pub async fn code(self: Vc) -> Result> { - let this = self.await?; + pub async fn code(&self) -> Result> { + let this = self; let runtime_base_content = this.asset.module_content_without_analysis().await?; let mut code = CodeBuilder::default(); code.push_source( diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/asset.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/asset.rs index c807df3900fd8..41c8603779bff 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/asset.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/asset.rs @@ -33,8 +33,8 @@ pub struct EcmascriptModulePartAsset { #[turbo_tasks::value_impl] impl EcmascriptParsable for EcmascriptModulePartAsset { #[turbo_tasks::function] - async fn failsafe_parse(self: Vc) -> Result> { - let this = self.await?; + async fn failsafe_parse(&self) -> Result> { + let this = self; let parsed = this.full_module.failsafe_parse(); let split_data = split( @@ -59,27 +59,24 @@ impl EcmascriptParsable for EcmascriptModulePartAsset { #[turbo_tasks::value_impl] impl EcmascriptAnalyzable for EcmascriptModulePartAsset { #[turbo_tasks::function] - async fn analyze(self: Vc) -> Result> { - let this = self.await?; + async fn analyze(&self) -> Result> { + let this = self; let part = this.part; Ok(analyse_ecmascript_module(this.full_module, Some(part))) } #[turbo_tasks::function] - async fn module_content_without_analysis( - self: Vc, - ) -> Result> { - Ok(self.await?.full_module.module_content_without_analysis()) + async fn module_content_without_analysis(&self) -> Result> { + Ok(self.full_module.module_content_without_analysis()) } #[turbo_tasks::function] async fn module_content( - self: Vc, + &self, chunking_context: Vc>, async_module_info: Option>, ) -> Result> { Ok(self - .await? .full_module .module_content(chunking_context, async_module_info)) } @@ -275,8 +272,8 @@ impl ChunkableModule for EcmascriptModulePartAsset { #[turbo_tasks::value_impl] impl EcmascriptModulePartAsset { #[turbo_tasks::function] - pub(super) async fn analyze(self: Vc) -> Result> { - let this = self.await?; + pub(super) async fn analyze(&self) -> Result> { + let this = self; Ok(analyze(this.full_module, this.part)) } diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs index 61095d9c1ba6e..e4db6452715bb 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs @@ -32,10 +32,10 @@ impl EcmascriptChunkItem for EcmascriptModulePartChunkItem { #[turbo_tasks::function] async fn content_with_async_module_info( - self: Vc, + &self, async_module_info: Option>, ) -> Result> { - let this = self.await?; + let this = self; let module = this.module.await?; let split_data = split_module(module.full_module); diff --git a/turbopack/crates/turbopack-ecmascript/src/worker_chunk/chunk_item.rs b/turbopack/crates/turbopack-ecmascript/src/worker_chunk/chunk_item.rs index c6cce6a9ba3eb..9531a819526d7 100644 --- a/turbopack/crates/turbopack-ecmascript/src/worker_chunk/chunk_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/worker_chunk/chunk_item.rs @@ -35,8 +35,8 @@ pub fn worker_modifier() -> Vc { #[turbo_tasks::value_impl] impl WorkerLoaderChunkItem { #[turbo_tasks::function] - async fn chunks(self: Vc) -> Result> { - let this = self.await?; + async fn chunks(&self) -> Result> { + let this = self; let module = this.module.await?; let Some(evaluatable) = diff --git a/turbopack/crates/turbopack-mdx/src/lib.rs b/turbopack/crates/turbopack-mdx/src/lib.rs index d7cf78fff4aee..cce1687d8400f 100644 --- a/turbopack/crates/turbopack-mdx/src/lib.rs +++ b/turbopack/crates/turbopack-mdx/src/lib.rs @@ -134,8 +134,8 @@ impl Asset for MdxTransformedAsset { #[turbo_tasks::value_impl] impl MdxTransformedAsset { #[turbo_tasks::function] - async fn process(self: Vc) -> Result> { - let this = self.await?; + async fn process(&self) -> Result> { + let this = self; let content = this.source.content().await?; let transform_options = this.options.await?; diff --git a/turbopack/crates/turbopack-node/src/execution_context.rs b/turbopack/crates/turbopack-node/src/execution_context.rs index a6846c75e082e..8efd14203348a 100644 --- a/turbopack/crates/turbopack-node/src/execution_context.rs +++ b/turbopack/crates/turbopack-node/src/execution_context.rs @@ -28,17 +28,17 @@ impl ExecutionContext { } #[turbo_tasks::function] - pub async fn project_path(self: Vc) -> Result> { - Ok(self.await?.project_path) + pub async fn project_path(&self) -> Result> { + Ok(self.project_path) } #[turbo_tasks::function] - pub async fn chunking_context(self: Vc) -> Result>> { - Ok(self.await?.chunking_context) + pub async fn chunking_context(&self) -> Result>> { + Ok(self.chunking_context) } #[turbo_tasks::function] - pub async fn env(self: Vc) -> Result>> { - Ok(self.await?.env) + pub async fn env(&self) -> Result>> { + Ok(self.env) } } diff --git a/turbopack/crates/turbopack-node/src/render/node_api_source.rs b/turbopack/crates/turbopack-node/src/render/node_api_source.rs index d81e0819c6a9f..0bf1b729dee00 100644 --- a/turbopack/crates/turbopack-node/src/render/node_api_source.rs +++ b/turbopack/crates/turbopack-node/src/render/node_api_source.rs @@ -71,8 +71,8 @@ pub struct NodeApiContentSource { #[turbo_tasks::value_impl] impl NodeApiContentSource { #[turbo_tasks::function] - pub async fn get_pathname(self: Vc) -> Result> { - Ok(self.await?.pathname) + pub async fn get_pathname(&self) -> Result> { + Ok(self.pathname) } } diff --git a/turbopack/crates/turbopack-node/src/render/rendered_source.rs b/turbopack/crates/turbopack-node/src/render/rendered_source.rs index 7dc57cfa900a0..d495af48e0b3c 100644 --- a/turbopack/crates/turbopack-node/src/render/rendered_source.rs +++ b/turbopack/crates/turbopack-node/src/render/rendered_source.rs @@ -99,8 +99,8 @@ pub struct NodeRenderContentSource { #[turbo_tasks::value_impl] impl NodeRenderContentSource { #[turbo_tasks::function] - pub async fn get_pathname(self: Vc) -> Result> { - Ok(self.await?.pathname) + pub async fn get_pathname(&self) -> Result> { + Ok(self.pathname) } } diff --git a/turbopack/crates/turbopack-node/src/source_map/trace.rs b/turbopack/crates/turbopack-node/src/source_map/trace.rs index 433ed0d523d76..18ff0b5f22df8 100644 --- a/turbopack/crates/turbopack-node/src/source_map/trace.rs +++ b/turbopack/crates/turbopack-node/src/source_map/trace.rs @@ -128,8 +128,8 @@ impl SourceMapTrace { /// the individual sections of the JS file's map without the /// serialization. #[turbo_tasks::function] - pub async fn trace(self: Vc) -> Result> { - let this = self.await?; + pub async fn trace(&self) -> Result> { + let this = self; let token = this .map diff --git a/turbopack/crates/turbopack-node/src/transforms/postcss.rs b/turbopack/crates/turbopack-node/src/transforms/postcss.rs index d0a8004c9759f..7157e9f048b4e 100644 --- a/turbopack/crates/turbopack-node/src/transforms/postcss.rs +++ b/turbopack/crates/turbopack-node/src/transforms/postcss.rs @@ -424,8 +424,8 @@ impl GenerateSourceMap for PostCssTransformedAsset { #[turbo_tasks::value_impl] impl PostCssTransformedAsset { #[turbo_tasks::function] - async fn process(self: Vc) -> Result> { - let this = self.await?; + async fn process(&self) -> Result> { + let this = self; let ExecutionContext { project_path, chunking_context, diff --git a/turbopack/crates/turbopack-nodejs/src/chunking_context.rs b/turbopack/crates/turbopack-nodejs/src/chunking_context.rs index 0134c901612dc..ebb93170b7c49 100644 --- a/turbopack/crates/turbopack-nodejs/src/chunking_context.rs +++ b/turbopack/crates/turbopack-nodejs/src/chunking_context.rs @@ -363,11 +363,8 @@ impl ChunkingContext for NodeJsChunkingContext { } #[turbo_tasks::function] - async fn chunk_item_id_from_ident( - self: Vc, - ident: Vc, - ) -> Result> { - Ok(self.await?.module_id_strategy.get_module_id(ident)) + async fn chunk_item_id_from_ident(&self, ident: Vc) -> Result> { + Ok(self.module_id_strategy.get_module_id(ident)) } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs index e59f63591002d..f498dc4232777 100644 --- a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs +++ b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs @@ -109,8 +109,8 @@ impl EcmascriptBuildNodeChunkContent { } #[turbo_tasks::function] - pub(crate) async fn own_version(self: Vc) -> Result> { - let this = self.await?; + pub(crate) async fn own_version(&self) -> Result> { + let this = self; Ok(EcmascriptBuildNodeChunkVersion::new( this.chunking_context.output_root(), this.chunk.ident().path(), diff --git a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/entry/chunk.rs b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/entry/chunk.rs index 2ec6829da495d..4f58d63abc749 100644 --- a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/entry/chunk.rs +++ b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/entry/chunk.rs @@ -144,8 +144,8 @@ impl EcmascriptBuildNodeEntryChunk { } #[turbo_tasks::function] - async fn runtime_chunk(self: Vc) -> Result> { - let this = self.await?; + async fn runtime_chunk(&self) -> Result> { + let this = self; Ok(EcmascriptBuildNodeRuntimeChunk::new(this.chunking_context)) } } diff --git a/turbopack/crates/turbopack-static/src/lib.rs b/turbopack/crates/turbopack-static/src/lib.rs index dac5336fe4d8c..6f57d24106011 100644 --- a/turbopack/crates/turbopack-static/src/lib.rs +++ b/turbopack/crates/turbopack-static/src/lib.rs @@ -61,10 +61,10 @@ impl StaticModuleAsset { #[turbo_tasks::function] async fn static_asset( - self: Vc, + &self, chunking_context: Vc>, ) -> Result> { - Ok(StaticAsset::new(chunking_context, self.await?.source)) + Ok(StaticAsset::new(chunking_context, self.source)) } } diff --git a/turbopack/crates/turbopack/src/lib.rs b/turbopack/crates/turbopack/src/lib.rs index 79278443855a4..edab1193284ce 100644 --- a/turbopack/crates/turbopack/src/lib.rs +++ b/turbopack/crates/turbopack/src/lib.rs @@ -368,18 +368,18 @@ impl ModuleAssetContext { } #[turbo_tasks::function] - pub async fn module_options_context(self: Vc) -> Result> { - Ok(self.await?.module_options_context) + pub async fn module_options_context(&self) -> Result> { + Ok(self.module_options_context) } #[turbo_tasks::function] - pub async fn resolve_options_context(self: Vc) -> Result> { - Ok(self.await?.resolve_options_context) + pub async fn resolve_options_context(&self) -> Result> { + Ok(self.resolve_options_context) } #[turbo_tasks::function] - pub async fn is_types_resolving_enabled(self: Vc) -> Result> { - let resolve_options_context = self.await?.resolve_options_context.await?; + pub async fn is_types_resolving_enabled(&self) -> Result> { + let resolve_options_context = self.resolve_options_context.await?; Ok(Vc::cell( resolve_options_context.enable_types && resolve_options_context.enable_typescript, )) @@ -769,12 +769,8 @@ impl AssetContext for ModuleAssetContext { } #[turbo_tasks::function] - async fn side_effect_free_packages(self: Vc) -> Result> { - let pkgs = &*self - .await? - .module_options_context - .await? - .side_effect_free_packages; + async fn side_effect_free_packages(&self) -> Result> { + let pkgs = &*self.module_options_context.await?.side_effect_free_packages; let mut globs = Vec::with_capacity(pkgs.len());