diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-09-26 12:31:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 12:31:03 -0400 |
commit | 7437f9d944175d7d62fa34c6a2a186c0cd1684a0 (patch) | |
tree | c3f2a080a730e549cf65cf6d93f4c988c0115c52 /cli/tools/doc.rs | |
parent | b80cf1f5e7a10567f2a39b2f3872735f951dd3a4 (diff) |
fix(doc): surface graph errors as warnings (#25888)
Diffstat (limited to 'cli/tools/doc.rs')
-rw-r--r-- | cli/tools/doc.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index 0ba3b84fb..8f37632c8 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -7,7 +7,9 @@ use crate::args::Flags; use crate::colors; use crate::display; use crate::factory::CliFactory; -use crate::graph_util::graph_exit_lock_errors; +use crate::graph_util::graph_exit_integrity_errors; +use crate::graph_util::graph_walk_errors; +use crate::graph_util::GraphWalkErrorsOptions; use crate::tsc::get_types_declaration_file_text; use crate::util::fs::collect_specifiers; use deno_ast::diagnostics::Diagnostic; @@ -107,7 +109,7 @@ pub async fn doc( } DocSourceFileFlag::Paths(ref source_files) => { let module_graph_creator = factory.module_graph_creator().await?; - let maybe_lockfile = cli_options.maybe_lockfile(); + let fs = factory.fs(); let module_specifiers = collect_specifiers( FilePatterns { @@ -127,8 +129,18 @@ pub async fn doc( .create_graph(GraphKind::TypesOnly, module_specifiers.clone()) .await?; - if maybe_lockfile.is_some() { - graph_exit_lock_errors(&graph); + graph_exit_integrity_errors(&graph); + let errors = graph_walk_errors( + &graph, + fs, + &module_specifiers, + GraphWalkErrorsOptions { + check_js: false, + kind: GraphKind::TypesOnly, + }, + ); + for error in errors { + log::warn!("{} {}", colors::yellow("Warning"), error); } let doc_parser = doc::DocParser::new( |