File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,14 +50,14 @@ function countDocs(packageName: string, version?: string): number {
5050 return count
5151}
5252
53- function countEmbeddings ( packageName : string , version ?: string ) : number | null {
53+ async function countEmbeddings ( packageName : string , version ?: string ) : Promise < number | null > {
5454 if ( ! version )
5555 return null
5656 const dbPath = getPackageDbPath ( packageName , version )
5757 if ( ! existsSync ( dbPath ) )
5858 return null
5959 try {
60- const { DatabaseSync } = require ( 'node:sqlite' )
60+ const { DatabaseSync } = await import ( 'node:sqlite' )
6161 const db = new DatabaseSync ( dbPath , { open : true , readOnly : true } )
6262 const row = db . prepare ( 'SELECT count(*) as cnt FROM vector_metadata' ) . get ( ) as { cnt : number } | undefined
6363 db . close ( )
@@ -215,7 +215,7 @@ export function statusCommand(opts: StatusOptions = {}): void {
215215 if ( docs > 0 )
216216 meta . push ( `${ docs } docs` )
217217
218- const embeddings = countEmbeddings ( pkgName , info . version )
218+ const embeddings = await countEmbeddings ( pkgName , info . version )
219219 if ( embeddings !== null )
220220 meta . push ( `${ embeddings } chunks` )
221221
You can’t perform that action at this time.
0 commit comments