"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/install/filter-invalid-actions.js" (7 Feb 2017, 1021 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 'use strict'
    2 var path = require('path')
    3 var validate = require('aproba')
    4 var log = require('npmlog')
    5 var packageId = require('../utils/package-id.js')
    6 
    7 module.exports = function (top, differences, next) {
    8   validate('SAF', arguments)
    9   var action
   10   var keep = []
   11 
   12   differences.forEach(function (action) {
   13     var cmd = action[0]
   14     var pkg = action[1]
   15     if (cmd === 'remove') {
   16       pkg.removing = true
   17     }
   18   })
   19 
   20   /*eslint no-cond-assign:0*/
   21   while (action = differences.shift()) {
   22     var cmd = action[0]
   23     var pkg = action[1]
   24     if (pkg.isInLink || (pkg.parent && (pkg.parent.target || pkg.parent.isLink))) {
   25       // we want to skip warning if this is a child of another module that we're removing
   26       if (!pkg.parent.removing) {
   27         log.warn('skippingAction', 'Module is inside a symlinked module: not running ' +
   28           cmd + ' ' + packageId(pkg) + ' ' + path.relative(top, pkg.path))
   29       }
   30     } else {
   31       keep.push(action)
   32     }
   33   }
   34   differences.push.apply(differences, keep)
   35   next()
   36 }