您如何发现哪些NPM模块依赖于您的?

时间:2021-08-20 21:10:49

It's easy to see what modules a specific module depends on but I can't seem to find out how to see what modules depend on a specific module. Is there a simple way to do this? If so, is there a way to do this programmatically?

很容易看到一个特定模块所依赖的模块,但是我似乎不知道如何看到哪些模块依赖于一个特定模块。有简单的方法吗?如果是这样,有没有一种方法可以通过编程来实现这一点?

4 个解决方案

#1


32  

Update: The registry API has changed, and may or may not let you talk directly to underlying CouchDB database. Fortunately, there is still a public mirror provided for replication at https://skimdb.npmjs.com/registry that you can still send queries to. To use:

更新:注册表API已经更改,可能允许也可能不允许您直接与底层的CouchDB数据库进行对话。幸运的是,在https://skimdb.npmjs.com/registry中仍然提供了一个用于复制的公共镜像,您仍然可以将查询发送到它。使用方法:

https://skimdb.npmjs.com/registry/_design/app/_view/dependedUpon?group_level=3&startkey=%5B"socket.io"%5D&endkey=%5B"socket.io"%2C%7B%7D%5D&skip=0&limit=1000

For ease of reading, here are the querystring parameters from the example:

为了便于阅读,下面是示例中的querystring参数:

{ group_level: 3,
  startkey: '["socket.io"]',
  endkey: '["socket.io", {}]',
  skip: 0,
  limit: 1000 }

Note that as stated above, these are parameters for a CouchDB request. There doesn't seem to be an endpoint on the official API to get this data, but there's an issue open for the registry that you can follow here.

注意,如上所述,这些是CouchDB请求的参数。在官方API上似乎没有端点来获取这些数据,但是在这里您可以跟踪注册中心有一个问题。


The closest thing you'd get to doing that is probably requesting JSON from the npm registry. For example, to get the packages dependent on Socket.IO, send a GET request to this link:

最接近的方法可能是从npm注册中心请求JSON。例如,获取依赖于套接字的包。IO,发送一个GET请求到这个链接:

http://registry.npmjs.org/-/_view/dependedUpon?group_level=3&startkey=%5B%22socket.io%22%5D&endkey=%5B%22socket.io%22%2C%7B%7D%5D&skip=0&limit=1000

#2


22  

You can browse them on npmjs.com itself, by going to a URLs like, for example, https://www.npmjs.com/browse/depended/markdown-it

您可以在npmjs.com上浏览它们,方法是访问url,例如https://www.npmjs.com/browse/depended/markdownit

#3


11  

As of lately there is also https://libraries.io/npm/socket.io that tracks dependents and dependencies for you.

最近还出现了https://libraries.io/npm/socket。为您跟踪依赖项和依赖项的io。

#4


3  

dependedUpon is wrapped by at least these tools now :

至少现在这些工具都是依赖于这些工具的:

npm install -g npm-static-stats dependents-tree npm-get-dependents npm-dependents

dependents-tree looks most useful for checking out a new package

依赖树在检查新包时看起来最有用。

#1


32  

Update: The registry API has changed, and may or may not let you talk directly to underlying CouchDB database. Fortunately, there is still a public mirror provided for replication at https://skimdb.npmjs.com/registry that you can still send queries to. To use:

更新:注册表API已经更改,可能允许也可能不允许您直接与底层的CouchDB数据库进行对话。幸运的是,在https://skimdb.npmjs.com/registry中仍然提供了一个用于复制的公共镜像,您仍然可以将查询发送到它。使用方法:

https://skimdb.npmjs.com/registry/_design/app/_view/dependedUpon?group_level=3&startkey=%5B"socket.io"%5D&endkey=%5B"socket.io"%2C%7B%7D%5D&skip=0&limit=1000

For ease of reading, here are the querystring parameters from the example:

为了便于阅读,下面是示例中的querystring参数:

{ group_level: 3,
  startkey: '["socket.io"]',
  endkey: '["socket.io", {}]',
  skip: 0,
  limit: 1000 }

Note that as stated above, these are parameters for a CouchDB request. There doesn't seem to be an endpoint on the official API to get this data, but there's an issue open for the registry that you can follow here.

注意,如上所述,这些是CouchDB请求的参数。在官方API上似乎没有端点来获取这些数据,但是在这里您可以跟踪注册中心有一个问题。


The closest thing you'd get to doing that is probably requesting JSON from the npm registry. For example, to get the packages dependent on Socket.IO, send a GET request to this link:

最接近的方法可能是从npm注册中心请求JSON。例如,获取依赖于套接字的包。IO,发送一个GET请求到这个链接:

http://registry.npmjs.org/-/_view/dependedUpon?group_level=3&startkey=%5B%22socket.io%22%5D&endkey=%5B%22socket.io%22%2C%7B%7D%5D&skip=0&limit=1000

#2


22  

You can browse them on npmjs.com itself, by going to a URLs like, for example, https://www.npmjs.com/browse/depended/markdown-it

您可以在npmjs.com上浏览它们,方法是访问url,例如https://www.npmjs.com/browse/depended/markdownit

#3


11  

As of lately there is also https://libraries.io/npm/socket.io that tracks dependents and dependencies for you.

最近还出现了https://libraries.io/npm/socket。为您跟踪依赖项和依赖项的io。

#4


3  

dependedUpon is wrapped by at least these tools now :

至少现在这些工具都是依赖于这些工具的:

npm install -g npm-static-stats dependents-tree npm-get-dependents npm-dependents

dependents-tree looks most useful for checking out a new package

依赖树在检查新包时看起来最有用。