summaryrefslogtreecommitdiff
path: root/cli/tools/registry/tar.rs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-01-24 14:49:33 +0100
committerGitHub <noreply@github.com>2024-01-24 14:49:33 +0100
commit745333f073aba4c97e7d06c731063105493cde5a (patch)
tree79f91d9621e11b46272b29a27e048fe235b32491 /cli/tools/registry/tar.rs
parent930ce2087051b4e45b2026ce7a77c14360a6993f (diff)
chore: improve unanalyzable dynamic import diagnostic (#22051)
Diffstat (limited to 'cli/tools/registry/tar.rs')
-rw-r--r--cli/tools/registry/tar.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/cli/tools/registry/tar.rs b/cli/tools/registry/tar.rs
index 0f6edbc3a..9bd7f098e 100644
--- a/cli/tools/registry/tar.rs
+++ b/cli/tools/registry/tar.rs
@@ -15,6 +15,9 @@ use tar::Header;
use crate::util::import_map::ImportMapUnfurler;
use deno_config::glob::PathOrPatternSet;
+use super::diagnostics::PublishDiagnostic;
+use super::diagnostics::PublishDiagnosticsCollector;
+
#[derive(Debug, Clone, PartialEq)]
pub struct PublishableTarballFile {
pub path: PathBuf,
@@ -32,6 +35,7 @@ pub struct PublishableTarball {
pub fn create_gzipped_tarball(
dir: &Path,
source_cache: &dyn deno_graph::ParsedSourceStore,
+ diagnostics_collector: &PublishDiagnosticsCollector,
unfurler: &ImportMapUnfurler,
exclude_patterns: &PathOrPatternSet,
) -> Result<PublishableTarball, AnyError> {
@@ -72,9 +76,11 @@ pub fn create_gzipped_tarball(
});
let content = match source_cache.get_parsed_source(&url) {
Some(parsed_source) => {
- let (content, unfurl_diagnostics) =
- unfurler.unfurl(&url, &parsed_source);
- diagnostics.extend_from_slice(&unfurl_diagnostics);
+ let mut reporter = |diagnostic| {
+ diagnostics_collector
+ .push(PublishDiagnostic::ImportMapUnfurl(diagnostic));
+ };
+ let content = unfurler.unfurl(&url, &parsed_source, &mut reporter);
content.into_bytes()
}
None => data,