依赖选择器

依赖选择器语法和查询

描述

npm query 命令公开了一个新的依赖选择器语法(参考并尊重 CSS 选择器 4 规范 的许多方面),其中:

  • 使用健壮的对象模型、元数据和选择器语法标准化依赖图的形状和查询
  • 利用 CSS 中现有的已知语言语法和运算符来广泛访问不同的包信息
  • 解锁回答有关依赖关系、它们的关系和关联元数据的复杂、多方面问题的能力
  • 整合 npm 中类似查询命令的冗余逻辑(例如npm fund, npm ls, npm outdated, npm audit ...)

依赖选择器语法 v1.0.0

概述

  • 没有 "type" 或 "tag" 选择器(例如。div, h1, a) 作为依赖项/目标是唯一可以查询的 Node 类型
  • "dependencies" 一词是指在 Arborist 返回的 tree 中找到的任何 Node

组合器

  • > 直系后代/子代
  • 任何后代/孩子
  • ~ 兄弟姐妹

选择器

    +VuGqYuBUebMojrAscTHDTxxB6eLC5l60QR40q4iDDwJ3l3syPvCov7Nz+J0jfAZw9nHMXOoEinam8313LqUBgsDMgIi5rJIP0yZeBktrEr1ZaTZERj7Yqh7YseDRg0Ypuow7VHYS54ergUn1IA06Lvryph4RSbzq1NaObOewXcw8/MC0aRzwibvN6zhd1fjd70edxk725iBF4Qh6H+PcLBhf2J54PmILB01bZOzTLvkT+I+YYKbg/pkRAdQ4izCrI92CO0hvMAAWYtDqbqObgsFP9O5Oy8wKfMdMguOf0OTeuCiyy/LTlJnIh03s10FKyHfjhCm0O0afV2+2H78w88t7dYRWKi8brUpoBfZUZi+YIKMYJFchwFpcjYE0xyVigAzwc8pVBL1+jzPG8kW/Ub1+v34YHayXtdqbZHnICL0mC5zwB7q/pYFvRJ7lxCcHkPNjoI3cbdsQco0M1ej4Y8chnSRvyWU0bfCS9BzxP3Xj1fjs6NWGOaZu86SmUHsDjIqGyJk90Z4XX6iITO9Cg==

依赖类型选择器

    qHpUw5HlIqM+6IjlALzmvAsHcXKgjc06ifee0jPkMCGKMqZVM6S4tEA/jaQndwu+Vy5B0GJXGit52nsNKHiJhlw2uqWNjpE1+jLm4ZGbhGn0kArrrqCGM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2XuNeFWWtdjDaCLC27o90qFbWwN2sNmSgCf/4JuLn58tCIAUlUP+QpRu3uxVexQ9tH4bezAskT8vWKypkJoy9OOKpRVc14nCQCPkffdpxuYxrc5hKVM9QSuGb2bsD8rUR6vOqKj6PCrP5lOoO7BnW9jxbuqm5Wlollm4DOZbHiYhuXHpDo/mnN8nR+fyFPjoWEBpjlz7mh59Wxl9omJtvIY68htYRQ=

Objects

/* return dependencies that have a `scripts.test` containing `"tap"` */
*:attr(scripts, [test~=tap])

嵌套 Objects

MGLE8UuHRM0tVq3O21hBz8Qs8pznG3Dbffc/AKEWKO4tNrAdG0bMOZ9LYKS0eaBi+QHWZU2rP5F7ZXckVbzePQ==

/* return dependencies that have a testling config for opera browsers */
*:attr(testling, browsers, [~=opera])

Arrays

KCsaiB4XK6/sndsShSeUTHlMR5Gr7lIaR7tNjlzif/2hHIkGFl3Pb0jeUNSGKxzCi3iwDT4An9DVH2hDY7WwW/B6ROCBX0axz6DZCP8J25Ji4aV47CPSTj7J0+GeTMI/eLVWh5ziOLuU/3+ZpXylOfGxn0A/fEueWzcICb0uf45QiiGK4MEkgmXO9rOohexNd1DZ8/ciFl3WPgiOM1O4RixEY7kEt1v037efvC2RGewG/SatmPG5FG5XX36Q9er06x9qWJPTMbzRdm0LWrm5y+4MWtnB/uKHHS5Jpkn/upE=

Array 属性选择示例:

/* removes the distinction between properties & arrays */
/* ie. we'd have to check the property & iterate to match selection */
*:attr([keywords^=react])
*:attr(contributors, :attr([name~=Jordan]))

直接匹配值的 Array 示例:

/* return dependencies that have the exact keyword "react" */
/* this is equivalent to `*:keywords([value="react"])` */
*:attr([keywords=react])

Object 中的 Array 示例:

/* returns */
*:attr(contributors, [email=ruyadorno@github.com])

wvYEEpDk+6X8iQLh57z+2aiW6j5/49g/UUP1yv07KMs5/WA719S8iP7NqBp8vOzWxgoDFdXN5kBBfjM7cv4pxqdsla9+8PFbyYV8sEm58kAys0PFZyjm+s1Cm9RcA9/DNUQC4txWRGgyGHD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yA7fDZB/ga6H/vJVjWS6e4jdVKTsbobfYC5Qhm1ugcB3oi2URQrew8k8QOUJHhJmfpOdoQyCYUcQ5l3U+cJGh/pa2f+OsQ7PfcNMdZTxkTzZEM67iEFKqpb8m4jM0gX5bKOZTyRW1HcR5vuK0PhNOXxrRDR1FKtwwRrbVOUh/oEhpbNQNO81l0v+xwVIlu4vhQ5m1VF6m4NhmsUtBonejd9d0zCrAcTYqMdVKuxItgSICQYramCb9jQ0DDsRVu5qVvahoKAi3K9evDZD8mcUBgXu5sMP
const Arborist = require('@npmcli/arborist')
const arb = new Arborist({})
// root-level
arb.loadActual().then(async (tree) => {
  // query all production dependencies
  const results = await tree.querySelectorAll('.prod')
  console.log(results)
})
// iterative
arb.loadActual().then(async (tree) => {
  // query for the deduped version of react
  const results = await tree.querySelectorAll('#react:not(:deduped)')
  // query the deduped react for git deps
  const deps = await results[0].querySelectorAll(':type(git)')
  console.log(deps)
})