Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pnpm

Package Overview
Dependencies
Maintainers
2
Versions
1075
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pnpm - npm Package Compare versions

Comparing version 0.26.1 to 0.26.2

12

bin/pnpm.js
#!/usr/bin/env node
'use strict'
if (~process.argv.indexOf('--debug')) {
process.env.DEBUG = 'pnpm:*'
process.argv.push('--quiet')
}
const rc = require('rc')
const camelcaseKeys = require('camelcase-keys')
const spawnSync = require('cross-spawn').sync
const isCI = require('is-ci')

@@ -64,4 +60,6 @@ const pnpmCmds = {

cli.flags.quiet = cli.flags.quiet || cli.flags.debug || isCI
if (cli.flags.debug) {
cli.flags.quiet = true
process.env.DEBUG = 'pnpm:*'
}

@@ -76,3 +74,3 @@

var opts = Object.assign({}, getRC('npm'), getRC('pnpm'))
const opts = Object.assign({}, getRC('npm'), getRC('pnpm'))

@@ -79,0 +77,0 @@ // This is needed because the arg values should be used only if they were passed

'use strict'
var readPkgUp = require('read-pkg-up')
var resolve = require('path').resolve
var dirname = require('path').dirname
var thenify = require('thenify')
var lock = thenify(require('lockfile').lock)
var unlock = thenify(require('lockfile').unlock)
var requireJson = require('../fs/require_json')
var writeJson = require('../fs/write_json')
var expandTilde = require('../fs/expand_tilde')
const readPkgUp = require('read-pkg-up')
const resolve = require('path').resolve
const dirname = require('path').dirname
const thenify = require('thenify')
const lock = thenify(require('lockfile').lock)
const unlock = thenify(require('lockfile').unlock)
const requireJson = require('../fs/require_json')
const writeJson = require('../fs/write_json')
const expandTilde = require('../fs/expand_tilde')
const resolveGlobalPkgPath = require('../resolve_global_pkg_path')
var logger = require('../logger')
var storeJsonController = require('../fs/store_json_controller')
var mkdirp = require('../fs/mkdirp')
const logger = require('../logger')
const storeJsonController = require('../fs/store_json_controller')
const mkdirp = require('../fs/mkdirp')
module.exports = function (opts) {
module.exports = opts => {
opts = opts || {}
const cwd = opts.cwd || process.cwd()
var cmd = {
const cmd = {
ctx: {}
}
var lockfile
let lockfile
return (opts.global ? readGlobalPkg(opts.globalPath) : readPkgUp({ cwd }))

@@ -32,3 +32,3 @@ .then(_ => { cmd.pkg = _ })

function updateContext () {
var root = cmd.pkg.path ? dirname(cmd.pkg.path) : cwd
const root = cmd.pkg.path ? dirname(cmd.pkg.path) : cwd
cmd.ctx.root = root

@@ -41,3 +41,3 @@ cmd.ctx.store = resolveStorePath(opts.storePath)

if (!opts.quiet) cmd.ctx.log = logger(opts.logger)
else cmd.ctx.log = function () { return function () {} }
else cmd.ctx.log = () => () => {}

@@ -44,0 +44,0 @@ function resolveStorePath (storePath) {

@@ -59,6 +59,6 @@ 'use strict'

function savePkgs (packages) {
var saveType = getSaveType(opts)
const saveType = getSaveType(opts)
if (saveType && installType === 'named') {
var inputNames = Object.keys(packagesToInstall)
var savedPackages = packages.filter(pkg => inputNames.indexOf(pkg.name) > -1)
const inputNames = Object.keys(packagesToInstall)
const savedPackages = packages.filter(pkg => inputNames.indexOf(pkg.name) > -1)
return save(cmd.pkg, savedPackages, saveType, opts.saveExact)

@@ -69,3 +69,3 @@ }

function mainPostInstall () {
var scripts = cmd.pkg.pkg && cmd.pkg.pkg.scripts || {}
const scripts = cmd.pkg.pkg && cmd.pkg.pkg.scripts || {}
if (scripts.postinstall) runScript('postinstall')

@@ -76,3 +76,3 @@ if (!isProductionInstall && scripts.prepublish) runScript('prepublish')

function runScript (scriptName) {
var result = spawnSync('npm', ['run', scriptName], {
const result = spawnSync('npm', ['run', scriptName], {
cwd: path.dirname(cmd.pkg.path),

@@ -93,3 +93,3 @@ stdio: 'inherit'

return pkgs.reduce((pkgsMap, pkgFullName) => {
var matches = /(@?[^@]+)@(.*)/.exec(pkgFullName)
const matches = /(@?[^@]+)@(.*)/.exec(pkgFullName)
if (!matches) {

@@ -96,0 +96,0 @@ pkgsMap[pkgFullName] = null

@@ -21,3 +21,3 @@ 'use strict'

cmd.pkg.pkg.dependencies = cmd.pkg.pkg.dependencies || {}
var pkgFullNames = pkgsToUninstall.map(dep => cmd.ctx.dependencies[cmd.pkg.path].find(_ => _.indexOf(dep + '@') === 0))
const pkgFullNames = pkgsToUninstall.map(dep => cmd.ctx.dependencies[cmd.pkg.path].find(_ => _.indexOf(dep + '@') === 0))
tryUninstall(pkgFullNames.slice())

@@ -54,8 +54,8 @@ if (cmd.ctx.dependencies[cmd.pkg.path]) {

var numberOfUninstalls = 0
for (var i = 0; i < pkgFullNames.length;) {
for (let i = 0; i < pkgFullNames.length;) {
if (canBeUninstalled(pkgFullNames[i])) {
var uninstalledPkg = pkgFullNames.splice(i, 1)[0]
const uninstalledPkg = pkgFullNames.splice(i, 1)[0]
removeBins(uninstalledPkg)
uninstalledPkgs.push(uninstalledPkg)
var deps = cmd.ctx.dependencies[uninstalledPkg] || []
const deps = cmd.ctx.dependencies[uninstalledPkg] || []
delete cmd.ctx.dependencies[uninstalledPkg]

@@ -82,4 +82,4 @@ delete cmd.ctx.dependents[uninstalledPkg]

function removeBins (uninstalledPkg) {
var uninstalledPkgJson = require(join(cmd.ctx.store, uninstalledPkg, '_/package.json'))
var bins = binify(uninstalledPkgJson)
const uninstalledPkgJson = require(join(cmd.ctx.store, uninstalledPkg, '_/package.json'))
const bins = binify(uninstalledPkgJson)
Object.keys(bins).forEach(bin => cbRimraf.sync(join(cmd.ctx.root, 'node_modules/.bin', bin)))

@@ -86,0 +86,0 @@ }

@@ -17,3 +17,3 @@ 'use strict'

if (typeof pkg.bin === 'string') {
var obj = {}
const obj = {}
obj[pkg.name] = pkg.bin

@@ -20,0 +20,0 @@ return obj

'use strict'
const link = require('../api/link')
module.exports = function (input, opts) {
module.exports = (input, opts) => {
if (!input || !input.length) {

@@ -6,0 +6,0 @@ return link.linkToGlobal(opts)

@@ -0,1 +1,2 @@

'use strict'
module.exports = require('rc')('pnpm', {

@@ -2,0 +3,0 @@ concurrency: 16,

@@ -0,1 +1,2 @@

'use strict'
module.exports = {

@@ -2,0 +3,0 @@ concurrency: 16,

@@ -1,2 +0,3 @@

var chalk = require('chalk')
'use strict'
const chalk = require('chalk')

@@ -3,0 +4,0 @@ module.exports = function err (error) {

@@ -1,7 +0,8 @@

var debug = require('debug')('pnpm:fetch')
var got = require('./got')
var crypto = require('crypto')
var gunzip = require('gunzip-maybe')
var tar = require('tar-fs')
var fs = require('fs')
'use strict'
const debug = require('debug')('pnpm:fetch')
const got = require('./got')
const crypto = require('crypto')
const gunzip = require('gunzip-maybe')
const tar = require('tar-fs')
const fs = require('fs')

@@ -22,5 +23,5 @@ /*

return new Promise((resolve, reject) => {
var actualShasum = crypto.createHash('sha1')
var size
var downloaded = 0
const actualShasum = crypto.createHash('sha1')
let size
let downloaded = 0

@@ -50,3 +51,3 @@ unpackStream(

function finish () {
var digest = actualShasum.digest('hex')
const digest = actualShasum.digest('hex')
debug('finish %s %s', shasum, tarball)

@@ -53,0 +54,0 @@ if (shasum && digest !== shasum) {

@@ -15,5 +15,5 @@ 'use strict'

function getHomedir () {
var home = osHomedir()
const home = osHomedir()
if (!home) throw new Error('Could not find the homedir')
return home
}
'use strict'
var fs = require('fs')
var thenify = require('thenify')
var debug = require('debug')('pnpm:symlink')
const fs = require('fs')
const thenify = require('thenify')
const debug = require('debug')('pnpm:symlink')

@@ -20,6 +20,6 @@ /*

fs.readlink(dstPath, function (err, linkString) {
fs.readlink(dstPath, (err, linkString) => {
if (err || srcPath === linkString) return cb(err)
fs.unlink(dstPath, function (err) {
fs.unlink(dstPath, err => {
if (err) return cb(err)

@@ -26,0 +26,0 @@ forceSymlink(srcPath, dstPath, type, cb)

@@ -1,2 +0,3 @@

var debug = require('debug')('pnpm:mkdirp')
'use strict'
const debug = require('debug')('pnpm:mkdirp')

@@ -8,5 +9,5 @@ /*

module.exports = function mkdirp (path) {
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
debug(path)
require('mkdirp')(path, function (err) {
require('mkdirp')(path, err => {
if (err) reject(err)

@@ -13,0 +14,0 @@ else resolve(path)

@@ -1,3 +0,4 @@

var rimraf = require('thenify')(require('rimraf'))
var fs = require('mz/fs')
'use strict'
const rimraf = require('thenify')(require('rimraf'))
const fs = require('mz/fs')

@@ -4,0 +5,0 @@ /*

@@ -1,9 +0,10 @@

var symlink = require('./force_symlink')
var dirname = require('path').dirname
var relative = require('path').relative
var os = require('os')
'use strict'
const symlink = require('./force_symlink')
const dirname = require('path').dirname
const relative = require('path').relative
const os = require('os')
// Always use "junctions" on Windows. Even though support for "symbolic links" was added in Vista+, users by default
// lack permission to create them
var symlinkType = os.platform() === 'win32' ? 'junction' : 'dir'
const symlinkType = os.platform() === 'win32' ? 'junction' : 'dir'

@@ -16,5 +17,5 @@ /*

// Junction points can't be relative
var rel = symlinkType !== 'junction' ? relative(dirname(dest), src) : src
const rel = symlinkType !== 'junction' ? relative(dirname(dest), src) : src
return symlink(rel, dest, symlinkType)
}

@@ -1,2 +0,3 @@

var cache = {}
'use strict'
const cache = {}

@@ -3,0 +4,0 @@ /*

@@ -1,10 +0,11 @@

var join = require('path').join
var writeFileSync = require('fs').writeFileSync
var readFileSync = require('fs').readFileSync
'use strict'
const join = require('path').join
const writeFileSync = require('fs').writeFileSync
const readFileSync = require('fs').readFileSync
module.exports = function storeJsonController (storePath) {
var storeJsonPath = join(storePath, 'store.json')
const storeJsonPath = join(storePath, 'store.json')
return {
read: function () {
read () {
try {

@@ -16,3 +17,3 @@ return JSON.parse(readFileSync(storeJsonPath, 'utf8'))

},
save: function (storeJson) {
save (storeJson) {
writeFileSync(storeJsonPath, JSON.stringify(storeJson, null, 2), 'utf8')

@@ -19,0 +20,0 @@ }

@@ -1,2 +0,3 @@

var fs = require('mz/fs')
'use strict'
const fs = require('mz/fs')

@@ -3,0 +4,0 @@ /*

@@ -1,5 +0,4 @@

var writeFile = require('mz/fs').writeFile
'use strict'
const writeFile = require('mz/fs').writeFile
module.exports = function (path, json) {
return writeFile(path, JSON.stringify(json, null, 2) + '\n', 'utf8')
}
module.exports = (path, json) => writeFile(path, JSON.stringify(json, null, 2) + '\n', 'utf8')

@@ -0,1 +1,2 @@

'use strict'
module.exports = function getSaveType (opts) {

@@ -2,0 +3,0 @@ if (opts.save || opts.global) return 'dependencies'

@@ -1,10 +0,11 @@

var debug = require('debug')('pnpm:http')
var throat = require('throat')
var got = require('got')
var HttpAgent = require('http').Agent
var HttpsAgent = require('https').Agent
var caw = require('caw')
var getAuthToken = require('registry-auth-token')
'use strict'
const debug = require('debug')('pnpm:http')
const throat = require('throat')
const got = require('got')
const HttpAgent = require('http').Agent
const HttpsAgent = require('https').Agent
const caw = require('caw')
const getAuthToken = require('registry-auth-token')
var cache = {}
const cache = {}

@@ -15,7 +16,7 @@ function getThroater () {

var httpKeepaliveAgent = new HttpAgent({
const httpKeepaliveAgent = new HttpAgent({
keepAlive: true,
keepAliveMsecs: 30000
})
var httpsKeepaliveAgent = new HttpsAgent({
const httpsKeepaliveAgent = new HttpsAgent({
keepAlive: true,

@@ -29,5 +30,5 @@ keepAliveMsecs: 30000

exports.get = function (url, options) {
var throater = getThroater()
var key = JSON.stringify([ url, options ])
exports.get = (url, options) => {
const throater = getThroater()
const key = JSON.stringify([ url, options ])
if (!cache[key]) {

@@ -37,4 +38,4 @@ cache[key] = new Promise(resolve => {

debug(url)
var promise = got(url, extend(url, options))
resolve({ promise: promise })
const promise = got(url, extend(url, options))
resolve({ promise })
return promise

@@ -51,8 +52,8 @@ })

exports.getStream = function (url, options) {
var throater = getThroater()
exports.getStream = (url, options) => {
const throater = getThroater()
return new Promise(resolve => {
throater(_ => {
debug(url, '[stream]')
var stream = got.stream(url, extend(url, options))
const stream = got.stream(url, extend(url, options))
resolve(stream)

@@ -81,3 +82,3 @@ return waiter(stream)

var authToken = getAuthToken(url, {recursive: true})
const authToken = getAuthToken(url, {recursive: true})
if (authToken) {

@@ -84,0 +85,0 @@ options.headers = Object.assign({}, options.headers || {}, {

@@ -1,3 +0,4 @@

var install = require('./install')
var pkgFullName = require('./pkg_full_name')
'use strict'
const install = require('./install')
const pkgFullName = require('./pkg_full_name')

@@ -15,6 +16,6 @@ /*

var optionalPkgs = Object.keys(optionalPkgsMap)
const optionalPkgs = Object.keys(optionalPkgsMap)
.map(pkgName => pkgMeta(pkgName, optionalPkgsMap[pkgName], true))
var requiredPkgs = Object.keys(requiredPkgsMap)
const requiredPkgs = Object.keys(requiredPkgsMap)
.filter(pkgName => !optionalPkgsMap[pkgName])

@@ -26,25 +27,23 @@ .map(pkgName => pkgMeta(pkgName, requiredPkgsMap[pkgName], false))

return Promise.all(optionalPkgs.concat(requiredPkgs).map(function (pkg) {
return install(ctx, pkg.fullName, modules, options)
.then(dependency => {
var depFullName = pkgFullName(dependency)
ctx.dependents[depFullName] = ctx.dependents[depFullName] || []
if (ctx.dependents[depFullName].indexOf(options.dependent) === -1) {
ctx.dependents[depFullName].push(options.dependent)
}
ctx.dependencies[options.dependent] = ctx.dependencies[options.dependent] || []
if (ctx.dependencies[options.dependent].indexOf(depFullName) === -1) {
ctx.dependencies[options.dependent].push(depFullName)
}
return dependency
})
.catch(err => {
if (pkg.optional) {
console.log('Skipping failed optional dependency ' + pkg.fullName + ':')
console.log(err.message || err)
return
}
throw err
})
}))
return Promise.all(optionalPkgs.concat(requiredPkgs).map(pkg => install(ctx, pkg.fullName, modules, options)
.then(dependency => {
const depFullName = pkgFullName(dependency)
ctx.dependents[depFullName] = ctx.dependents[depFullName] || []
if (ctx.dependents[depFullName].indexOf(options.dependent) === -1) {
ctx.dependents[depFullName].push(options.dependent)
}
ctx.dependencies[options.dependent] = ctx.dependencies[options.dependent] || []
if (ctx.dependencies[options.dependent].indexOf(depFullName) === -1) {
ctx.dependencies[options.dependent].push(depFullName)
}
return dependency
})
.catch(err => {
if (pkg.optional) {
console.log('Skipping failed optional dependency ' + pkg.fullName + ':')
console.log(err.message || err)
return
}
throw err
})))
}

@@ -55,4 +54,4 @@

fullName: version ? '' + name + '@' + version : name,
optional: optional
optional
}
}

@@ -1,27 +0,28 @@

var debug = require('debug')('pnpm:install')
var npa = require('npm-package-arg')
var getUuid = require('node-uuid')
var fs = require('mz/fs')
var thenify = require('thenify')
var lock = thenify(require('lockfile').lock)
var unlock = thenify(require('lockfile').unlock)
var checkLock = thenify(require('lockfile').unlock)
'use strict'
const debug = require('debug')('pnpm:install')
const npa = require('npm-package-arg')
const getUuid = require('node-uuid')
const fs = require('mz/fs')
const thenify = require('thenify')
const lock = thenify(require('lockfile').lock)
const unlock = thenify(require('lockfile').unlock)
const checkLock = thenify(require('lockfile').unlock)
var join = require('path').join
var dirname = require('path').dirname
var basename = require('path').basename
var abspath = require('path').resolve
const join = require('path').join
const dirname = require('path').dirname
const basename = require('path').basename
const abspath = require('path').resolve
var fetch = require('./fetch')
var resolve = require('./resolve')
const fetch = require('./fetch')
const resolve = require('./resolve')
var mkdirp = require('./fs/mkdirp')
var obliterate = require('./fs/obliterate')
var requireJson = require('./fs/require_json')
var relSymlink = require('./fs/rel_symlink')
const mkdirp = require('./fs/mkdirp')
const obliterate = require('./fs/obliterate')
const requireJson = require('./fs/require_json')
const relSymlink = require('./fs/rel_symlink')
var linkBins = require('./install/link_bins')
var linkBundledDeps = require('./install/link_bundled_deps')
var isAvailable = require('./install/is_available')
var postInstall = require('./install/post_install')
const linkBins = require('./install/link_bins')
const linkBundledDeps = require('./install/link_bundled_deps')
const isAvailable = require('./install/is_available')
const postInstall = require('./install/post_install')

@@ -57,3 +58,3 @@ /*

var pkg = {
const pkg = {
// Preliminary spec data

@@ -83,5 +84,5 @@ // => { raw, name, scope, type, spec, rawSpec }

var paths = {
const paths = {
// Module storage => './node_modules'
modules: modules,
modules,

@@ -95,3 +96,3 @@ // Temporary destination while building

var log = ctx.log(pkg.spec) // function
const log = ctx.log(pkg.spec) // function

@@ -134,3 +135,3 @@ // it might be a bundleDependency, in which case, don't bother

function saveCachedResolution () {
var target = join(modules, pkg.spec.name)
const target = join(modules, pkg.spec.name)
return fs.lstat(target)

@@ -147,3 +148,3 @@ .then(stat => {

function save (fullpath) {
var data = requireJson(join(fullpath, 'package.json'))
const data = requireJson(join(fullpath, 'package.json'))
pkg.name = data.name

@@ -205,4 +206,4 @@ pkg.fullname = basename(fullpath)

function buildInStore (ctx, paths, pkg, log) {
var installAll = require('./install_multiple')
var fulldata
const installAll = require('./install_multiple')
let fulldata

@@ -247,3 +248,3 @@ return Promise.resolve()

require('debug')('pnpm:post_install')('%s %s', pkg.fullname, line)
log(stream, { name: pkg.fullname, line: line })
log(stream, { name: pkg.fullname, line })
}

@@ -283,3 +284,3 @@ }

// TODO: uncomment to make things fail
var pkgData = requireJson(join(target, 'package.json'))
const pkgData = requireJson(join(target, 'package.json'))
if (!pkgData.name) { throw new Error('Invalid package.json for ' + target) }

@@ -290,3 +291,3 @@

// .tmp/01234567890/node_modules/lodash -> ../../../.store/lodash@4.0.0
var out = join(modules, pkgData.name)
const out = join(modules, pkgData.name)
return mkdirp(dirname(out))

@@ -293,0 +294,0 @@ .then(_ => relSymlink(target, out))

@@ -1,4 +0,5 @@

var semver = require('semver')
var join = require('path').join
var fs = require('mz/fs')
'use strict'
const semver = require('semver')
const join = require('path').join
const fs = require('mz/fs')

@@ -17,6 +18,6 @@ /*

module.exports = function isAvailable (spec, modules) {
var name = spec && spec.name
const name = spec && spec.name
if (!name) return Promise.resolve(false)
var packageJsonPath = join(modules, name, 'package.json')
const packageJsonPath = join(modules, name, 'package.json')

@@ -23,0 +24,0 @@ return Promise.resolve()

@@ -1,15 +0,16 @@

var join = require('path').join
var basename = require('path').basename
var relative = require('path').relative
var semver = require('semver')
var normalizePath = require('normalize-path')
var relSymlink = require('../fs/rel_symlink')
var fs = require('mz/fs')
var mkdirp = require('../fs/mkdirp')
var debug = require('debug')('pnpm:link_bins')
var requireJson = require('../fs/require_json')
var binify = require('../binify')
'use strict'
const join = require('path').join
const basename = require('path').basename
const relative = require('path').relative
const semver = require('semver')
const normalizePath = require('normalize-path')
const relSymlink = require('../fs/rel_symlink')
const fs = require('mz/fs')
const mkdirp = require('../fs/mkdirp')
const debug = require('debug')('pnpm:link_bins')
const requireJson = require('../fs/require_json')
const binify = require('../binify')
var preserveSymlinks = semver.satisfies(process.version, '>=6.3.0')
var isWindows = process.platform === 'win32'
const preserveSymlinks = semver.satisfies(process.version, '>=6.3.0')
const isWindows = process.platform === 'win32'

@@ -52,12 +53,12 @@ module.exports = linkAllBins

function linkPkgBins (modules, target) {
var pkg = tryRequire(join(target, 'package.json'))
const pkg = tryRequire(join(target, 'package.json'))
if (!pkg || !pkg.bin) return
var bins = binify(pkg)
const bins = binify(pkg)
return Promise.all(Object.keys(bins).map(bin => {
var actualBin = bins[bin]
var binDir = join(modules, '.bin')
var externalBinPath = join(binDir, bin)
const actualBin = bins[bin]
const binDir = join(modules, '.bin')
const externalBinPath = join(binDir, bin)

@@ -67,3 +68,3 @@ return Promise.resolve()

.then(_ => {
var targetPath = normalizePath(join(pkg.name, actualBin))
const targetPath = normalizePath(join(pkg.name, actualBin))
if (isWindows) {

@@ -73,3 +74,3 @@ if (!preserveSymlinks) {

}
var proxyFilePath = join(binDir, bin + '.proxy')
const proxyFilePath = join(binDir, bin + '.proxy')
fs.writeFileSync(proxyFilePath, 'require("../' + targetPath + '")', 'utf8')

@@ -99,3 +100,3 @@ return cmdShim(externalBinPath, relative(binDir, proxyFilePath))

function proxy (proxyPath, targetPath) {
var proxyContent = [
const proxyContent = [
'#!/bin/sh',

@@ -110,4 +111,4 @@ '":" //# comment; exec /usr/bin/env node --preserve-symlinks "$0" "$@"',

function cmdShim (proxyPath, targetPath) {
var nodeOptions = preserveSymlinks ? '--preserve-symlinks' : ''
var cmdContent = [
const nodeOptions = preserveSymlinks ? '--preserve-symlinks' : ''
const cmdContent = [
'@IF EXIST "%~dp0\\node.exe" (',

@@ -123,3 +124,3 @@ ' "%~dp0\\node.exe ' + nodeOptions + '" "%~dp0/' + targetPath + '" %*',

var shContent = [
const shContent = [
'#!/bin/sh',

@@ -126,0 +127,0 @@ 'basedir=$(dirname "$(echo "$0" | sed -e \'s,\\,/,g\')")',

@@ -1,7 +0,8 @@

var fs = require('mz/fs')
var join = require('path').join
var linkBins = require('./link_bins')
'use strict'
const fs = require('mz/fs')
const join = require('path').join
const linkBins = require('./link_bins')
module.exports = function linkBundledDeps (root) {
var nodeModules = join(root, 'node_modules')
const nodeModules = join(root, 'node_modules')

@@ -8,0 +9,0 @@ return isDir(nodeModules, _ =>

@@ -1,6 +0,7 @@

var mkdirp = require('../fs/mkdirp')
var unsymlink = require('../fs/unsymlink')
var relSymlink = require('../fs/rel_symlink')
var join = require('path').join
var semver = require('semver')
'use strict'
const mkdirp = require('../fs/mkdirp')
const unsymlink = require('../fs/unsymlink')
const relSymlink = require('../fs/rel_symlink')
const join = require('path').join
const semver = require('semver')

@@ -13,8 +14,8 @@ /*

if (!installs) return
var peers = {}
var roots = {}
const peers = {}
const roots = {}
Object.keys(installs).forEach(name => {
var pkgData = installs[name]
var realname = pkgData.name
const pkgData = installs[name]
const realname = pkgData.name

@@ -29,3 +30,3 @@ if (pkgData.keypath.length === 0) {

var modules = join(store, 'node_modules')
const modules = join(store, 'node_modules')
return mkdirp(modules)

@@ -32,0 +33,0 @@ .then(_ => Promise.all(Object.keys(roots).map(name => {

'use strict'
var join = require('path').join
var dirname = require('path').dirname
var spawn = require('cross-spawn')
var debug = require('debug')('pnpm:post_install')
var delimiter = require('path').delimiter
var byline = require('byline')
var fs = require('mz/fs')
const join = require('path').join
const dirname = require('path').dirname
const spawn = require('cross-spawn')
const debug = require('debug')('pnpm:post_install')
const delimiter = require('path').delimiter
const byline = require('byline')
const fs = require('mz/fs')
module.exports = function postInstall (root_, pkg, log) {
var root = join(root_, '_')
const root = join(root_, '_')
debug('postinstall', pkg.name + '@' + pkg.version)
var scripts = pkg && pkg.scripts || {}
const scripts = pkg && pkg.scripts || {}
return Promise.resolve()

@@ -55,12 +55,13 @@ .then(_ => !scripts.install && checkBindingGyp(root, log))

return new Promise((resolve, reject) => {
var env = Object.create(process.env)
const env = Object.create(process.env)
env.PATH = [
join(opts.cwd, 'node_modules', '.bin'),
dirname(require.resolve('../../bin/node-gyp-bin/node-gyp')),
dirname(process.execPath),
process.env.PATH
].join(delimiter)
var proc = spawn(command, args, {
const proc = spawn(command, args, {
cwd: opts.cwd,
env: env
env
})

@@ -67,0 +68,0 @@

@@ -1,2 +0,3 @@

var supportsColor = require('supports-color')
'use strict'
const supportsColor = require('supports-color')

@@ -3,0 +4,0 @@ module.exports = loggerType =>

@@ -1,4 +0,5 @@

var chalk = require('chalk')
'use strict'
const chalk = require('chalk')
var observatory = require('observatory')
const observatory = require('observatory')
observatory.settings({ prefix: ' ', width: 74 })

@@ -20,7 +21,7 @@

module.exports = function logger () {
var tasks = {}
const tasks = {}
function getTask (pkg) {
if (tasks[pkg.rawSpec]) return tasks[pkg.rawSpec]
var task = observatory.add(
const task = observatory.add(
(pkg.name ? (pkg.name + ' ') : '') +

@@ -33,5 +34,5 @@ chalk.gray(pkg.rawSpec || ''))

return function (pkg) {
var pkgData // package.json
var res // resolution
return pkg => {
let pkgData // package.json
let res // resolution

@@ -38,0 +39,0 @@ // lazy get task

@@ -1,10 +0,11 @@

var chalk = require('chalk')
'use strict'
const chalk = require('chalk')
var UPDATERS = [
const UPDATERS = [
'resolving', 'resolved', 'download-start', 'dependencies'
]
var BAR_LENGTH = 20
const BAR_LENGTH = 20
var s = {
const s = {
gray: chalk.gray,

@@ -20,6 +21,6 @@ green: chalk.green,

module.exports = function logger () {
var out = process.stdout
var progress = { done: 0, total: 0 }
var lastStatus
var done = {}
const out = process.stdout
const progress = { done: 0, total: 0 }
let lastStatus
const done = {}

@@ -30,4 +31,4 @@ process.on('exit', _ => {

return function (pkg) {
var name = pkg.name
return pkg => {
const name = pkg.name
? (pkg.name + ' ' + pkg.rawSpec)

@@ -38,6 +39,6 @@ : pkg.rawSpec

progress.total += UPDATERS.length + 20
var left = UPDATERS.length + 20
var pkgData
let left = UPDATERS.length + 20
let pkgData
return function (status, args) {
return (status, args) => {
if (status === 'done') progress.done += left

@@ -79,5 +80,5 @@

var percent = progress.done / progress.total
const percent = progress.done / progress.total
if (progress.total > 0 && out.isTTY) {
var bar = Math.round(percent * BAR_LENGTH)
const bar = Math.round(percent * BAR_LENGTH)
out.write(

@@ -84,0 +85,0 @@ reset() +

@@ -1,3 +0,2 @@

module.exports = function (pkg) {
return pkg.name.replace('/', '!') + '@' + pkg.version
}
'use strict'
module.exports = pkg => pkg.name.replace('/', '!') + '@' + pkg.version

@@ -1,2 +0,3 @@

var registryUrl = require('registry-url')
'use strict'
const registryUrl = require('registry-url')

@@ -3,0 +4,0 @@ /*

@@ -1,10 +0,11 @@

var requireJson = require('./fs/require_json')
var writeJson = require('./fs/write_json')
'use strict'
const requireJson = require('./fs/require_json')
const writeJson = require('./fs/write_json')
module.exports = function (pkg, removedPackages, saveType) {
var packageJson = requireJson(pkg.path)
module.exports = (pkg, removedPackages, saveType) => {
const packageJson = requireJson(pkg.path)
packageJson[saveType] = packageJson[saveType]
if (!packageJson[saveType]) return Promise.resolve()
removedPackages.forEach(function (dependency) {
removedPackages.forEach(dependency => {
delete packageJson[saveType][dependency]

@@ -11,0 +12,0 @@ })

@@ -1,5 +0,6 @@

var resolveNpm = require('./resolve/npm')
var resolveTarball = require('./resolve/tarball')
var resolveGithub = require('./resolve/github')
var resolveLocal = require('./resolve/local')
'use strict'
const resolveNpm = require('./resolve/npm')
const resolveTarball = require('./resolve/tarball')
const resolveGithub = require('./resolve/github')
const resolveLocal = require('./resolve/local')

@@ -6,0 +7,0 @@ /**

@@ -1,2 +0,3 @@

var got = require('../got')
'use strict'
const got = require('../got')

@@ -7,13 +8,13 @@ /**

var PARSE_GITHUB_RE = /^github:([^\/]+)\/([^#]+)(#(.+))?$/
const PARSE_GITHUB_RE = /^github:([^\/]+)\/([^#]+)(#(.+))?$/
module.exports = function resolveGithub (pkg) {
var spec = parseGithubSpec(pkg)
return resolveRef(spec).then(function (ref) {
const spec = parseGithubSpec(pkg)
return resolveRef(spec).then(ref => {
spec.ref = ref
return resolvePackageName(spec).then(function (name) {
var fullname = name.replace('/', '!') + ['@github', spec.owner, spec.repo, spec.ref].join('!')
return resolvePackageName(spec).then(name => {
const fullname = name.replace('/', '!') + ['@github', spec.owner, spec.repo, spec.ref].join('!')
return {
name: name,
fullname: fullname,
name,
fullname,
dist: {

@@ -34,3 +35,3 @@ tarball: [

function resolvePackageName (spec) {
var url = [
const url = [
'https://api.github.com/repos',

@@ -41,5 +42,5 @@ spec.owner,

].join('/')
return getJSON(url).then(function (body) {
var content = new Buffer(body.content, 'base64').toString('utf8')
var pkg = JSON.parse(content)
return getJSON(url).then(body => {
const content = new Buffer(body.content, 'base64').toString('utf8')
const pkg = JSON.parse(content)
return pkg.name

@@ -50,3 +51,3 @@ })

function resolveRef (spec) {
var url = [
const url = [
'https://api.github.com/repos',

@@ -58,3 +59,3 @@ spec.owner,

].join('/')
return getJSON(url).then(function (body) { return body.sha })
return getJSON(url).then(body => body.sha)
}

@@ -64,5 +65,5 @@

return got.get(url)
.then(function (res) { return res.promise })
.then(function (res) {
var body = JSON.parse(res.body)
.then(res => res.promise)
.then(res => {
const body = JSON.parse(res.body)
return body

@@ -73,10 +74,10 @@ })

function parseGithubSpec (pkg) {
var m = PARSE_GITHUB_RE.exec(pkg.hosted.shortcut)
const m = PARSE_GITHUB_RE.exec(pkg.hosted.shortcut)
if (!m) {
throw new Error('cannot parse: ' + pkg.hosted.shortcut)
}
var owner = m[1]
var repo = m[2]
var ref = m[4] || 'HEAD'
return {owner: owner, repo: repo, ref: ref}
const owner = m[1]
const repo = m[2]
const ref = m[4] || 'HEAD'
return {owner, repo, ref}
}

@@ -1,3 +0,4 @@

var resolve = require('path').resolve
var spawn = require('cross-spawn')
'use strict'
const resolve = require('path').resolve
const spawn = require('cross-spawn')

@@ -9,6 +10,6 @@ /**

module.exports = function resolveLocal (pkg) {
var dependencyPath = resolve(pkg.root, pkg.spec)
const dependencyPath = resolve(pkg.root, pkg.spec)
return new Promise((resolve, reject) => {
var proc = spawn('npm', ['pack'], {
const proc = spawn('npm', ['pack'], {
cwd: dependencyPath

@@ -25,4 +26,4 @@ })

.then(_ => {
var localPkg = require(resolve(dependencyPath, 'package.json'))
var tgzFilename = localPkg.name + '-' + localPkg.version + '.tgz'
const localPkg = require(resolve(dependencyPath, 'package.json'))
const tgzFilename = localPkg.name + '-' + localPkg.version + '.tgz'
return {

@@ -29,0 +30,0 @@ name: localPkg.name,

@@ -1,7 +0,8 @@

var url = require('url')
var enc = global.encodeURIComponent
var got = require('../got')
var pkgFullName = require('../pkg_full_name')
var registryUrl = require('registry-url')
var semver = require('semver')
'use strict'
const url = require('url')
const enc = global.encodeURIComponent
const got = require('../got')
const pkgFullName = require('../pkg_full_name')
const registryUrl = require('registry-url')
const semver = require('semver')

@@ -49,6 +50,6 @@ /**

function pickVersionFromRegistryDocument (pkg, dep) {
var versions = Object.keys(pkg.versions)
const versions = Object.keys(pkg.versions)
if (dep.type === 'tag') {
var tagVersion = pkg['dist-tags'][dep.spec]
const tagVersion = pkg['dist-tags'][dep.spec]
if (pkg.versions[tagVersion]) {

@@ -58,3 +59,3 @@ return pkg.versions[tagVersion]

} else {
var maxVersion = semver.maxSatisfying(versions, dep.spec)
const maxVersion = semver.maxSatisfying(versions, dep.spec)
if (maxVersion) {

@@ -65,6 +66,6 @@ return pkg.versions[maxVersion]

var message = versions.length
const message = versions.length
? 'Versions in registry:\n' + versions.join(', ') + '\n'
: 'No valid version found.'
var er = new Error('No compatible version found: ' +
const er = new Error('No compatible version found: ' +
dep.raw + '\n' + message)

@@ -82,3 +83,3 @@ throw er

function toUri (pkg) {
var name
let name

@@ -85,0 +86,0 @@ if (pkg.name.substr(0, 1) === '@') {

@@ -1,3 +0,4 @@

var basename = require('path').basename
var crypto = require('crypto')
'use strict'
const basename = require('path').basename
const crypto = require('crypto')

@@ -18,6 +19,6 @@ /**

module.exports = function resolveTarball (pkg) {
var name = basename(pkg.raw).replace(/(\.tgz|\.tar\.gz)$/i, '')
const name = basename(pkg.raw).replace(/(\.tgz|\.tar\.gz)$/i, '')
return Promise.resolve({
name: name,
name,
fullname: name + '#' + hash(pkg.raw),

@@ -31,5 +32,5 @@ dist: {

function hash (str) {
var hash = crypto.createHash('sha1')
const hash = crypto.createHash('sha1')
hash.update(str)
return hash.digest('hex')
}

@@ -0,1 +1,3 @@

'use strict'
/*

@@ -7,5 +9,5 @@ * An error message with a `silent` flag, where the stack is supressed.

module.exports = function runtimeError (message) {
var err = new Error(message)
const err = new Error(message)
err.silent = true
return err
}

@@ -1,11 +0,12 @@

var requireJson = require('./fs/require_json')
var writeJson = require('./fs/write_json')
var sortedObject = require('sorted-object')
'use strict'
const requireJson = require('./fs/require_json')
const writeJson = require('./fs/write_json')
const sortedObject = require('sorted-object')
module.exports = function save (pkg, installedPackages, saveType, useExactVersion) {
// Read the latest version of package.json to avoid accidental overwriting
var packageJson = requireJson(pkg.path, { ignoreCache: true })
const packageJson = requireJson(pkg.path, { ignoreCache: true })
packageJson[saveType] = packageJson[saveType] || {}
installedPackages.forEach(function (dependency) {
var semverCharacter = useExactVersion ? '' : '^'
installedPackages.forEach(dependency => {
const semverCharacter = useExactVersion ? '' : '^'
packageJson[saveType][dependency.spec.name] = semverCharacter + dependency.version

@@ -12,0 +13,0 @@ })

{
"name": "pnpm",
"description": "A fast implementation of npm install",
"version": "0.26.1",
"version": "0.26.2",
"author": "Rico Sta. Cruz <rico@ricostacruz.com>",

@@ -26,2 +26,3 @@ "bin": {

"gunzip-maybe": "1.3.1",
"is-ci": "1.0.9",
"lockfile": "1.0.1",

@@ -45,3 +46,3 @@ "meow": "3.7.0",

"supports-color": "3.1.2",
"tar-fs": "1.13.1",
"tar-fs": "1.13.2",
"thenify": "3.2.0",

@@ -61,6 +62,5 @@ "throat": "3.0.0"

"isexe": "1.1.2",
"istanbul": "^0.4.4",
"istanbul": "^0.4.5",
"ncp": "^2.0.0",
"nixt": "0.5.0",
"npm": "3.10.6",
"sepia": "2.0.1",

@@ -67,0 +67,0 @@ "tap-spec": "4.1.1",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc