Socket
Socket
Sign inDemoInstall

@npmcli/arborist

Package Overview
Dependencies
181
Maintainers
6
Versions
191
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.0.6

17

lib/add-rm-pkg-deps.js
// add and remove dependency specs to/from pkg manifest
const relpath = require('./relpath.js')
const removeFromOthers = (name, type, pkg) => {

@@ -34,5 +36,5 @@ const others = new Set([

const add = ({pkg, add, saveBundle, saveType}) => {
const add = ({pkg, add, saveBundle, saveType, path}) => {
for (const spec of add) {
addSingle({pkg, spec, saveBundle, saveType})
addSingle({pkg, spec, saveBundle, saveType, path})
}

@@ -42,7 +44,7 @@ return pkg

const addSingle = ({pkg, spec, saveBundle, saveType}) => {
const addSingle = ({pkg, spec, saveBundle, saveType, path}) => {
if (!saveType)
saveType = getSaveType(pkg, spec)
const {name} = spec
const {name, rawSpec, type: specType, fetchSpec } = spec
removeFromOthers(name, saveType, pkg)

@@ -56,4 +58,7 @@ const type = saveType === 'prod' ? 'dependencies'

pkg[type] = pkg[type] || {}
if (spec.rawSpec !== '' || pkg[type][name] === undefined)
pkg[type][name] = spec.rawSpec || '*'
if (rawSpec !== '' || pkg[type][name] === undefined) {
// if we're in global mode, file specs are based on cwd, not arb path
pkg[type][name] = specType === 'file' ? `file:${relpath(path, fetchSpec)}`
: (rawSpec || '*')
}

@@ -60,0 +65,0 @@ if (saveType === 'peer' || saveType === 'peerOptional') {

@@ -306,3 +306,5 @@ // mixin implementing the buildIdealTree method

return Promise.all(add.map(s => {
const spec = npa(s, this.path)
// in global mode, `npm i foo.tgz` needs to be resolved from
// the current working dir, NOT /usr/local/lib!
const spec = npa(s, this[_global] ? process.cwd() : this.path)
return spec.name ? spec : pacote.manifest(spec).then(mani => {

@@ -321,2 +323,3 @@ spec.name = mani.name

saveType,
path: this.path,
})

@@ -323,0 +326,0 @@ for (const spec of add) {

{
"name": "@npmcli/arborist",
"version": "0.0.5",
"version": "0.0.6",
"description": "Manage node_modules trees",

@@ -5,0 +5,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc