diff --git a/node_modules/node-gyp/.eslintrc.yaml b/node_modules/node-gyp/.eslintrc.yaml deleted file mode 100644 index f808ce2d9a3ab..0000000000000 --- a/node_modules/node-gyp/.eslintrc.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - env: - node: true - es6: true - rules: - no-unused-vars: error diff --git a/node_modules/node-gyp/.travis.yml b/node_modules/node-gyp/.travis.yml index 77c778ad22006..a6dd2dcf28b1e 100644 --- a/node_modules/node-gyp/.travis.yml +++ b/node_modules/node-gyp/.travis.yml @@ -4,33 +4,73 @@ cache: pip matrix: include: - name: "Python 2.7 on Linux" + env: NODE_GYP_FORCE_PYTHON=python2 python: 2.7 - - name: "Python 3.7 on Linux" - python: 3.7 - name: "Python 2.7 on macOS" os: osx osx_image: xcode10.2 language: shell # 'language: python' is not yet supported on macOS + env: NODE_GYP_FORCE_PYTHON=python2 before_install: HOMEBREW_NO_AUTO_UPDATE=1 brew install npm - - name: "Python 2.7 on Windows" + - name: "Node.js 6 & Python 2.7 on Windows" + os: windows + language: node_js + node_js: 6 # node + env: >- + PATH=/c/Python27:/c/Python27/Scripts:$PATH + NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe + before_install: choco install python2 + - name: "Node.js 12 & Python 2.7 on Windows" os: windows language: node_js node_js: 12 # node - env: PATH=/c/Python27:/c/Python27/Scripts:$PATH + env: >- + PATH=/c/Python27:/c/Python27/Scripts:$PATH + NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe before_install: choco install python2 + - name: "Node.js 6 & Python 3.7 on Linux" + python: 3.7 + env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + before_install: nvm install 6 + - name: "Node.js 8 & Python 3.7 on Linux" + python: 3.7 + env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + before_install: nvm install 8 + - name: "Node.js 10 & Python 3.7 on Linux" + python: 3.7 + env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + before_install: nvm install 10 + - name: "Node.js 12 & Python 3.7 on Linux" + python: 3.7 + env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + before_install: nvm install 12 + - name: "Node.js 12 & Python 3.7 on Windows" + os: windows + language: node_js + node_js: 12 # node + env: >- + PATH=/c/Python37:/c/Python37/Scripts:$PATH + NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe + EXPERIMENTAL_NODE_GYP_PYTHON3=1 + before_install: choco install python allow_failures: - - os: windows + - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + - env: >- + PATH=/c/Python37:/c/Python37/Scripts:$PATH + NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe + EXPERIMENTAL_NODE_GYP_PYTHON3=1 install: #- pip install -r requirements.txt - pip install flake8 # pytest # add another testing frameworks later before_script: - flake8 --version # stop the build if there are Python syntax errors or undefined names - - flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics + - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. Two space indentation is OK. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics - npm install script: + - node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})' - npm test #- pytest --capture=sys # add other tests here notifications: diff --git a/node_modules/node-gyp/CHANGELOG.md b/node_modules/node-gyp/CHANGELOG.md index 8aee70eb5f2d4..9a99ef2d0af40 100644 --- a/node_modules/node-gyp/CHANGELOG.md +++ b/node_modules/node-gyp/CHANGELOG.md @@ -1,3 +1,15 @@ +v5.0.3 2019-07-17 +================= + +* [[`66ad305775`](https://github.com/nodejs/node-gyp/commit/66ad305775)] - **python**: accept Python 3 conditionally (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815) +* [[`7e7fce3fed`](https://github.com/nodejs/node-gyp/commit/7e7fce3fed)] - **python**: move Python detection to its own file (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815) +* [[`e40c99e283`](https://github.com/nodejs/node-gyp/commit/e40c99e283)] - **src**: implement standard.js linting (Rod Vagg) [#1794](https://github.com/nodejs/node-gyp/pull/1794) +* [[`bb92c761a9`](https://github.com/nodejs/node-gyp/commit/bb92c761a9)] - **test**: add Node.js 6 on Windows to Travis CI (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812) +* [[`7fd924079f`](https://github.com/nodejs/node-gyp/commit/7fd924079f)] - **test**: increase tap timeout (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812) +* [[`7e8127068f`](https://github.com/nodejs/node-gyp/commit/7e8127068f)] - **test**: cover supported node versions with travis (Rod Vagg) [#1809](https://github.com/nodejs/node-gyp/pull/1809) +* [[`24109148df`](https://github.com/nodejs/node-gyp/commit/24109148df)] - **test**: downgrade to tap@^12 for continued Node 6 support (Rod Vagg) [#1808](https://github.com/nodejs/node-gyp/pull/1808) +* [[`656117cc4a`](https://github.com/nodejs/node-gyp/commit/656117cc4a)] - **win**: make VS path match case-insensitive (João Reis) [#1806](https://github.com/nodejs/node-gyp/pull/1806) + v5.0.2 2019-06-27 ================= diff --git a/node_modules/node-gyp/addon.gypi b/node_modules/node-gyp/addon.gypi index 3cadaab78b688..6462f539ffb72 100644 --- a/node_modules/node-gyp/addon.gypi +++ b/node_modules/node-gyp/addon.gypi @@ -90,14 +90,10 @@ 'conditions': [ [ 'OS=="mac"', { - 'cflags': [ - '-fvisibility=hidden' - ], 'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ], 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 'DYLIB_INSTALL_NAME_BASE': '@rpath' }, }], diff --git a/node_modules/node-gyp/bin/node-gyp.js b/node_modules/node-gyp/bin/node-gyp.js index 8c9b6169bb6ee..13f2d399f737f 100755 --- a/node_modules/node-gyp/bin/node-gyp.js +++ b/node_modules/node-gyp/bin/node-gyp.js @@ -1,17 +1,19 @@ #!/usr/bin/env node +'use strict' + process.title = 'node-gyp' -var envPaths = require('env-paths') -var gyp = require('../') -var log = require('npmlog') -var os = require('os') +const envPaths = require('env-paths') +const gyp = require('../') +const log = require('npmlog') +const os = require('os') /** * Process and execute the selected commands. */ -var prog = gyp() +const prog = gyp() var completed = false prog.parseArgv(process.argv) prog.devDir = prog.opts.devdir @@ -24,8 +26,8 @@ if (prog.devDir) { } else { throw new Error( "node-gyp requires that the user's home directory is specified " + - "in either of the environmental variables HOME or USERPROFILE. " + - "Overide with: --devdir /path/to/.node-gyp") + 'in either of the environmental variables HOME or USERPROFILE. ' + + 'Overide with: --devdir /path/to/.node-gyp') } if (prog.todo.length === 0) { @@ -42,7 +44,6 @@ log.verbose('cli', process.argv) log.info('using', 'node-gyp@%s', prog.version) log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch) - /** * Change dir if -C/--directory was passed. */ @@ -84,7 +85,7 @@ function run () { log.error('not ok') return process.exit(1) } - if (command.name == 'list') { + if (command.name === 'list') { var versions = arguments[1] if (versions.length > 0) { versions.forEach(function (version) { @@ -122,7 +123,7 @@ function errorMessage () { var os = require('os') log.error('System', os.type() + ' ' + os.release()) log.error('command', process.argv - .map(JSON.stringify).join(' ')) + .map(JSON.stringify).join(' ')) log.error('cwd', process.cwd()) log.error('node -v', process.version) log.error('node-gyp -v', 'v' + prog.package.version) @@ -130,10 +131,10 @@ function errorMessage () { function issueMessage () { errorMessage() - log.error('', [ 'This is a bug in `node-gyp`.' - , 'Try to update node-gyp and file an Issue if it does not help:' - , ' ' - ].join('\n')) + log.error('', [ 'This is a bug in `node-gyp`.', + 'Try to update node-gyp and file an Issue if it does not help:', + ' ' + ].join('\n')) } // start running the given commands! diff --git a/node_modules/node-gyp/lib/build.js b/node_modules/node-gyp/lib/build.js index 783ab9c595561..24cfe38de2f86 100644 --- a/node_modules/node-gyp/lib/build.js +++ b/node_modules/node-gyp/lib/build.js @@ -1,12 +1,11 @@ +'use strict' -module.exports = exports = build - -var fs = require('graceful-fs') - , path = require('path') - , glob = require('glob') - , log = require('npmlog') - , which = require('which') - , win = process.platform === 'win32' +const fs = require('graceful-fs') +const path = require('path') +const glob = require('glob') +const log = require('npmlog') +const which = require('which') +const win = process.platform === 'win32' exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module' @@ -17,18 +16,19 @@ function build (gyp, argv, callback) { } else if (process.platform.indexOf('bsd') !== -1) { platformMake = 'gmake' } else if (win && argv.length > 0) { - argv = argv.map(function(target) { + argv = argv.map(function (target) { return '/t:' + target }) } var makeCommand = gyp.opts.make || process.env.MAKE || platformMake - , command = win ? 'msbuild' : makeCommand - , jobs = gyp.opts.jobs || process.env.JOBS - , buildType - , config - , arch - , nodeDir + var command = win ? 'msbuild' : makeCommand + var jobs = gyp.opts.jobs || process.env.JOBS + var buildType + var config + var arch + var nodeDir + var guessedSolution loadConfigGypi() @@ -38,16 +38,17 @@ function build (gyp, argv, callback) { function loadConfigGypi () { var configPath = path.resolve('build', 'config.gypi') + fs.readFile(configPath, 'utf8', function (err, data) { if (err) { - if (err.code == 'ENOENT') { + if (err.code === 'ENOENT') { callback(new Error('You must run `node-gyp configure` first!')) } else { callback(err) } return } - config = JSON.parse(data.replace(/\#.+\n/, '')) + config = JSON.parse(data.replace(/#.+\n/, '')) // get the 'arch', 'buildType', and 'nodeDir' vars from the config buildType = config.target_defaults.default_configuration @@ -79,7 +80,9 @@ function build (gyp, argv, callback) { function findSolutionFile () { glob('build/*.sln', function (err, files) { - if (err) return callback(err) + if (err) { + return callback(err) + } if (files.length === 0) { return callback(new Error('Could not find *.sln file. Did you run "configure"?')) } @@ -124,9 +127,12 @@ function build (gyp, argv, callback) { function doBuild () { // Enable Verbose build var verbose = log.levels[log.level] <= log.levels.verbose + var j + if (!win && verbose) { argv.push('V=1') } + if (win && !verbose) { argv.push('/clp:Verbosity=minimal') } @@ -142,12 +148,12 @@ function build (gyp, argv, callback) { // Since there are many ways to state '32-bit Intel', default to it. // N.B. msbuild's Condition string equality tests are case-insensitive. var archLower = arch.toLowerCase() - var p = archLower === 'x64' ? 'x64' : - (archLower === 'arm' ? 'ARM' : - (archLower === 'arm64' ? 'ARM64' : 'Win32')) + var p = archLower === 'x64' ? 'x64' + : (archLower === 'arm' ? 'ARM' + : (archLower === 'arm64' ? 'ARM64' : 'Win32')) argv.push('/p:Configuration=' + buildType + ';Platform=' + p) if (jobs) { - var j = parseInt(jobs, 10) + j = parseInt(jobs, 10) if (!isNaN(j) && j > 0) { argv.push('/m:' + j) } else if (jobs.toUpperCase() === 'MAX') { @@ -160,7 +166,7 @@ function build (gyp, argv, callback) { argv.push('-C') argv.push('build') if (jobs) { - var j = parseInt(jobs, 10) + j = parseInt(jobs, 10) if (!isNaN(j) && j > 0) { argv.push('--jobs') argv.push(j) @@ -174,7 +180,7 @@ function build (gyp, argv, callback) { if (win) { // did the user specify their own .sln file? var hasSln = argv.some(function (arg) { - return path.extname(arg) == '.sln' + return path.extname(arg) === '.sln' }) if (!hasSln) { argv.unshift(gyp.opts.solution || guessedSolution) @@ -195,3 +201,5 @@ function build (gyp, argv, callback) { callback() } } + +module.exports = build diff --git a/node_modules/node-gyp/lib/clean.js b/node_modules/node-gyp/lib/clean.js index 8172e1c3d3774..dbfa4dbb99d3c 100644 --- a/node_modules/node-gyp/lib/clean.js +++ b/node_modules/node-gyp/lib/clean.js @@ -1,10 +1,7 @@ +'use strict' -module.exports = exports = clean - -exports.usage = 'Removes any generated build files and the "out" dir' - -var rm = require('rimraf') -var log = require('npmlog') +const rm = require('rimraf') +const log = require('npmlog') function clean (gyp, argv, callback) { // Remove the 'build' dir @@ -13,3 +10,6 @@ function clean (gyp, argv, callback) { log.verbose('clean', 'removing "%s" directory', buildDir) rm(buildDir, callback) } + +module.exports = clean +module.exports.usage = 'Removes any generated build files and the "out" dir' diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js index c3a07d472d02d..267e7587f5db9 100644 --- a/node_modules/node-gyp/lib/configure.js +++ b/node_modules/node-gyp/lib/configure.js @@ -1,35 +1,26 @@ -module.exports = exports = configure -module.exports.test = { - PythonFinder: PythonFinder, - findAccessibleSync: findAccessibleSync, - findPython: findPython, -} - -var fs = require('graceful-fs') - , path = require('path') - , log = require('npmlog') - , os = require('os') - , semver = require('semver') - , mkdirp = require('mkdirp') - , cp = require('child_process') - , extend = require('util')._extend - , processRelease = require('./process-release') - , win = process.platform === 'win32' - , findNodeDirectory = require('./find-node-directory') - , msgFormat = require('util').format - , logWithPrefix = require('./util').logWithPrefix -if (win) +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const log = require('npmlog') +const os = require('os') +const mkdirp = require('mkdirp') +const processRelease = require('./process-release') +const win = process.platform === 'win32' +const findNodeDirectory = require('./find-node-directory') +const msgFormat = require('util').format +var findPython = require('./find-python') +if (win) { var findVisualStudio = require('./find-visualstudio') - -exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' +} function configure (gyp, argv, callback) { var python - , buildDir = path.resolve('build') - , configNames = [ 'config.gypi', 'common.gypi' ] - , configs = [] - , nodeDir - , release = processRelease(argv, gyp, process.version, process.release) + var buildDir = path.resolve('build') + var configNames = [ 'config.gypi', 'common.gypi' ] + var configs = [] + var nodeDir + var release = processRelease(argv, gyp, process.version, process.release) findPython(gyp.opts.python, function (err, found) { if (err) { @@ -67,10 +58,12 @@ function configure (gyp, argv, callback) { // If the tarball option is set, always remove and reinstall the headers // into devdir. Otherwise only install if they're not already there. - gyp.opts.ensure = gyp.opts.tarball ? false : true + gyp.opts.ensure = !gyp.opts.tarball gyp.commands.install([ release.version ], function (err) { - if (err) return callback(err) + if (err) { + return callback(err) + } log.verbose('get node dir', 'target node version installed:', release.versionDir) nodeDir = path.resolve(gyp.devDir, release.versionDir) createBuildDir() @@ -81,7 +74,9 @@ function configure (gyp, argv, callback) { function createBuildDir () { log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir) mkdirp(buildDir, function (err, isNew) { - if (err) return callback(err) + if (err) { + return callback(err) + } log.verbose('build dir', '"build" dir needed to be created?', isNew) if (win) { findVisualStudio(release.semver, gyp.opts.msvs_version, @@ -93,7 +88,9 @@ function configure (gyp, argv, callback) { } function createConfigFile (err, vsInfo) { - if (err) return callback(err) + if (err) { + return callback(err) + } var configFilename = 'config.gypi' var configPath = path.resolve(buildDir, configFilename) @@ -101,14 +98,18 @@ function configure (gyp, argv, callback) { log.verbose('build/' + configFilename, 'creating config file') var config = process.config || {} - , defaults = config.target_defaults - , variables = config.variables + var defaults = config.target_defaults + var variables = config.variables // default "config.variables" - if (!variables) variables = config.variables = {} + if (!variables) { + variables = config.variables = {} + } // default "config.defaults" - if (!defaults) defaults = config.target_defaults = {} + if (!defaults) { + defaults = config.target_defaults = {} + } // don't inherit the "defaults" from node's `process.config` object. // doing so could cause problems in cases where the `node` executable was @@ -123,13 +124,14 @@ function configure (gyp, argv, callback) { if ('debug' in gyp.opts) { defaults.default_configuration = gyp.opts.debug ? 'Debug' : 'Release' } + if (!defaults.default_configuration) { defaults.default_configuration = 'Release' } // set the target_arch variable variables.target_arch = gyp.opts.arch || process.arch || 'ia32' - if (variables.target_arch == 'arm64') { + if (variables.target_arch === 'arm64') { defaults['msvs_configuration_platform'] = 'ARM64' } @@ -146,7 +148,7 @@ function configure (gyp, argv, callback) { if (vsInfo.sdk) { defaults['msvs_windows_target_platform_version'] = vsInfo.sdk } - if (variables.target_arch == 'arm64') { + if (variables.target_arch === 'arm64') { if (vsInfo.versionMajor > 15 || (vsInfo.versionMajor === 15 && vsInfo.versionMajor >= 9)) { defaults['msvs_enable_marmasm'] = 1 @@ -163,15 +165,20 @@ function configure (gyp, argv, callback) { // // $ node-gyp configure --shared-libxml2 Object.keys(gyp.opts).forEach(function (opt) { - if (opt === 'argv') return - if (opt in gyp.configDefs) return + if (opt === 'argv') { + return + } + if (opt in gyp.configDefs) { + return + } variables[opt.replace(/-/g, '_')] = gyp.opts[opt] }) // ensures that any boolean values from `process.config` get stringified function boolsToString (k, v) { - if (typeof v === 'boolean') + if (typeof v === 'boolean') { return String(v) + } return v } @@ -179,21 +186,28 @@ function configure (gyp, argv, callback) { // now write out the config.gypi file to the build/ dir var prefix = '# Do not edit. File was generated by node-gyp\'s "configure" step' - , json = JSON.stringify(config, boolsToString, 2) + + var json = JSON.stringify(config, boolsToString, 2) log.verbose('build/' + configFilename, 'writing out config file: %s', configPath) configs.push(configPath) - fs.writeFile(configPath, [prefix, json, ''].join('\n'), findConfigs) + fs.writeFile(configPath, [ prefix, json, '' ].join('\n'), findConfigs) } function findConfigs (err) { - if (err) return callback(err) + if (err) { + return callback(err) + } + var name = configNames.shift() - if (!name) return runGyp() + if (!name) { + return runGyp() + } var fullPath = path.resolve(name) + log.verbose(name, 'checking for gypi file: %s', fullPath) fs.stat(fullPath, function (err) { if (err) { - if (err.code == 'ENOENT') { + if (err.code === 'ENOENT') { findConfigs() // check next gypi filename } else { callback(err) @@ -207,7 +221,9 @@ function configure (gyp, argv, callback) { } function runGyp (err) { - if (err) return callback(err) + if (err) { + return callback(err) + } if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) { if (win) { @@ -228,63 +244,68 @@ function configure (gyp, argv, callback) { // For AIX and z/OS we need to set up the path to the exports file // which contains the symbols needed for linking. - var node_exp_file = undefined + var nodeExpFile if (process.platform === 'aix' || process.platform === 'os390') { var ext = process.platform === 'aix' ? 'exp' : 'x' - var node_root_dir = findNodeDirectory() - var candidates = undefined + var nodeRootDir = findNodeDirectory() + var candidates + if (process.platform === 'aix') { - candidates = ['include/node/node', - 'out/Release/node', - 'out/Debug/node', - 'node' - ].map(function(file) { - return file + '.' + ext - }) + candidates = [ + 'include/node/node', + 'out/Release/node', + 'out/Debug/node', + 'node' + ].map(function (file) { + return file + '.' + ext + }) } else { - candidates = ['out/Release/obj.target/libnode', - 'out/Debug/obj.target/libnode', - 'lib/libnode' - ].map(function(file) { - return file + '.' + ext - }) + candidates = [ + 'out/Release/obj.target/libnode', + 'out/Debug/obj.target/libnode', + 'lib/libnode' + ].map(function (file) { + return file + '.' + ext + }) } + var logprefix = 'find exports file' - node_exp_file = findAccessibleSync(logprefix, node_root_dir, candidates) - if (node_exp_file !== undefined) { - log.verbose(logprefix, 'Found exports file: %s', node_exp_file) + nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates) + if (nodeExpFile !== undefined) { + log.verbose(logprefix, 'Found exports file: %s', nodeExpFile) } else { - var msg = msgFormat('Could not find node.%s file in %s', ext, node_root_dir) + var msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir) log.error(logprefix, 'Could not find exports file') return callback(new Error(msg)) } } // this logic ported from the old `gyp_addon` python file - var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py') - var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi') - var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi') - fs.stat(common_gypi, function (err) { - if (err) - common_gypi = path.resolve(nodeDir, 'common.gypi') - - var output_dir = 'build' + var gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py') + var addonGypi = path.resolve(__dirname, '..', 'addon.gypi') + var commonGypi = path.resolve(nodeDir, 'include/node/common.gypi') + fs.stat(commonGypi, function (err) { + if (err) { + commonGypi = path.resolve(nodeDir, 'common.gypi') + } + + var outputDir = 'build' if (win) { // Windows expects an absolute path - output_dir = buildDir + outputDir = buildDir } var nodeGypDir = path.resolve(__dirname, '..') var nodeLibFile = path.join(nodeDir, !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)', release.name + '.lib') - argv.push('-I', addon_gypi) - argv.push('-I', common_gypi) + argv.push('-I', addonGypi) + argv.push('-I', commonGypi) argv.push('-Dlibrary=shared_library') argv.push('-Dvisibility=default') argv.push('-Dnode_root_dir=' + nodeDir) if (process.platform === 'aix' || process.platform === 'os390') { - argv.push('-Dnode_exp_file=' + node_exp_file) + argv.push('-Dnode_exp_file=' + nodeExpFile) } argv.push('-Dnode_gyp_dir=' + nodeGypDir) argv.push('-Dnode_lib_file=' + nodeLibFile) @@ -295,7 +316,7 @@ function configure (gyp, argv, callback) { argv.push('--no-parallel') // tell gyp to write the Makefile/Solution files into output_dir - argv.push('--generator-output', output_dir) + argv.push('--generator-output', outputDir) // tell make to write its output into the same dir argv.push('-Goutput_dir=.') @@ -304,10 +325,10 @@ function configure (gyp, argv, callback) { argv.unshift('binding.gyp') // execute `gyp` from the current target nodedir - argv.unshift(gyp_script) + argv.unshift(gypScript) // make sure python uses files that came with this particular node package - var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')] + var pypath = [ path.join(__dirname, '..', 'gyp', 'pylib') ] if (process.env.PYTHONPATH) { pypath.push(process.env.PYTHONPATH) } @@ -326,7 +347,6 @@ function configure (gyp, argv, callback) { callback() } } - } /** @@ -336,298 +356,24 @@ function configure (gyp, argv, callback) { */ function findAccessibleSync (logprefix, dir, candidates) { for (var next = 0; next < candidates.length; next++) { - var candidate = path.resolve(dir, candidates[next]) - try { - var fd = fs.openSync(candidate, 'r') - } catch (e) { - // this candidate was not found or not readable, do nothing - log.silly(logprefix, 'Could not open %s: %s', candidate, e.message) - continue - } - fs.closeSync(fd) - log.silly(logprefix, 'Found readable %s', candidate) - return candidate - } - - return undefined -} - -function PythonFinder(configPython, callback) { - this.callback = callback - this.configPython = configPython - this.errorLog = [] -} - -PythonFinder.prototype = { - log: logWithPrefix(log, 'find Python'), - argsExecutable: ['-c', 'import sys; print(sys.executable);'], - argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'], - semverRange: '>=2.6.0 <3.0.0', - - // These can be overridden for testing: - execFile: cp.execFile, - env: process.env, - win: win, - pyLauncher: 'py.exe', - defaultLocation: path.join(process.env.SystemDrive || 'C:', 'Python27', - 'python.exe'), - - // Logs a message at verbose level, but also saves it to be displayed later - // at error level if an error occurs. This should help diagnose the problem. - addLog: function addLog(message) { - this.log.verbose(message) - this.errorLog.push(message) - }, - - - // Find Python by trying a sequence of possibilities. - // Ignore errors, keep trying until Python is found. - findPython: function findPython() { - const SKIP=0, FAIL=1 - const toCheck = [ - { - before: () => { - if (!this.configPython) { - this.addLog( - 'Python is not set from command line or npm configuration') - return SKIP - } - this.addLog('checking Python explicitly set from command line or ' + - 'npm configuration') - this.addLog('- "--python=" or "npm config get python" is ' + - `"${this.configPython}"`) - }, - check: this.checkCommand, - arg: this.configPython, - }, - { - before: () => { - if (!this.env.PYTHON) { - this.addLog('Python is not set from environment variable PYTHON') - return SKIP - } - this.addLog( - 'checking Python explicitly set from environment variable PYTHON') - this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`) - }, - check: this.checkCommand, - arg: this.env.PYTHON, - }, - { - before: () => { this.addLog('checking if "python2" can be used') }, - check: this.checkCommand, - arg: 'python2', - }, - { - before: () => { this.addLog('checking if "python" can be used') }, - check: this.checkCommand, - arg: 'python', - }, - { - before: () => { - if (!this.win) { - // Everything after this is Windows specific - return FAIL - } - this.addLog( - 'checking if the py launcher can be used to find Python 2') - }, - check: this.checkPyLauncher, - }, - { - before: () => { - this.addLog( - 'checking if Python 2 is installed in the default location') - }, - check: this.checkExecPath, - arg: this.defaultLocation, - }, - ] - - function runChecks(err) { - this.log.silly('runChecks: err = %j', err && err.stack || err) - - const check = toCheck.shift() - if (!check) { - return this.fail() - } - - const before = check.before.apply(this) - if (before === SKIP) { - return runChecks.apply(this) - } - if (before === FAIL) { - return this.fail() - } - - const args = [ runChecks.bind(this) ] - if (check.arg) { - args.unshift(check.arg) - } - check.check.apply(this, args) - } - - runChecks.apply(this) - }, - - - // Check if command is a valid Python to use. - // Will exit the Python finder on success. - // If on Windows, run in a CMD shell to support BAT/CMD launchers. - checkCommand: function checkCommand (command, errorCallback) { - var exec = command - var args = this.argsExecutable - var shell = false - if (this.win) { - // Arguments have to be manually quoted - exec = `"${exec}"` - args = args.map(a => `"${a}"`) - shell = true - } - - this.log.verbose(`- executing "${command}" to get executable path`) - this.run(exec, args, shell, function (err, execPath) { - // Possible outcomes: - // - Error: not in PATH, not executable or execution fails - // - Gibberish: the next command to check version will fail - // - Absolute path to executable - if (err) { - this.addLog(`- "${command}" is not in PATH or produced an error`) - return errorCallback(err) - } - this.addLog(`- executable path is "${execPath}"`) - this.checkExecPath(execPath, errorCallback) - }.bind(this)) - }, - - // Check if the py launcher can find a valid Python to use. - // Will exit the Python finder on success. - // Distributions of Python on Windows by default install with the "py.exe" - // Python launcher which is more likely to exist than the Python executable - // being in the $PATH. - // Because the Python launcher supports all versions of Python, we have to - // explicitly request a Python 2 version. This is done by supplying "-2" as - // the first command line argument. Since "py.exe -2" would be an invalid - // executable for "execFile", we have to use the launcher to figure out - // where the actual "python.exe" executable is located. - checkPyLauncher: function checkPyLauncher (errorCallback) { - this.log.verbose( - `- executing "${this.pyLauncher}" to get Python 2 executable path`) - this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false, - function (err, execPath) { - // Possible outcomes: same as checkCommand - if (err) { - this.addLog( - `- "${this.pyLauncher}" is not in PATH or produced an error`) - return errorCallback(err) - } - this.addLog(`- executable path is "${execPath}"`) - this.checkExecPath(execPath, errorCallback) - }.bind(this)) - }, - - // Check if a Python executable is the correct version to use. - // Will exit the Python finder on success. - checkExecPath: function checkExecPath (execPath, errorCallback) { - this.log.verbose(`- executing "${execPath}" to get version`) - this.run(execPath, this.argsVersion, false, function (err, version) { - // Possible outcomes: - // - Error: executable can not be run (likely meaning the command wasn't - // a Python executable and the previous command produced gibberish) - // - Gibberish: somehow the last command produced an executable path, - // this will fail when verifying the version - // - Version of the Python executable - if (err) { - this.addLog(`- "${execPath}" could not be run`) - return errorCallback(err) - } - this.addLog(`- version is "${version}"`) - - const range = semver.Range(this.semverRange) - var valid = false - try { - valid = range.test(version) - } catch (err) { - this.log.silly('range.test() threw:\n%s', err.stack) - this.addLog(`- "${execPath}" does not have a valid version`) - this.addLog('- is it a Python executable?') - return errorCallback(err) - } - - if (!valid) { - this.addLog(`- version is ${version} - should be ${this.semverRange}`) - this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED') - return errorCallback(new Error( - `Found unsupported Python version ${version}`)) - } - this.succeed(execPath, version) - }.bind(this)) - }, - - // Run an executable or shell command, trimming the output. - run: function run(exec, args, shell, callback) { - var env = extend({}, this.env) - env.TERM = 'dumb' - const opts = { env: env, shell: shell } - - this.log.silly('execFile: exec = %j', exec) - this.log.silly('execFile: args = %j', args) - this.log.silly('execFile: opts = %j', opts) + var candidate = path.resolve(dir, candidates[next]) try { - this.execFile(exec, args, opts, execFileCallback.bind(this)) - } catch (err) { - this.log.silly('execFile: threw:\n%s', err.stack) - return callback(err) + var fd = fs.openSync(candidate, 'r') + } catch (e) { + // this candidate was not found or not readable, do nothing + log.silly(logprefix, 'Could not open %s: %s', candidate, e.message) + continue } + fs.closeSync(fd) + log.silly(logprefix, 'Found readable %s', candidate) + return candidate + } - function execFileCallback(err, stdout, stderr) { - this.log.silly('execFile result: err = %j', err && err.stack || err) - this.log.silly('execFile result: stdout = %j', stdout) - this.log.silly('execFile result: stderr = %j', stderr) - if (err) { - return callback(err) - } - const execPath = stdout.trim() - callback(null, execPath) - } - }, - - - succeed: function succeed(execPath, version) { - this.log.info(`using Python version ${version} found at "${execPath}"`) - process.nextTick(this.callback.bind(null, null, execPath)) - }, - - fail: function fail() { - const errorLog = this.errorLog.join('\n') - - const pathExample = this.win ? 'C:\\Path\\To\\python.exe' : - '/path/to/pythonexecutable' - // For Windows 80 col console, use up to the column before the one marked - // with X (total 79 chars including logger prefix, 58 chars usable here): - // X - const info = [ - '**********************************************************', - 'You need to install the latest version of Python 2.7.', - 'Node-gyp should be able to find and use Python. If not,', - 'you can try one of the following options:', - `- Use the switch --python="${pathExample}"`, - ' (accepted by both node-gyp and npm)', - '- Set the environment variable PYTHON', - '- Set the npm configuration variable python:', - ` npm config set python "${pathExample}"`, - 'For more information consult the documentation at:', - 'https://github.com/nodejs/node-gyp#installation', - '**********************************************************', - ].join('\n') - - this.log.error(`\n${errorLog}\n\n${info}\n`) - process.nextTick(this.callback.bind(null, new Error ( - 'Could not find any Python 2 installation to use'))) - }, + return undefined } -function findPython (configPython, callback) { - var finder = new PythonFinder(configPython, callback) - finder.findPython() +module.exports = configure +module.exports.test = { + findAccessibleSync: findAccessibleSync } +module.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' diff --git a/node_modules/node-gyp/lib/find-node-directory.js b/node_modules/node-gyp/lib/find-node-directory.js index 524909581f713..0dd781a6cfae8 100644 --- a/node_modules/node-gyp/lib/find-node-directory.js +++ b/node_modules/node-gyp/lib/find-node-directory.js @@ -1,7 +1,9 @@ -var path = require('path') - , log = require('npmlog') +'use strict' -module.exports = function findNodeDirectory(scriptLocation, processObj) { +const path = require('path') +const log = require('npmlog') + +function findNodeDirectory (scriptLocation, processObj) { // set dirname and process if not passed in // this facilitates regression tests if (scriptLocation === undefined) { @@ -12,48 +14,50 @@ module.exports = function findNodeDirectory(scriptLocation, processObj) { } // Have a look to see what is above us, to try and work out where we are - npm_parent_directory = path.join(scriptLocation, '../../../..') - log.verbose('node-gyp root', 'npm_parent_directory is ' - + path.basename(npm_parent_directory)) - node_root_dir = "" + var npmParentDirectory = path.join(scriptLocation, '../../../..') + log.verbose('node-gyp root', 'npm_parent_directory is ' + + path.basename(npmParentDirectory)) + var nodeRootDir = '' log.verbose('node-gyp root', 'Finding node root directory') - if (path.basename(npm_parent_directory) === 'deps') { + if (path.basename(npmParentDirectory) === 'deps') { // We are in a build directory where this script lives in // deps/npm/node_modules/node-gyp/lib - node_root_dir = path.join(npm_parent_directory, '..') - log.verbose('node-gyp root', 'in build directory, root = ' - + node_root_dir) - } else if (path.basename(npm_parent_directory) === 'node_modules') { + nodeRootDir = path.join(npmParentDirectory, '..') + log.verbose('node-gyp root', 'in build directory, root = ' + + nodeRootDir) + } else if (path.basename(npmParentDirectory) === 'node_modules') { // We are in a node install directory where this script lives in // lib/node_modules/npm/node_modules/node-gyp/lib or // node_modules/npm/node_modules/node-gyp/lib depending on the // platform if (processObj.platform === 'win32') { - node_root_dir = path.join(npm_parent_directory, '..') + nodeRootDir = path.join(npmParentDirectory, '..') } else { - node_root_dir = path.join(npm_parent_directory, '../..') + nodeRootDir = path.join(npmParentDirectory, '../..') } - log.verbose('node-gyp root', 'in install directory, root = ' - + node_root_dir) + log.verbose('node-gyp root', 'in install directory, root = ' + + nodeRootDir) } else { // We don't know where we are, try working it out from the location // of the node binary - var node_dir = path.dirname(processObj.execPath) - var directory_up = path.basename(node_dir) - if (directory_up === 'bin') { - node_root_dir = path.join(node_dir, '..') - } else if (directory_up === 'Release' || directory_up === 'Debug') { + var nodeDir = path.dirname(processObj.execPath) + var directoryUp = path.basename(nodeDir) + if (directoryUp === 'bin') { + nodeRootDir = path.join(nodeDir, '..') + } else if (directoryUp === 'Release' || directoryUp === 'Debug') { // If we are a recently built node, and the directory structure // is that of a repository. If we are on Windows then we only need // to go one level up, everything else, two if (processObj.platform === 'win32') { - node_root_dir = path.join(node_dir, '..') + nodeRootDir = path.join(nodeDir, '..') } else { - node_root_dir = path.join(node_dir, '../..') + nodeRootDir = path.join(nodeDir, '../..') } } // Else return the default blank, "". } - return node_root_dir + return nodeRootDir } + +module.exports = findNodeDirectory diff --git a/node_modules/node-gyp/lib/find-python.js b/node_modules/node-gyp/lib/find-python.js new file mode 100644 index 0000000000000..1a4390dbd2c9c --- /dev/null +++ b/node_modules/node-gyp/lib/find-python.js @@ -0,0 +1,317 @@ +'use strict' + +const path = require('path') +const log = require('npmlog') +const semver = require('semver') +const cp = require('child_process') +const extend = require('util')._extend // eslint-disable-line +const win = process.platform === 'win32' +const logWithPrefix = require('./util').logWithPrefix + +function PythonFinder (configPython, callback) { + this.callback = callback + this.configPython = configPython + this.errorLog = [] +} + +PythonFinder.prototype = { + log: logWithPrefix(log, 'find Python'), + argsExecutable: [ '-c', 'import sys; print(sys.executable);' ], + argsVersion: [ '-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);' ], + semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0' + : '>=2.6.0 <3.0.0', + + // These can be overridden for testing: + execFile: cp.execFile, + env: process.env, + win: win, + pyLauncher: 'py.exe', + winDefaultLocations: [ + path.join(process.env.SystemDrive || 'C:', 'Python27', 'python.exe'), + path.join(process.env.SystemDrive || 'C:', 'Python37', 'python.exe') + ], + + // Logs a message at verbose level, but also saves it to be displayed later + // at error level if an error occurs. This should help diagnose the problem. + addLog: function addLog (message) { + this.log.verbose(message) + this.errorLog.push(message) + }, + + // Find Python by trying a sequence of possibilities. + // Ignore errors, keep trying until Python is found. + findPython: function findPython () { + const SKIP = 0; const FAIL = 1 + var toCheck = getChecks.apply(this) + + function getChecks () { + if (this.env.NODE_GYP_FORCE_PYTHON) { + return [ { + before: () => { + this.addLog( + 'checking Python explicitly set from NODE_GYP_FORCE_PYTHON') + this.addLog('- process.env.NODE_GYP_FORCE_PYTHON is ' + + `"${this.env.NODE_GYP_FORCE_PYTHON}"`) + }, + check: this.checkCommand, + arg: this.env.NODE_GYP_FORCE_PYTHON + } ] + } + + var checks = [ + { + before: () => { + if (!this.configPython) { + this.addLog( + 'Python is not set from command line or npm configuration') + return SKIP + } + this.addLog('checking Python explicitly set from command line or ' + + 'npm configuration') + this.addLog('- "--python=" or "npm config get python" is ' + + `"${this.configPython}"`) + }, + check: this.checkCommand, + arg: this.configPython + }, + { + before: () => { + if (!this.env.PYTHON) { + this.addLog('Python is not set from environment variable ' + + 'PYTHON') + return SKIP + } + this.addLog('checking Python explicitly set from environment ' + + 'variable PYTHON') + this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`) + }, + check: this.checkCommand, + arg: this.env.PYTHON + }, + { + before: () => { this.addLog('checking if "python" can be used') }, + check: this.checkCommand, + arg: 'python' + }, + { + before: () => { this.addLog('checking if "python2" can be used') }, + check: this.checkCommand, + arg: 'python2' + } + ] + + if (this.win) { + checks.push({ + before: () => { + this.addLog( + 'checking if the py launcher can be used to find Python 2') + }, + check: this.checkPyLauncher + }) + for (var i = 0; i < this.winDefaultLocations.length; ++i) { + const location = this.winDefaultLocations[i] + checks.push({ + before: () => { + this.addLog('checking if Python is ' + + `${location}`) + }, + check: this.checkExecPath, + arg: location + }) + } + } + + return checks + } + + function runChecks (err) { + this.log.silly('runChecks: err = %j', (err && err.stack) || err) + + const check = toCheck.shift() + if (!check) { + return this.fail() + } + + const before = check.before.apply(this) + if (before === SKIP) { + return runChecks.apply(this) + } + if (before === FAIL) { + return this.fail() + } + + const args = [ runChecks.bind(this) ] + if (check.arg) { + args.unshift(check.arg) + } + check.check.apply(this, args) + } + + runChecks.apply(this) + }, + + // Check if command is a valid Python to use. + // Will exit the Python finder on success. + // If on Windows, run in a CMD shell to support BAT/CMD launchers. + checkCommand: function checkCommand (command, errorCallback) { + var exec = command + var args = this.argsExecutable + var shell = false + if (this.win) { + // Arguments have to be manually quoted + exec = `"${exec}"` + args = args.map(a => `"${a}"`) + shell = true + } + + this.log.verbose(`- executing "${command}" to get executable path`) + this.run(exec, args, shell, function (err, execPath) { + // Possible outcomes: + // - Error: not in PATH, not executable or execution fails + // - Gibberish: the next command to check version will fail + // - Absolute path to executable + if (err) { + this.addLog(`- "${command}" is not in PATH or produced an error`) + return errorCallback(err) + } + this.addLog(`- executable path is "${execPath}"`) + this.checkExecPath(execPath, errorCallback) + }.bind(this)) + }, + + // Check if the py launcher can find a valid Python to use. + // Will exit the Python finder on success. + // Distributions of Python on Windows by default install with the "py.exe" + // Python launcher which is more likely to exist than the Python executable + // being in the $PATH. + // Because the Python launcher supports all versions of Python, we have to + // explicitly request a Python 2 version. This is done by supplying "-2" as + // the first command line argument. Since "py.exe -2" would be an invalid + // executable for "execFile", we have to use the launcher to figure out + // where the actual "python.exe" executable is located. + checkPyLauncher: function checkPyLauncher (errorCallback) { + this.log.verbose( + `- executing "${this.pyLauncher}" to get Python 2 executable path`) + this.run(this.pyLauncher, [ '-2', ...this.argsExecutable ], false, + function (err, execPath) { + // Possible outcomes: same as checkCommand + if (err) { + this.addLog( + `- "${this.pyLauncher}" is not in PATH or produced an error`) + return errorCallback(err) + } + this.addLog(`- executable path is "${execPath}"`) + this.checkExecPath(execPath, errorCallback) + }.bind(this)) + }, + + // Check if a Python executable is the correct version to use. + // Will exit the Python finder on success. + checkExecPath: function checkExecPath (execPath, errorCallback) { + this.log.verbose(`- executing "${execPath}" to get version`) + this.run(execPath, this.argsVersion, false, function (err, version) { + // Possible outcomes: + // - Error: executable can not be run (likely meaning the command wasn't + // a Python executable and the previous command produced gibberish) + // - Gibberish: somehow the last command produced an executable path, + // this will fail when verifying the version + // - Version of the Python executable + if (err) { + this.addLog(`- "${execPath}" could not be run`) + return errorCallback(err) + } + this.addLog(`- version is "${version}"`) + + const range = semver.Range(this.semverRange) + var valid = false + try { + valid = range.test(version) + } catch (err) { + this.log.silly('range.test() threw:\n%s', err.stack) + this.addLog(`- "${execPath}" does not have a valid version`) + this.addLog('- is it a Python executable?') + return errorCallback(err) + } + + if (!valid) { + this.addLog(`- version is ${version} - should be ${this.semverRange}`) + this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED') + return errorCallback(new Error( + `Found unsupported Python version ${version}`)) + } + this.succeed(execPath, version) + }.bind(this)) + }, + + // Run an executable or shell command, trimming the output. + run: function run (exec, args, shell, callback) { + var env = extend({}, this.env) + env.TERM = 'dumb' + const opts = { env: env, shell: shell } + + this.log.silly('execFile: exec = %j', exec) + this.log.silly('execFile: args = %j', args) + this.log.silly('execFile: opts = %j', opts) + try { + this.execFile(exec, args, opts, execFileCallback.bind(this)) + } catch (err) { + this.log.silly('execFile: threw:\n%s', err.stack) + return callback(err) + } + + function execFileCallback (err, stdout, stderr) { + this.log.silly('execFile result: err = %j', (err && err.stack) || err) + this.log.silly('execFile result: stdout = %j', stdout) + this.log.silly('execFile result: stderr = %j', stderr) + if (err) { + return callback(err) + } + const execPath = stdout.trim() + callback(null, execPath) + } + }, + + succeed: function succeed (execPath, version) { + this.log.info(`using Python version ${version} found at "${execPath}"`) + process.nextTick(this.callback.bind(null, null, execPath)) + }, + + fail: function fail () { + const errorLog = this.errorLog.join('\n') + + const pathExample = this.win ? 'C:\\Path\\To\\python.exe' + : '/path/to/pythonexecutable' + // For Windows 80 col console, use up to the column before the one marked + // with X (total 79 chars including logger prefix, 58 chars usable here): + // X + const info = [ + '**********************************************************', + 'You need to install the latest version of Python 2.7.', + 'Node-gyp should be able to find and use Python. If not,', + 'you can try one of the following options:', + `- Use the switch --python="${pathExample}"`, + ' (accepted by both node-gyp and npm)', + '- Set the environment variable PYTHON', + '- Set the npm configuration variable python:', + ` npm config set python "${pathExample}"`, + 'For more information consult the documentation at:', + 'https://github.com/nodejs/node-gyp#installation', + '**********************************************************' + ].join('\n') + + this.log.error(`\n${errorLog}\n\n${info}\n`) + process.nextTick(this.callback.bind(null, new Error( + 'Could not find any Python installation to use'))) + } +} + +function findPython (configPython, callback) { + var finder = new PythonFinder(configPython, callback) + finder.findPython() +} + +module.exports = findPython +module.exports.test = { + PythonFinder: PythonFinder, + findPython: findPython +} diff --git a/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/node-gyp/lib/find-visualstudio.js index bf47f4ce0aadd..b2c00e68355b7 100644 --- a/node_modules/node-gyp/lib/find-visualstudio.js +++ b/node_modules/node-gyp/lib/find-visualstudio.js @@ -1,8 +1,4 @@ -module.exports = exports = findVisualStudio -module.exports.test = { - VisualStudioFinder: VisualStudioFinder, - findVisualStudio: findVisualStudio -} +'use strict' const log = require('npmlog') const execFile = require('child_process').execFile @@ -132,9 +128,13 @@ VisualStudioFinder.prototype = { var ps = path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe') var csFile = path.join(__dirname, 'Find-VisualStudio.cs') - var psArgs = ['-ExecutionPolicy', 'Unrestricted', '-NoProfile', - '-Command', '&{Add-Type -Path \'' + csFile + '\';' + - '[VisualStudioConfiguration.Main]::PrintJson()}'] + var psArgs = [ + '-ExecutionPolicy', + 'Unrestricted', + '-NoProfile', + '-Command', + '&{Add-Type -Path \'' + csFile + '\';' + '[VisualStudioConfiguration.Main]::PrintJson()}' + ] this.log.silly('Running', ps, psArgs) var child = execFile(ps, psArgs, { encoding: 'utf8' }, @@ -188,7 +188,9 @@ VisualStudioFinder.prototype = { // Remove future versions or errors parsing version number vsInfo = vsInfo.filter((info) => { - if (info.versionYear) { return true } + if (info.versionYear) { + return true + } this.addLog(`unknown version "${info.version}" found at "${info.path}"`) return false }) @@ -403,11 +405,13 @@ VisualStudioFinder.prototype = { this.addLog('- msvs_version does not match this version') return false } - if (this.configPath && this.configPath !== vsPath) { + if (this.configPath && + path.relative(this.configPath, vsPath) !== '') { this.addLog('- msvs_version does not point to this installation') return false } - if (this.envVcInstallDir && this.envVcInstallDir !== vsPath) { + if (this.envVcInstallDir && + path.relative(this.envVcInstallDir, vsPath) !== '') { this.addLog('- does not match this Visual Studio Command Prompt') return false } @@ -415,3 +419,9 @@ VisualStudioFinder.prototype = { return true } } + +module.exports = findVisualStudio +module.exports.test = { + VisualStudioFinder: VisualStudioFinder, + findVisualStudio: findVisualStudio +} diff --git a/node_modules/node-gyp/lib/install.js b/node_modules/node-gyp/lib/install.js index 06353663dbeea..6ac8519ef5d6a 100644 --- a/node_modules/node-gyp/lib/install.js +++ b/node_modules/node-gyp/lib/install.js @@ -1,33 +1,25 @@ -module.exports = exports = function (gyp, argv, callback) { - return install(fs, gyp, argv, callback) -} - -module.exports.test = { - download: download, - install: install, - readCAFile: readCAFile, -} - -exports.usage = 'Install node development files for the specified node version.' - -var fs = require('graceful-fs') - , os = require('os') - , tar = require('tar') - , path = require('path') - , crypto = require('crypto') - , log = require('npmlog') - , semver = require('semver') - , request = require('request') - , mkdir = require('mkdirp') - , processRelease = require('./process-release') - , win = process.platform == 'win32' +'use strict' + +const fs = require('graceful-fs') +const os = require('os') +const tar = require('tar') +const path = require('path') +const crypto = require('crypto') +const log = require('npmlog') +const semver = require('semver') +const request = require('request') +const mkdir = require('mkdirp') +const processRelease = require('./process-release') +const win = process.platform === 'win32' function install (fs, gyp, argv, callback) { var release = processRelease(argv, gyp, process.version, process.release) // ensure no double-callbacks happen function cb (err) { - if (cb.done) return + if (cb.done) { + return + } cb.done = true if (err) { log.warn('install', 'got an error, rolling back install') @@ -76,10 +68,10 @@ function install (fs, gyp, argv, callback) { log.verbose('install', '--ensure was passed, so won\'t reinstall if already installed') fs.stat(devDir, function (err) { if (err) { - if (err.code == 'ENOENT') { + if (err.code === 'ENOENT') { log.verbose('install', 'version not already installed, continuing with install', release.version) go() - } else if (err.code == 'EACCES') { + } else if (err.code === 'EACCES') { eaccesFallback(err) } else { cb(err) @@ -89,7 +81,7 @@ function install (fs, gyp, argv, callback) { log.verbose('install', 'version is already installed, need to check "installVersion"') var installVersionFile = path.resolve(devDir, 'installVersion') fs.readFile(installVersionFile, 'ascii', function (err, ver) { - if (err && err.code != 'ENOENT') { + if (err && err.code !== 'ENOENT') { return cb(err) } var installVersion = parseInt(ver, 10) || 0 @@ -108,7 +100,7 @@ function install (fs, gyp, argv, callback) { go() } - function getContentSha(res, callback) { + function getContentSha (res, callback) { var shasum = crypto.createHash('sha256') res.on('data', function (chunk) { shasum.update(chunk) @@ -123,7 +115,7 @@ function install (fs, gyp, argv, callback) { // first create the dir for the node dev files mkdir(devDir, function (err, created) { if (err) { - if (err.code == 'EACCES') { + if (err.code === 'EACCES') { eaccesFallback(err) } else { cb(err) @@ -138,8 +130,7 @@ function install (fs, gyp, argv, callback) { // now download the node tarball var tarPath = gyp.opts.tarball var badDownload = false - , extractCount = 0 - + var extractCount = 0 var contentShasums = {} var expectShasums = {} @@ -213,7 +204,9 @@ function install (fs, gyp, argv, callback) { // invoked after the tarball has finished being extracted function afterTarball () { - if (badDownload) return + if (badDownload) { + return + } if (extractCount === 0) { return cb(new Error('There was a fatal problem while downloading/extracting the tarball')) } @@ -244,7 +237,9 @@ function install (fs, gyp, argv, callback) { } function deref (err) { - if (err) return cb(err) + if (err) { + return cb(err) + } async-- if (!async) { @@ -262,7 +257,7 @@ function install (fs, gyp, argv, callback) { } } - function downloadShasums(done) { + function downloadShasums (done) { log.verbose('check download content checksum, need to download `SHASUMS256.txt`...') log.verbose('checksum url', release.shasumsUrl) try { @@ -286,7 +281,9 @@ function install (fs, gyp, argv, callback) { var lines = Buffer.concat(chunks).toString().trim().split('\n') lines.forEach(function (line) { var items = line.trim().split(/\s+/) - if (items.length !== 2) return + if (items.length !== 2) { + return + } // 0035d18e2dcf9aad669b1c7c07319e17abfe3762 ./node-v0.11.4.tar.gz var name = items[1].replace(/^\.\//, '') @@ -313,7 +310,9 @@ function install (fs, gyp, argv, callback) { log.verbose(name, 'url', libUrl) mkdir(dir, function (err) { - if (err) return done(err) + if (err) { + return done(err) + } log.verbose('streaming', name, 'to:', targetLibPath) try { @@ -342,9 +341,7 @@ function install (fs, gyp, argv, callback) { }) }) } // downloadNodeLib() - }) // mkdir() - } // go() /** @@ -353,8 +350,8 @@ function install (fs, gyp, argv, callback) { function valid (file) { // header files - var extname = path.extname(file); - return extname === '.h' || extname === '.gypi'; + var extname = path.extname(file) + return extname === '.h' || extname === '.gypi' } /** @@ -368,28 +365,29 @@ function install (fs, gyp, argv, callback) { function eaccesFallback (err) { var noretry = '--node_gyp_internal_noretry' - if (-1 !== argv.indexOf(noretry)) return cb(err) + if (argv.indexOf(noretry) !== -1) { + return cb(err) + } var tmpdir = os.tmpdir() gyp.devDir = path.resolve(tmpdir, '.node-gyp') log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir) log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir) - if (process.cwd() == tmpdir) { + if (process.cwd() === tmpdir) { log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space') gyp.todo.push({ name: 'remove', args: argv }) } gyp.commands.install([noretry].concat(argv), cb) } - } function download (gyp, env, url) { log.http('GET', url) var requestOpts = { - uri: url - , headers: { - 'User-Agent': 'node-gyp v' + gyp.version + ' (node ' + process.version + ')' - } + uri: url, + headers: { + 'User-Agent': 'node-gyp v' + gyp.version + ' (node ' + process.version + ')' + } } var cafile = gyp.opts.cafile @@ -398,10 +396,10 @@ function download (gyp, env, url) { } // basic support for a proxy server - var proxyUrl = gyp.opts.proxy - || env.http_proxy - || env.HTTP_PROXY - || env.npm_config_proxy + var proxyUrl = gyp.opts.proxy || + env.http_proxy || + env.HTTP_PROXY || + env.npm_config_proxy if (proxyUrl) { if (/^https?:\/\//i.test(proxyUrl)) { log.verbose('download', 'using proxy url: "%s"', proxyUrl) @@ -426,3 +424,13 @@ function readCAFile (filename) { var re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g return ca.match(re) } + +module.exports = function (gyp, argv, callback) { + return install(fs, gyp, argv, callback) +} +module.exports.test = { + download: download, + install: install, + readCAFile: readCAFile +} +module.exports.usage = 'Install node development files for the specified node version.' diff --git a/node_modules/node-gyp/lib/list.js b/node_modules/node-gyp/lib/list.js index 90f644718025e..3e5de28851028 100644 --- a/node_modules/node-gyp/lib/list.js +++ b/node_modules/node-gyp/lib/list.js @@ -1,10 +1,7 @@ +'use strict' -module.exports = exports = list - -exports.usage = 'Prints a listing of the currently installed node development files' - -var fs = require('graceful-fs') - , log = require('npmlog') +const fs = require('graceful-fs') +const log = require('npmlog') function list (gyp, args, callback) { var devDir = gyp.devDir @@ -13,14 +10,18 @@ function list (gyp, args, callback) { fs.readdir(devDir, onreaddir) function onreaddir (err, versions) { - if (err && err.code != 'ENOENT') { + if (err && err.code !== 'ENOENT') { return callback(err) } + if (Array.isArray(versions)) { - versions = versions.filter(function (v) { return v != 'current' }) + versions = versions.filter(function (v) { return v !== 'current' }) } else { versions = [] } callback(null, versions) } } + +module.exports = list +exports.usage = 'Prints a listing of the currently installed node development files' diff --git a/node_modules/node-gyp/lib/node-gyp.js b/node_modules/node-gyp/lib/node-gyp.js index 21ed80f9ffec6..91880f94339fa 100644 --- a/node_modules/node-gyp/lib/node-gyp.js +++ b/node_modules/node-gyp/lib/node-gyp.js @@ -1,27 +1,26 @@ - -module.exports = exports = gyp - -var path = require('path') - , nopt = require('nopt') - , log = require('npmlog') - , child_process = require('child_process') - , EE = require('events').EventEmitter - , inherits = require('util').inherits - , commands = [ - // Module build commands - 'build' - , 'clean' - , 'configure' - , 'rebuild' - // Development Header File management commands - , 'install' - , 'list' - , 'remove' - ] - , aliases = { - 'ls': 'list' - , 'rm': 'remove' - } +'use strict' + +const path = require('path') +const nopt = require('nopt') +const log = require('npmlog') +const childProcess = require('child_process') +const EE = require('events').EventEmitter +const inherits = require('util').inherits +const commands = [ + // Module build commands + 'build', + 'clean', + 'configure', + 'rebuild', + // Development Header File management commands + 'install', + 'list', + 'remove' +] +const aliases = { + 'ls': 'list', + 'rm': 'remove' +} // differentiate node-gyp's logs from npm's log.heading = 'gyp' @@ -58,24 +57,24 @@ proto.package = require('../package.json') */ proto.configDefs = { - help: Boolean // everywhere - , arch: String // 'configure' - , cafile: String // 'install' - , debug: Boolean // 'build' - , directory: String // bin - , make: String // 'build' - , msvs_version: String // 'configure' - , ensure: Boolean // 'install' - , solution: String // 'build' (windows only) - , proxy: String // 'install' - , devdir: String // everywhere - , nodedir: String // 'configure' - , loglevel: String // everywhere - , python: String // 'configure' - , 'dist-url': String // 'install' - , 'tarball': String // 'install' - , jobs: String // 'build' - , thin: String // 'configure' + help: Boolean, // everywhere + arch: String, // 'configure' + cafile: String, // 'install' + debug: Boolean, // 'build' + directory: String, // bin + make: String, // 'build' + msvs_version: String, // 'configure' + ensure: Boolean, // 'install' + solution: String, // 'build' (windows only) + proxy: String, // 'install' + devdir: String, // everywhere + nodedir: String, // 'configure' + loglevel: String, // everywhere + python: String, // 'configure' + 'dist-url': String, // 'install' + 'tarball': String, // 'install' + jobs: String, // 'build' + thin: String // 'configure' } /** @@ -83,13 +82,13 @@ proto.configDefs = { */ proto.shorthands = { - release: '--no-debug' - , C: '--directory' - , debug: '--debug' - , j: '--jobs' - , silly: '--loglevel=silly' - , verbose: '--loglevel=verbose' - , silent: '--loglevel=silent' + release: '--no-debug', + C: '--directory', + debug: '--debug', + j: '--jobs', + silly: '--loglevel=silly', + verbose: '--loglevel=verbose', + silent: '--loglevel=silent' } /** @@ -134,18 +133,22 @@ proto.parseArgv = function parseOpts (argv) { } // support for inheriting config env variables from npm - var npm_config_prefix = 'npm_config_' + var npmConfigPrefix = 'npm_config_' Object.keys(process.env).forEach(function (name) { - if (name.indexOf(npm_config_prefix) !== 0) return + if (name.indexOf(npmConfigPrefix) !== 0) { + return + } var val = process.env[name] - if (name === npm_config_prefix + 'loglevel') { + if (name === npmConfigPrefix + 'loglevel') { log.level = val } else { // add the user-defined options to the config - name = name.substring(npm_config_prefix.length) + name = name.substring(npmConfigPrefix.length) // gyp@741b7f1 enters an infinite loop when it encounters // zero-length options so ensure those don't get through. - if (name) this.opts[name] = val + if (name) { + this.opts[name] = val + } } }, this) @@ -160,11 +163,13 @@ proto.parseArgv = function parseOpts (argv) { */ proto.spawn = function spawn (command, args, opts) { - if (!opts) opts = {} + if (!opts) { + opts = {} + } if (!opts.silent && !opts.stdio) { opts.stdio = [ 0, 1, 2 ] } - var cp = child_process.spawn(command, args, opts) + var cp = childProcess.spawn(command, args, opts) log.info('spawn', command) log.info('spawn args', args) return cp @@ -176,16 +181,16 @@ proto.spawn = function spawn (command, args, opts) { proto.usage = function usage () { var str = [ - '' - , ' Usage: node-gyp [options]' - , '' - , ' where is one of:' - , commands.map(function (c) { - return ' - ' + c + ' - ' + require('./' + c).usage - }).join('\n') - , '' - , 'node-gyp@' + this.version + ' ' + path.resolve(__dirname, '..') - , 'node@' + process.versions.node + '', + ' Usage: node-gyp [options]', + '', + ' where is one of:', + commands.map(function (c) { + return ' - ' + c + ' - ' + require('./' + c).usage + }).join('\n'), + '', + 'node-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), + 'node@' + process.versions.node ].join('\n') return str } @@ -195,8 +200,10 @@ proto.usage = function usage () { */ Object.defineProperty(proto, 'version', { - get: function () { - return this.package.version - } - , enumerable: true + get: function () { + return this.package.version + }, + enumerable: true }) + +module.exports = exports = gyp diff --git a/node_modules/node-gyp/lib/process-release.js b/node_modules/node-gyp/lib/process-release.js index 1be5be97abd61..0acab061bd7b5 100644 --- a/node_modules/node-gyp/lib/process-release.js +++ b/node_modules/node-gyp/lib/process-release.js @@ -1,30 +1,32 @@ -var semver = require('semver') - , url = require('url') - , path = require('path') - , log = require('npmlog') +'use strict' - // versions where -headers.tar.gz started shipping - , headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42' - , bitsre = /\/win-(x86|x64)\// - , bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should - // have been "x86" +const semver = require('semver') +const url = require('url') +const path = require('path') +const log = require('npmlog') + +// versions where -headers.tar.gz started shipping +const headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42' +const bitsre = /\/win-(x86|x64)\// +const bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should +// have been "x86" // Captures all the logic required to determine download URLs, local directory and // file names. Inputs come from command-line switches (--target, --dist-url), // `process.version` and `process.release` where it exists. function processRelease (argv, gyp, defaultVersion, defaultRelease) { var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion - , versionSemver = semver.parse(version) - , overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl - , isDefaultVersion - , isNamedForLegacyIojs - , name - , distBaseUrl - , baseUrl - , libUrl32 - , libUrl64 - , tarballUrl - , canGetHeaders + var versionSemver = semver.parse(version) + var overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl + var isDefaultVersion + var isNamedForLegacyIojs + var name + var distBaseUrl + var baseUrl + var libUrl32 + var libUrl64 + var tarballUrl + var canGetHeaders if (!versionSemver) { // not a valid semver string, nothing we can do @@ -37,8 +39,9 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) { isDefaultVersion = version === semver.parse(defaultVersion).version // can't use process.release if we're using --target=x.y.z - if (!isDefaultVersion) + if (!isDefaultVersion) { defaultRelease = null + } if (defaultRelease) { // v3 onward, has process.release @@ -56,16 +59,19 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) { } // check for the nvm.sh standard mirror env variables - if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR) + if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR) { overrideDistUrl = process.env.NODEJS_ORG_MIRROR + } - if (overrideDistUrl) + if (overrideDistUrl) { log.verbose('download', 'using dist-url', overrideDistUrl) + } - if (overrideDistUrl) + if (overrideDistUrl) { distBaseUrl = overrideDistUrl.replace(/\/+$/, '') - else + } else { distBaseUrl = 'https://nodejs.org/dist' + } distBaseUrl += '/v' + version + '/' // new style, based on process.release so we have a lot of the data we need @@ -97,8 +103,14 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) { tarballUrl: tarballUrl, shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'), versionDir: (name !== 'node' ? name + '-' : '') + version, - ia32: { libUrl: libUrl32, libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl32).path)) }, - x64: { libUrl: libUrl64, libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl64).path)) }, + ia32: { + libUrl: libUrl32, + libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl32).path)) + }, + x64: { + libUrl: libUrl64, + libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl64).path)) + } } } @@ -108,12 +120,13 @@ function normalizePath (p) { function resolveLibUrl (name, defaultUrl, arch, versionMajor) { var base = url.resolve(defaultUrl, './') - , hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl)) + var hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl)) if (!hasLibUrl) { // let's assume it's a baseUrl then - if (versionMajor >= 1) - return url.resolve(base, 'win-' + arch +'/' + name + '.lib') + if (versionMajor >= 1) { + return url.resolve(base, 'win-' + arch + '/' + name + '.lib') + } // prior to io.js@1.0.0 32-bit node.lib lives in /, 64-bit lives in /x64/ return url.resolve(base, (arch === 'x64' ? 'x64/' : '') + name + '.lib') } diff --git a/node_modules/node-gyp/lib/rebuild.js b/node_modules/node-gyp/lib/rebuild.js index dc8025a7b065f..a1c5b27cbe56a 100644 --- a/node_modules/node-gyp/lib/rebuild.js +++ b/node_modules/node-gyp/lib/rebuild.js @@ -1,13 +1,13 @@ - -module.exports = exports = rebuild - -exports.usage = 'Runs "clean", "configure" and "build" all at once' +'use strict' function rebuild (gyp, argv, callback) { gyp.todo.push( - { name: 'clean', args: [] } + { name: 'clean', args: [] } , { name: 'configure', args: argv } , { name: 'build', args: [] } ) process.nextTick(callback) } + +module.exports = rebuild +module.exports.usage = 'Runs "clean", "configure" and "build" all at once' diff --git a/node_modules/node-gyp/lib/remove.js b/node_modules/node-gyp/lib/remove.js index 46a1a3d4c235f..8c945e5659001 100644 --- a/node_modules/node-gyp/lib/remove.js +++ b/node_modules/node-gyp/lib/remove.js @@ -1,13 +1,10 @@ +'use strict' -module.exports = exports = remove - -exports.usage = 'Removes the node development files for the specified version' - -var fs = require('fs') - , rm = require('rimraf') - , path = require('path') - , log = require('npmlog') - , semver = require('semver') +const fs = require('fs') +const rm = require('rimraf') +const path = require('path') +const log = require('npmlog') +const semver = require('semver') function remove (gyp, argv, callback) { var devDir = gyp.devDir @@ -33,7 +30,7 @@ function remove (gyp, argv, callback) { // first check if its even installed fs.stat(versionPath, function (err) { if (err) { - if (err.code == 'ENOENT') { + if (err.code === 'ENOENT') { callback(null, 'version was already uninstalled: ' + version) } else { callback(err) @@ -44,3 +41,6 @@ function remove (gyp, argv, callback) { rm(versionPath, callback) }) } + +module.exports = exports = remove +module.exports.usage = 'Removes the node development files for the specified version' diff --git a/node_modules/node-gyp/lib/util.js b/node_modules/node-gyp/lib/util.js index ac6a8753541c7..3e23c628e6ad7 100644 --- a/node_modules/node-gyp/lib/util.js +++ b/node_modules/node-gyp/lib/util.js @@ -1,23 +1,19 @@ -module.exports = { - logWithPrefix: logWithPrefix, - regGetValue: regGetValue, - regSearchKeys: regSearchKeys -} +'use strict' const log = require('npmlog') const execFile = require('child_process').execFile const path = require('path') function logWithPrefix (log, prefix) { - function setPrefix(logFunction) { - return (...args) => logFunction.apply(null, [prefix, ...args]) + function setPrefix (logFunction) { + return (...args) => logFunction.apply(null, [ prefix, ...args ]) // eslint-disable-line } return { silly: setPrefix(log.silly), verbose: setPrefix(log.verbose), info: setPrefix(log.info), warn: setPrefix(log.warn), - error: setPrefix(log.error), + error: setPrefix(log.error) } } @@ -60,3 +56,9 @@ function regSearchKeys (keys, value, addOpts, cb) { } search() } + +module.exports = { + logWithPrefix: logWithPrefix, + regGetValue: regGetValue, + regSearchKeys: regSearchKeys +} diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json index b89cf29ee2481..bffb3c774b4b6 100644 --- a/node_modules/node-gyp/package.json +++ b/node_modules/node-gyp/package.json @@ -1,8 +1,8 @@ { - "_from": "node-gyp@5.0.2", - "_id": "node-gyp@5.0.2", + "_from": "node-gyp@5.0.3", + "_id": "node-gyp@5.0.3", "_inBundle": false, - "_integrity": "sha512-sNcb5O7eJ9XiNAhWZ/UE2bWsBJn3Jb7rayMqMP4wjenlr1DwzZxUmbtmIrl04EU0p5fN2rU9WIDV+u0EbsI8oQ==", + "_integrity": "sha512-z/JdtkFGUm0QaQUusvloyYuGDub3nUbOo5de1Fz57cM++osBTvQatBUSTlF1k/w8vFHPxxXW6zxGvkxXSpaBkQ==", "_location": "/node-gyp", "_phantomChildren": { "abbrev": "1.1.1" @@ -10,20 +10,21 @@ "_requested": { "type": "version", "registry": true, - "raw": "node-gyp@5.0.2", + "raw": "node-gyp@5.0.3", "name": "node-gyp", "escapedName": "node-gyp", - "rawSpec": "5.0.2", + "rawSpec": "5.0.3", "saveSpec": null, - "fetchSpec": "5.0.2" + "fetchSpec": "5.0.3" }, "_requiredBy": [ "#USER", - "/" + "/", + "/npm-lifecycle" ], - "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-5.0.2.tgz", - "_shasum": "422f7b7550d2c37952ac184e2a5a2d9fe49a8b77", - "_spec": "node-gyp@5.0.2", + "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-5.0.3.tgz", + "_shasum": "80d64c23790244991b6d44532f0a351bedd3dd45", + "_spec": "node-gyp@5.0.3", "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Nathan Rajlich", @@ -53,12 +54,11 @@ "deprecated": false, "description": "Node.js native addon build tool", "devDependencies": { - "babel-eslint": "^8.2.5", "bindings": "~1.2.1", - "eslint": "^5.0.1", "nan": "^2.0.0", "require-inject": "~1.3.0", - "tap": "~14.2.4" + "standard": "~12.0.1", + "tap": "~12.7.0" }, "engines": { "node": ">= 6.0.0" @@ -83,9 +83,8 @@ "url": "git://github.com/nodejs/node-gyp.git" }, "scripts": { - "lint": "eslint bin lib test", - "test": "npm run lint && tap test/test-*", - "test-ci": "npm run lint && tap -Rtap test/test-*" + "lint": "standard */*.js test/**/*.js", + "test": "npm run lint && tap --timeout=120 test/test-*" }, - "version": "5.0.2" + "version": "5.0.3" } diff --git a/node_modules/node-gyp/test/process-exec-sync.js b/node_modules/node-gyp/test/process-exec-sync.js index 13daf308a3e9b..f786484027cde 100644 --- a/node_modules/node-gyp/test/process-exec-sync.js +++ b/node_modules/node-gyp/test/process-exec-sync.js @@ -1,15 +1,17 @@ 'use strict' -var fs = require('graceful-fs') -var child_process = require('child_process') +const fs = require('graceful-fs') +const childProcess = require('child_process') -if (!String.prototype.startsWith) { - String.prototype.startsWith = function(search, pos) { - return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search +function startsWith (str, search, pos) { + if (String.prototype.startsWith) { + return str.startsWith(search, pos) } + + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search } -function processExecSync(file, args, options) { +function processExecSync (file, args, options) { var child, error, timeout, tmpdir, command command = makeCommand(file, args) @@ -22,19 +24,19 @@ function processExecSync(file, args, options) { // init timeout timeout = Date.now() + options.timeout // init tmpdir - var os_temp_base = '/tmp' - var os = determine_os() - os_temp_base = '/tmp' + var osTempBase = '/tmp' + var os = determineOS() + osTempBase = '/tmp' if (process.env.TMP) { - os_temp_base = process.env.TMP + osTempBase = process.env.TMP } - if (os_temp_base[os_temp_base.length - 1] !== '/') { - os_temp_base += '/' + if (osTempBase[osTempBase.length - 1] !== '/') { + osTempBase += '/' } - tmpdir = os_temp_base + 'processExecSync.' + Date.now() + Math.random() + tmpdir = osTempBase + 'processExecSync.' + Date.now() + Math.random() fs.mkdirSync(tmpdir) // init command @@ -47,7 +49,7 @@ function processExecSync(file, args, options) { } // init child - child = child_process.exec(command, options) + child = childProcess.exec(command, options) var maxTry = 100000 // increases the test time by 6 seconds on win-2016-node-0.10 var tryCount = 0 @@ -65,7 +67,7 @@ function processExecSync(file, args, options) { } } - ['stdout', 'stderr', 'status'].forEach(function (file) { + [ 'stdout', 'stderr', 'status' ].forEach(function (file) { child[file] = fs.readFileSync(tmpdir + '/' + file, options.encoding) setTimeout(unlinkFile, 500, tmpdir + '/' + file) }) @@ -84,23 +86,23 @@ function processExecSync(file, args, options) { return child.stdout } -function makeCommand(file, args) { +function makeCommand (file, args) { var command, quote command = file if (args.length > 0) { - for(var i in args) { + for (var i in args) { command = command + ' ' if (args[i][0] === '-') { command = command + args[i] } else { if (!quote) { - command = command + '\"' + command = command + '"' quote = true } command = command + args[i] if (quote) { if (args.length === (parseInt(i) + 1)) { - command = command + '\"' + command = command + '"' } } } @@ -109,29 +111,29 @@ function makeCommand(file, args) { return command } -function determine_os() { +function determineOS () { var os = '' var tmpVar = '' if (process.env.OSTYPE) { tmpVar = process.env.OSTYPE - } else if (process.env.OS) { + } else if (process.env.OS) { tmpVar = process.env.OS } else { - //default is linux + // default is linux tmpVar = 'linux' } - if (tmpVar.startsWith('linux')) { + if (startsWith(tmpVar, 'linux')) { os = 'linux' } - if (tmpVar.startsWith('win')) { + if (startsWith(tmpVar, 'win')) { os = 'win' } return os } -function unlinkFile(file) { +function unlinkFile (file) { fs.unlinkSync(file) } diff --git a/node_modules/node-gyp/test/simple-proxy.js b/node_modules/node-gyp/test/simple-proxy.js index 8ac737a652477..cb0dfcfec7edc 100644 --- a/node_modules/node-gyp/test/simple-proxy.js +++ b/node_modules/node-gyp/test/simple-proxy.js @@ -1,22 +1,26 @@ -var http = require('http') - , https = require('https') - , server = http.createServer(handler) - , port = +process.argv[2] - , prefix = process.argv[3] - , upstream = process.argv[4] - , calls = 0 +'use strict' + +const http = require('http') +const https = require('https') +const server = http.createServer(handler) +const port = +process.argv[2] +const prefix = process.argv[3] +const upstream = process.argv[4] +var calls = 0 server.listen(port) function handler (req, res) { - if (req.url.indexOf(prefix) != 0) + if (req.url.indexOf(prefix) !== 0) { throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']') + } var upstreamUrl = upstream + req.url.substring(prefix.length) https.get(upstreamUrl, function (ures) { ures.on('end', function () { - if (++calls == 2) + if (++calls === 2) { server.close() + } }) ures.pipe(res) }) diff --git a/node_modules/node-gyp/test/test-addon.js b/node_modules/node-gyp/test/test-addon.js index ce447bf3657dd..f97215c0a2652 100644 --- a/node_modules/node-gyp/test/test-addon.js +++ b/node_modules/node-gyp/test/test-addon.js @@ -1,42 +1,33 @@ 'use strict' -var test = require('tap').test -var path = require('path') -var fs = require('graceful-fs') -var child_process = require('child_process') -var os = require('os') -var addonPath = path.resolve(__dirname, 'node_modules', 'hello_world') -var nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js') -var execFileSync = child_process.execFileSync || require('./process-exec-sync') -var execFile = child_process.execFile - -function runHello(hostProcess) { +const test = require('tap').test +const path = require('path') +const fs = require('graceful-fs') +const childProcess = require('child_process') +const os = require('os') +const addonPath = path.resolve(__dirname, 'node_modules', 'hello_world') +const nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js') +const execFileSync = childProcess.execFileSync || require('./process-exec-sync') +const execFile = childProcess.execFile + +function runHello (hostProcess) { if (!hostProcess) { hostProcess = process.execPath } var testCode = "console.log(require('hello_world').hello())" - return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString() + return execFileSync(hostProcess, [ '-e', testCode ], { cwd: __dirname }).toString() } -function runDuplicateBindings() { - const hostProcess = process.execPath; - var testCode = - "console.log((function(bindings) {" + - "return bindings.pointerCheck1(bindings.pointerCheck2());" + - "})(require('duplicate_symbols')))" - return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString() -} - -function getEncoding() { +function getEncoding () { var code = 'import locale;print(locale.getdefaultlocale()[1])' - return execFileSync('python', ['-c', code]).toString().trim() + return execFileSync('python', [ '-c', code ]).toString().trim() } -function checkCharmapValid() { +function checkCharmapValid () { var data try { - data = execFileSync('python', ['fixtures/test-charmap.py'], - { cwd: __dirname }) + data = execFileSync('python', [ 'fixtures/test-charmap.py' ], + { cwd: __dirname }) } catch (err) { return false } @@ -48,10 +39,10 @@ test('build simple addon', function (t) { t.plan(3) // Set the loglevel otherwise the output disappears when run via 'npm test' - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] + var cmd = [ nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose' ] var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length-1] + var lastLine = logLines[logLines.length - 1] t.strictEqual(err, null) t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') t.strictEqual(runHello().trim(), 'world') @@ -60,21 +51,6 @@ test('build simple addon', function (t) { proc.stderr.setEncoding('utf-8') }) -test('make sure addon symbols do not overlap', function (t) { - t.plan(3) - - var addonPath = path.resolve(__dirname, 'node_modules', 'duplicate_symbols') - // Set the loglevel otherwise the output disappears when run via 'npm test' - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] - execFile(process.execPath, cmd, function (err, stdout, stderr) { - var logLines = stderr.trim().split(/\r?\n/) - var lastLine = logLines[logLines.length-1] - t.strictEqual(err, null) - t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') - t.strictEqual(runDuplicateBindings().trim(), 'not equal') - }) -}) - test('build simple addon in path with non-ascii characters', function (t) { t.plan(1) @@ -96,14 +72,15 @@ test('build simple addon in path with non-ascii characters', function (t) { t.plan(3) - var data, configPath = path.join(addonPath, 'build', 'config.gypi') + var data + var configPath = path.join(addonPath, 'build', 'config.gypi') try { data = fs.readFileSync(configPath, 'utf8') } catch (err) { t.error(err) return } - var config = JSON.parse(data.replace(/\#.+\n/, '')) + var config = JSON.parse(data.replace(/#.+\n/, '')) var nodeDir = config.variables.nodedir var testNodeDir = path.join(addonPath, testDirName) // Create symbol link to path with non-ascii characters @@ -121,8 +98,14 @@ test('build simple addon in path with non-ascii characters', function (t) { } } - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, - '--loglevel=verbose', '-nodedir=' + testNodeDir] + var cmd = [ + nodeGyp, + 'rebuild', + '-C', + addonPath, + '--loglevel=verbose', + '-nodedir=' + testNodeDir + ] var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { try { fs.unlink(testNodeDir) @@ -131,7 +114,7 @@ test('build simple addon in path with non-ascii characters', function (t) { } var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length-1] + var lastLine = logLines[logLines.length - 1] t.strictEqual(err, null) t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') t.strictEqual(runHello().trim(), 'world') @@ -143,9 +126,9 @@ test('build simple addon in path with non-ascii characters', function (t) { test('addon works with renamed host executable', function (t) { // No `fs.copyFileSync` before node8. if (process.version.substr(1).split('.')[0] < 8) { - t.skip("skipping test for old node version"); - t.end(); - return; + t.skip('skipping test for old node version') + t.end() + return } t.plan(3) @@ -153,10 +136,10 @@ test('addon works with renamed host executable', function (t) { var notNodePath = path.join(os.tmpdir(), 'notnode' + path.extname(process.execPath)) fs.copyFileSync(process.execPath, notNodePath) - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] + var cmd = [ nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose' ] var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length-1] + var lastLine = logLines[logLines.length - 1] t.strictEqual(err, null) t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') t.strictEqual(runHello(notNodePath).trim(), 'world') diff --git a/node_modules/node-gyp/test/test-configure-python.js b/node_modules/node-gyp/test/test-configure-python.js index 895e488ba8807..41b8c70427336 100644 --- a/node_modules/node-gyp/test/test-configure-python.js +++ b/node_modules/node-gyp/test/test-configure-python.js @@ -1,21 +1,21 @@ 'use strict' -var test = require('tap').test -var path = require('path') -var gyp = require('../lib/node-gyp') -var requireInject = require('require-inject') -var configure = requireInject('../lib/configure', { +const test = require('tap').test +const path = require('path') +const gyp = require('../lib/node-gyp') +const requireInject = require('require-inject') +const configure = requireInject('../lib/configure', { 'graceful-fs': { - 'openSync': function () { return 0; }, + 'openSync': function () { return 0 }, 'closeSync': function () { }, 'writeFile': function (file, data, cb) { cb() }, 'stat': function (file, cb) { cb(null, {}) } } }) -var EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib') -var SEPARATOR = process.platform == 'win32' ? ';' : ':' -var SPAWN_RESULT = { on: function () { } } +const EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib') +const SEPARATOR = process.platform === 'win32' ? ';' : ':' +const SPAWN_RESULT = { on: function () { } } require('npmlog').level = 'warn' @@ -42,11 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) { var prog = gyp() prog.parseArgv([]) prog.spawn = function () { - - t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) + t.equal(process.env.PYTHONPATH, [ EXPECTED_PYPATH, existingPath ].join(SEPARATOR)) var dirs = process.env.PYTHONPATH.split(SEPARATOR) - t.deepEqual(dirs, [EXPECTED_PYPATH, existingPath]) + t.deepEqual(dirs, [ EXPECTED_PYPATH, existingPath ]) return SPAWN_RESULT } @@ -58,17 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) { var pythonDir1 = path.join('a', 'b') var pythonDir2 = path.join('b', 'c') - var existingPath = [pythonDir1, pythonDir2].join(SEPARATOR) + var existingPath = [ pythonDir1, pythonDir2 ].join(SEPARATOR) process.env.PYTHONPATH = existingPath var prog = gyp() prog.parseArgv([]) prog.spawn = function () { - - t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) + t.equal(process.env.PYTHONPATH, [ EXPECTED_PYPATH, existingPath ].join(SEPARATOR)) var dirs = process.env.PYTHONPATH.split(SEPARATOR) - t.deepEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2]) + t.deepEqual(dirs, [ EXPECTED_PYPATH, pythonDir1, pythonDir2 ]) return SPAWN_RESULT } diff --git a/node_modules/node-gyp/test/test-download.js b/node_modules/node-gyp/test/test-download.js index 52b881271ae74..dbffb20246267 100644 --- a/node_modules/node-gyp/test/test-download.js +++ b/node_modules/node-gyp/test/test-download.js @@ -1,10 +1,11 @@ 'use strict' -var test = require('tap').test -var fs = require('fs') -var http = require('http') -var https = require('https') -var install = require('../lib/install') +const test = require('tap').test +const fs = require('fs') +const path = require('path') +const http = require('http') +const https = require('https') +const install = require('../lib/install') require('npmlog').level = 'warn' @@ -13,7 +14,7 @@ test('download over http', function (t) { var server = http.createServer(function (req, res) { t.strictEqual(req.headers['user-agent'], - 'node-gyp v42 (node ' + process.version + ')') + 'node-gyp v42 (node ' + process.version + ')') res.end('ok') server.close() }) @@ -23,17 +24,17 @@ test('download over http', function (t) { var port = this.address().port var gyp = { opts: {}, - version: '42', + version: '42' } var url = 'http://' + host + ':' + port var req = install.test.download(gyp, {}, url) req.on('response', function (res) { var body = '' res.setEncoding('utf8') - res.on('data', function(data) { + res.on('data', function (data) { body += data }) - res.on('end', function() { + res.on('end', function () { t.strictEqual(body, 'ok') }) }) @@ -43,17 +44,17 @@ test('download over http', function (t) { test('download over https with custom ca', function (t) { t.plan(3) - var cert = fs.readFileSync(__dirname + '/fixtures/server.crt', 'utf8') - var key = fs.readFileSync(__dirname + '/fixtures/server.key', 'utf8') + var cert = fs.readFileSync(path.join(__dirname, 'fixtures/server.crt'), 'utf8') + var key = fs.readFileSync(path.join(__dirname, 'fixtures/server.key'), 'utf8') - var cafile = __dirname + '/fixtures/ca.crt' + var cafile = path.join(__dirname, '/fixtures/ca.crt') var ca = install.test.readCAFile(cafile) t.strictEqual(ca.length, 1) var options = { ca: ca, cert: cert, key: key } var server = https.createServer(options, function (req, res) { t.strictEqual(req.headers['user-agent'], - 'node-gyp v42 (node ' + process.version + ')') + 'node-gyp v42 (node ' + process.version + ')') res.end('ok') server.close() }) @@ -67,17 +68,17 @@ test('download over https with custom ca', function (t) { var port = this.address().port var gyp = { opts: { cafile: cafile }, - version: '42', + version: '42' } var url = 'https://' + host + ':' + port var req = install.test.download(gyp, {}, url) req.on('response', function (res) { var body = '' res.setEncoding('utf8') - res.on('data', function(data) { + res.on('data', function (data) { body += data }) - res.on('end', function() { + res.on('end', function () { t.strictEqual(body, 'ok') }) }) @@ -87,7 +88,7 @@ test('download over https with custom ca', function (t) { test('download with missing cafile', function (t) { t.plan(1) var gyp = { - opts: { cafile: 'no.such.file' }, + opts: { cafile: 'no.such.file' } } try { install.test.download(gyp, {}, 'http://bad/') @@ -97,7 +98,7 @@ test('download with missing cafile', function (t) { }) test('check certificate splitting', function (t) { - var cas = install.test.readCAFile(__dirname + '/fixtures/ca-bundle.crt') + var cas = install.test.readCAFile(path.join(__dirname, 'fixtures/ca-bundle.crt')) t.plan(2) t.strictEqual(cas.length, 2) t.notStrictEqual(cas[0], cas[1]) diff --git a/node_modules/node-gyp/test/test-find-accessible-sync.js b/node_modules/node-gyp/test/test-find-accessible-sync.js index 15adec5379d21..32234f5389c1d 100644 --- a/node_modules/node-gyp/test/test-find-accessible-sync.js +++ b/node_modules/node-gyp/test/test-find-accessible-sync.js @@ -1,13 +1,13 @@ 'use strict' -var test = require('tap').test -var path = require('path') -var requireInject = require('require-inject') -var configure = requireInject('../lib/configure', { +const test = require('tap').test +const path = require('path') +const requireInject = require('require-inject') +const configure = requireInject('../lib/configure', { 'graceful-fs': { 'closeSync': function () { return undefined }, 'openSync': function (path) { - if (readableFiles.some(function (f) { return f === path} )) { + if (readableFiles.some(function (f) { return f === path })) { return 0 } else { var error = new Error('ENOENT - not found') @@ -17,11 +17,11 @@ var configure = requireInject('../lib/configure', { } }) -var dir = path.sep + 'testdir' -var readableFile = 'readable_file' -var anotherReadableFile = 'another_readable_file' -var readableFileInDir = 'somedir' + path.sep + readableFile -var readableFiles = [ +const dir = path.sep + 'testdir' +const readableFile = 'readable_file' +const anotherReadableFile = 'another_readable_file' +const readableFileInDir = 'somedir' + path.sep + readableFile +const readableFiles = [ path.resolve(dir, readableFile), path.resolve(dir, anotherReadableFile), path.resolve(dir, readableFileInDir) @@ -59,7 +59,6 @@ test('find accessible - single item array, unreadable', function (t) { t.strictEqual(found, undefined) }) - test('find accessible - multi item array, no matches', function (t) { t.plan(1) @@ -68,7 +67,6 @@ test('find accessible - multi item array, no matches', function (t) { t.strictEqual(found, undefined) }) - test('find accessible - multi item array, single match', function (t) { t.plan(1) diff --git a/node_modules/node-gyp/test/test-find-node-directory.js b/node_modules/node-gyp/test/test-find-node-directory.js index 7cc680d1fa8f5..767b6f6b37d20 100644 --- a/node_modules/node-gyp/test/test-find-node-directory.js +++ b/node_modules/node-gyp/test/test-find-node-directory.js @@ -1,8 +1,10 @@ -var test = require('tap').test -var path = require('path') -var findNodeDirectory = require('../lib/find-node-directory') +'use strict' -var platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix'] +const test = require('tap').test +const path = require('path') +const findNodeDirectory = require('../lib/find-node-directory') + +const platforms = [ 'darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix' ] // we should find the directory based on the directory // the script is running in and it should match the layout @@ -11,10 +13,10 @@ var platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix'] test('test find-node-directory - node install', function (t) { t.plan(platforms.length) for (var next = 0; next < platforms.length; next++) { - var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]} + var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } t.equal( findNodeDirectory('/x/deps/npm/node_modules/node-gyp/lib', processObj), - path.join('/x')) + path.join('/x')) } }) @@ -26,15 +28,15 @@ test('test find-node-directory - node install', function (t) { test('test find-node-directory - node build', function (t) { t.plan(platforms.length) for (var next = 0; next < platforms.length; next++) { - var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]} + var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } if (platforms[next] === 'win32') { t.equal( findNodeDirectory('/y/node_modules/npm/node_modules/node-gyp/lib', - processObj), path.join('/y')) + processObj), path.join('/y')) } else { t.equal( findNodeDirectory('/y/lib/node_modules/npm/node_modules/node-gyp/lib', - processObj), path.join('/y')) + processObj), path.join('/y')) } } }) @@ -44,7 +46,7 @@ test('test find-node-directory - node build', function (t) { test('test find-node-directory - node in bin directory', function (t) { t.plan(platforms.length) for (var next = 0; next < platforms.length; next++) { - var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]} + var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } t.equal( findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), path.join('/x/y')) @@ -58,15 +60,15 @@ test('test find-node-directory - node in build release dir', function (t) { for (var next = 0; next < platforms.length; next++) { var processObj if (platforms[next] === 'win32') { - processObj = {execPath: '/x/y/Release/node', platform: platforms[next]} + processObj = { execPath: '/x/y/Release/node', platform: platforms[next] } } else { - processObj = {execPath: '/x/y/out/Release/node', - platform: platforms[next]} + processObj = { execPath: '/x/y/out/Release/node', + platform: platforms[next] } } t.equal( findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), - path.join('/x/y')) + path.join('/x/y')) } }) @@ -77,14 +79,14 @@ test('test find-node-directory - node in Debug release dir', function (t) { for (var next = 0; next < platforms.length; next++) { var processObj if (platforms[next] === 'win32') { - processObj = {execPath: '/a/b/Debug/node', platform: platforms[next]} + processObj = { execPath: '/a/b/Debug/node', platform: platforms[next] } } else { - processObj = {execPath: '/a/b/out/Debug/node', platform: platforms[next]} + processObj = { execPath: '/a/b/out/Debug/node', platform: platforms[next] } } t.equal( findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), - path.join('/a/b')) + path.join('/a/b')) } }) @@ -93,7 +95,7 @@ test('test find-node-directory - node in Debug release dir', function (t) { test('test find-node-directory - not found', function (t) { t.plan(platforms.length) for (var next = 0; next < platforms.length; next++) { - var processObj = {execPath: '/x/y/z/y', platform:next} + var processObj = { execPath: '/x/y/z/y', platform: next } t.equal(findNodeDirectory('/a/b/c/d', processObj), '') } }) @@ -107,9 +109,9 @@ test('test find-node-directory - not found', function (t) { test('test find-node-directory - node install', function (t) { t.plan(platforms.length) for (var next = 0; next < platforms.length; next++) { - var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]} + var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } t.equal( findNodeDirectory('/x/y/z/a/b/c/deps/npm/node_modules/node-gyp/lib', - processObj), path.join('/x/y/z/a/b/c')) + processObj), path.join('/x/y/z/a/b/c')) } }) diff --git a/node_modules/node-gyp/test/test-find-python.js b/node_modules/node-gyp/test/test-find-python.js index fbb35c3d36fd5..c52a5796663ee 100644 --- a/node_modules/node-gyp/test/test-find-python.js +++ b/node_modules/node-gyp/test/test-find-python.js @@ -1,16 +1,19 @@ 'use strict' -var test = require('tap').test -var configure = require('../lib/configure') -var execFile = require('child_process').execFile -var PythonFinder = configure.test.PythonFinder +const test = require('tap').test +const findPython = require('../lib/find-python') +const execFile = require('child_process').execFile +const PythonFinder = findPython.test.PythonFinder + +delete process.env.PYTHON +delete process.env.NODE_GYP_FORCE_PYTHON require('npmlog').level = 'warn' test('find python', function (t) { t.plan(4) - configure.test.findPython(null, function (err, found) { + findPython.test.findPython(null, function (err, found) { t.strictEqual(err, null) var proc = execFile(found, ['-V'], function (err, stdout, stderr) { t.strictEqual(err, null) @@ -22,8 +25,8 @@ test('find python', function (t) { }) }) -function poison(object, property) { - function fail() { +function poison (object, property) { + function fail () { console.error(Error(`Property ${property} should not have been accessed.`)) process.abort() } @@ -31,12 +34,14 @@ function poison(object, property) { configurable: false, enumerable: false, get: fail, - set: fail, + set: fail } Object.defineProperty(object, property, descriptor) } -function TestPythonFinder() { PythonFinder.apply(this, arguments) } +function TestPythonFinder () { + PythonFinder.apply(this, arguments) +} TestPythonFinder.prototype = Object.create(PythonFinder.prototype) // Silence npmlog - remove for debugging TestPythonFinder.prototype.log = { @@ -44,28 +49,28 @@ TestPythonFinder.prototype.log = { verbose: () => {}, info: () => {}, warn: () => {}, - error: () => {}, + error: () => {} } test('find python - python', function (t) { t.plan(6) var f = new TestPythonFinder('python', done) - f.execFile = function(program, args, opts, cb) { - f.execFile = function(program, args, opts, cb) { + f.execFile = function (program, args, opts, cb) { + f.execFile = function (program, args, opts, cb) { poison(f, 'execFile') t.strictEqual(program, '/path/python') t.ok(/sys\.version_info/.test(args[1])) cb(null, '2.7.15') } t.strictEqual(program, - process.platform === 'win32' ? '"python"' : 'python') + process.platform === 'win32' ? '"python"' : 'python') t.ok(/sys\.executable/.test(args[1])) cb(null, '/path/python') } f.findPython() - function done(err, python) { + function done (err, python) { t.strictEqual(err, null) t.strictEqual(python, '/path/python') } @@ -75,10 +80,10 @@ test('find python - python too old', function (t) { t.plan(2) var f = new TestPythonFinder(null, done) - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { + f.execFile = function (program, args, opts, cb) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(null, '/path/python') - } else if (/sys\.version_info/.test(args[args.length-1])) { + } else if (/sys\.version_info/.test(args[args.length - 1])) { cb(null, '2.3.4') } else { t.fail() @@ -86,28 +91,7 @@ test('find python - python too old', function (t) { } f.findPython() - function done(err) { - t.ok(/Could not find any Python/.test(err)) - t.ok(/not supported/i.test(f.errorLog)) - } -}) - -test('find python - python too new', function (t) { - t.plan(2) - - var f = new TestPythonFinder(null, done) - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { - cb(null, '/path/python') - } else if (/sys\.version_info/.test(args[args.length-1])) { - cb(null, '3.0.0') - } else { - t.fail() - } - } - f.findPython() - - function done(err) { + function done (err) { t.ok(/Could not find any Python/.test(err)) t.ok(/not supported/i.test(f.errorLog)) } @@ -117,10 +101,10 @@ test('find python - no python', function (t) { t.plan(2) var f = new TestPythonFinder(null, done) - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { + f.execFile = function (program, args, opts, cb) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length-1])) { + } else if (/sys\.version_info/.test(args[args.length - 1])) { cb(new Error('not a Python executable')) } else { t.fail() @@ -128,37 +112,12 @@ test('find python - no python', function (t) { } f.findPython() - function done(err) { + function done (err) { t.ok(/Could not find any Python/.test(err)) t.ok(/not in PATH/.test(f.errorLog)) } }) -test('find python - no python2', function (t) { - t.plan(2) - - var f = new TestPythonFinder(null, done) - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { - if (program == 'python2') { - cb(new Error('not found')) - } else { - cb(null, '/path/python') - } - } else if (/sys\.version_info/.test(args[args.length-1])) { - cb(null, '2.7.14') - } else { - t.fail() - } - } - f.findPython() - - function done(err, python) { - t.strictEqual(err, null) - t.strictEqual(python, '/path/python') - } -}) - test('find python - no python2, no python, unix', function (t) { t.plan(2) @@ -166,8 +125,8 @@ test('find python - no python2, no python, unix', function (t) { f.checkPyLauncher = t.fail f.win = false - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { + f.execFile = function (program, args, opts, cb) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(new Error('not found')) } else { t.fail() @@ -175,7 +134,7 @@ test('find python - no python2, no python, unix', function (t) { } f.findPython() - function done(err) { + function done (err) { t.ok(/Could not find any Python/.test(err)) t.ok(/not in PATH/.test(f.errorLog)) } @@ -187,15 +146,15 @@ test('find python - no python, use python launcher', function (t) { var f = new TestPythonFinder(null, done) f.win = true - f.execFile = function(program, args, opts, cb) { + f.execFile = function (program, args, opts, cb) { if (program === 'py.exe') { t.notEqual(args.indexOf('-2'), -1) t.notEqual(args.indexOf('-c'), -1) return cb(null, 'Z:\\snake.exe') } - if (/sys\.executable/.test(args[args.length-1])) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length-1])) { + } else if (/sys\.version_info/.test(args[args.length - 1])) { if (program === 'Z:\\snake.exe') { cb(null, '2.7.14') } else { @@ -207,112 +166,30 @@ test('find python - no python, use python launcher', function (t) { } f.findPython() - function done(err, python) { - t.strictEqual(err, null) - t.strictEqual(python, 'Z:\\snake.exe') - } -}) - -test('find python - python 3, use python launcher', function (t) { - t.plan(4) - - var f = new TestPythonFinder(null, done) - f.win = true - - f.execFile = function(program, args, opts, cb) { - if (program === 'py.exe') { - f.execFile = function(program, args, opts, cb) { - poison(f, 'execFile') - if (/sys\.version_info/.test(args[args.length-1])) { - cb(null, '2.7.14') - } else { - t.fail() - } - } - t.notEqual(args.indexOf('-2'), -1) - t.notEqual(args.indexOf('-c'), -1) - return cb(null, 'Z:\\snake.exe') - } - if (/sys\.executable/.test(args[args.length-1])) { - cb(null, '/path/python') - } else if (/sys\.version_info/.test(args[args.length-1])) { - cb(null, '3.0.0') - } else { - t.fail() - } - } - f.findPython() - - function done(err, python) { + function done (err, python) { t.strictEqual(err, null) t.strictEqual(python, 'Z:\\snake.exe') } }) -test('find python - python 3, use python launcher, python 2 too old', - function (t) { - t.plan(6) - - var f = new TestPythonFinder(null, done) - f.win = true - - f.execFile = function(program, args, opts, cb) { - if (program === 'py.exe') { - f.execFile = function(program, args, opts, cb) { - if (/sys\.version_info/.test(args[args.length-1])) { - f.execFile = function(program, args, opts, cb) { - if (/sys\.version_info/.test(args[args.length-1])) { - poison(f, 'execFile') - t.strictEqual(program, f.defaultLocation) - cb(new Error('not found')) - } else { - t.fail() - } - } - t.strictEqual(program, 'Z:\\snake.exe') - cb(null, '2.3.4') - } else { - t.fail() - } - } - t.notEqual(args.indexOf('-2'), -1) - t.notEqual(args.indexOf('-c'), -1) - return cb(null, 'Z:\\snake.exe') - } - if (/sys\.executable/.test(args[args.length-1])) { - cb(null, '/path/python') - } else if (/sys\.version_info/.test(args[args.length-1])) { - cb(null, '3.0.0') - } else { - t.fail() - } - } - f.findPython() - - function done(err) { - t.ok(/Could not find any Python/.test(err)) - t.ok(/not supported/i.test(f.errorLog)) - } -}) - test('find python - no python, no python launcher, good guess', function (t) { t.plan(4) - var re = /C:[\\\/]Python27[\\\/]python[.]exe/ + var re = /C:[\\/]Python27[\\/]python[.]exe/ var f = new TestPythonFinder(null, done) f.win = true - f.execFile = function(program, args, opts, cb) { + f.execFile = function (program, args, opts, cb) { if (program === 'py.exe') { - f.execFile = function(program, args, opts, cb) { + f.execFile = function (program, args, opts, cb) { poison(f, 'execFile') t.ok(re.test(program)) - t.ok(/sys\.version_info/.test(args[args.length-1])) + t.ok(/sys\.version_info/.test(args[args.length - 1])) cb(null, '2.7.14') } return cb(new Error('not found')) } - if (/sys\.executable/.test(args[args.length-1])) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(new Error('not found')) } else { t.fail() @@ -320,7 +197,7 @@ test('find python - no python, no python launcher, good guess', function (t) { } f.findPython() - function done(err, python) { + function done (err, python) { t.strictEqual(err, null) t.ok(re.test(python)) } @@ -332,10 +209,10 @@ test('find python - no python, no python launcher, bad guess', function (t) { var f = new TestPythonFinder(null, done) f.win = true - f.execFile = function(program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length-1])) { + f.execFile = function (program, args, opts, cb) { + if (/sys\.executable/.test(args[args.length - 1])) { cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length-1])) { + } else if (/sys\.version_info/.test(args[args.length - 1])) { cb(new Error('not a Python executable')) } else { t.fail() @@ -343,7 +220,7 @@ test('find python - no python, no python launcher, bad guess', function (t) { } f.findPython() - function done(err) { + function done (err) { t.ok(/Could not find any Python/.test(err)) t.ok(/not in PATH/.test(f.errorLog)) } diff --git a/node_modules/node-gyp/test/test-find-visualstudio.js b/node_modules/node-gyp/test/test-find-visualstudio.js index cf6349c80894e..b00adf022719a 100644 --- a/node_modules/node-gyp/test/test-find-visualstudio.js +++ b/node_modules/node-gyp/test/test-find-visualstudio.js @@ -1,6 +1,6 @@ 'use strict' -var test = require('tap').test +const test = require('tap').test const fs = require('fs') const path = require('path') const findVisualStudio = require('../lib/find-visualstudio') @@ -525,7 +525,7 @@ test('look for VS2019 by version number', function (t) { finder.findVisualStudio() }) -test('look for VS2017 by installation path', function (t) { +test('look for VS2019 by installation path', function (t) { t.plan(2) const finder = new TestVisualStudioFinder(semverV1, @@ -540,6 +540,21 @@ test('look for VS2017 by installation path', function (t) { finder.findVisualStudio() }) +test('msvs_version match should be case insensitive', function (t) { + t.plan(2) + + const finder = new TestVisualStudioFinder(semverV1, + 'c:\\program files (x86)\\microsoft visual studio\\2019\\BUILDTOOLS', + (err, info) => { + t.strictEqual(err, null) + t.deepEqual(info.path, + 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools') + }) + + allVsVersions(t, finder) + finder.findVisualStudio() +}) + test('latest version should be found by default', function (t) { t.plan(2) @@ -568,6 +583,22 @@ test('run on a usable VS Command Prompt', function (t) { finder.findVisualStudio() }) +test('VCINSTALLDIR match should be case insensitive', function (t) { + t.plan(2) + + process.env.VCINSTALLDIR = + 'c:\\program files (x86)\\microsoft visual studio\\2019\\BUILDTOOLS\\VC' + + const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { + t.strictEqual(err, null) + t.deepEqual(info.path, + 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools') + }) + + allVsVersions(t, finder) + finder.findVisualStudio() +}) + test('run on a unusable VS Command Prompt', function (t) { t.plan(2) diff --git a/node_modules/node-gyp/test/test-install.js b/node_modules/node-gyp/test/test-install.js index 9e44c39bc108d..c3317155e0f3d 100644 --- a/node_modules/node-gyp/test/test-install.js +++ b/node_modules/node-gyp/test/test-install.js @@ -1,7 +1,7 @@ 'use strict' -var test = require('tap').test -var install = require('../lib/install').test.install +const test = require('tap').test +const install = require('../lib/install').test.install require('npmlog').level = 'error' // we expect a warning @@ -13,7 +13,7 @@ test('EACCES retry once', function (t) { var err = new Error() err.code = 'EACCES' cb(err) - t.ok(true); + t.ok(true) } var gyp = {} diff --git a/node_modules/node-gyp/test/test-options.js b/node_modules/node-gyp/test/test-options.js index 51d473308c76d..252baa2035e0c 100644 --- a/node_modules/node-gyp/test/test-options.js +++ b/node_modules/node-gyp/test/test-options.js @@ -1,15 +1,15 @@ -'use strict'; +'use strict' -var test = require('tap').test -var gyp = require('../lib/node-gyp') +const test = require('tap').test +const gyp = require('../lib/node-gyp') test('options in environment', function (t) { t.plan(1) // `npm test` dumps a ton of npm_config_* variables in the environment. Object.keys(process.env) - .filter(function(key) { return /^npm_config_/.test(key) }) - .forEach(function(key) { delete process.env[key] }) + .filter(function (key) { return /^npm_config_/.test(key) }) + .forEach(function (key) { delete process.env[key] }) // Zero-length keys should get filtered out. process.env.npm_config_ = '42' @@ -18,8 +18,8 @@ test('options in environment', function (t) { // Except loglevel. process.env.npm_config_loglevel = 'debug' - var g = gyp(); - g.parseArgv(['rebuild']) // Also sets opts.argv. + var g = gyp() + g.parseArgv(['rebuild']) // Also sets opts.argv. t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x']) }) diff --git a/node_modules/node-gyp/test/test-process-release.js b/node_modules/node-gyp/test/test-process-release.js index 83998af04189d..e4370e59eed9a 100644 --- a/node_modules/node-gyp/test/test-process-release.js +++ b/node_modules/node-gyp/test/test-process-release.js @@ -1,5 +1,7 @@ -var test = require('tap').test -var processRelease = require('../lib/process-release') +'use strict' + +const test = require('tap').test +const processRelease = require('../lib/process-release') test('test process release - process.version = 0.8.20', function (t) { t.plan(2) @@ -17,7 +19,7 @@ test('test process release - process.version = 0.8.20', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt', versionDir: '0.8.20', ia32: { libUrl: 'https://nodejs.org/dist/v0.8.20/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.8.20/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.8.20/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -37,7 +39,7 @@ test('test process release - process.version = 0.10.21', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt', versionDir: '0.10.21', ia32: { libUrl: 'https://nodejs.org/dist/v0.10.21/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.21/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.10.21/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -58,7 +60,7 @@ test('test process release - process.version = 0.12.9', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt', versionDir: '0.12.9', ia32: { libUrl: 'https://nodejs.org/dist/v0.12.9/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.12.9/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.12.9/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -79,7 +81,7 @@ test('test process release - process.version = 0.10.41', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt', versionDir: '0.10.41', ia32: { libUrl: 'https://nodejs.org/dist/v0.10.41/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.41/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.10.41/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -100,7 +102,7 @@ test('test process release - process.release ~ node@0.10.42', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt', versionDir: '0.10.42', ia32: { libUrl: 'https://nodejs.org/dist/v0.10.42/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.42/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.10.42/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -121,7 +123,7 @@ test('test process release - process.release ~ node@0.12.10', function (t) { shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt', versionDir: '0.12.10', ia32: { libUrl: 'https://nodejs.org/dist/v0.12.10/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.12.10/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.12.10/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -144,7 +146,7 @@ test('test process release - process.release ~ node@4.1.23', function (t) { shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt', versionDir: '4.1.23', ia32: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) @@ -167,7 +169,7 @@ test('test process release - process.release ~ node@4.1.23 / corp build', functi shasumsUrl: 'https://some.custom.location/SHASUMS256.txt', versionDir: '4.1.23', ia32: { libUrl: 'https://some.custom.location/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://some.custom.location/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://some.custom.location/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) @@ -190,7 +192,7 @@ test('test process release - process.release ~ node@4.1.23 --target=0.10.40', fu shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt', versionDir: '0.10.40', ia32: { libUrl: 'https://nodejs.org/dist/v0.10.40/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.40/x64/node.lib', libPath: 'x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/dist/v0.10.40/x64/node.lib', libPath: 'x64/node.lib' } }) }) @@ -213,7 +215,7 @@ test('test process release - process.release ~ node@4.1.23 --dist-url=https://fo shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt', versionDir: '4.1.23', ia32: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) @@ -236,11 +238,10 @@ test('test process release - process.release ~ frankenstein@4.1.23', function (t shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt', versionDir: 'frankenstein-4.1.23', ia32: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' }, - x64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' }, + x64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' } }) }) - test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function (t) { t.plan(2) @@ -260,7 +261,7 @@ test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=ht shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt', versionDir: 'frankenstein-4.1.23', ia32: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' }, - x64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' }, + x64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' } }) }) @@ -283,11 +284,10 @@ test('test process release - process.release ~ node@4.0.0-rc.4', function (t) { shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', versionDir: '4.0.0-rc.4', ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) - test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function (t) { t.plan(2) @@ -309,11 +309,10 @@ test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0] shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', versionDir: '4.0.0-rc.4', ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) - test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function (t) { t.plan(2) @@ -335,7 +334,7 @@ test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string pa shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', versionDir: '4.0.0-rc.4', ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) }) @@ -360,7 +359,7 @@ test('test process release - NODEJS_ORG_MIRROR', function (t) { shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt', versionDir: '4.1.23', ia32: { libUrl: 'http://foo.bar/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'http://foo.bar/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, + x64: { libUrl: 'http://foo.bar/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' } }) delete process.env.NODEJS_ORG_MIRROR diff --git a/package-lock.json b/package-lock.json index 149742e74f1dd..1748575f37828 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3668,9 +3668,9 @@ } }, "node-gyp": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-5.0.2.tgz", - "integrity": "sha512-sNcb5O7eJ9XiNAhWZ/UE2bWsBJn3Jb7rayMqMP4wjenlr1DwzZxUmbtmIrl04EU0p5fN2rU9WIDV+u0EbsI8oQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-5.0.3.tgz", + "integrity": "sha512-z/JdtkFGUm0QaQUusvloyYuGDub3nUbOo5de1Fz57cM++osBTvQatBUSTlF1k/w8vFHPxxXW6zxGvkxXSpaBkQ==", "requires": { "env-paths": "^1.0.0", "glob": "^7.0.3", diff --git a/package.json b/package.json index 26e99d9cb9f97..872da6b0444dc 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "mississippi": "^3.0.0", "mkdirp": "~0.5.1", "move-concurrently": "^1.0.1", - "node-gyp": "^5.0.2", + "node-gyp": "^5.0.3", "nopt": "~4.0.1", "normalize-package-data": "^2.5.0", "npm-audit-report": "^1.3.2",