diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2020-12-09 10:33:11 -0500 |
---|---|---|
committer | Myles Borins <mylesborins@github.com> | 2020-12-11 17:59:18 -0500 |
commit | f51a0e4b85370c00710cda961d040a0fbd70892a (patch) | |
tree | 6ea545a2ae1402cc7918807d6c69839d8bb0996b /deps/npm/node_modules/resolve | |
parent | 7faeddf23a98c53896f8b574a6e66589e8fb1eb8 (diff) | |
download | node-new-f51a0e4b85370c00710cda961d040a0fbd70892a.tar.gz |
deps: upgrade npm to 7.1.1
PR-URL: https://github.com/nodejs/node/pull/36459
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/resolve')
-rw-r--r-- | deps/npm/node_modules/resolve/.editorconfig | 24 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/.travis.yml | 8 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/appveyor.yml | 42 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/lib/async.js | 11 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/lib/core.js | 4 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/lib/core.json | 9 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/lib/is-core.js | 4 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/lib/sync.js | 11 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/package.json | 18 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/readme.markdown | 28 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/test/core.js | 12 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/test/shadowed_core.js | 16 | ||||
-rw-r--r-- | deps/npm/node_modules/resolve/test/symlinks.js | 5 |
13 files changed, 126 insertions, 66 deletions
diff --git a/deps/npm/node_modules/resolve/.editorconfig b/deps/npm/node_modules/resolve/.editorconfig index bc228f8269..b96fcfbf23 100644 --- a/deps/npm/node_modules/resolve/.editorconfig +++ b/deps/npm/node_modules/resolve/.editorconfig @@ -1,20 +1,34 @@ root = true [*] -indent_style = tab -indent_size = 4 +indent_style = space +indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 150 +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab [CHANGELOG.md] indent_style = space indent_size = 2 -[*.json] +[{*.json,Makefile}] max_line_length = off -[Makefile] +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off max_line_length = off +insert_final_newline = off diff --git a/deps/npm/node_modules/resolve/.travis.yml b/deps/npm/node_modules/resolve/.travis.yml deleted file mode 100644 index 5ed0fa52f9..0000000000 --- a/deps/npm/node_modules/resolve/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: ~> 1.0 -language: node_js -os: - - linux -import: - - ljharb/travis-ci:node/all.yml - - ljharb/travis-ci:node/pretest.yml - - ljharb/travis-ci:node/posttest.yml diff --git a/deps/npm/node_modules/resolve/appveyor.yml b/deps/npm/node_modules/resolve/appveyor.yml index 9458fb82b1..747fbdbba5 100644 --- a/deps/npm/node_modules/resolve/appveyor.yml +++ b/deps/npm/node_modules/resolve/appveyor.yml @@ -4,6 +4,9 @@ build: off environment: matrix: + #- nodejs_version: "15" + - nodejs_version: "14" + - nodejs_version: "13" - nodejs_version: "12" - nodejs_version: "11" - nodejs_version: "10" @@ -25,6 +28,7 @@ matrix: allow_failures: - nodejs_version: "5" # due to windows npm bug, registry-side - nodejs_version: "0.8" + # platform: x86 # x64 has started failing on the registry side, around early November 2020 - nodejs_version: "0.6" platform: @@ -33,17 +37,33 @@ platform: # Install scripts. (runs after repo cloning) install: - # Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef - - git config core.symlinks true - - git reset --hard - # Get the latest stable version of Node.js or io.js - - ps: Install-Product node $env:nodejs_version $env:platform - - IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3 - - IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5 - - set PATH=%APPDATA%\npm;%PATH% - #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm - # install modules - - npm install + # Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef + - git config core.symlinks true + - git reset --hard + # Get the latest stable version of Node.js or io.js + - ps: if ($env:nodejs_version -ne '0.6') { Install-Product node $env:nodejs_version $env:platform } + - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform + - IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3 + - IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5 + - IF %nodejs_version% EQU 1 npm -g install npm@2.9 + - IF %nodejs_version% EQU 2 npm -g install npm@4 + - IF %nodejs_version% EQU 3 npm -g install npm@4 + - IF %nodejs_version% EQU 4 npm -g install npm@5.3 + - IF %nodejs_version% EQU 5 npm -g install npm@5.3 + - IF %nodejs_version% EQU 6 npm -g install npm@6.9 + - IF %nodejs_version% EQU 7 npm -g install npm@6 + - IF %nodejs_version% EQU 8 npm -g install npm@6 + - IF %nodejs_version% EQU 9 npm -g install npm@6.9 + - IF %nodejs_version% EQU 10 npm -g install npm@7 + - IF %nodejs_version% EQU 11 npm -g install npm@7 + - IF %nodejs_version% EQU 12 npm -g install npm@7 + - IF %nodejs_version% EQU 13 npm -g install npm@7 + - IF %nodejs_version% EQU 14 npm -g install npm@7 + - IF %nodejs_version% EQU 15 npm -g install npm@7 + - set PATH=%APPDATA%\npm;%PATH% + #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm + # install modules + - npm install # Post-install test scripts. test_script: diff --git a/deps/npm/node_modules/resolve/lib/async.js b/deps/npm/node_modules/resolve/lib/async.js index 06aa458833..2928507945 100644 --- a/deps/npm/node_modules/resolve/lib/async.js +++ b/deps/npm/node_modules/resolve/lib/async.js @@ -1,9 +1,9 @@ var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); -var isCore = require('./is-core'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; @@ -73,6 +73,7 @@ module.exports = function resolve(x, options, callback) { var packageIterator = opts.packageIterator; var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; var basedir = opts.basedir || path.dirname(caller()); var parent = opts.filename || basedir; @@ -99,7 +100,7 @@ module.exports = function resolve(x, options, callback) { if ((/\/$/).test(x) && res === basedir) { loadAsDirectory(res, opts.package, onfile); } else loadAsFile(res, opts.package, onfile); - } else if (isCore(x)) { + } else if (includeCoreModules && isCore(x)) { return cb(null, x); } else loadNodeModules(x, basedir, function (err, n, pkg) { if (err) cb(err); diff --git a/deps/npm/node_modules/resolve/lib/core.js b/deps/npm/node_modules/resolve/lib/core.js index 0877650cca..c417d23c5a 100644 --- a/deps/npm/node_modules/resolve/lib/core.js +++ b/deps/npm/node_modules/resolve/lib/core.js @@ -6,8 +6,8 @@ function specifierIncluded(specifier) { var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); for (var i = 0; i < 3; ++i) { - var cur = Number(current[i] || 0); - var ver = Number(versionParts[i] || 0); + var cur = parseInt(current[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); if (cur === ver) { continue; // eslint-disable-line no-restricted-syntax, no-continue } diff --git a/deps/npm/node_modules/resolve/lib/core.json b/deps/npm/node_modules/resolve/lib/core.json index d51b70b149..226198f89b 100644 --- a/deps/npm/node_modules/resolve/lib/core.json +++ b/deps/npm/node_modules/resolve/lib/core.json @@ -1,5 +1,6 @@ { "assert": true, + "assert/strict": ">= 15", "async_hooks": ">= 8", "buffer_ieee754": "< 0.9.7", "buffer": true, @@ -11,8 +12,10 @@ "_debug_agent": ">= 1 && < 8", "_debugger": "< 8", "dgram": true, + "diagnostics_channel": ">= 15.1", "dns": true, - "domain": true, + "dns/promises": ">= 15", + "domain": ">= 0.7.12", "events": true, "freelist": "< 6", "fs": true, @@ -49,9 +52,11 @@ "_stream_readable": ">= 0.9.4", "_stream_writable": ">= 0.9.4", "stream": true, + "stream/promises": ">= 15", "string_decoder": true, - "sys": true, + "sys": [">= 0.6 && < 0.7", ">= 0.8"], "timers": true, + "timers/promises": ">= 15", "_tls_common": ">= 0.11.13", "_tls_legacy": ">= 0.11.3 && < 10", "_tls_wrap": ">= 0.11.3", diff --git a/deps/npm/node_modules/resolve/lib/is-core.js b/deps/npm/node_modules/resolve/lib/is-core.js index 48bc96c47e..537f5c782f 100644 --- a/deps/npm/node_modules/resolve/lib/is-core.js +++ b/deps/npm/node_modules/resolve/lib/is-core.js @@ -1,5 +1,5 @@ -var core = require('./core'); +var isCoreModule = require('is-core-module'); module.exports = function isCore(x) { - return Object.prototype.hasOwnProperty.call(core, x); + return isCoreModule(x); }; diff --git a/deps/npm/node_modules/resolve/lib/sync.js b/deps/npm/node_modules/resolve/lib/sync.js index da74e19d0c..d5308c926e 100644 --- a/deps/npm/node_modules/resolve/lib/sync.js +++ b/deps/npm/node_modules/resolve/lib/sync.js @@ -1,9 +1,9 @@ -var isCore = require('./is-core'); +var isCore = require('is-core-module'); var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; @@ -66,6 +66,7 @@ module.exports = function resolveSync(x, options) { var packageIterator = opts.packageIterator; var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; var basedir = opts.basedir || path.dirname(caller()); var parent = opts.filename || basedir; @@ -79,7 +80,7 @@ module.exports = function resolveSync(x, options) { if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; var m = loadAsFileSync(res) || loadAsDirectorySync(res); if (m) return maybeRealpathSync(realpathSync, m, opts); - } else if (isCore(x)) { + } else if (includeCoreModules && isCore(x)) { return x; } else { var n = loadNodeModulesSync(x, absoluteStart); diff --git a/deps/npm/node_modules/resolve/package.json b/deps/npm/node_modules/resolve/package.json index b6d3bec191..dfcfc497b3 100644 --- a/deps/npm/node_modules/resolve/package.json +++ b/deps/npm/node_modules/resolve/package.json @@ -1,7 +1,7 @@ { "name": "resolve", "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "version": "1.17.0", + "version": "1.19.0", "repository": { "type": "git", "url": "git://github.com/browserify/resolve.git" @@ -14,23 +14,26 @@ "module" ], "scripts": { - "prepublish": "safe-publish-latest", - "lint": "eslint .", + "prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/", + "prelint": "eclint check '**/*'", + "lint": "eslint --ext=js,mjs .", "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", "tests-only": "tape test/*.js", "pretest": "npm run lint", "test": "npm run --silent tests-only", - "posttest": "npm run test:multirepo", + "posttest": "npm run test:multirepo && aud --production", "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" }, "devDependencies": { - "@ljharb/eslint-config": "^16.0.0", + "@ljharb/eslint-config": "^17.2.0", "array.prototype.map": "^1.0.2", - "eslint": "^6.8.0", + "aud": "^1.1.3", + "eclint": "^2.8.1", + "eslint": "^7.13.0", "object-keys": "^1.1.1", "safe-publish-latest": "^1.1.4", "tap": "0.4.13", - "tape": "^5.0.0-next.5" + "tape": "^5.0.1" }, "license": "MIT", "author": { @@ -42,6 +45,7 @@ "url": "https://github.com/sponsors/ljharb" }, "dependencies": { + "is-core-module": "^2.1.0", "path-parse": "^1.0.6" } } diff --git a/deps/npm/node_modules/resolve/readme.markdown b/deps/npm/node_modules/resolve/readme.markdown index 5e1aea3317..f742c38dd4 100644 --- a/deps/npm/node_modules/resolve/readme.markdown +++ b/deps/npm/node_modules/resolve/readme.markdown @@ -43,6 +43,12 @@ $ node example/sync.js var resolve = require('resolve'); ``` +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + ## resolve(id, opts={}, cb) Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. @@ -55,6 +61,8 @@ options are: * opts.extensions - array of file extensions to search in order +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + * opts.readFile - how to read files asynchronously * opts.isFile - function to asynchronously test whether a file exists @@ -102,6 +110,7 @@ default `opts` values: paths: [], basedir: __dirname, extensions: ['.js'], + includeCoreModules: true, readFile: fs.readFile, isFile: function isFile(file, cb) { fs.stat(file, function (err, stat) { @@ -122,12 +131,12 @@ default `opts` values: }); }, realpath: function realpath(file, cb) { - var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - realpath(file, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? file : realPath); - }); - }, + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, moduleDirectory: 'node_modules', preserveSymlinks: true } @@ -144,6 +153,8 @@ options are: * opts.extensions - array of file extensions to search in order +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + * opts.readFile - how to read files synchronously * opts.isFile - function to synchronously test whether a file exists @@ -190,6 +201,7 @@ default `opts` values: paths: [], basedir: __dirname, extensions: ['.js'], + includeCoreModules: true, readFileSync: fs.readFileSync, isFile: function isFile(file) { try { @@ -225,10 +237,6 @@ default `opts` values: } ``` -## resolve.isCore(pkg) - -Return whether a package is in core. - # install With [npm](https://npmjs.org) do: diff --git a/deps/npm/node_modules/resolve/test/core.js b/deps/npm/node_modules/resolve/test/core.js index 4c111e1dde..7a3ccb16b4 100644 --- a/deps/npm/node_modules/resolve/test/core.js +++ b/deps/npm/node_modules/resolve/test/core.js @@ -22,16 +22,12 @@ test('core modules', function (t) { for (var i = 0; i < cores.length; ++i) { var mod = cores[i]; + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + console.log(mod, resolve.core, resolve.core[mod]); if (resolve.core[mod]) { - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' supported; requiring does not throw' - ); + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); } else { - st.throws( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' not supported; requiring throws' - ); + st.throws(requireFunc, mod + ' not supported; requiring throws'); } } diff --git a/deps/npm/node_modules/resolve/test/shadowed_core.js b/deps/npm/node_modules/resolve/test/shadowed_core.js index 98c52a760b..3a5f4fcff7 100644 --- a/deps/npm/node_modules/resolve/test/shadowed_core.js +++ b/deps/npm/node_modules/resolve/test/shadowed_core.js @@ -36,3 +36,19 @@ test('shadowed core modules return shadow when appending `/` [sync]', function ( t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); }); +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/deps/npm/node_modules/resolve/test/symlinks.js b/deps/npm/node_modules/resolve/test/symlinks.js index 152d14ef2d..35f881afb8 100644 --- a/deps/npm/node_modules/resolve/test/symlinks.js +++ b/deps/npm/node_modules/resolve/test/symlinks.js @@ -68,7 +68,10 @@ test('sync symlink when preserveSymlinks = true', function (t) { test('sync symlink', function (t) { var start = new Date(); t.doesNotThrow(function () { - t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); }); t.ok(new Date() - start < 50, 'resolve.sync timedout'); t.end(); |