Giter Club home page Giter Club logo

Comments (1)

wraithgar avatar wraithgar commented on June 26, 2024 1

Looks like missing nodes weren't fully fleshed out in arborist, and the query command wasn't nuanced enough to include them (they don't have a location so they all group as one).

diff --git a/lib/commands/query.js b/lib/commands/query.js
index 17a55a446..dfa1356eb 100644
--- a/lib/commands/query.js
+++ b/lib/commands/query.js
@@ -113,10 +113,12 @@ class Query extends BaseCommand {
   // builds a normalized inventory
   buildResponse (items) {
     for (const node of items) {
-      if (!this.#seen.has(node.target.location)) {
+      if (!node.target.location || !this.#seen.has(node.target.location)) {
         const item = new QuerySelectorItem(node)
         this.#response.push(item)
-        this.#seen.add(item.location)
+        if (node.target.location) {
+          this.#seen.add(item.location)
+        }
       }
     }
   }
diff --git a/workspaces/arborist/lib/query-selector-all.js b/workspaces/arborist/lib/query-selector-all.js
index ce49201ce..c8ec866f0 100644
--- a/workspaces/arborist/lib/query-selector-all.js
+++ b/workspaces/arborist/lib/query-selector-all.js
@@ -257,7 +257,12 @@ class Results {
       for (const edge of node.edgesOut.values()) {
         if (edge.missing) {
           const pkg = { name: edge.name, version: edge.spec }
-          res.push(new this.#targetNode.constructor({ pkg }))
+          const item = new this.#targetNode.constructor({ pkg })
+          item.queryContext = {
+            missing: true,
+          }
+          item.edgesIn = new Set([edge])
+          res.push(item)

This fixes it for me locally, will need tests.

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.