Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: skip npm install if graph has no new packages #24017

Merged
merged 24 commits into from
May 28, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' into deno_graph_load_perf
  • Loading branch information
dsherret committed May 28, 2024
commit 8c8bba6db4d4de2b29447178aa281027d526516e
58 changes: 39 additions & 19 deletions cli/tools/registry/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,45 @@ impl GraphDiagnosticsCollector {
}
}

// check for a missing version constraint
if let Ok(jsr_req_ref) =
JsrPackageReqReference::from_specifier(&resolution.specifier)
{
if jsr_req_ref.req().version_req.version_text() == "*" {
let maybe_version = graph
.packages
.mappings()
.get(jsr_req_ref.req())
.map(|nv| nv.version.clone());
diagnostics_collector.push(
PublishDiagnostic::MissingConstraint {
specifier: resolution.specifier.clone(),
specifier_text: specifier_text.to_string(),
resolved_version: maybe_version,
text_info: SourceTextInfo::new(source_text.clone()),
referrer: resolution.range.clone(),
},
);
pub fn collect_diagnostics_for_graph(
&self,
graph: &ModuleGraph,
diagnostics_collector: &PublishDiagnosticsCollector,
) -> Result<(), AnyError> {
let mut visited = HashSet::new();
let mut skip_specifiers: HashSet<Url> = HashSet::new();

let mut collect_if_invalid =
|skip_specifiers: &mut HashSet<Url>,
source_text: &Arc<str>,
specifier_text: &str,
resolution: &ResolutionResolved| {
if visited.insert(resolution.specifier.clone()) {
match resolution.specifier.scheme() {
"file" | "data" | "node" => {}
"jsr" => {
skip_specifiers.insert(resolution.specifier.clone());

// check for a missing version constraint
if let Ok(jsr_req_ref) =
JsrPackageReqReference::from_specifier(&resolution.specifier)
{
if jsr_req_ref.req().version_req.version_text() == "*" {
let maybe_version = graph
.packages
.mappings()
.get(jsr_req_ref.req())
.map(|nv| nv.version.clone());
diagnostics_collector.push(
PublishDiagnostic::MissingConstraint {
specifier: resolution.specifier.clone(),
specifier_text: specifier_text.to_string(),
resolved_version: maybe_version,
text_info: SourceTextInfo::new(source_text.clone()),
referrer: resolution.range.clone(),
},
);
}
}
}
"npm" => {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.