@nodesecure/tree-walker
Version:
NodeSecure tree walker
25 lines • 746 B
JavaScript
// Import Node.js Dependencies
import path from "node:path";
import fs from "node:fs/promises";
// Import Third-party Dependencies
import Arborist from "@npmcli/arborist";
// Import Internal Dependencies
import * as utils from "../utils/index.js";
export class LocalDependencyTreeLoader {
async load(location, registry) {
const arb = new Arborist({
...utils.NPM_TOKEN,
path: location,
registry
});
try {
await fs.access(path.join(location, "node_modules"));
await arb.loadActual();
return arb.buildIdealTree();
}
catch {
return arb.loadVirtual();
}
}
}
//# sourceMappingURL=LocalDependencyTreeLoader.js.map