MCPcopy Index your code
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/query.js:62–86  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

60 }
61
62 async exec (args) {
63 const packageLockOnly = this.npm.config.get('package-lock-only')
64 const Arborist = require('@npmcli/arborist')
65 const arb = new Arborist({
66 ...this.npm.flatOptions,
67 // one dir up from wherever node_modules lives
68 path: resolve(this.npm.dir, '..'),
69 forceActual: !packageLockOnly,
70 })
71 let tree
72 if (packageLockOnly) {
73 try {
74 tree = await arb.loadVirtual()
75 } catch (err) {
76 log.verbose('loadVirtual', err.stack)
77 throw this.usageError(
78 'A package lock or shrinkwrap file is required in package-lock-only mode'
79 )
80 }
81 } else {
82 tree = await arb.loadActual()
83 }
84 await this.#queryTree(tree, args[0])
85 this.#output()
86 }
87
88 async execWorkspaces (args) {
89 await this.setWorkspaces()

Callers

nothing calls this directly

Calls 7

#queryTreeMethod · 0.95
#outputMethod · 0.95
verboseMethod · 0.80
usageErrorMethod · 0.80
getMethod · 0.65
requireFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected