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

Method isNode

deps/npm/lib/commands/rebuild.js:95–120  ·  view source on GitHub ↗
(specs, node)

Source from the content-addressed store, hash-verified

93 }
94
95 isNode (specs, node) {
96 // Bundled dependencies are never selected by name. Their identity comes
97 // from the bundling parent's tarball (a bundled folder can call itself
98 // anything), so `npm rebuild bcrypt` must never target a bundled
99 // `node_modules/bcrypt`. Their install scripts never run regardless.
100 if (node.inBundle) {
101 return false
102 }
103 return specs.some(spec => {
104 if (spec.type === 'directory') {
105 return node.path === spec.fetchSpec
106 }
107
108 if (spec.name !== node.name) {
109 return false
110 }
111
112 if (spec.rawSpec === '' || spec.rawSpec === '*') {
113 return true
114 }
115
116 const { version } = node.package
117 // TODO: add tests for a package with missing version
118 return semver.satisfies(version, spec.fetchSpec)
119 })
120 }
121}
122
123module.exports = Rebuild

Callers 1

execMethod · 0.95

Calls 1

someMethod · 0.80

Tested by

no test coverage detected