PATH:
opt
/
alt
/
alt-nodejs9
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
/
install
'use strict' const BB = require('bluebird') const fs = require('graceful-fs') const iferr = require('iferr') const inflateShrinkwrap = require('./inflate-shrinkwrap.js') const log = require('npmlog') const parseJSON = require('../utils/parse-json.js') const path = require('path') const PKGLOCK_VERSION = require('../npm.js').lockfileVersion const readFileAsync = BB.promisify(fs.readFile) module.exports = readShrinkwrap function readShrinkwrap (child, next) { if (child.package._shrinkwrap) return process.nextTick(next) BB.join( maybeReadFile('npm-shrinkwrap.json', child), // Don't read non-root lockfiles child.isTop && maybeReadFile('package-lock.json', child), child.isTop && maybeReadFile('package.json', child), (shrinkwrap, lockfile, pkgJson) => { if (shrinkwrap && lockfile) { log.warn('read-shrinkwrap', 'Ignoring package-lock.json because there is already an npm-shrinkwrap.json. Please use only one of the two.') } const name = shrinkwrap ? 'npm-shrinkwrap.json' : 'package-lock.json' let parsed = null if (shrinkwrap || lockfile) { try { parsed = parseJSON(shrinkwrap || lockfile) } catch (ex) { throw ex } } if (parsed && parsed.lockfileVersion !== PKGLOCK_VERSION) { log.warn('read-shrinkwrap', `This version of npm is compatible with lockfileVersion@${PKGLOCK_VERSION}, but ${name} was generated for lockfileVersion@${parsed.lockfileVersion || 0}. I'll try to do my best with it!`) } child.package._shrinkwrap = parsed } ).then(() => next(), next) } function maybeReadFile (name, child) { return readFileAsync( path.join(child.path, name) ).catch({code: 'ENOENT'}, () => null) } module.exports.andInflate = function (child, next) { readShrinkwrap(child, iferr(next, function () { if (child.package._shrinkwrap) { return inflateShrinkwrap(child, child.package._shrinkwrap || {}, next) } else { return next() } })) }
[-] mutate-into-logical-tree.js
[edit]
[-] realize-shrinkwrap-specifier.js
[edit]
[-] save.js
[edit]
[-] check-permissions.js
[edit]
[-] inflate-shrinkwrap.js
[edit]
[-] is-extraneous.js
[edit]
[-] update-package-json.js
[edit]
[-] validate-tree.js
[edit]
[-] node.js
[edit]
[-] exists.js
[edit]
[-] read-shrinkwrap.js
[edit]
[-] access-error.js
[edit]
[-] validate-args.js
[edit]
[-] is-only-dev.js
[edit]
[-] actions.js
[edit]
[-] and-finish-tracker.js
[edit]
[+]
action
[+]
..
[-] is-only-optional.js
[edit]
[-] is-prod-dep.js
[edit]
[-] is-dev-dep.js
[edit]
[-] writable.js
[edit]
[-] diff-trees.js
[edit]
[-] module-staging-path.js
[edit]
[-] is-opt-dep.js
[edit]
[-] flatten-tree.js
[edit]
[-] and-add-parent-to-errors.js
[edit]
[-] get-requested.js
[edit]
[-] inflate-bundled.js
[edit]
[-] decompose-actions.js
[edit]
[-] and-ignore-errors.js
[edit]
[-] is-fs-access-available.js
[edit]
[-] copy-tree.js
[edit]
[-] report-optional-failure.js
[edit]
[-] deps.js
[edit]