Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions crates/napi/src/next_api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use turbo_tasks_fs::FileContent;
use turbopack_core::{
diagnostics::{Diagnostic, DiagnosticContextExt, PlainDiagnostic},
issue::{
IssueDescriptionExt, IssueSeverity, PlainIssue, PlainIssueSource, PlainSource, StyledString,
CollectibleIssuesExt, IssueSeverity, PlainIssue, PlainIssueSource, PlainSource,
StyledString,
},
source_pos::SourcePos,
};
Expand Down Expand Up @@ -101,7 +102,7 @@ pub fn root_task_dispose(
}

pub async fn get_issues<T: Send>(source: OperationVc<T>) -> Result<Arc<Vec<ReadRef<PlainIssue>>>> {
let issues = source.peek_issues_with_path().await?;
let issues = source.peek_issues().await?;
Ok(Arc::new(issues.get_plain_issues().await?))
}

Expand Down
4 changes: 2 additions & 2 deletions crates/next-api/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use turbo_tasks::{
CollectiblesSource, FxIndexMap, NonLocalValue, OperationValue, OperationVc, ResolvedVc,
TaskInput, Vc, debug::ValueDebugFormat, get_effects, trace::TraceRawVcs,
};
use turbopack_core::{diagnostics::Diagnostic, issue::IssueDescriptionExt};
use turbopack_core::{diagnostics::Diagnostic, issue::CollectibleIssuesExt};

use crate::{
entrypoints::Entrypoints,
Expand Down Expand Up @@ -38,7 +38,7 @@ async fn entrypoints_without_collectibles_operation(
) -> Result<Vc<Entrypoints>> {
let _ = entrypoints.resolve_strongly_consistent().await?;
let _ = entrypoints.take_collectibles::<Box<dyn Diagnostic>>();
let _ = entrypoints.take_issues_with_path().await?;
let _ = entrypoints.take_issues().await?;
let _ = get_effects(entrypoints).await?;
Ok(entrypoints.connect())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
file_source::FileSource,
ident::Layer,
issue::{
Issue, IssueDescriptionExt, IssueExt, IssueSeverity, IssueStage, OptionStyledString,
CollectibleIssuesExt, Issue, IssueExt, IssueSeverity, IssueStage, OptionStyledString,
StyledString,
},
module::Module,
Expand Down Expand Up @@ -153,7 +153,7 @@
/// E.g. `/home/user/projects/my-repo`.
pub root_path: RcStr,

/// A path which contains the app/pages directories, relative to [`Project::root_path`], always

Check warning on line 156 in crates/next-api/src/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_path` links to private item `Project::root_path`
/// Unix path. E.g. `apps/my-app`
pub project_path: RcStr,

Expand Down Expand Up @@ -960,7 +960,7 @@
async move {
let module_graphs_op = whole_app_module_graph_operation(self);
let module_graphs_vc = module_graphs_op.resolve_strongly_consistent().await?;
let _ = module_graphs_op.take_issues_with_path().await?;
let _ = module_graphs_op.take_issues().await?;

// At this point all modules have been computed and we can get rid of the node.js
// process pools
Expand Down
41 changes: 3 additions & 38 deletions turbopack/crates/turbopack-cli-utils/src/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use crossterm::style::{StyledContent, Stylize};
use owo_colors::{OwoColorize as _, Style};
use rustc_hash::{FxHashMap, FxHashSet};
use turbo_rcstr::RcStr;
use turbo_tasks::{RawVc, ReadRef, TransientInstance, TransientValue, Vc};
use turbo_tasks::{RawVc, TransientInstance, TransientValue, Vc};
use turbo_tasks_fs::{FileLinesContent, source_context::get_source_context};
use turbopack_core::issue::{
CapturedIssues, IssueReporter, IssueSeverity, PlainIssue, PlainIssueProcessingPathItem,
PlainIssueSource, PlainTraceItem, StyledString,
CapturedIssues, IssueReporter, IssueSeverity, PlainIssue, PlainIssueSource, PlainTraceItem,
StyledString,
};

use crate::source_context::format_source_context_lines;
Expand Down Expand Up @@ -44,39 +44,6 @@ fn format_source_content(source: &PlainIssueSource, formatted_issue: &mut String
}
}

fn format_optional_path(
path: &Option<Vec<ReadRef<PlainIssueProcessingPathItem>>>,
formatted_issue: &mut String,
) -> Result<()> {
if let Some(path) = path {
let mut last_context = None;
for item in path.iter().rev() {
let PlainIssueProcessingPathItem {
file_path: ref context,
ref description,
} = **item;
if let Some(context) = context {
let option_context = Some(context.clone());
if last_context == option_context {
writeln!(formatted_issue, " at {description}")?;
} else {
writeln!(
formatted_issue,
" at {} ({})",
context.to_string().bright_blue(),
description
)?;
last_context = option_context;
}
} else {
writeln!(formatted_issue, " at {description}")?;
last_context = None;
}
}
}
Ok(())
}

pub fn format_issue(
plain_issue: &PlainIssue,
path: Option<String>,
Expand Down Expand Up @@ -435,7 +402,6 @@ impl IssueReporter for ConsoleUi {
let context_path =
make_relative_to_cwd(&plain_issue.file_path, project_dir, current_dir);
let stage = plain_issue.stage.to_string();
let processing_path = &*plain_issue.processing_path;
let severity_map = grouped_issues.entry(severity).or_default();
let category_map = severity_map.entry(stage.clone()).or_default();
let issues = category_map.entry(context_path.to_string()).or_default();
Expand All @@ -462,7 +428,6 @@ impl IssueReporter for ConsoleUi {
if !documentation_link.is_empty() {
writeln!(&mut styled_issue, "\ndocumentation: {documentation_link}")?;
}
format_optional_path(processing_path, &mut styled_issue)?;
}
issues.push(styled_issue);
}
Expand Down
1 change: 0 additions & 1 deletion turbopack/crates/turbopack-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ turbo-tasks-backend = { workspace = true }

[features]
default = []
issue_path = []
Loading
Loading