1'use strict' 2 3const pkg = require('./package.json') 4const figgyPudding = require('figgy-pudding') 5const silentLog = require('./silentlog.js') 6 7const AUTH_REGEX = /^(?:.*:)?(token|_authToken|username|_password|password|email|always-auth|_auth|otp)$/ 8const SCOPE_REGISTRY_REGEX = /@.*:registry$/gi 9module.exports = figgyPudding({ 10 'agent': {}, 11 'algorithms': {}, 12 'body': {}, 13 'ca': {}, 14 'cache': {}, 15 'cert': {}, 16 'fetch-retries': {}, 17 'fetch-retry-factor': {}, 18 'fetch-retry-maxtimeout': {}, 19 'fetch-retry-mintimeout': {}, 20 'force-auth': {}, 21 forceAuth: 'force-auth', 22 'gzip': {}, 23 'headers': {}, 24 'https-proxy': {}, 25 'ignore-body': {}, 26 ignoreBody: 'ignore-body', 27 'integrity': {}, 28 'is-from-ci': 'isFromCI', 29 'isFromCI': { 30 default () { 31 return ( 32 process.env['CI'] === 'true' || 33 process.env['TDDIUM'] || 34 process.env['JENKINS_URL'] || 35 process.env['bamboo.buildKey'] || 36 process.env['GO_PIPELINE_NAME'] 37 ) 38 } 39 }, 40 'key': {}, 41 'local-address': {}, 42 'log': { 43 default: silentLog 44 }, 45 'map-json': 'mapJson', 46 'mapJSON': 'mapJson', 47 'mapJson': {}, 48 'max-sockets': 'maxsockets', 49 'maxsockets': { 50 default: 12 51 }, 52 'memoize': {}, 53 'method': { 54 default: 'GET' 55 }, 56 'no-proxy': {}, 57 'noproxy': {}, 58 'npm-session': 'npmSession', 59 'npmSession': {}, 60 'offline': {}, 61 'otp': {}, 62 'prefer-offline': {}, 63 'prefer-online': {}, 64 'projectScope': {}, 65 'project-scope': 'projectScope', 66 'Promise': {default: () => Promise}, 67 'proxy': {}, 68 'query': {}, 69 'refer': {}, 70 'referer': 'refer', 71 'registry': { 72 default: 'https://registry.npmjs.org/' 73 }, 74 'retry': {}, 75 'scope': {}, 76 'spec': {}, 77 'strict-ssl': {}, 78 'timeout': { 79 default: 0 80 }, 81 'user-agent': { 82 default: `${ 83 pkg.name 84 }@${ 85 pkg.version 86 }/node@${ 87 process.version 88 }+${ 89 process.arch 90 } (${ 91 process.platform 92 })` 93 } 94}, { 95 other (key) { 96 return key.match(AUTH_REGEX) || key.match(SCOPE_REGISTRY_REGEX) 97 } 98}) 99