$25 GRAYBYTE WORDPRESS FILE MANAGER $63

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/utils/

HOME
Current File : /opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/utils//map-to-registry.js
var url = require('url')

var log = require('npmlog')
var npa = require('npm-package-arg')

module.exports = mapToRegistry

function mapToRegistry (name, config, cb) {
  log.silly('mapToRegistry', 'name', name)
  var registry

  // the name itself takes precedence
  var data = npa(name)
  if (data.scope) {
    // the name is definitely scoped, so escape now
    name = name.replace('/', '%2f')

    log.silly('mapToRegistry', 'scope (from package name)', data.scope)

    registry = config.get(data.scope + ':registry')
    if (!registry) {
      log.verbose('mapToRegistry', 'no registry URL found in name for scope', data.scope)
    }
  }

  // ...then --scope=@scope or --scope=scope
  var scope = config.get('scope')
  if (!registry && scope) {
    // I'm an enabler, sorry
    if (scope.charAt(0) !== '@') scope = '@' + scope

    log.silly('mapToRegistry', 'scope (from config)', scope)

    registry = config.get(scope + ':registry')
    if (!registry) {
      log.verbose('mapToRegistry', 'no registry URL found in config for scope', scope)
    }
  }

  // ...and finally use the default registry
  if (!registry) {
    log.silly('mapToRegistry', 'using default registry')
    registry = config.get('registry')
  }

  log.silly('mapToRegistry', 'registry', registry)

  var auth = config.getCredentialsByURI(registry)

  // normalize registry URL so resolution doesn't drop a piece of registry URL
  var normalized = registry.slice(-1) !== '/' ? registry + '/' : registry
  var uri
  log.silly('mapToRegistry', 'data', data)
  if (data.type === 'remote') {
    uri = data.spec
  } else {
    uri = url.resolve(normalized, name)
  }

  log.silly('mapToRegistry', 'uri', uri)

  cb(null, uri, scopeAuth(uri, registry, auth), normalized)
}

function scopeAuth (uri, registry, auth) {
  var cleaned = {
    scope: auth.scope,
    email: auth.email,
    alwaysAuth: auth.alwaysAuth,
    token: undefined,
    username: undefined,
    password: undefined,
    auth: undefined
  }

  var requestHost
  var registryHost

  if (auth.token || auth.auth || (auth.username && auth.password)) {
    requestHost = url.parse(uri).hostname
    registryHost = url.parse(registry).hostname

    if (requestHost === registryHost) {
      cleaned.token = auth.token
      cleaned.auth = auth.auth
      cleaned.username = auth.username
      cleaned.password = auth.password
    } else if (auth.alwaysAuth) {
      log.verbose('scopeAuth', 'alwaysAuth set for', registry)
      cleaned.token = auth.token
      cleaned.auth = auth.auth
      cleaned.username = auth.username
      cleaned.password = auth.password
    } else {
      log.silly('scopeAuth', uri, "doesn't share host with registry", registry)
    }
  }

  return cleaned
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 8.02 AM
root / root
0755
completion
--
31 Aug 2024 8.02 AM
root / root
0755
child-path.js
0.283 KB
28 Sep 2021 4.36 PM
root / root
0644
completion.sh
1.624 KB
28 Sep 2021 4.36 PM
root / root
0755
correct-mkdir.js
3.035 KB
28 Sep 2021 4.36 PM
root / root
0644
deep-sort-object.js
0.414 KB
28 Sep 2021 4.36 PM
root / root
0644
depr-check.js
0.381 KB
28 Sep 2021 4.36 PM
root / root
0644
error-handler.js
4.994 KB
28 Sep 2021 4.36 PM
root / root
0644
error-message.js
9.693 KB
28 Sep 2021 4.36 PM
root / root
0644
escape-arg.js
0.657 KB
28 Sep 2021 4.36 PM
root / root
0644
escape-exec-path.js
0.759 KB
28 Sep 2021 4.36 PM
root / root
0644
gently-rm.js
8.646 KB
28 Sep 2021 4.36 PM
root / root
0644
get-publish-config.js
0.788 KB
28 Sep 2021 4.36 PM
root / root
0644
git.js
1.211 KB
28 Sep 2021 4.36 PM
root / root
0644
is-windows-bash.js
0.126 KB
28 Sep 2021 4.36 PM
root / root
0644
is-windows-shell.js
0.149 KB
28 Sep 2021 4.36 PM
root / root
0644
is-windows.js
0.058 KB
28 Sep 2021 4.36 PM
root / root
0644
lifecycle.js
11.369 KB
28 Sep 2021 4.36 PM
root / root
0644
link.js
2.021 KB
28 Sep 2021 4.36 PM
root / root
0644
locker.js
1.81 KB
28 Sep 2021 4.36 PM
root / root
0644
map-to-registry.js
2.663 KB
28 Sep 2021 4.36 PM
root / root
0644
module-name.js
0.927 KB
28 Sep 2021 4.36 PM
root / root
0644
no-progress-while-running.js
0.528 KB
28 Sep 2021 4.36 PM
root / root
0644
output.js
0.205 KB
28 Sep 2021 4.36 PM
root / root
0644
package-id.js
0.39 KB
28 Sep 2021 4.36 PM
root / root
0644
parse-json.js
0.578 KB
28 Sep 2021 4.36 PM
root / root
0644
pulse-till-done.js
0.416 KB
28 Sep 2021 4.36 PM
root / root
0644
read-local-package.js
0.321 KB
28 Sep 2021 4.36 PM
root / root
0644
rename.js
0.312 KB
28 Sep 2021 4.36 PM
root / root
0644
save-stack.js
0.341 KB
28 Sep 2021 4.36 PM
root / root
0644
spawn.js
1.377 KB
28 Sep 2021 4.36 PM
root / root
0644
tar.js
14.461 KB
28 Sep 2021 4.36 PM
root / root
0644
temp-filename.js
0.169 KB
28 Sep 2021 4.36 PM
root / root
0644
umask.js
0.335 KB
28 Sep 2021 4.36 PM
root / root
0644
usage.js
0.563 KB
28 Sep 2021 4.36 PM
root / root
0644
warn-deprecated.js
0.543 KB
28 Sep 2021 4.36 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF