https://registry.npmjs.org/{pkg}/latesthttps://registry.npmjs.org/vue/latestnpm 官方源,pkg 填包名,例如 vue、react、axios。返回的是该包最新版本的完整 package.json。
常用字段:version 当前版本,description 简介,dependencies 运行依赖,repository.url 源码地址,license 许可证,dist.unpackedSize 解压体积。
带命名空间的包要写成 @scope/name 的形式,斜杠会被当成路径分隔符,直接传 @vue/cli 也可以。国内访问慢可以把域名换成 registry.npmmirror.com,路径完全一样。
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
pkg |
string | 必填 | vue | npm 包名,可带 @scope/ |
https://registry.npmjs.org/{pkg}/latest
此处将显示接口返回结果…
{
"name": "vue",
"version": "3.5.46",
"description": "The progressive JavaScript framework for building modern web UI.",
"license": "MIT",
"repository": { "url": "git+https://github.com/vuejs/core.git" }
}
—