Skip to content
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
6 changes: 3 additions & 3 deletions turbopack/crates/turbopack-core/src/changed.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use turbo_tasks::{
Completion, Completions, ResolvedVc, TryJoinIterExt, Vc,
graph::{GraphTraversal, NonDeterministic},
graph::{AdjacencyMap, GraphTraversal, NonDeterministic},
};

use crate::{
Expand Down Expand Up @@ -32,13 +32,13 @@ pub async fn get_referenced_modules(
pub async fn any_content_changed_of_module(
root: ResolvedVc<Box<dyn Module>>,
) -> Result<Vc<Completion>> {
let completions = NonDeterministic::new()
let completions = AdjacencyMap::new()
.skip_duplicates()
.visit([root], get_referenced_modules)
.await
.completed()?
.into_inner()
.into_iter()
.into_postorder_topological()
.map(|m| content_changed(*ResolvedVc::upcast(m)))
.map(|v| v.to_resolved())
.try_join()
Expand Down
1 change: 0 additions & 1 deletion turbopack/crates/turbopack-css/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ impl CssChunkItem for CssModuleChunkItem {
if let FinalCssResult::Ok {
output_code,
source_map,
..
} = &*result
{
Ok(CssChunkItemContent {
Expand Down
14 changes: 2 additions & 12 deletions turbopack/crates/turbopack-css/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::{Arc, RwLock};

use anyhow::{Result, bail};
use lightningcss::{
css_modules::{CssModuleExport, CssModuleExports, Pattern, Segment},
css_modules::{CssModuleExport, Pattern, Segment},
stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleSheet, ToCssResult},
targets::{BrowserslistConfig, Features, Targets},
traits::ToCss,
Expand Down Expand Up @@ -193,27 +193,18 @@ pub enum CssWithPlaceholderResult {
NotFound,
}

#[turbo_tasks::value(shared, serialization = "none", eq = "manual")]
#[turbo_tasks::value(shared, serialization = "none")]
pub enum FinalCssResult {
Ok {
#[turbo_tasks(trace_ignore)]
output_code: String,

#[turbo_tasks(trace_ignore)]
exports: Option<CssModuleExports>,

source_map: ResolvedVc<OptionStringifiedSourceMap>,
},
Unparsable,
NotFound,
}

impl PartialEq for FinalCssResult {
fn eq(&self, _: &Self) -> bool {
false
}
}

#[turbo_tasks::function]
pub async fn process_css_with_placeholder(
parse_result: ResolvedVc<ParseCssResult>,
Expand Down Expand Up @@ -327,7 +318,6 @@ pub async fn finalize_css(

Ok(FinalCssResult::Ok {
output_code: result.code,
exports: result.exports,
source_map: ResolvedVc::cell(srcmap),
}
.cell())
Expand Down
7 changes: 2 additions & 5 deletions turbopack/crates/turbopack-css/src/references/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{
};

#[turbo_tasks::value(eq = "manual", serialization = "none", shared)]
#[derive(PartialEq)]
pub enum ImportAttributes {
LightningCss {
#[turbo_tasks(trace_ignore)]
Expand All @@ -32,11 +33,7 @@ pub enum ImportAttributes {
},
}

impl PartialEq for ImportAttributes {
fn eq(&self, _: &Self) -> bool {
false
}
}
impl Eq for ImportAttributes {}

impl ImportAttributes {
pub fn new_from_lightningcss(prelude: &ImportRule<'static>) -> Self {
Expand Down
3 changes: 2 additions & 1 deletion turbopack/crates/turbopack-ecmascript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ impl EcmascriptParsable for EcmascriptModuleAsset {
if this.options.await?.keep_last_successful_parse {
let real_result_value = real_result.await?;
let result_value = if matches!(*real_result_value, ParseResult::Ok { .. }) {
this.last_successful_parse.set(real_result_value.clone());
this.last_successful_parse
.set_unconditionally(real_result_value.clone());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why set_unconditionally is better here? Just to prevent the potentially expensive eq check? Or for actual semantical reasons?

real_result_value
} else {
let state_ref = this.last_successful_parse.get();
Expand Down
11 changes: 1 addition & 10 deletions turbopack/crates/turbopack-ecmascript/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use crate::{
transform::{EcmascriptInputTransforms, TransformContext},
};

#[turbo_tasks::value(shared, serialization = "none", eq = "manual")]
#[turbo_tasks::value(shared, serialization = "none", eq = "manual", cell = "new")]
#[allow(clippy::large_enum_variant)]
pub enum ParseResult {
// Note: Ok must not contain any Vc as it's snapshot by failsafe_parse
Expand All @@ -73,15 +73,6 @@ pub enum ParseResult {
NotFound,
}

impl PartialEq for ParseResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Ok { .. }, Self::Ok { .. }) => false,
_ => core::mem::discriminant(self) == core::mem::discriminant(other),
}
}
}

/// `original_source_maps_complete` indicates whether the `original_source_maps` cover the whole
/// map, i.e. whether every module that ended up in `mappings` had an original sourcemap.
#[instrument(level = "info", name = "generate source map", skip_all)]
Expand Down
Loading