Skip to content

Commit 4188f8d

Browse files
committed
fix: use ofetch for fast-npm-meta
1 parent 418a22e commit 4188f8d

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

‎packages/devtools/src/npm/index.ts‎

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,14 @@ import { createRequire } from 'node:module'
22
import{logger,useNuxt}from'@nuxt/kit'
33
import{readPackageJSON}from'pkg-types'
44
importsemverfrom'semver'
5+
import{fetch}from'ofetch'
56
import{getPackageInfo}from'local-pkg'
67
importtype{PackageUpdateInfo}from'../types'
78

89
exportasyncfunctiongetMainPackageJSON(nuxt=useNuxt()){
910
returnreadPackageJSON(nuxt.options.rootDir)
1011
}
1112

12-
exportinterfacePackument{
13-
'name': string
14-
/**
15-
* An object where each key is a version, and each value is the manifest for
16-
* that version.
17-
*/
18-
'versions': Record<string,Omit<Packument,'versions'>>
19-
/**
20-
* An object mapping dist-tags to version numbers. This is how `foo@latest`
21-
* gets turned into `foo@1.2.3`.
22-
*/
23-
'dist-tags': {latest: string}&Record<string,string>
24-
/**
25-
* In the full packument, an object mapping version numbers to publication
26-
* times, for the `opts.before` functionality.
27-
*/
28-
'time': Record<string,string>&{
29-
created: string
30-
modified: string
31-
}
32-
}
33-
3413
exportasyncfunctioncheckForUpdateOf(name: string,current?: string,nuxt=useNuxt()): Promise<PackageUpdateInfo|undefined>{
3514
try{
3615
if(!current){
@@ -45,7 +24,9 @@ export async function checkForUpdateOf(name: string, current?: string, nuxt = us
4524
return
4625

4726
const{ getLatestVersion }=awaitimport('fast-npm-meta')
48-
const{version: latest}=awaitgetLatestVersion(name)
27+
const{version: latest}=awaitgetLatestVersion(name,{
28+
fetch,
29+
})
4930

5031
constneedsUpdate=!!latest&&latest!==current&&semver.lt(current,latest)
5132

0 commit comments

Comments
 (0)