the esbuild "build" object that's available inside of esbuild plugin setup functions.
for mock testing, you can also provide a stub like this: const build = { esbuild }
.
follow the example below that makes use of a similar stub.
import * as esbuild from "npm:esbuild@0.25.0"
const build = { esbuild }
const myPackageDirScanner = findResolveDirOfNpmPackageFactory(build)
const my_package_resolve_dir = await myPackageDirScanner("@oazmi/tsignal", [
"D:/temp/node/",
"file:///d:/sdk/cache/",
])
console.log(`the "@oazmi/tsignal" package can be located when resolveDir is set to:`, my_package_resolve_dir)
generate a function that makes esbuild scan multiple directories in search for an npm-package inside of some
"./node_modules/"
folder. the first valid directory, in which the npm-package was scanned for was successful, will be returned.