Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Jan 23, 2024
1 parent 2958acf commit 82d7ca3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/plumbing/which.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { provides as cache_provides } from "../hooks/useSyncCache.ts"
import { provides as cache_provides, available as cache_available } from "../hooks/useSyncCache.ts"
import usePantry, { PantryError } from "../hooks/usePantry.ts"
import { PackageRequirement } from "../types.ts"
import * as semver from "../utils/semver.ts"
Expand Down Expand Up @@ -38,13 +38,15 @@ async function *_which(arg0: string, opts: { providers: boolean }): AsyncGenerat
let found: WhichResult[] = []

// don't use the cache if PKGX_PANTRY_PATH is set
const cached = await cache_provides(arg0)
if (cached) {
for (const project of cached) {
yield { project, constraint: new semver.Range("*"), shebang: [arg0] }
if (cache_available()) {
const cached = await cache_provides(arg0)
if (cached) {
for (const project of cached) {
yield { project, constraint: new semver.Range("*"), shebang: [arg0] }
}
// NOTE probs wrong, but we need a rewrite
if (cached.length) return
}
// NOTE probs wrong, but we need a rewrite
if (cached.length) return
}

const promises: Promise<void>[] = []
Expand Down

0 comments on commit 82d7ca3

Please sign in to comment.