From cca0372022632465f1cf14febf8f848f989c8999 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Fri, 19 Jun 2020 21:31:21 +0300 Subject: [PATCH 001/104] timers: allow timers to be used as primitives This allows timers to be matched to numeric Ids and therefore used as keys of an Object, passed and stored without storing the Timer instance. clearTimeout/clearInterval is modified to support numeric/string Ids. Co-authored-by: Bradley Farias Co-authored-by: Anatoli Papirovski Refs: https://github.com/nodejs/node/pull/21152 Backport-PR-URL: https://github.com/nodejs/node/pull/34482 PR-URL: https://github.com/nodejs/node/pull/34017 Backport-PR-URL: https://github.com/nodejs/node/pull/34482 Reviewed-By: James M Snell Reviewed-By: Bradley Farias Reviewed-By: Jeremiah Senkpiel Reviewed-By: Anna Henningsen Reviewed-By: Trivikram Kamat Reviewed-By: Yongsheng Zhang Reviewed-By: Benjamin Gruenbaum Signed-off-by: Denys Otrishko --- doc/api/timers.md | 16 +++++++++++++ lib/internal/timers.js | 4 ++++ lib/timers.js | 28 ++++++++++++++++++++++ test/parallel/test-timers-to-primitive.js | 29 +++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 test/parallel/test-timers-to-primitive.js diff --git a/doc/api/timers.md b/doc/api/timers.md index 1157ae286e0d0a..70c66785bf5a54 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -125,6 +125,21 @@ Calling `timeout.unref()` creates an internal timer that will wake the Node.js event loop. Creating too many of these can adversely impact performance of the Node.js application. +### `timeout[Symbol.toPrimitive]()` + + +* Returns: {integer} number that can be used to reference this `timeout` + +Coerce a `Timeout` to a primitive, a primitive will be generated that +can be used to clear the `Timeout`. +The generated number can only be used in the same thread where timeout +was created. Therefore to use it cross [`worker_threads`][] it has +to first be passed to a correct thread. +This allows enhanced compatibility with browser's `setTimeout()`, and +`setInterval()` implementations. + ## Scheduling timers A timer in Node.js is an internal construct that calls a given function after @@ -274,3 +289,4 @@ Cancels a `Timeout` object created by [`setTimeout()`][]. [`setInterval()`]: timers.html#timers_setinterval_callback_delay_args [`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args [`util.promisify()`]: util.html#util_util_promisify_original +[`worker_threads`]: worker_threads.html diff --git a/lib/internal/timers.js b/lib/internal/timers.js index ead8bec819fbaa..c478a43de9b7d8 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -103,6 +103,8 @@ const { const async_id_symbol = Symbol('asyncId'); const trigger_async_id_symbol = Symbol('triggerId'); +const kHasPrimitive = Symbol('kHasPrimitive'); + const { ERR_INVALID_CALLBACK, ERR_OUT_OF_RANGE @@ -184,6 +186,7 @@ function Timeout(callback, after, args, isRepeat, isRefed) { if (isRefed) incRefCount(); this[kRefed] = isRefed; + this[kHasPrimitive] = false; initAsyncResource(this, 'Timeout'); } @@ -597,6 +600,7 @@ module.exports = { trigger_async_id_symbol, Timeout, kRefed, + kHasPrimitive, initAsyncResource, setUnrefTimeout, getTimerDuration, diff --git a/lib/timers.js b/lib/timers.js index 21f02300f885eb..de50e56a11909a 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -22,8 +22,10 @@ 'use strict'; const { + ObjectCreate, MathTrunc, Promise, + SymbolToPrimitive } = primordials; const { @@ -40,6 +42,7 @@ const { kRefCount }, kRefed, + kHasPrimitive, initAsyncResource, getTimerDuration, timerListMap, @@ -64,6 +67,11 @@ const { emitDestroy } = require('internal/async_hooks'); +// This stores all the known timer async ids to allow users to clearTimeout and +// clearInterval using those ids, to match the spec and the rest of the web +// platform. +const knownTimersById = ObjectCreate(null); + // Remove a timer. Cancels the timeout and resets the relevant timer properties. function unenroll(item) { if (item._destroyed) @@ -71,6 +79,9 @@ function unenroll(item) { item._destroyed = true; + if (item[kHasPrimitive]) + delete knownTimersById[item[async_id_symbol]]; + // Fewer checks may be possible, but these cover everything. if (destroyHooksExist() && item[async_id_symbol] !== undefined) emitDestroy(item[async_id_symbol]); @@ -161,6 +172,14 @@ function clearTimeout(timer) { if (timer && timer._onTimeout) { timer._onTimeout = null; unenroll(timer); + return; + } + if (typeof timer === 'number' || typeof timer === 'string') { + const timerInstance = knownTimersById[timer]; + if (timerInstance !== undefined) { + timerInstance._onTimeout = null; + unenroll(timerInstance); + } } } @@ -206,6 +225,15 @@ Timeout.prototype.close = function() { return this; }; +Timeout.prototype[SymbolToPrimitive] = function() { + const id = this[async_id_symbol]; + if (!this[kHasPrimitive]) { + this[kHasPrimitive] = true; + knownTimersById[id] = this; + } + return id; +}; + const Immediate = class Immediate { constructor(callback, args) { this._idleNext = null; diff --git a/test/parallel/test-timers-to-primitive.js b/test/parallel/test-timers-to-primitive.js new file mode 100644 index 00000000000000..65f11b91483040 --- /dev/null +++ b/test/parallel/test-timers-to-primitive.js @@ -0,0 +1,29 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); + +[ + setTimeout(common.mustNotCall(), 1), + setInterval(common.mustNotCall(), 1), +].forEach((timeout) => { + assert.strictEqual(Number.isNaN(+timeout), false); + assert.strictEqual(+timeout, timeout[Symbol.toPrimitive]()); + assert.strictEqual(`${timeout}`, timeout[Symbol.toPrimitive]().toString()); + assert.deepStrictEqual(Object.keys({ [timeout]: timeout }), [`${timeout}`]); + clearTimeout(+timeout); +}); + +{ + // Check that clearTimeout works with number id. + const timeout = setTimeout(common.mustNotCall(), 1); + const id = +timeout; + clearTimeout(id); +} + +{ + // Check that clearTimeout works with string id. + const timeout = setTimeout(common.mustNotCall(), 1); + const id = `${timeout}`; + clearTimeout(id); +} From aaa6e43d3c1691a8970b8ffcd0da977fe1967f08 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Tue, 21 Jul 2020 17:47:43 +0200 Subject: [PATCH 002/104] Forces Powershell to use tls1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Powershell defaults to tls 1.0 - This forces powershell to use tls 1.2 Tls 1.2 is supported in all current microsoft operating systems and needed to download chocolatey. Fixes: https://github.com/nodejs/node/issues/33140 Backport-PR-URL: https://github.com/nodejs/node/pull/34461 PR-URL: https://github.com/nodejs/node/pull/33609 Reviewed-By: Bartosz Sosnowski Reviewed-By: Michael Dawson Reviewed-By: Tobias Nießen --- tools/msvs/install_tools/install_tools.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/msvs/install_tools/install_tools.bat b/tools/msvs/install_tools/install_tools.bat index eac70e2159fa86..dfdf5ddd724df1 100644 --- a/tools/msvs/install_tools/install_tools.bat +++ b/tools/msvs/install_tools/install_tools.bat @@ -52,4 +52,4 @@ pause cls -"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1'')); choco upgrade -y python visualstudio2017-workload-vctools; Read-Host ''Type ENTER to exit'' ' -Verb RunAs +"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1'')); choco upgrade -y python visualstudio2017-workload-vctools; Read-Host ''Type ENTER to exit'' ' -Verb RunAs From 093a4b0ae4905f30980c5bbeb9fafa3ca60f1b05 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Fri, 7 Aug 2020 13:16:17 +0300 Subject: [PATCH 003/104] test: add tests for validateNumber/validateString PR-URL: https://github.com/nodejs/node/pull/34672 Reviewed-By: James M Snell Reviewed-By: Yongsheng Zhang Reviewed-By: Pranshu Srivastava Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-validators.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/parallel/test-validators.js b/test/parallel/test-validators.js index 1c36cc17ec046b..cf4ba17f52e9d7 100644 --- a/test/parallel/test-validators.js +++ b/test/parallel/test-validators.js @@ -7,7 +7,9 @@ const { validateArray, validateBoolean, validateInteger, + validateNumber, validateObject, + validateString, } = require('internal/validators'); const { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } = Number; const outOfRangeError = { @@ -85,3 +87,24 @@ const invalidArgValueError = { validateObject(null, 'foo', { nullable: true }); } + +{ + // validateString type validation. + [ + -1, {}, [], false, true, + 1, Infinity, -Infinity, NaN, + undefined, null, 1.1 + ].forEach((i) => assert.throws(() => validateString(i, 'name'), { + code: 'ERR_INVALID_ARG_TYPE' + })); +} +{ + // validateNumber type validation. + [ + 'a', {}, [], false, true, + undefined, null, '', ' ', '0x', + '-0x1', '-0o1', '-0b1', '0o', '0b' + ].forEach((i) => assert.throws(() => validateNumber(i, 'name'), { + code: 'ERR_INVALID_ARG_TYPE' + })); +} From 9a7c87df37e67dc0629ab9ee816c110ddeb2223c Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 2 Aug 2020 18:03:48 -0700 Subject: [PATCH 004/104] module: use cjsCache over esm injection PR-URL: https://github.com/nodejs/node/pull/34605 Reviewed-By: Bradley Farias Reviewed-By: Rich Trott --- lib/internal/modules/cjs/loader.js | 29 ++++------------- lib/internal/modules/esm/loader.js | 4 +-- lib/internal/modules/esm/translators.js | 42 +++++++++---------------- 3 files changed, 22 insertions(+), 53 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 01803211fe0223..13c4589fc377e1 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -112,8 +112,7 @@ const { } = require('internal/util/types'); const asyncESM = require('internal/process/esm_loader'); -const ModuleJob = require('internal/modules/esm/module_job'); -const { ModuleWrap, kInstantiated } = internalBinding('module_wrap'); +const { kEvaluated } = internalBinding('module_wrap'); const { encodedSepRegEx, packageInternalResolve @@ -1101,29 +1100,13 @@ Module.prototype.load = function(filename) { this.loaded = true; const ESMLoader = asyncESM.ESMLoader; - const url = `${pathToFileURL(filename)}`; - const module = ESMLoader.moduleMap.get(url); // Create module entry at load time to snapshot exports correctly const exports = this.exports; - // Called from cjs translator - if (module !== undefined && module.module !== undefined) { - if (module.module.getStatus() >= kInstantiated) - module.module.setExport('default', exports); - } else { - // Preemptively cache - // We use a function to defer promise creation for async hooks. - ESMLoader.moduleMap.set( - url, - // Module job creation will start promises. - // We make it a function to lazily trigger those promises - // for async hooks compatibility. - () => new ModuleJob(ESMLoader, url, () => - new ModuleWrap(url, undefined, ['default'], function() { - this.setExport('default', exports); - }) - , false /* isMain */, false /* inspectBrk */) - ); - } + // Preemptively cache + if ((module?.module === undefined || + module.module.getStatus() < kEvaluated) && + !ESMLoader.cjsCache.has(this)) + ESMLoader.cjsCache.set(this, exports); }; diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 37191f65bf0b7e..110464cbdb1da3 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -6,7 +6,7 @@ require('internal/modules/cjs/loader'); const { FunctionPrototypeBind, ObjectSetPrototypeOf, - SafeMap, + SafeWeakMap, } = primordials; const { @@ -47,7 +47,7 @@ class Loader { this.moduleMap = new ModuleMap(); // Map of already-loaded CJS modules to use - this.cjsCache = new SafeMap(); + this.cjsCache = new SafeWeakMap(); // This hook is called before the first root module is imported. It's a // function that returns a piece of code that runs as a sloppy-mode script. diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index bb3528eddde964..bb095446bc27eb 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -48,6 +48,8 @@ const experimentalImportMetaResolve = const translators = new SafeMap(); exports.translators = translators; +const asyncESM = require('internal/process/esm_loader'); + let DECODER = null; function assertBufferSource(body, allowString, hookName) { if (allowString && typeof body === 'string') { @@ -80,21 +82,14 @@ function errPath(url) { return url; } -let esmLoader; async function importModuleDynamically(specifier, { url }) { - if (!esmLoader) { - esmLoader = require('internal/process/esm_loader').ESMLoader; - } - return esmLoader.import(specifier, url); + return asyncESM.ESMLoader.import(specifier, url); } function createImportMetaResolve(defaultParentUrl) { return async function resolve(specifier, parentUrl = defaultParentUrl) { - if (!esmLoader) { - esmLoader = require('internal/process/esm_loader').ESMLoader; - } return PromisePrototypeCatch( - esmLoader.resolve(specifier, parentUrl), + asyncESM.ESMLoader.resolve(specifier, parentUrl), (error) => ( error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ? error.url : PromiseReject(error)) @@ -132,27 +127,18 @@ const isWindows = process.platform === 'win32'; const winSepRegEx = /\//g; translators.set('commonjs', function commonjsStrategy(url, isMain) { debug(`Translating CJSModule ${url}`); - const pathname = internalURLModule.fileURLToPath(new URL(url)); - const cached = this.cjsCache.get(url); - if (cached) { - this.cjsCache.delete(url); - return cached; - } - const module = CJSModule._cache[ - isWindows ? StringPrototypeReplace(pathname, winSepRegEx, '\\') : pathname - ]; - if (module && module.loaded) { - const exports = module.exports; - return new ModuleWrap(url, undefined, ['default'], function() { - this.setExport('default', exports); - }); - } return new ModuleWrap(url, undefined, ['default'], function() { debug(`Loading CJSModule ${url}`); - // We don't care about the return val of _load here because Module#load - // will handle it for us by checking the loader registry and filling the - // exports like above - CJSModule._load(pathname, undefined, isMain); + const pathname = internalURLModule.fileURLToPath(new URL(url)); + let exports; + const cachedModule = CJSModule._cache[pathname]; + if (cachedModule && asyncESM.ESMLoader.cjsCache.has(cachedModule)) { + exports = asyncESM.ESMLoader.cjsCache.get(cachedModule); + asyncESM.ESMLoader.cjsCache.delete(cachedModule); + } else { + exports = CJSModule._load(pathname, undefined, isMain); + } + this.setExport('default', exports); }); }); From 7cde699115b64ff487f92ca452fdcdfa903b045b Mon Sep 17 00:00:00 2001 From: Mary Marchini Date: Wed, 5 Aug 2020 16:54:02 -0700 Subject: [PATCH 005/104] doc: harden policy around objections Harden policy around objections to avoid misunderstanding and to encourage collaboration between pull request authors and objectors. Fixes: https://github.com/nodejs/node/issues/34564 PR-URL: https://github.com/nodejs/node/pull/34639 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Joyee Cheung Reviewed-By: Rich Trott --- doc/guides/collaborator-guide.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/guides/collaborator-guide.md b/doc/guides/collaborator-guide.md index fb03df4740bd20..e95de0a827c504 100644 --- a/doc/guides/collaborator-guide.md +++ b/doc/guides/collaborator-guide.md @@ -120,14 +120,22 @@ needed [approvals](#code-reviews), [CI](#testing-and-ci), and except the [wait time](#waiting-for-approvals), please add the [`author ready`](#author-ready-pull-requests) label. -Where there is disagreement among Collaborators, consensus should be sought if -possible. If reaching consensus is not possible, a Collaborator may escalate the -issue to the TSC. - -Collaborators should not block a pull request without providing a reason. -Another Collaborator may ask an objecting Collaborator to explain their -objection. If the objector is unresponsive, another Collaborator may dismiss the -objection. +If a collaborator believes a pull request should not land as is, **the "Request +Changes" GitHub feature must be used to make the objection explicit**. An +implicit objection not using the "Request Changes" feature is not a +blocker for a pull request. Pull requests with an explicit objection should +not land until all objections are satisfied. Collaborators should not block a +pull request without providing a reason. **Providing a set of actionable steps +alongside the objection is recommended, and the objector must be willing to +work with the pull request author to reach a consensus about the direction of +the pull request**. If reaching consensus is not possible, a Collaborator may +escalate the issue to the TSC. + +If the objection is not clear to others, another Collaborator may ask an +objecting Collaborator to explain their objection or to provide actionable +steps to resolve the objection. **If the objector is unresponsive for seven +days after a collaborator asks for clarification, another Collaborator may +dismiss the objection**. [Breaking changes](#breaking-changes) must receive [TSC review](#involving-the-tsc). If two TSC members approve the pull request From b93ba07fa5f8de228cc9775e3c068adf7f627e7e Mon Sep 17 00:00:00 2001 From: Priyank Singh Date: Wed, 15 Jul 2020 21:26:34 +0530 Subject: [PATCH 006/104] doc: add writable and readable options to Duplex docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/nodejs/node/issues/34382 PR-URL: https://github.com/nodejs/node/pull/34383 Reviewed-By: Anna Henningsen Reviewed-By: Robert Nagy Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: James M Snell Reviewed-By: Juan José Arboleda Reviewed-By: Anto Aravinth --- doc/api/stream.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index dc892178d5bf0d..5a2dc7b65afbfa 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2412,6 +2412,10 @@ changes: * `allowHalfOpen` {boolean} If set to `false`, then the stream will automatically end the writable side when the readable side ends. **Default:** `true`. + * `readable` {boolean} Sets whether the `Duplex` should be readable. + **Default:** `true`. + * `writable` {boolean} Sets whether the `Duplex` should be writable. + **Default:** `true`. * `readableObjectMode` {boolean} Sets `objectMode` for readable side of the stream. Has no effect if `objectMode` is `true`. **Default:** `false`. * `writableObjectMode` {boolean} Sets `objectMode` for writable side of the From 2abc98e9ff8f95f6a68b543e7df42acf16eb9377 Mon Sep 17 00:00:00 2001 From: Mary Marchini Date: Mon, 13 Apr 2020 17:50:55 -0700 Subject: [PATCH 007/104] build: add flag to build V8 with OBJECT_PRINT Add a configure flag to build V8 with `-DOBJECT_PRINT`, which will expose auxiliar functions to inspect heap objects using native debuggers. Fixes: https://github.com/nodejs/node/issues/32402 Signed-off-by: Mary Marchini PR-URL: https://github.com/nodejs/node/pull/32834 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Ujjwal Sharma Reviewed-By: Jiawen Geng --- configure.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure.py b/configure.py index 749692b9e2d69b..3aadac4055e1c0 100755 --- a/configure.py +++ b/configure.py @@ -659,6 +659,12 @@ 'memory footprint, but also implies no just-in-time compilation ' + 'support, thus much slower execution)') +parser.add_option('--v8-enable-object-print', + action='store_true', + dest='v8_enable_object_print', + default=False, + help='compile V8 with auxiliar functions for native debuggers') + parser.add_option('--node-builtin-modules-path', action='store', dest='node_builtin_modules_path', @@ -1266,6 +1272,7 @@ def configure_v8(o): o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1 o['variables']['dcheck_always_on'] = 1 if options.v8_with_dchecks else 0 + o['variables']['v8_enable_object_print'] = 1 if options.v8_enable_object_print else 0 o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 From 8766b5bfd59e921182f88fb7b9131cdbead54a32 Mon Sep 17 00:00:00 2001 From: Gabriele Greco Date: Wed, 15 Jul 2020 11:17:35 +0200 Subject: [PATCH 008/104] tools: add debug entitlements for macOS 10.15+ To debug native modules node should be a debuggable process, that will require the **com.apple.security.get-task-allow** entitlement to be added to the codesign procedure. PR-URL: https://github.com/nodejs/node/pull/34378 Fixes: https://github.com/nodejs/node/issues/34340 Reviewed-By: Rod Vagg Reviewed-By: Michael Dawson Reviewed-By: Evan Lucas Reviewed-By: Matteo Collina --- tools/osx-entitlements.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/osx-entitlements.plist b/tools/osx-entitlements.plist index 555c10f7ff8607..57a738b7621edd 100644 --- a/tools/osx-entitlements.plist +++ b/tools/osx-entitlements.plist @@ -12,5 +12,7 @@ com.apple.security.cs.disable-library-validation + com.apple.security.get-task-allow + From 9527a2a8a7c8f88b670acaf74dd17e9c9fb66e70 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 7 Aug 2020 23:23:54 +0200 Subject: [PATCH 009/104] deps: V8: cherry-pick e06ace6b5cdb Original commit message: [api] Fix empty Maybe crash in GetRealNamedPropertyAttributes `Object::GetRealNamedPropertyAttributes()` can crash if an empty `Maybe` is returned by `JSReceiver::GetPropertyAttributes()` because it was not checking for that. Fix that. Refs: https://github.com/nodejs/node/issues/34606 Change-Id: Ic83f904ba7134786bcd8f786eb2ce98adb4fea1e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335057 Commit-Queue: Leszek Swirski Reviewed-by: Leszek Swirski Cr-Commit-Position: refs/heads/master@{#69258} Refs: https://github.com/v8/v8/commit/e06ace6b5cdb64b6abfe8e1229f2159b7a38b4e7 PR-URL: https://github.com/nodejs/node/pull/34673 Fixes: https://github.com/nodejs/node/issues/34606 Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott Reviewed-By: James M Snell --- common.gypi | 2 +- deps/v8/src/api/api.cc | 12 ++++++---- deps/v8/test/cctest/test-api.cc | 42 +++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/common.gypi b/common.gypi index 3ec4581ea811fb..882b3a694c5fc0 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.12', + 'v8_embedder_string': '-node.13', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 43f83529d82654..169c9bd7f90cea 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -4653,9 +4653,9 @@ Maybe v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( Local context, Local key) { auto isolate = reinterpret_cast(context->GetIsolate()); - ENTER_V8_NO_SCRIPT(isolate, context, Object, - GetRealNamedPropertyAttributesInPrototypeChain, - Nothing(), i::HandleScope); + ENTER_V8(isolate, context, Object, + GetRealNamedPropertyAttributesInPrototypeChain, + Nothing(), i::HandleScope); i::Handle self = Utils::OpenHandle(this); if (!self->IsJSObject()) return Nothing(); i::Handle key_obj = Utils::OpenHandle(*key); @@ -4668,6 +4668,7 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Maybe result = i::JSReceiver::GetPropertyAttributes(&it); + has_pending_exception = result.IsNothing(); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); if (!it.IsFound()) return Nothing(); if (result.FromJust() == i::ABSENT) return Just(None); @@ -4692,14 +4693,15 @@ MaybeLocal v8::Object::GetRealNamedProperty(Local context, Maybe v8::Object::GetRealNamedPropertyAttributes( Local context, Local key) { auto isolate = reinterpret_cast(context->GetIsolate()); - ENTER_V8_NO_SCRIPT(isolate, context, Object, GetRealNamedPropertyAttributes, - Nothing(), i::HandleScope); + ENTER_V8(isolate, context, Object, GetRealNamedPropertyAttributes, + Nothing(), i::HandleScope); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); i::LookupIterator::Key lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, self, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); auto result = i::JSReceiver::GetPropertyAttributes(&it); + has_pending_exception = result.IsNothing(); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); if (!it.IsFound()) return Nothing(); if (result.FromJust() == i::ABSENT) { diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 151076296b41a8..18f7738033f8db 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -11959,6 +11959,48 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) { CHECK(result.IsEmpty()); } +THREADED_TEST(GetRealNamedPropertyAttributes_With_Proxy) { + LocalContext context; + HandleScope scope(context->GetIsolate()); + + { + Local proxy = + CompileRun( + "new Proxy({ p: 1 }, { getOwnPropertyDescriptor: _ => { " + " throw new Error('xyz'); } });") + .As(); + TryCatch try_catch(context->GetIsolate()); + v8::Maybe result = + proxy->GetRealNamedPropertyAttributes(context.local(), v8_str("p")); + CHECK(result.IsNothing()); + CHECK(try_catch.HasCaught()); + CHECK(try_catch.Exception() + .As() + ->Get(context.local(), v8_str("message")) + .ToLocalChecked() + ->StrictEquals(v8_str("xyz"))); + } + + { + Local proxy = + CompileRun( + "Object.create(" + " new Proxy({ p: 1 }, { getOwnPropertyDescriptor: _ => { " + " throw new Error('abc'); } }))") + .As(); + TryCatch try_catch(context->GetIsolate()); + v8::Maybe result = + proxy->GetRealNamedPropertyAttributesInPrototypeChain(context.local(), + v8_str("p")); + CHECK(result.IsNothing()); + CHECK(try_catch.HasCaught()); + CHECK(try_catch.Exception() + .As() + ->Get(context.local(), v8_str("message")) + .ToLocalChecked() + ->StrictEquals(v8_str("abc"))); + } +} static void ThrowingCallbackWithTryCatch( const v8::FunctionCallbackInfo& args) { From 27c06535175f4ef908e0a77c1aa0598b8b031fdd Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 7 Aug 2020 23:41:00 +0200 Subject: [PATCH 010/104] test: add vm crash regression test Refs: https://github.com/nodejs/node/issues/34606 PR-URL: https://github.com/nodejs/node/pull/34673 Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/parallel/test-vm-set-property-proxy.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/parallel/test-vm-set-property-proxy.js diff --git a/test/parallel/test-vm-set-property-proxy.js b/test/parallel/test-vm-set-property-proxy.js new file mode 100644 index 00000000000000..2e3293bf62947c --- /dev/null +++ b/test/parallel/test-vm-set-property-proxy.js @@ -0,0 +1,16 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +// Regression test for https://github.com/nodejs/node/issues/34606 + +const handler = { + getOwnPropertyDescriptor: common.mustCallAtLeast(() => { + return {}; + }) +}; + +const proxy = new Proxy({}, handler); +assert.throws(() => vm.runInNewContext('p = 6', proxy), + /getOwnPropertyDescriptor/); From 77bbd7391958b9c012fe06e586bf144ddea10449 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Fri, 12 Jun 2020 10:25:38 -0500 Subject: [PATCH 011/104] util: add debug and debuglog.enabled PR-URL: https://github.com/nodejs/node/pull/33424 Reviewed-By: James M Snell --- doc/api/util.md | 36 +++++++++++++++++++++++ lib/internal/util/debuglog.js | 47 ++++++++++++++++++++++-------- lib/util.js | 1 + test/sequential/test-util-debug.js | 4 +-- 4 files changed, 74 insertions(+), 14 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index b14c5969f0b416..bf4bc0e2f62a0a 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -136,6 +136,42 @@ let debuglog = util.debuglog('internals', (debug) => { }); ``` +### `debuglog().enabled` + + +* {boolean} + +The `util.debuglog().enabled` getter is used to create a test that can be used +in conditionals based on the existence of the `NODE_DEBUG` environment variable. +If the `section` name appears within the value of that environment variable, +then the returned value will be `true`. If not, then the returned value will be +`false`. + +```js +const util = require('util'); +const enabled = util.debuglog('foo').enabled; +if (enabled) { + console.log('hello from foo [%d]', 123); +} +``` + +If this program is run with `NODE_DEBUG=foo` in the environment, then it will +output something like: + +```console +hello from foo [123] +``` + +## `util.debug(section)` + + +Alias for `util.debuglog`. Usage allows for readability of that doesn't imply +logging when only using `util.debuglog().enabled`. + ## `util.deprecate(fn, msg[, code])` -Indicates that the underlying connection was terminated. +Indicates that the the response is completed, or its underlying connection was +terminated prematurely (before the response completion). ### Event: `'finish'` + +> Stability: 1 - Experimental + +Enable experimental support for custom conditional exports resolution +conditions. + +Any number of custom string condition names are permitted. + +The default Node.js conditions of `"node"`, `"default"`, `"import"`, and +`"require"` will always apply as defined. + ### `--cpu-prof` +* `--conditions`, `-u` * `--diagnostic-dir` * `--disable-proto` * `--enable-fips` diff --git a/doc/api/esm.md b/doc/api/esm.md index 551eef604eac0e..adbb55f0d82f0d 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -501,6 +501,21 @@ a nested conditional does not have any mapping it will continue checking the remaining conditions of the parent condition. In this way nested conditions behave analogously to nested JavaScript `if` statements. +#### Resolving user conditions + +When running Node.js, custom user conditions can be added with the +`--conditions` or `-u` flag: + +```bash +node --conditions=development main.js +``` + +which would then resolve the `"development"` condition in package imports and +exports, while resolving the existing `"node"`, `"default"`, `"import"`, and +`"require"` conditions as appropriate. + +Any number of custom conditions can be set with repeat flags. + #### Self-referencing a package using its name Within a package, the values defined in the package’s diff --git a/doc/node.1 b/doc/node.1 index 3da44752bd38eb..7eb877bb1c8b4d 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -78,6 +78,10 @@ Aborting instead of exiting causes a core file to be generated for analysis. .It Fl -completion-bash Print source-able bash completion script for Node.js. . +.It Fl u , Fl -conditions Ar string +Use custom conditional exports conditions +.Ar string +. .It Fl -cpu-prof Start the V8 CPU profiler on start up, and write the CPU profile to disk before exit. If diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 13c4589fc377e1..8f9ea40d7079b4 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -84,6 +84,7 @@ const manifest = getOptionValue('--experimental-policy') ? require('internal/process/policy').manifest : null; const { compileFunction } = internalBinding('contextify'); +const userConditions = getOptionValue('--conditions'); // Whether any user-provided CJS modules had been loaded (executed). // Used for internal assertions. @@ -477,8 +478,12 @@ function applyExports(basePath, expansion) { if (typeof pkgExports === 'object') { if (ObjectPrototypeHasOwnProperty(pkgExports, mappingKey)) { const mapping = pkgExports[mappingKey]; - return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, '', - mappingKey); + const resolved = resolveExportsTarget( + pathToFileURL(basePath + '/'), mapping, '', mappingKey); + if (resolved === null || resolved === undefined) + throw new ERR_PACKAGE_PATH_NOT_EXPORTED( + basePath, mappingKey); + return resolved; } let dirMatch = ''; @@ -495,6 +500,9 @@ function applyExports(basePath, expansion) { const subpath = StringPrototypeSlice(mappingKey, dirMatch.length); const resolved = resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, subpath, mappingKey); + if (resolved === null || resolved === undefined) + throw new ERR_PACKAGE_PATH_NOT_EXPORTED( + basePath, mappingKey + subpath); // Extension searching for folder exports only const rc = stat(resolved); if (rc === 0) return resolved; @@ -582,21 +590,29 @@ function resolveExportsTarget(baseUrl, target, subpath, mappingKey) { throw new ERR_INVALID_MODULE_SPECIFIER(mappingKey + subpath, reason); } else if (ArrayIsArray(target)) { if (target.length === 0) - throw new ERR_PACKAGE_PATH_NOT_EXPORTED( - baseUrl.pathname, mappingKey + subpath); + return null; let lastException; for (const targetValue of target) { + let resolved; try { - return resolveExportsTarget(baseUrl, targetValue, subpath, mappingKey); + resolved = resolveExportsTarget(baseUrl, targetValue, subpath, + mappingKey); } catch (e) { lastException = e; - if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED' && - e.code !== 'ERR_INVALID_PACKAGE_TARGET') + if (e.code !== 'ERR_INVALID_PACKAGE_TARGET') throw e; } + if (resolved === undefined) + continue; + if (resolved === null) { + lastException = null; + continue; + } + return resolved; } // Throw last fallback error - assert(lastException !== undefined); + if (lastException === undefined || lastException === null) + return lastException; throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectKeys(target); @@ -605,30 +621,17 @@ function resolveExportsTarget(baseUrl, target, subpath, mappingKey) { 'contain numeric property keys.'); } for (const p of keys) { - switch (p) { - case 'node': - case 'require': - try { - return resolveExportsTarget(baseUrl, target[p], subpath, - mappingKey); - } catch (e) { - if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e; - } - break; - case 'default': - try { - return resolveExportsTarget(baseUrl, target.default, subpath, - mappingKey); - } catch (e) { - if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e; - } + if (cjsConditions.has(p) || p === 'default') { + const resolved = resolveExportsTarget(baseUrl, target[p], subpath, + mappingKey); + if (resolved === undefined) + continue; + return resolved; } } - throw new ERR_PACKAGE_PATH_NOT_EXPORTED( - baseUrl.pathname, mappingKey + subpath); + return undefined; } else if (target === null) { - throw new ERR_PACKAGE_PATH_NOT_EXPORTED( - baseUrl.pathname, mappingKey + subpath); + return null; } throw new ERR_INVALID_PACKAGE_TARGET(baseUrl.pathname, mappingKey, target); } @@ -985,8 +988,7 @@ Module._load = function(request, parent, isMain) { return module.exports; }; -// TODO: Use this set when resolving pkg#exports conditions. -const cjsConditions = new SafeSet(['require', 'node']); +const cjsConditions = new SafeSet(['require', 'node', ...userConditions]); Module._resolveFilename = function(request, parent, isMain, options) { if (NativeModule.canBeRequiredByUsers(request)) { return request; diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 7ea59f30c6894e..7cf3552948194d 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -51,7 +51,8 @@ const { const { Module: CJSModule } = require('internal/modules/cjs/loader'); const packageJsonReader = require('internal/modules/package_json_reader'); -const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import']); +const userConditions = getOptionValue('--conditions'); +const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import', ...userConditions]); const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS); @@ -359,12 +360,9 @@ function isArrayIndex(key) { function resolvePackageTarget( packageJSONUrl, target, subpath, packageSubpath, base, internal, conditions) { if (typeof target === 'string') { - const resolved = resolvePackageTargetString( + return finalizeResolution(resolvePackageTargetString( target, subpath, packageSubpath, packageJSONUrl, base, internal, - conditions); - if (resolved === null) - return null; - return finalizeResolution(resolved, base); + conditions), base); } else if (ArrayIsArray(target)) { if (target.length === 0) return null; diff --git a/src/node_options.cc b/src/node_options.cc index 17617d57bd8e67..0cc0b234826600 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -281,6 +281,11 @@ DebugOptionsParser::DebugOptionsParser() { } EnvironmentOptionsParser::EnvironmentOptionsParser() { + AddOption("--conditions", + "additional user conditions for conditional exports and imports", + &EnvironmentOptions::conditions, + kAllowedInEnvironment); + AddAlias("-u", "--conditions"); AddOption("--diagnostic-dir", "set dir for all output files" " (default: current working directory)", diff --git a/src/node_options.h b/src/node_options.h index fe20022bb2f357..3258d4b3f0df0c 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -100,6 +100,7 @@ class DebugOptions : public Options { class EnvironmentOptions : public Options { public: bool abort_on_uncaught_exception = false; + std::vector conditions; bool enable_source_maps = false; bool experimental_json_modules = false; bool experimental_modules = false; diff --git a/test/es-module/test-esm-custom-exports.mjs b/test/es-module/test-esm-custom-exports.mjs new file mode 100644 index 00000000000000..ad81abfdafd861 --- /dev/null +++ b/test/es-module/test-esm-custom-exports.mjs @@ -0,0 +1,10 @@ +// Flags: --conditions=custom-condition -u another +import { mustCall } from '../common/index.mjs'; +import { strictEqual } from 'assert'; +import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; +[requireFixture, importFixture].forEach((loadFixture) => { + loadFixture('pkgexports/condition') + .then(mustCall((actual) => { + strictEqual(actual.default, 'from custom condition'); + })); +}); diff --git a/test/fixtures/node_modules/pkgexports/custom-condition.js b/test/fixtures/node_modules/pkgexports/custom-condition.js new file mode 100644 index 00000000000000..63d77460d8d6b7 --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/custom-condition.js @@ -0,0 +1 @@ +module.exports = 'from custom condition'; diff --git a/test/fixtures/node_modules/pkgexports/package.json b/test/fixtures/node_modules/pkgexports/package.json index b99e5c7b79f6a8..71406a407c453d 100644 --- a/test/fixtures/node_modules/pkgexports/package.json +++ b/test/fixtures/node_modules/pkgexports/package.json @@ -21,7 +21,10 @@ "./nofallback2": [null, {}, "builtin:x"], "./nodemodules": "./node_modules/internalpkg/x.js", "./condition": [{ - "custom-condition": "./custom-condition.mjs", + "custom-condition": { + "import": "./custom-condition.mjs", + "require": "./custom-condition.js" + }, "import": "///overridden", "require": { "require": { From f7563f811a61d778e56d478b30b42105101557d4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 9 Aug 2020 14:34:32 -0700 Subject: [PATCH 026/104] doc: remove typo in crypto.md Change "its[sic] recommended to" to "be sure to". This fixes a typo and also improves the passive and indirect phrasing to a more concise active and direct phrasing. PR-URL: https://github.com/nodejs/node/pull/34698 Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Anto Aravinth Reviewed-By: Luigi Pinca --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 0c872e99823467..af34ef34cd5153 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -868,7 +868,7 @@ If `outputEncoding` is given a string will be returned; otherwise a `ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is usually supplied from a remote user over an insecure network, -its recommended for developers to handle this exception accordingly. +be sure to handle this exception accordingly. ### `ecdh.generateKeys([encoding[, format]])` + +Type: Documentation-only + +The [`crypto.Certificate()` constructor][] is deprecated. Use +[static methods of `crypto.Certificate()`][] instead. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_static_method_buffer_allocunsafeslow_size @@ -2776,6 +2790,7 @@ Type: Documentation-only [`clearTimeout()`]: timers.html#timers_cleartimeout_timeout [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args +[`crypto.Certificate()` constructor]: crypto.html#crypto_legacy_api [`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding [`crypto.createCipher()`]: crypto.html#crypto_crypto_createcipher_algorithm_password_options [`crypto.createCipheriv()`]: crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv_options @@ -2875,3 +2890,4 @@ Type: Documentation-only [from_arraybuffer]: buffer.html#buffer_static_method_buffer_from_arraybuffer_byteoffset_length [from_string_encoding]: buffer.html#buffer_static_method_buffer_from_string_encoding [legacy `urlObject`]: url.html#url_legacy_urlobject +[static methods of `crypto.Certificate()`]: crypto.html#crypto_class_certificate From 7ed7ef7ad865962deef25c4fdf3bc9c7a10af3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 15 Aug 2020 11:02:13 +0200 Subject: [PATCH 065/104] test: move execution of WPT to worker threads Running outside of the main Node.js context prevents us from upgrading the WPT harness because new versions more aggressively check the identity of globals like error constructors. Instead of exposing globals used by the tests on vm sandboxes, use worker threads to run everything. PR-URL: https://github.com/nodejs/node/pull/34796 Reviewed-By: Matteo Collina Reviewed-By: Joyee Cheung Reviewed-By: James M Snell --- test/common/README.md | 2 +- test/common/wpt.js | 146 +++++++++++------------------ test/common/wpt/worker.js | 55 +++++++++++ test/wpt/README.md | 27 +++--- test/wpt/test-console.js | 3 - test/wpt/test-encoding.js | 13 +-- test/wpt/test-hr-time.js | 23 +---- test/wpt/test-microtask-queuing.js | 3 - test/wpt/test-timers.js | 8 -- test/wpt/test-url.js | 22 ++--- 10 files changed, 141 insertions(+), 161 deletions(-) create mode 100644 test/common/wpt/worker.js diff --git a/test/common/README.md b/test/common/README.md index b6b3089b7b4bbe..34342b46c1e147 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -962,7 +962,7 @@ the original WPT harness, see [the WPT tests README][]. ### Class: WPTRunner -A driver class for running WPT with the WPT harness in a vm. +A driver class for running WPT with the WPT harness in a worker thread. See [the WPT tests README][] for details. diff --git a/test/common/wpt.js b/test/common/wpt.js index e79bd66b370735..60891f1ca338fe 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -6,8 +6,8 @@ const fixtures = require('../common/fixtures'); const fs = require('fs'); const fsPromises = fs.promises; const path = require('path'); -const vm = require('vm'); const { inspect } = require('util'); +const { Worker } = require('worker_threads'); // https://github.com/w3c/testharness.js/blob/master/testharness.js // TODO: get rid of this half-baked harness in favor of the one @@ -222,7 +222,6 @@ class IntlRequirement { const intlRequirements = new IntlRequirement(); - class StatusLoader { /** * @param {string} path relative path of the WPT subset @@ -287,10 +286,9 @@ class WPTRunner { constructor(path) { this.path = path; this.resource = new ResourceLoader(path); - this.sandbox = null; - this.context = null; - this.globals = new Map(); + this.flags = []; + this.initScript = null; this.status = new StatusLoader(path); this.status.load(); @@ -304,28 +302,19 @@ class WPTRunner { } /** - * Specify that certain global descriptors from the object - * should be defined in the vm - * @param {object} obj - * @param {string[]} names + * Sets the Node.js flags passed to the worker. + * @param {Array} flags */ - copyGlobalsFromObject(obj, names) { - for (const name of names) { - const desc = Object.getOwnPropertyDescriptor(obj, name); - if (!desc) { - assert.fail(`${name} does not exist on the object`); - } - this.globals.set(name, desc); - } + setFlags(flags) { + this.flags = flags; } /** - * Specify that certain global descriptors should be defined in the vm - * @param {string} name - * @param {object} descriptor + * Sets a script to be run in the worker before executing the tests. + * @param {string} script */ - defineGlobal(name, descriptor) { - this.globals.set(name, descriptor); + setInitScript(script) { + this.initScript = script; } // TODO(joyeecheung): work with the upstream to port more tests in .html @@ -353,8 +342,8 @@ class WPTRunner { const meta = spec.title = this.getMeta(content); const absolutePath = spec.getAbsolutePath(); - const context = this.generateContext(spec); const relativePath = spec.getRelativePath(); + const harnessPath = fixtures.path('wpt', 'resources', 'testharness.js'); const scriptsToRun = []; // Scripts specified with the `// META: script=` header if (meta.script) { @@ -371,24 +360,46 @@ class WPTRunner { filename: absolutePath }); - for (const { code, filename } of scriptsToRun) { - try { - vm.runInContext(code, context, { filename }); - } catch (err) { - this.fail( - testFileName, - { - status: NODE_UNCAUGHT, - name: 'evaluation in WPTRunner.runJsTests()', - message: err.message, - stack: inspect(err) - }, - kUncaught - ); - this.inProgress.delete(filename); - break; + const workerPath = path.join(__dirname, 'wpt/worker.js'); + const worker = new Worker(workerPath, { + execArgv: this.flags, + workerData: { + filename: testFileName, + wptRunner: __filename, + wptPath: this.path, + initScript: this.initScript, + harness: { + code: fs.readFileSync(harnessPath, 'utf8'), + filename: harnessPath, + }, + scriptsToRun, + }, + }); + + worker.on('message', (message) => { + switch (message.type) { + case 'result': + return this.resultCallback(testFileName, message.result); + case 'completion': + return this.completionCallback(testFileName, message.status); + default: + throw new Error(`Unexpected message from worker: ${message.type}`); } - } + }); + + worker.on('error', (err) => { + this.fail( + testFileName, + { + status: NODE_UNCAUGHT, + name: 'evaluation in WPTRunner.runJsTests()', + message: err.message, + stack: inspect(err) + }, + kUncaught + ); + this.inProgress.delete(testFileName); + }); } process.on('exit', () => { @@ -430,56 +441,6 @@ class WPTRunner { }); } - mock(testfile) { - const resource = this.resource; - const result = { - // This is a mock, because at the moment fetch is not implemented - // in Node.js, but some tests and harness depend on this to pull - // resources. - fetch(file) { - return resource.read(testfile, file, true); - }, - GLOBAL: { - isWindow() { return false; } - }, - Object - }; - - return result; - } - - // Note: this is how our global space for the WPT test should look like - getSandbox(filename) { - const result = this.mock(filename); - for (const [name, desc] of this.globals) { - Object.defineProperty(result, name, desc); - } - return result; - } - - generateContext(test) { - const filename = test.filename; - const sandbox = this.sandbox = this.getSandbox(test.getRelativePath()); - const context = this.context = vm.createContext(sandbox); - - const harnessPath = fixtures.path('wpt', 'resources', 'testharness.js'); - const harness = fs.readFileSync(harnessPath, 'utf8'); - vm.runInContext(harness, context, { - filename: harnessPath - }); - - sandbox.add_result_callback( - this.resultCallback.bind(this, filename) - ); - sandbox.add_completion_callback( - this.completionCallback.bind(this, filename) - ); - sandbox.self = sandbox; - // TODO(joyeecheung): we are not a window - work with the upstream to - // add a new scope for us. - return context; - } - getTestTitle(filename) { const spec = this.specMap.get(filename); const title = spec.meta && spec.meta.title; @@ -524,9 +485,9 @@ class WPTRunner { * Report the status of each WPT test (one per file) * * @param {string} filename - * @param {Test[]} test The Test objects returned by WPT harness + * @param {object} harnessStatus - The status object returned by WPT harness. */ - completionCallback(filename, tests, harnessStatus) { + completionCallback(filename, harnessStatus) { // Treat it like a test case failure if (harnessStatus.status === 2) { const title = this.getTestTitle(filename); @@ -644,5 +605,6 @@ class WPTRunner { module.exports = { harness: harnessMock, + ResourceLoader, WPTRunner }; diff --git a/test/common/wpt/worker.js b/test/common/wpt/worker.js new file mode 100644 index 00000000000000..f0faeeba9e8062 --- /dev/null +++ b/test/common/wpt/worker.js @@ -0,0 +1,55 @@ +/* eslint-disable node-core/required-modules,node-core/require-common-first */ + +'use strict'; + +const { runInThisContext } = require('vm'); +const { parentPort, workerData } = require('worker_threads'); + +const { ResourceLoader } = require(workerData.wptRunner); +const resource = new ResourceLoader(workerData.wptPath); + +global.self = global; +global.GLOBAL = { + isWindow() { return false; } +}; +global.require = require; + +// This is a mock, because at the moment fetch is not implemented +// in Node.js, but some tests and harness depend on this to pull +// resources. +global.fetch = function fetch(file) { + return resource.read(workerData.filename, file, true); +}; + +if (workerData.initScript) { + runInThisContext(workerData.initScript); +} + +runInThisContext(workerData.harness.code, { + filename: workerData.harness.filename +}); + +// eslint-disable-next-line no-undef +add_result_callback((result) => { + parentPort.postMessage({ + type: 'result', + result: { + status: result.status, + name: result.name, + message: result.message, + stack: result.stack, + }, + }); +}); + +// eslint-disable-next-line no-undef +add_completion_callback((_, status) => { + parentPort.postMessage({ + type: 'completion', + status, + }); +}); + +for (const scriptToRun of workerData.scriptsToRun) { + runInThisContext(scriptToRun.code, { filename: scriptToRun.filename }); +} diff --git a/test/wpt/README.md b/test/wpt/README.md index d15a56745be090..d2a47737b0367b 100644 --- a/test/wpt/README.md +++ b/test/wpt/README.md @@ -45,23 +45,20 @@ For example, for the URL tests, add a file `test/wpt/test-url.js`: ```js 'use strict'; -// This flag is required by the WPT Runner to patch the internals -// for the tests to run in a vm. -// Flags: --expose-internals - require('../common'); const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('url'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, ['URL', 'URLSearchParams']); -// Define any additional globals with descriptors -runner.defineGlobal('DOMException', { - get() { - return require('internal/domexception'); - } -}); +// Set Node.js flags required for the tests. +runner.setFlags(['--expose-internals']); + +// Set a script that will be executed in the worker before running the tests. +runner.setInitScript(` + const { internalBinding } = require('internal/test/binding'); + const { DOMException } = internalBinding('messaging'); + global.DOMException = DOMException; +`); runner.runJsTests(); ``` @@ -82,7 +79,7 @@ To run a specific test in WPT, for example, `url/url-searchparams.any.js`, pass the file name as argument to the corresponding test driver: ```text -node --expose-internals test/wpt/test-url.js url-searchparams.any.js +node test/wpt/test-url.js url-searchparams.any.js ``` If there are any failures, update the corresponding status file @@ -138,9 +135,9 @@ loads: * Status file (for example, `test/wpt/status/url.json` for `url`) * The WPT harness -Then, for each test, it creates a vm with the globals and mocks, +Then, for each test, it creates a worker thread with the globals and mocks, sets up the harness result hooks, loads the metadata in the test (including -loading extra resources), and runs all the tests in that vm, +loading extra resources), and runs all the tests in that worker thread, skipping tests that cannot be run because of lack of dependency or expected failures. diff --git a/test/wpt/test-console.js b/test/wpt/test-console.js index ae0e3385479bae..e66726431fba6e 100644 --- a/test/wpt/test-console.js +++ b/test/wpt/test-console.js @@ -4,7 +4,4 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('console'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, ['console']); - runner.runJsTests(); diff --git a/test/wpt/test-encoding.js b/test/wpt/test-encoding.js index 8cd0d5e04e0b7b..b297648d9cb7ee 100644 --- a/test/wpt/test-encoding.js +++ b/test/wpt/test-encoding.js @@ -1,16 +1,11 @@ 'use strict'; require('../common'); -const { MessageChannel } = require('worker_threads'); const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('encoding'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, ['TextDecoder', 'TextEncoder']); - -runner.defineGlobal('MessageChannel', { - get() { - return MessageChannel; - } -}); +runner.setInitScript(` + const { MessageChannel } = require('worker_threads'); + global.MessageChannel = MessageChannel; +`); runner.runJsTests(); diff --git a/test/wpt/test-hr-time.js b/test/wpt/test-hr-time.js index eb9c68797dfcbf..d77ac0bbc6d9c0 100644 --- a/test/wpt/test-hr-time.js +++ b/test/wpt/test-hr-time.js @@ -1,27 +1,14 @@ 'use strict'; -// Flags: --expose-internals - require('../common'); const { WPTRunner } = require('../common/wpt'); -const { performance, PerformanceObserver } = require('perf_hooks'); const runner = new WPTRunner('hr-time'); -runner.copyGlobalsFromObject(global, [ - 'setInterval', - 'clearInterval', - 'setTimeout', - 'clearTimeout' -]); - -runner.defineGlobal('performance', { - get() { - return performance; - } -}); -runner.defineGlobal('PerformanceObserver', { - value: PerformanceObserver -}); +runner.setInitScript(` + const { performance, PerformanceObserver } = require('perf_hooks'); + global.performance = performance; + global.PerformanceObserver = PerformanceObserver; +`); runner.runJsTests(); diff --git a/test/wpt/test-microtask-queuing.js b/test/wpt/test-microtask-queuing.js index 84f29ac2b994b0..3a83fd33ba051e 100644 --- a/test/wpt/test-microtask-queuing.js +++ b/test/wpt/test-microtask-queuing.js @@ -5,7 +5,4 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('html/webappapis/microtask-queuing'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, ['queueMicrotask']); - runner.runJsTests(); diff --git a/test/wpt/test-timers.js b/test/wpt/test-timers.js index 4d342305400215..7736d540a2aa28 100644 --- a/test/wpt/test-timers.js +++ b/test/wpt/test-timers.js @@ -5,12 +5,4 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('html/webappapis/timers'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, [ - 'setInterval', - 'clearInterval', - 'setTimeout', - 'clearTimeout' -]); - runner.runJsTests(); diff --git a/test/wpt/test-url.js b/test/wpt/test-url.js index 5d5240ce181393..4652bfd880cd76 100644 --- a/test/wpt/test-url.js +++ b/test/wpt/test-url.js @@ -1,20 +1,18 @@ 'use strict'; -// Flags: --expose-internals - require('../common'); const { WPTRunner } = require('../common/wpt'); -const { internalBinding } = require('internal/test/binding'); -const { DOMException } = internalBinding('messaging'); + const runner = new WPTRunner('url'); -// Copy global descriptors from the global object -runner.copyGlobalsFromObject(global, ['URL', 'URLSearchParams']); -// Needed by urlsearchparams-constructor.any.js -runner.defineGlobal('DOMException', { - get() { - return DOMException; - } -}); +// Needed to access to DOMException. +runner.setFlags(['--expose-internals']); + +// DOMException is needed by urlsearchparams-constructor.any.js +runner.setInitScript(` + const { internalBinding } = require('internal/test/binding'); + const { DOMException } = internalBinding('messaging'); + global.DOMException = DOMException; +`); runner.runJsTests(); From c080fc590d019f0f9cebbc6b69196d21b75eddf6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 12 Aug 2020 17:26:23 -0700 Subject: [PATCH 066/104] test: move test-inspector-already-activated-cli to parallel There doesn't seem to be a reason for this test to have to stay in sequential. It appears to have been placed there out of caution. PR-URL: https://github.com/nodejs/node/pull/34755 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- .../test-inspector-already-activated-cli.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{sequential => parallel}/test-inspector-already-activated-cli.js (100%) diff --git a/test/sequential/test-inspector-already-activated-cli.js b/test/parallel/test-inspector-already-activated-cli.js similarity index 100% rename from test/sequential/test-inspector-already-activated-cli.js rename to test/parallel/test-inspector-already-activated-cli.js From 3360dcbfab12fd09aa54785589e1f2740668b973 Mon Sep 17 00:00:00 2001 From: Hilla Shahrabani Date: Sun, 16 Aug 2020 20:52:01 +0200 Subject: [PATCH 067/104] doc: fix some typos and grammar mistakes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34800 Reviewed-By: Colin Ihrig Reviewed-By: Benjamin Gruenbaum Reviewed-By: Richard Lau Reviewed-By: Harshitha K P Reviewed-By: Anna Henningsen Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- doc/guides/contributing/issues.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guides/contributing/issues.md b/doc/guides/contributing/issues.md index 70f649a6105921..44b18bc8ede7d2 100644 --- a/doc/guides/contributing/issues.md +++ b/doc/guides/contributing/issues.md @@ -100,8 +100,8 @@ on the README.md of this project with: i) a request to be added as a triager, ii) the motivation for becoming a triager, and iii) agreement on reading, understanding, and adhering to the project's [Code Of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md). -The triage role enables the ability to carry the out most common triage -activities, such as applying labels and close/repoening/assigning issues. +The triage role enables the ability to carry out the most common triage +activities, such as applying labels and closing/reopening/assigning issues. For more information on the roles and permissions, see ["Permission levels for repositories owned by an organization"](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization). From 969fb1c5e39a17c4442459af9e6211f315926073 Mon Sep 17 00:00:00 2001 From: Andrey Pechkurov Date: Tue, 18 Aug 2020 16:37:02 +0300 Subject: [PATCH 068/104] doc: improve async_hooks snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34829 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Gerhard Stöbich --- doc/api/async_hooks.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 74abab4fa789be..921147f5cc09b0 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -273,7 +273,8 @@ async_hooks.createHook({ init(asyncId, type, triggerAsyncId) { const eid = async_hooks.executionAsyncId(); fs.writeSync( - 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + process.stdout.fd, + `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); } }).enable(); @@ -325,7 +326,7 @@ async_hooks.createHook({ const eid = async_hooks.executionAsyncId(); const indentStr = ' '.repeat(indent); fs.writeSync( - 1, + process.stdout.fd, `${indentStr}${type}(${asyncId}):` + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); }, From 8f38c19c0860daa13563f4c9ab253cd9b5be49ab Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sun, 16 Aug 2020 12:28:54 +0300 Subject: [PATCH 069/104] esm: improve error message of ERR_UNSUPPORTED_ESM_URL_SCHEME Refs: https://github.com/nodejs/node/issues/34765 PR-URL: https://github.com/nodejs/node/pull/34795 Reviewed-By: Matteo Collina Reviewed-By: Ruben Bridgewater Reviewed-By: Jan Krems Reviewed-By: Guy Bedford Reviewed-By: Bradley Farias Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- lib/internal/errors.js | 13 +++++++++++-- lib/internal/modules/esm/resolve.js | 2 +- test/es-module/test-esm-dynamic-import.js | 23 ++++++++++++++--------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 54a05df736148f..191d51552f7d22 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -26,6 +26,8 @@ const { WeakMap, } = primordials; +const isWindows = process.platform === 'win32'; + const messages = new Map(); const codes = {}; @@ -1410,8 +1412,15 @@ E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError); E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError); E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules imported from %s', Error); -E('ERR_UNSUPPORTED_ESM_URL_SCHEME', 'Only file and data URLs are supported ' + - 'by the default ESM loader', Error); +E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => { + let msg = 'Only file and data URLs are supported by the default ESM loader'; + if (isWindows && url.protocol.length === 2) { + msg += '. Absolute Windows paths without prefix are not valid URLs, ' + + "consider using 'file://' prefix"; + } + msg += `. Received protocol '${url.protocol}'`; + return msg; +}, Error); // This should probably be a `TypeError`. E('ERR_VALID_PERFORMANCE_ENTRY_TYPE', diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 04a17c908ad91b..d58eac5f1c10cb 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -747,7 +747,7 @@ function defaultResolve(specifier, context = {}, defaultResolveUnused) { if (parsed && parsed.protocol === 'nodejs:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') - throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(); + throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); if (NativeModule.canBeRequiredByUsers(specifier)) { return { url: 'nodejs:' + specifier diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index e72922d31c0b18..30a5758ad9b0d4 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -8,15 +8,11 @@ const absolutePath = require.resolve('../fixtures/es-modules/test-esm-ok.mjs'); const targetURL = new URL('file:///'); targetURL.pathname = absolutePath; -function expectErrorProperty(result, propertyKey, value) { - Promise.resolve(result) - .catch(common.mustCall((error) => { - assert.strictEqual(error[propertyKey], value); - })); -} - -function expectModuleError(result, err) { - expectErrorProperty(result, 'code', err); +function expectModuleError(result, code, message) { + Promise.resolve(result).catch(common.mustCall((error) => { + assert.strictEqual(error.code, code); + if (message) assert.strictEqual(error.message, message); + })); } function expectOkNamespace(result) { @@ -60,4 +56,13 @@ function expectFsNamespace(result) { 'ERR_MODULE_NOT_FOUND'); expectModuleError(import('http://example.com/foo.js'), 'ERR_UNSUPPORTED_ESM_URL_SCHEME'); + if (common.isWindows) { + const msg = + 'Only file and data URLs are supported by the default ESM loader. ' + + 'Absolute Windows paths without prefix are not valid URLs, ' + + "consider using 'file://' prefix. Received protocol 'c:'"; + expectModuleError(import('C:\\example\\foo.mjs'), + 'ERR_UNSUPPORTED_ESM_URL_SCHEME', + msg); + } })(); From 5c987ffc96c49c3b7f5d3ab3755d5e491e690347 Mon Sep 17 00:00:00 2001 From: Frank Lemanschik Date: Sat, 15 Aug 2020 09:45:43 +0200 Subject: [PATCH 070/104] doc: fix file name to main.mjs and not main.js in esm.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34786 Reviewed-By: Michaël Zasso Reviewed-By: Derek Lewis Reviewed-By: Geoffrey Booth Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Rich Trott --- doc/api/esm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 12aed8ff772a61..d183cea1b5010c 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1506,8 +1506,8 @@ console.log(VERSION); With this loader, running: -```console -node --experimental-loader ./https-loader.mjs ./main.js +```bash +node --experimental-loader ./https-loader.mjs ./main.mjs ``` Will print the current version of CoffeeScript per the module at the URL in From b356b79ca4aa846522ddc5eb9c8aa0da4dc5f703 Mon Sep 17 00:00:00 2001 From: "Jerome T.K. Covington" Date: Sat, 8 Aug 2020 20:17:01 -0400 Subject: [PATCH 071/104] doc: reorder deprecated tls docs In other api docs, it seems that deprecated classes and methods are listed along with others, and marked as deprecated. In tls docs, deprecations were listed at the bottom of the document. This commit reorders them to what seems to be the standard, and corrects some links in doc/api/deprecations.md PR-URL: https://github.com/nodejs/node/pull/34687 Reviewed-By: Rich Trott --- doc/api/deprecations.md | 4 +- doc/api/tls.md | 218 ++++++++++++++++++++-------------------- 2 files changed, 110 insertions(+), 112 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index d0e2c6d0b26745..dc7220ee82c614 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2846,9 +2846,9 @@ The [`crypto.Certificate()` constructor][] is deprecated. Use [`timeout.ref()`]: timers.html#timers_timeout_ref [`timeout.refresh()`]: timers.html#timers_timeout_refresh [`timeout.unref()`]: timers.html#timers_timeout_unref -[`tls.CryptoStream`]: tls.html#tls_class_cryptostream +[`tls.CryptoStream`]: tls.html#tls_class_tls_cryptostream [`tls.SecureContext`]: tls.html#tls_tls_createsecurecontext_options -[`tls.SecurePair`]: tls.html#tls_class_securepair +[`tls.SecurePair`]: tls.html#tls_class_tls_securepair [`tls.TLSSocket`]: tls.html#tls_class_tls_tlssocket [`tls.checkServerIdentity()`]: tls.html#tls_tls_checkserveridentity_hostname_cert [`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options diff --git a/doc/api/tls.md b/doc/api/tls.md index 5d24db52d6ff5f..58b0f77db59428 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -370,6 +370,51 @@ The first 3 are enabled by default. The last 2 `CCM`-based suites are supported by TLSv1.3 because they may be more performant on constrained systems, but they are not enabled by default since they offer less security. +## Class: `tls.CryptoStream` + + +> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +is deprecated and should no longer be used. + +### `cryptoStream.bytesWritten` + + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +## Class: `tls.SecurePair` + + +> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. + +Returned by [`tls.createSecurePair()`][]. + +### Event: `'secure'` + + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server +[`'secureConnection'`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + ## Class: `tls.Server` + +> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. + +* `context` {Object} A secure context object as returned by + `tls.createSecureContext()` +* `isServer` {boolean} `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` {boolean} `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` {boolean} If not `false` a server automatically reject + clients with invalid certificates. Only applies when `isServer` is `true`. +* `options` + * `enableTrace`: See [`tls.createServer()`][] + * `secureContext`: A TLS context object from [`tls.createSecureContext()`][] + * `isServer`: If `true` the TLS socket will be instantiated in server-mode. + **Default:** `false`. + * `server` {net.Server} A [`net.Server`][] instance + * `requestCert`: See [`tls.createServer()`][] + * `rejectUnauthorized`: See [`tls.createServer()`][] + * `ALPNProtocols`: See [`tls.createServer()`][] + * `SNICallback`: See [`tls.createServer()`][] + * `session` {Buffer} A `Buffer` instance containing a TLS session. + * `requestOCSP` {boolean} If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication. + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +Using `cleartext` has the same API as [`tls.TLSSocket`][]. + +The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```js +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```js +secureSocket = tls.TLSSocket(socket, options); +``` + +where `secureSocket` has the same API as `pair.cleartext`. + ## `tls.createServer([options][, secureConnectionListener])` - -> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -The `tls.CryptoStream` class represents a stream of encrypted data. This class -is deprecated and should no longer be used. - -#### `cryptoStream.bytesWritten` - - -The `cryptoStream.bytesWritten` property returns the total number of bytes -written to the underlying socket *including* the bytes required for the -implementation of the TLS protocol. - -### Class: `SecurePair` - - -> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -Returned by [`tls.createSecurePair()`][]. - -#### Event: `'secure'` - - -The `'secure'` event is emitted by the `SecurePair` object once a secure -connection has been established. - -As with checking for the server -[`'secureConnection'`](#tls_event_secureconnection) -event, `pair.cleartext.authorized` should be inspected to confirm whether the -certificate used is properly authorized. - -### `tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])` - - -> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -* `context` {Object} A secure context object as returned by - `tls.createSecureContext()` -* `isServer` {boolean} `true` to specify that this TLS connection should be - opened as a server. -* `requestCert` {boolean} `true` to specify whether a server should request a - certificate from a connecting client. Only applies when `isServer` is `true`. -* `rejectUnauthorized` {boolean} If not `false` a server automatically reject - clients with invalid certificates. Only applies when `isServer` is `true`. -* `options` - * `enableTrace`: See [`tls.createServer()`][] - * `secureContext`: A TLS context object from [`tls.createSecureContext()`][] - * `isServer`: If `true` the TLS socket will be instantiated in server-mode. - **Default:** `false`. - * `server` {net.Server} A [`net.Server`][] instance - * `requestCert`: See [`tls.createServer()`][] - * `rejectUnauthorized`: See [`tls.createServer()`][] - * `ALPNProtocols`: See [`tls.createServer()`][] - * `SNICallback`: See [`tls.createServer()`][] - * `session` {Buffer} A `Buffer` instance containing a TLS session. - * `requestOCSP` {boolean} If `true`, specifies that the OCSP status request - extension will be added to the client hello and an `'OCSPResponse'` event - will be emitted on the socket before establishing a secure communication. - -Creates a new secure pair object with two streams, one of which reads and writes -the encrypted data and the other of which reads and writes the cleartext data. -Generally, the encrypted stream is piped to/from an incoming encrypted data -stream and the cleartext one is used as a replacement for the initial encrypted -stream. - -`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and -`encrypted` stream properties. - -Using `cleartext` has the same API as [`tls.TLSSocket`][]. - -The `tls.createSecurePair()` method is now deprecated in favor of -`tls.TLSSocket()`. For example, the code: - -```js -pair = tls.createSecurePair(/* ... */); -pair.encrypted.pipe(socket); -socket.pipe(pair.encrypted); -``` - -can be replaced by: - -```js -secureSocket = tls.TLSSocket(socket, options); -``` - -where `secureSocket` has the same API as `pair.cleartext`. - [`'newSession'`]: #tls_event_newsession [`'resumeSession'`]: #tls_event_resumesession [`'secureConnect'`]: #tls_event_secureconnect From 7f0869f9639b97f9bcfd9de1d6cae054a9fb9a32 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 17 Aug 2020 11:52:52 -0400 Subject: [PATCH 072/104] build: run link checker in linter workflow Signed-off-by: Richard Lau PR-URL: https://github.com/nodejs/node/pull/34810 Refs: https://github.com/nodejs/node/issues/34787 Reviewed-By: Mary Marchini Reviewed-By: James M Snell Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- .github/workflows/misc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index 403a47614f8005..df33822770523b 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -28,3 +28,5 @@ jobs: with: name: docs path: out/doc + - name: Check links + run: node tools/doc/checkLinks.js . From cdd4540124354dcf5fa8e36237795af9c68fd861 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 17 Aug 2020 12:21:57 -0400 Subject: [PATCH 073/104] doc,tools: annotate broken links in actions workflow Change format of logged messages when run on GitHub Actions (i.e. when the `GITHUB_ACTIONS` environment variable is true) so that broken links are highlighted inline in pull requests. Signed-off-by: Richard Lau PR-URL: https://github.com/nodejs/node/pull/34810 Refs: https://github.com/nodejs/node/issues/34787 Reviewed-By: Mary Marchini Reviewed-By: James M Snell Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- tools/doc/checkLinks.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/doc/checkLinks.js b/tools/doc/checkLinks.js index 00697cc01cf01a..eea9af4cc9cfc9 100644 --- a/tools/doc/checkLinks.js +++ b/tools/doc/checkLinks.js @@ -50,7 +50,9 @@ function checkFile(path) { const targetURL = new URL(node.url, base); if (targetURL.protocol === 'file:' && !fs.existsSync(targetURL)) { const { line, column } = node.position.start; - console.error(`Broken link at ${path}:${line}:${column} (${node.url})`); + console.error((process.env.GITHUB_ACTIONS ? + `::error file=${path},line=${line},col=${column}::` : '') + + `Broken link at ${path}:${line}:${column} (${node.url})`); process.exitCode = 1; } } From 34430abd7170e184906d2fdbf1d404ac9ea7493f Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 12:16:08 +0200 Subject: [PATCH 074/104] doc: move module core module doc to separate page The `module` core module is available for both CJS and ESM users, it deserves its own page. PR-URL: https://github.com/nodejs/node/pull/34747 Refs: https://github.com/nodejs/modules/issues/539 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- .eslintrc.js | 1 + doc/api/deprecations.md | 2 +- doc/api/esm.md | 4 +- doc/api/index.md | 1 + doc/api/module.md | 194 ++++++++++++++++++++++++++++++++++++++ doc/api/modules.md | 195 +++------------------------------------ tools/doc/type-parser.js | 2 +- 7 files changed, 215 insertions(+), 184 deletions(-) create mode 100644 doc/api/module.md diff --git a/.eslintrc.js b/.eslintrc.js index 8279dfc9c4ab41..d9185356d15b06 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,6 +43,7 @@ module.exports = { { files: [ 'doc/api/esm.md', + 'doc/api/module.md', 'doc/api/modules.md', 'test/es-module/test-esm-type-flag.js', 'test/es-module/test-esm-type-flag-alias.js', diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index dc7220ee82c614..687fa4b8489a67 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2821,7 +2821,7 @@ The [`crypto.Certificate()` constructor][] is deprecated. Use [`http.request()`]: http.html#http_http_request_options_callback [`https.get()`]: https.html#https_https_get_options_callback [`https.request()`]: https.html#https_https_request_options_callback -[`module.createRequire()`]: modules.html#modules_module_createrequire_filename +[`module.createRequire()`]: module.html#module_module_createrequire_filename [`os.networkInterfaces()`]: os.html#os_os_networkinterfaces [`os.tmpdir()`]: os.html#os_os_tmpdir [`process.env`]: process.html#process_process_env diff --git a/doc/api/esm.md b/doc/api/esm.md index d183cea1b5010c..2968e0385b3656 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1920,8 +1920,8 @@ success! [`import()`]: #esm_import_expressions [`import.meta.url`]: #esm_import_meta [`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import -[`module.createRequire()`]: modules.html#modules_module_createrequire_filename -[`module.syncBuiltinESMExports()`]: modules.html#modules_module_syncbuiltinesmexports +[`module.createRequire()`]: module.html#module_module_createrequire_filename +[`module.syncBuiltinESMExports()`]: module.html#module_module_syncbuiltinesmexports [`transformSource` hook]: #esm_transformsource_source_context_defaulttransformsource [`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer diff --git a/doc/api/index.md b/doc/api/index.md index d0ade400639889..38c2f550b7094c 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -36,6 +36,7 @@ * [Inspector](inspector.html) * [Internationalization](intl.html) * [Modules](modules.html) +* [Modules: `module` core module](module.html) * [Net](net.html) * [OS](os.html) * [Path](path.html) diff --git a/doc/api/module.md b/doc/api/module.md new file mode 100644 index 00000000000000..98bc8e82f95247 --- /dev/null +++ b/doc/api/module.md @@ -0,0 +1,194 @@ +# Modules: `module` core module + + + +## The `Module` object + +* {Object} + +Provides general utility methods when interacting with instances of +`Module`, the `module` variable often seen in file modules. Accessed +via `require('module')`. + +### `module.builtinModules` + + +* {string[]} + +A list of the names of all modules provided by Node.js. Can be used to verify +if a module is maintained by a third party or not. + +`module` in this context isn't the same object that's provided +by the [module wrapper][]. To access it, require the `Module` module: + +```js +const builtin = require('module').builtinModules; +``` + +### `module.createRequire(filename)` + + +* `filename` {string|URL} Filename to be used to construct the require + function. Must be a file URL object, file URL string, or absolute path + string. +* Returns: {require} Require function + +```js +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); + +// sibling-module.js is a CommonJS module. +const siblingModule = require('./sibling-module'); +``` + +### `module.createRequireFromPath(filename)` + + +> Stability: 0 - Deprecated: Please use [`createRequire()`][] instead. + +* `filename` {string} Filename to be used to construct the relative require + function. +* Returns: {require} Require function + +```js +const { createRequireFromPath } = require('module'); +const requireUtil = createRequireFromPath('../src/utils/'); + +// Require `../src/utils/some-tool` +requireUtil('./some-tool'); +``` + +### `module.syncBuiltinESMExports()` + + +The `module.syncBuiltinESMExports()` method updates all the live bindings for +builtin ES Modules to match the properties of the CommonJS exports. It does +not add or remove exported names from the ES Modules. + +```js +const fs = require('fs'); +const { syncBuiltinESMExports } = require('module'); + +fs.readFile = null; + +delete fs.readFileSync; + +fs.newAPI = function newAPI() { + // ... +}; + +syncBuiltinESMExports(); + +import('fs').then((esmFS) => { + assert.strictEqual(esmFS.readFile, null); + assert.strictEqual('readFileSync' in fs, true); + assert.strictEqual(esmFS.newAPI, undefined); +}); +``` + +## Source map v3 support + + +> Stability: 1 - Experimental + +Helpers for interacting with the source map cache. This cache is +populated when source map parsing is enabled and +[source map include directives][] are found in a modules' footer. + +To enable source map parsing, Node.js must be run with the flag +[`--enable-source-maps`][], or with code coverage enabled by setting +[`NODE_V8_COVERAGE=dir`][]. + +```js +const { findSourceMap, SourceMap } = require('module'); +``` + +### `module.findSourceMap(path[, error])` + + +* `path` {string} +* `error` {Error} +* Returns: {module.SourceMap} + +`path` is the resolved path for the file for which a corresponding source map +should be fetched. + +The `error` instance should be passed as the second parameter to `findSourceMap` +in exceptional flows, e.g., when an overridden +[`Error.prepareStackTrace(error, trace)`][] is invoked. Modules are not added to +the module cache until they are successfully loaded, in these cases source maps +will be associated with the `error` instance along with the `path`. + +### Class: `module.SourceMap` + + +#### `new SourceMap(payload)` + +* `payload` {Object} + +Creates a new `sourceMap` instance. + +`payload` is an object with keys matching the [Source map v3 format][]: + +* `file`: {string} +* `version`: {number} +* `sources`: {string[]} +* `sourcesContent`: {string[]} +* `names`: {string[]} +* `mappings`: {string} +* `sourceRoot`: {string} + +#### `sourceMap.payload` + +* Returns: {Object} + +Getter for the payload used to construct the [`SourceMap`][] instance. + +#### `sourceMap.findEntry(lineNumber, columnNumber)` + +* `lineNumber` {number} +* `columnNumber` {number} +* Returns: {Object} + +Given a line number and column number in the generated source file, returns +an object representing the position in the original file. The object returned +consists of the following keys: + +* generatedLine: {number} +* generatedColumn: {number} +* originalSource: {string} +* originalLine: {number} +* originalColumn: {number} + +[`createRequire()`]: #module_module_createrequire_filename +[module wrapper]: modules_cjs.html#modules_cjs_the_module_wrapper +[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx +[`--enable-source-maps`]: cli.html#cli_enable_source_maps +[`NODE_V8_COVERAGE=dir`]: cli.html#cli_node_v8_coverage_dir +[`Error.prepareStackTrace(error, trace)`]: https://v8.dev/docs/stack-trace-api#customizing-stack-traces +[`SourceMap`]: #module_class_module_sourcemap +[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej diff --git a/doc/api/modules.md b/doc/api/modules.md index 061c07604b039f..044f2fdc068ab2 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -952,189 +952,31 @@ in order to be used. ## The `Module` object - - -* {Object} - -Provides general utility methods when interacting with instances of -`Module`, the `module` variable often seen in file modules. Accessed -via `require('module')`. - -### `module.builtinModules` - - -* {string[]} - -A list of the names of all modules provided by Node.js. Can be used to verify -if a module is maintained by a third party or not. - -`module` in this context isn't the same object that's provided -by the [module wrapper][]. To access it, require the `Module` module: - -```js -const builtin = require('module').builtinModules; -``` - -### `module.createRequire(filename)` - - -* `filename` {string|URL} Filename to be used to construct the require - function. Must be a file URL object, file URL string, or absolute path - string. -* Returns: {require} Require function - -```js -import { createRequire } from 'module'; -const require = createRequire(import.meta.url); - -// sibling-module.js is a CommonJS module. -const siblingModule = require('./sibling-module'); -``` - -### `module.createRequireFromPath(filename)` - - -> Stability: 0 - Deprecated: Please use [`createRequire()`][] instead. - -* `filename` {string} Filename to be used to construct the relative require - function. -* Returns: {require} Require function - -```js -const { createRequireFromPath } = require('module'); -const requireUtil = createRequireFromPath('../src/utils/'); - -// Require `../src/utils/some-tool` -requireUtil('./some-tool'); -``` - -### `module.syncBuiltinESMExports()` - - -The `module.syncBuiltinESMExports()` method updates all the live bindings for -builtin ES Modules to match the properties of the CommonJS exports. It does -not add or remove exported names from the ES Modules. +This section was moved to +[Modules: `module` core module](modules_module.html#modules_module_the_module_object). -```js -const fs = require('fs'); -const { syncBuiltinESMExports } = require('module'); - -fs.readFile = null; - -delete fs.readFileSync; - -fs.newAPI = function newAPI() { - // ... -}; - -syncBuiltinESMExports(); - -import('fs').then((esmFS) => { - assert.strictEqual(esmFS.readFile, null); - assert.strictEqual('readFileSync' in fs, true); - assert.strictEqual(esmFS.newAPI, undefined); -}); -``` + +* `module.builtinModules` +* `module.createRequire(filename)` +* `module.createRequireFromPath(filename)` +* `module.syncBuiltinESMExports()` ## Source map v3 support - - -> Stability: 1 - Experimental - -Helpers for interacting with the source map cache. This cache is -populated when source map parsing is enabled and -[source map include directives][] are found in a modules' footer. - -To enable source map parsing, Node.js must be run with the flag -[`--enable-source-maps`][], or with code coverage enabled by setting -[`NODE_V8_COVERAGE=dir`][]. - -```js -const { findSourceMap, SourceMap } = require('module'); -``` - -### `module.findSourceMap(path[, error])` - - -* `path` {string} -* `error` {Error} -* Returns: {module.SourceMap} - -`path` is the resolved path for the file for which a corresponding source map -should be fetched. - -The `error` instance should be passed as the second parameter to `findSourceMap` -in exceptional flows, e.g., when an overridden -[`Error.prepareStackTrace(error, trace)`][] is invoked. Modules are not added to -the module cache until they are successfully loaded, in these cases source maps -will be associated with the `error` instance along with the `path`. - -### Class: `module.SourceMap` - - -#### `new SourceMap(payload)` - -* `payload` {Object} - -Creates a new `sourceMap` instance. - -`payload` is an object with keys matching the [Source map v3 format][]: - -* `file`: {string} -* `version`: {number} -* `sources`: {string[]} -* `sourcesContent`: {string[]} -* `names`: {string[]} -* `mappings`: {string} -* `sourceRoot`: {string} - -#### `sourceMap.payload` - -* Returns: {Object} - -Getter for the payload used to construct the [`SourceMap`][] instance. - -#### `sourceMap.findEntry(lineNumber, columnNumber)` - -* `lineNumber` {number} -* `columnNumber` {number} -* Returns: {Object} -Given a line number and column number in the generated source file, returns -an object representing the position in the original file. The object returned -consists of the following keys: +This section was moved to +[Modules: `module` core module](modules_module.html#modules_module_source_map_v3_support). -* generatedLine: {number} -* generatedColumn: {number} -* originalSource: {string} -* originalLine: {number} -* originalColumn: {number} + +* `module.findSourceMap(path[, error])` +* Class: `module.SourceMap` + * `new SourceMap(payload)` + * `sourceMap.payload` + * `sourceMap.findEntry(lineNumber, columnNumber)` [GLOBAL_FOLDERS]: #modules_loading_from_the_global_folders [`Error`]: errors.html#errors_class_error [`__dirname`]: #modules_dirname [`__filename`]: #modules_filename -[`createRequire()`]: #modules_module_createrequire_filename [`module` object]: #modules_the_module_object [`module.id`]: #modules_module_id [`module.children`]: #modules_module_children @@ -1143,12 +985,5 @@ consists of the following keys: [an error]: errors.html#errors_err_require_esm [exports shortcut]: #modules_exports_shortcut [module resolution]: #modules_all_together -[module wrapper]: #modules_the_module_wrapper [native addons]: addons.html [`require.main`]: #modules_require_main -[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx -[`--enable-source-maps`]: cli.html#cli_enable_source_maps -[`NODE_V8_COVERAGE=dir`]: cli.html#cli_node_v8_coverage_dir -[`Error.prepareStackTrace(error, trace)`]: https://v8.dev/docs/stack-trace-api#customizing-stack-traces -[`SourceMap`]: modules.html#modules_class_module_sourcemap -[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index ec6c8e54ef8410..0b7424f8e72c42 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -114,7 +114,7 @@ const customTypesMap = { 'module': 'modules.html#modules_the_module_object', 'module.SourceMap': - 'modules.html#modules_class_module_sourcemap', + 'modules_module.html#modules_module_class_module_sourcemap', 'require': 'modules.html#modules_require_id', From 6b45bf347543f618a6400fe5f257d3db5d0567c3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 8 Aug 2020 23:44:08 +0200 Subject: [PATCH 075/104] test: modernize test-cluster-master-error Some stylistic changes to bring this more in line with what our tests currently look like, and add a note about general flakiness. PR-URL: https://github.com/nodejs/node/pull/34685 Reviewed-By: James M Snell Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- test/parallel/test-cluster-master-error.js | 38 +++++----------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/test/parallel/test-cluster-master-error.js b/test/parallel/test-cluster-master-error.js index 9abb42e4225567..eb0a3959969e48 100644 --- a/test/parallel/test-cluster-master-error.js +++ b/test/parallel/test-cluster-master-error.js @@ -29,16 +29,11 @@ const totalWorkers = 2; // Cluster setup if (cluster.isWorker) { const http = require('http'); - http.Server(() => { - - }).listen(0, '127.0.0.1'); - + http.Server(() => {}).listen(0, '127.0.0.1'); } else if (process.argv[2] === 'cluster') { - // Send PID to testcase process let forkNum = 0; cluster.on('fork', common.mustCall(function forkEvent(worker) { - // Send PID process.send({ cmd: 'worker', @@ -49,12 +44,11 @@ if (cluster.isWorker) { if (++forkNum === totalWorkers) { cluster.removeListener('fork', forkEvent); } - })); + }, totalWorkers)); // Throw accidental error when all workers are listening let listeningNum = 0; cluster.on('listening', common.mustCall(function listeningEvent() { - // When all workers are listening if (++listeningNum === totalWorkers) { // Stop listening @@ -65,21 +59,16 @@ if (cluster.isWorker) { throw new Error('accidental error'); }); } - - })); + }, totalWorkers)); // Startup a basic cluster cluster.fork(); cluster.fork(); - } else { // This is the testcase const fork = require('child_process').fork; - let masterExited = false; - let workersExited = false; - // List all workers const workers = []; @@ -88,7 +77,6 @@ if (cluster.isWorker) { // Handle messages from the cluster master.on('message', common.mustCall((data) => { - // Add worker pid to list and progress tracker if (data.cmd === 'worker') { workers.push(data.workerPID); @@ -97,30 +85,20 @@ if (cluster.isWorker) { // When cluster is dead master.on('exit', common.mustCall((code) => { - // Check that the cluster died accidentally (non-zero exit code) - masterExited = !!code; + assert.strictEqual(code, 1); + // XXX(addaleax): The fact that this uses raw PIDs makes the test inherently + // flaky – another process might end up being started right after the + // workers finished and receive the same PID. const pollWorkers = () => { // When master is dead all workers should be dead too - let alive = false; - workers.forEach((pid) => alive = common.isAlive(pid)); - if (alive) { + if (workers.some((pid) => common.isAlive(pid))) { setTimeout(pollWorkers, 50); - } else { - workersExited = true; } }; // Loop indefinitely until worker exit pollWorkers(); })); - - process.once('exit', () => { - assert(masterExited, - 'The master did not die after an error was thrown'); - assert(workersExited, - 'The workers did not die after an error in the master'); - }); - } From 90abdd3dd464d564371a64316a0d650b41ad47fb Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 17 Aug 2020 14:59:58 -0400 Subject: [PATCH 076/104] net: validate custom lookup() output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds validation to the IP address returned by the net module's custom DNS lookup() function. PR-URL: https://github.com/nodejs/node/pull/34813 Fixes: https://github.com/nodejs/node/issues/34812 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Yongsheng Zhang Reviewed-By: Matteo Collina Reviewed-By: Michaël Zasso Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Luigi Pinca --- lib/net.js | 3 +++ test/parallel/test-net-dns-custom-lookup.js | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/net.js b/lib/net.js index aebe9418b62c85..d06a1e18e556ea 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1051,6 +1051,9 @@ function lookupAndConnect(self, options) { // calls net.Socket.connect() on it (that's us). There are no event // listeners registered yet so defer the error event to the next tick. process.nextTick(connectErrorNT, self, err); + } else if (!isIP(ip)) { + err = new ERR_INVALID_IP_ADDRESS(ip); + process.nextTick(connectErrorNT, self, err); } else if (addressType !== 4 && addressType !== 6) { err = new ERR_INVALID_ADDRESS_FAMILY(addressType, options.host, diff --git a/test/parallel/test-net-dns-custom-lookup.js b/test/parallel/test-net-dns-custom-lookup.js index c7a01f5fa6faec..a7c05c82b95419 100644 --- a/test/parallel/test-net-dns-custom-lookup.js +++ b/test/parallel/test-net-dns-custom-lookup.js @@ -41,3 +41,14 @@ function check(addressType, cb) { check(4, function() { common.hasIPv6 && check(6); }); + +// Verify that bad lookup() IPs are handled. +{ + net.connect({ + host: 'localhost', + port: 80, + lookup(host, dnsopts, cb) { + cb(null, undefined, 4); + } + }).on('error', common.expectsError({ code: 'ERR_INVALID_IP_ADDRESS' })); +} From b73943e476e65ef5d9472abed87feb48cd5f48dc Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 31 Jul 2020 19:35:58 +0200 Subject: [PATCH 077/104] workers: add support for data: URLs PR-URL: https://github.com/nodejs/node/pull/34584 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Bradley Farias Reviewed-By: Jan Krems --- doc/api/worker_threads.md | 13 +++++++++- lib/internal/errors.js | 3 +++ lib/internal/main/worker_thread.js | 7 +++++- lib/internal/process/execution.js | 2 +- lib/internal/worker.js | 11 ++++++-- test/parallel/test-worker-data-url.js | 25 +++++++++++++++++++ test/parallel/test-worker-unsupported-path.js | 6 +++-- 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 test/parallel/test-worker-data-url.js diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 9b57d28a3e6dd2..b3562e44022a8d 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -621,6 +621,13 @@ if (isMainThread) { -* [addaleax](https://github.com/addaleax) - -**Anna Henningsen** <anna@addaleax.net> (she/her) * [apapirovski](https://github.com/apapirovski) - **Anatoli Papirovski** <apapirovski@mac.com> (he/him) * [BethGriggs](https://github.com/BethGriggs) - @@ -196,6 +194,8 @@ For information about the governance of the Node.js project, see ### TSC Emeriti +* [addaleax](https://github.com/addaleax) - +**Anna Henningsen** <anna@addaleax.net> (she/her) * [bnoordhuis](https://github.com/bnoordhuis) - **Ben Noordhuis** <info@bnoordhuis.nl> * [chrisdickinson](https://github.com/chrisdickinson) - From 604842172646c40085d7de1af1c0495531eb63ce Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Mon, 22 Jun 2020 11:22:42 +0200 Subject: [PATCH 080/104] build,win: use x64 Node when building for ARM64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses x64 node executable for running .js files in arm64 cross-compilation scenarios. MSI can now be created by running `vcbuild.bat release msi arm64` Refs: https://github.com/nodejs/node/issues/25998 Refs: https://github.com/nodejs/node/issues/32582 PR-URL: https://github.com/nodejs/node/pull/34009 Reviewed-By: James M Snell Reviewed-By: João Reis --- .gitignore | 3 +++ BUILDING.md | 2 ++ vcbuild.bat | 21 ++++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5b07ec4a8e3cdc..75039956cb18b1 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,9 @@ _UpgradeReport_Files/ # Ignore dependencies fetched by deps/v8/tools/node/fetch_deps.py /deps/.cipd +# === Rules for Windows vcbuild.bat === +/temp-vcbuild + # === Global Rules === # Keep last to avoid being excluded *.pyc diff --git a/BUILDING.md b/BUILDING.md index 5c7494a15f1e61..71aedb10f55dd9 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -545,6 +545,8 @@ Optional requirements to build the MSI installer package: * The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension) or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension). +* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if + building for Windows 10 on ARM (ARM64). Optional requirements for compiling for Windows 10 on ARM (ARM64): diff --git a/vcbuild.bat b/vcbuild.bat index 79214217e5bd54..07fc92e4fb9106 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -397,7 +397,26 @@ if errorlevel 1 echo Failed to sign exe&goto exit @rem Skip license.rtf generation if not requested. if not defined licensertf goto stage_package -%node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +set "use_x64_node_exe=false" +if "%target_arch%"=="arm64" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set "use_x64_node_exe=true" +if "%use_x64_node_exe%"=="true" ( + echo Cross-compilation to ARM64 detected. We'll use the x64 Node executable for license2rtf. + if not defined "%x64_node_exe%" set "x64_node_exe=temp-vcbuild\node-x64-cross-compiling.exe" + if not exist "%x64_node_exe%" ( + echo Downloading x64 node.exe... + if not exist "temp-vcbuild" mkdir temp-vcbuild + powershell -c "Invoke-WebRequest -Uri 'https://nodejs.org/dist/latest/win-x64/node.exe' -OutFile 'temp-vcbuild\node-x64-cross-compiling.exe'" + ) + if not exist "%x64_node_exe%" ( + echo Could not find the Node executable at the given x64_node_exe path. Aborting. + set exit_code=1 + goto exit + ) + %x64_node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +) else ( + %node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +) + if errorlevel 1 echo Failed to generate license.rtf&goto exit :stage_package From a16f0f427eb7bc8c31d8f93fd37bc42cdcf594f8 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 22 Jul 2020 12:55:11 +0200 Subject: [PATCH 081/104] process: correctly parse Unicode in NODE_OPTIONS Fixes an issue on Windows, where Unicode in NODE_OPTIONS was not parsed correctly. Fixes: https://github.com/nodejs/node/issues/34399 PR-URL: https://github.com/nodejs/node/pull/34476 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Gus Caplan Reviewed-By: Denys Otrishko --- src/node_credentials.cc | 16 +++++++++++-- test/parallel/test-unicode-node-options.js | 26 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-unicode-node-options.js diff --git a/src/node_credentials.cc b/src/node_credentials.cc index 83db705e10df4f..b07067580af850 100644 --- a/src/node_credentials.cc +++ b/src/node_credentials.cc @@ -56,8 +56,20 @@ bool SafeGetenv(const char* key, std::string* text, Environment* env) { { Mutex::ScopedLock lock(per_process::env_var_mutex); - if (const char* value = getenv(key)) { - *text = value; + + size_t init_sz = 256; + MaybeStackBuffer val; + int ret = uv_os_getenv(key, *val, &init_sz); + + if (ret == UV_ENOBUFS) { + // Buffer is not large enough, reallocate to the updated init_sz + // and fetch env value again. + val.AllocateSufficientStorage(init_sz); + ret = uv_os_getenv(key, *val, &init_sz); + } + + if (ret >= 0) { // Env key value fetch success. + *text = *val; return true; } } diff --git a/test/parallel/test-unicode-node-options.js b/test/parallel/test-unicode-node-options.js new file mode 100644 index 00000000000000..e5a40d118791d3 --- /dev/null +++ b/test/parallel/test-unicode-node-options.js @@ -0,0 +1,26 @@ +'use strict'; +// Flags: --expose-internals +require('../common'); +const { getOptionValue } = require('internal/options'); +const assert = require('assert'); +const cp = require('child_process'); + +const expected_redirect_value = 'foó'; + +if (process.argv.length === 2) { + const NODE_OPTIONS = `--redirect-warnings=${expected_redirect_value}`; + const result = cp.spawnSync(process.argv0, + ['--expose-internals', __filename, 'test'], + { + env: { + ...process.env, + NODE_OPTIONS + }, + stdio: 'inherit' + }); + assert.strictEqual(result.status, 0); +} else { + const redirect_value = getOptionValue('--redirect-warnings'); + console.log(`--redirect-warings=${redirect_value}`); + assert.strictEqual(redirect_value, expected_redirect_value); +} From 9e0d18fd3f7e1fcd31ba6f714564d6fdd98b2eb9 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sun, 14 Jun 2020 11:10:32 -0400 Subject: [PATCH 082/104] http2: use and support non-empty DATA frame with END_STREAM flag Adds support for reading from a stream where the final frame is a non-empty DATA frame with the END_STREAM flag set, instead of hanging waiting for another frame. When writing to a stream, uses a END_STREAM flag on final DATA frame instead of adding an empty DATA frame. BREAKING: http2 client now expects servers to properly support END_STREAM flag Fixes: https://github.com/nodejs/node/issues/31309 Fixes: https://github.com/nodejs/node/issues/33891 Refs: https://nghttp2.org/documentation/types.html#c.nghttp2_on_data_chunk_recv_callback PR-URL: https://github.com/nodejs/node/pull/33875 Backport-PR-URL: https://github.com/nodejs/node/pull/34838 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- lib/internal/http2/core.js | 104 ++++++++++++++---- src/node_http2.cc | 13 ++- .../test-http2-misbehaving-multiplex.js | 56 +++++++--- .../test-http2-pack-end-stream-flag.js | 61 ++++++++++ test/parallel/test-http2-padding-aligned.js | 2 +- test/parallel/test-http2-perf_hooks.js | 2 +- 6 files changed, 191 insertions(+), 47 deletions(-) create mode 100644 test/parallel/test-http2-pack-end-stream-flag.js diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index f4a53c931850fd..1bd0a9f7ae90bc 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1136,6 +1136,7 @@ class Http2Session extends EventEmitter { streams: new Map(), pendingStreams: new Set(), pendingAck: 0, + shutdownWritableCalled: false, writeQueueSize: 0, originSet: undefined }; @@ -1702,6 +1703,26 @@ function afterShutdown(status) { stream[kMaybeDestroy](); } +function shutdownWritable(callback) { + const handle = this[kHandle]; + if (!handle) return callback(); + const state = this[kState]; + if (state.shutdownWritableCalled) { + // Backport v14.x: Session required for debugging stream object + // debugStreamObj(this, 'shutdownWritable() already called'); + return callback(); + } + state.shutdownWritableCalled = true; + + const req = new ShutdownWrap(); + req.oncomplete = afterShutdown; + req.callback = callback; + req.handle = handle; + const err = handle.shutdown(req); + if (err === 1) // synchronous finish + return afterShutdown.call(req, 0); +} + function finishSendTrailers(stream, headersList) { // The stream might be destroyed and in that case // there is nothing to do. @@ -1962,10 +1983,48 @@ class Http2Stream extends Duplex { let req; + let waitingForWriteCallback = true; + let waitingForEndCheck = true; + let writeCallbackErr; + let endCheckCallbackErr; + const done = () => { + if (waitingForEndCheck || waitingForWriteCallback) return; + const err = writeCallbackErr || endCheckCallbackErr; + // writeGeneric does not destroy on error and + // we cannot enable autoDestroy, + // so make sure to destroy on error. + if (err) { + this.destroy(err); + } + cb(err); + }; + const writeCallback = (err) => { + waitingForWriteCallback = false; + writeCallbackErr = err; + done(); + }; + const endCheckCallback = (err) => { + waitingForEndCheck = false; + endCheckCallbackErr = err; + done(); + }; + // Shutdown write stream right after last chunk is sent + // so final DATA frame can include END_STREAM flag + process.nextTick(() => { + if (writeCallbackErr || + !this._writableState.ending || + this._writableState.buffered.length || + (this[kState].flags & STREAM_FLAGS_HAS_TRAILERS)) + return endCheckCallback(); + // Backport v14.x: Session required for debugging stream object + // debugStreamObj(this, 'shutting down writable on last write'); + shutdownWritable.call(this, endCheckCallback); + }); + if (writev) - req = writevGeneric(this, data, cb); + req = writevGeneric(this, data, writeCallback); else - req = writeGeneric(this, data, encoding, cb); + req = writeGeneric(this, data, encoding, writeCallback); trackWriteState(this, req.bytes); } @@ -1979,21 +2038,13 @@ class Http2Stream extends Duplex { } _final(cb) { - const handle = this[kHandle]; if (this.pending) { this.once('ready', () => this._final(cb)); - } else if (handle !== undefined) { - debugStreamObj(this, '_final shutting down'); - const req = new ShutdownWrap(); - req.oncomplete = afterShutdown; - req.callback = cb; - req.handle = handle; - const err = handle.shutdown(req); - if (err === 1) // synchronous finish - return afterShutdown.call(req, 0); - } else { - cb(); + return; } + // Backport v14.x: Session required for debugging stream object + // debugStreamObj(this, 'shutting down writable on _final'); + shutdownWritable.call(this, cb); } _read(nread) { @@ -2098,11 +2149,20 @@ class Http2Stream extends Duplex { debugStream(this[kID] || 'pending', session[kType], 'destroying stream'); const state = this[kState]; - const sessionCode = session[kState].goawayCode || - session[kState].destroyCode; - const code = err != null ? - sessionCode || NGHTTP2_INTERNAL_ERROR : - state.rstCode || sessionCode; + const sessionState = session[kState]; + const sessionCode = sessionState.goawayCode || sessionState.destroyCode; + + // If a stream has already closed successfully, there is no error + // to report from this stream, even if the session has errored. + // This can happen if the stream was already in process of destroying + // after a successful close, but the session had a error between + // this stream's close and destroy operations. + // Previously, this always overrode a successful close operation code + // NGHTTP2_NO_ERROR (0) with sessionCode because the use of the || operator. + const code = (err != null ? + (sessionCode || NGHTTP2_INTERNAL_ERROR) : + (this.closed ? this.rstCode : sessionCode) + ); const hasHandle = handle !== undefined; if (!this.closed) @@ -2111,13 +2171,13 @@ class Http2Stream extends Duplex { if (hasHandle) { handle.destroy(); - session[kState].streams.delete(id); + sessionState.streams.delete(id); } else { - session[kState].pendingStreams.delete(this); + sessionState.pendingStreams.delete(this); } // Adjust the write queue size for accounting - session[kState].writeQueueSize -= state.writeQueueSize; + sessionState.writeQueueSize -= state.writeQueueSize; state.writeQueueSize = 0; // RST code 8 not emitted as an error as its used by clients to signify diff --git a/src/node_http2.cc b/src/node_http2.cc index 5aa817a1ac8442..b5b38fc976158b 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -732,7 +732,7 @@ ssize_t Http2Session::OnMaxFrameSizePadding(size_t frameLen, // quite expensive. This is a potential performance optimization target later. ssize_t Http2Session::ConsumeHTTP2Data() { CHECK_NOT_NULL(stream_buf_.base); - CHECK_LT(stream_buf_offset_, stream_buf_.len); + CHECK_LE(stream_buf_offset_, stream_buf_.len); size_t read_len = stream_buf_.len - stream_buf_offset_; // multiple side effects. @@ -753,11 +753,11 @@ ssize_t Http2Session::ConsumeHTTP2Data() { CHECK_GT(ret, 0); CHECK_LE(static_cast(ret), read_len); - if (static_cast(ret) < read_len) { - // Mark the remainder of the data as available for later consumption. - stream_buf_offset_ += ret; - return ret; - } + // Mark the remainder of the data as available for later consumption. + // Even if all bytes were received, a paused stream may delay the + // nghttp2_on_frame_recv_callback which may have an END_STREAM flag. + stream_buf_offset_ += ret; + return ret; } // We are done processing the current input chunk. @@ -1093,6 +1093,7 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle, if (session->is_write_in_progress()) { CHECK(session->is_reading_stopped()); session->set_receive_paused(); + Debug(session, "receive paused"); return NGHTTP2_ERR_PAUSE; } diff --git a/test/parallel/test-http2-misbehaving-multiplex.js b/test/parallel/test-http2-misbehaving-multiplex.js index fbd8add8906b7e..0e057e1ed28e7a 100644 --- a/test/parallel/test-http2-misbehaving-multiplex.js +++ b/test/parallel/test-http2-misbehaving-multiplex.js @@ -2,6 +2,7 @@ // Flags: --expose-internals const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) common.skip('missing crypto'); @@ -13,16 +14,36 @@ const h2test = require('../common/http2'); let client; const server = h2.createServer(); +let gotFirstStreamId1; server.on('stream', common.mustCall((stream) => { stream.respond(); stream.end('ok'); - // The error will be emitted asynchronously - stream.on('error', common.expectsError({ - constructor: NghttpError, - code: 'ERR_HTTP2_ERROR', - message: 'Stream was already closed or invalid' - })); + // Http2Server should be fast enough to respond to and close + // the first streams with ID 1 and ID 3 without errors. + + // Test for errors in 'close' event to ensure no errors on some streams. + stream.on('error', () => {}); + stream.on('close', (err) => { + if (stream.id === 1) { + if (gotFirstStreamId1) { + // We expect our outgoing frames to fail on Stream ID 1 the second time + // because a stream with ID 1 was already closed before. + common.expectsError({ + constructor: NghttpError, + code: 'ERR_HTTP2_ERROR', + message: 'Stream was already closed or invalid' + }); + return; + } + gotFirstStreamId1 = true; + } + assert.strictEqual(err, undefined); + }); + + // Stream ID 5 should never reach the server + assert.notStrictEqual(stream.id, 5); + }, 2)); server.on('session', common.mustCall((session) => { @@ -35,26 +56,27 @@ server.on('session', common.mustCall((session) => { const settings = new h2test.SettingsFrame(); const settingsAck = new h2test.SettingsFrame(true); -const head1 = new h2test.HeadersFrame(1, h2test.kFakeRequestHeaders, 0, true); -const head2 = new h2test.HeadersFrame(3, h2test.kFakeRequestHeaders, 0, true); -const head3 = new h2test.HeadersFrame(1, h2test.kFakeRequestHeaders, 0, true); -const head4 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true); +// HeadersFrame(id, payload, padding, END_STREAM) +const id1 = new h2test.HeadersFrame(1, h2test.kFakeRequestHeaders, 0, true); +const id3 = new h2test.HeadersFrame(3, h2test.kFakeRequestHeaders, 0, true); +const id5 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true); server.listen(0, () => { client = net.connect(server.address().port, () => { client.write(h2test.kClientMagic, () => { client.write(settings.data, () => { client.write(settingsAck.data); - // This will make it ok. - client.write(head1.data, () => { - // This will make it ok. - client.write(head2.data, () => { + // Stream ID 1 frame will make it OK. + client.write(id1.data, () => { + // Stream ID 3 frame will make it OK. + client.write(id3.data, () => { + // A second Stream ID 1 frame should fail. // This will cause an error to occur because the client is // attempting to reuse an already closed stream. This must // cause the server session to be torn down. - client.write(head3.data, () => { - // This won't ever make it to the server - client.write(head4.data); + client.write(id1.data, () => { + // This Stream ID 5 frame will never make it to the server + client.write(id5.data); }); }); }); diff --git a/test/parallel/test-http2-pack-end-stream-flag.js b/test/parallel/test-http2-pack-end-stream-flag.js new file mode 100644 index 00000000000000..f6bb4452d95a77 --- /dev/null +++ b/test/parallel/test-http2-pack-end-stream-flag.js @@ -0,0 +1,61 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); +const http2 = require('http2'); + +const { PerformanceObserver } = require('perf_hooks'); + +const server = http2.createServer(); + +server.on('stream', (stream, headers) => { + stream.respond({ + 'content-type': 'text/html', + ':status': 200 + }); + switch (headers[':path']) { + case '/singleEnd': + stream.end('OK'); + break; + case '/sequentialEnd': + stream.write('OK'); + stream.end(); + break; + case '/delayedEnd': + stream.write('OK', () => stream.end()); + break; + } +}); + +function testRequest(path, targetFrameCount, callback) { + const obs = new PerformanceObserver((list, observer) => { + const entry = list.getEntries()[0]; + if (entry.name !== 'Http2Session') return; + if (entry.type !== 'client') return; + assert.strictEqual(entry.framesReceived, targetFrameCount); + observer.disconnect(); + callback(); + }); + obs.observe({ entryTypes: ['http2'] }); + const client = http2.connect(`http://localhost:${server.address().port}`, () => { + const req = client.request({ ':path': path }); + req.resume(); + req.end(); + req.on('end', () => client.close()); + }); +} + +// SETTINGS => SETTINGS => HEADERS => DATA +const MIN_FRAME_COUNT = 4; + +server.listen(0, () => { + testRequest('/singleEnd', MIN_FRAME_COUNT, () => { + testRequest('/sequentialEnd', MIN_FRAME_COUNT, () => { + testRequest('/delayedEnd', MIN_FRAME_COUNT + 1, () => { + server.close(); + }); + }); + }); +}); diff --git a/test/parallel/test-http2-padding-aligned.js b/test/parallel/test-http2-padding-aligned.js index 432e3e8629f379..f687c02a98dc6e 100644 --- a/test/parallel/test-http2-padding-aligned.js +++ b/test/parallel/test-http2-padding-aligned.js @@ -26,7 +26,7 @@ const makeDuplexPair = require('../common/duplexpair'); // The lengths of the expected writes... note that this is highly // sensitive to how the internals are implemented. const serverLengths = [24, 9, 9, 32]; - const clientLengths = [9, 9, 48, 9, 1, 21, 1, 16]; + const clientLengths = [9, 9, 48, 9, 1, 21, 1]; // Adjust for the 24-byte preamble and two 9-byte settings frames, and // the result must be equally divisible by 8 diff --git a/test/parallel/test-http2-perf_hooks.js b/test/parallel/test-http2-perf_hooks.js index 0fcbc323e01301..1023d70ff73f2c 100644 --- a/test/parallel/test-http2-perf_hooks.js +++ b/test/parallel/test-http2-perf_hooks.js @@ -30,7 +30,7 @@ const obs = new PerformanceObserver(common.mustCall((items) => { break; case 'client': assert.strictEqual(entry.streamCount, 1); - assert.strictEqual(entry.framesReceived, 8); + assert.strictEqual(entry.framesReceived, 7); break; default: assert.fail('invalid Http2Session type'); From 2a78c33445f2f87e8ea22ced48f46a4c317a12b4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 16 Aug 2020 10:33:39 -0700 Subject: [PATCH 083/104] test: run REPL preview test regardless of terminal type PR-URL: https://github.com/nodejs/node/pull/34798 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Mary Marchini --- test/parallel/test-repl-preview.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-repl-preview.js b/test/parallel/test-repl-preview.js index 02c1ec31cd5020..b0159bfd646a82 100644 --- a/test/parallel/test-repl-preview.js +++ b/test/parallel/test-repl-preview.js @@ -7,8 +7,9 @@ const { Stream } = require('stream'); const { inspect } = require('util'); common.skipIfInspectorDisabled(); -common.skipIfDumbTerminal(); +// Ignore terminal settings. This is so the test can be run intact if TERM=dumb. +process.env.TERM = ''; const PROMPT = 'repl > '; class REPLStream extends Stream { From ef41ddf5cb53b42f10e63e195b8999bbcdd63608 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 19 Aug 2020 18:29:42 -0700 Subject: [PATCH 084/104] doc: sort references lexically Keep references sorted in ASCII order in module.md. PR-URL: https://github.com/nodejs/node/pull/34848 Reviewed-By: Daijiro Wachi Reviewed-By: James M Snell Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- doc/api/module.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/module.md b/doc/api/module.md index 98bc8e82f95247..46eafeb7b622bd 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -184,11 +184,11 @@ consists of the following keys: * originalLine: {number} * originalColumn: {number} -[`createRequire()`]: #module_module_createrequire_filename -[module wrapper]: modules_cjs.html#modules_cjs_the_module_wrapper -[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx +[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej [`--enable-source-maps`]: cli.html#cli_enable_source_maps -[`NODE_V8_COVERAGE=dir`]: cli.html#cli_node_v8_coverage_dir [`Error.prepareStackTrace(error, trace)`]: https://v8.dev/docs/stack-trace-api#customizing-stack-traces +[`NODE_V8_COVERAGE=dir`]: cli.html#cli_node_v8_coverage_dir [`SourceMap`]: #module_class_module_sourcemap -[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej +[`createRequire()`]: #module_module_createrequire_filename +[module wrapper]: modules_cjs.html#modules_cjs_the_module_wrapper +[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx From b1c3fb73fcb08ce0007127984f7d55c76b806bb0 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 19 Aug 2020 19:16:44 -0700 Subject: [PATCH 085/104] doc: fix bulleted list punctuation in BUILDING.md Remove/add periods as appropriate in bulleted lists in BUILDING.md. PR-URL: https://github.com/nodejs/node/pull/34849 Reviewed-By: James M Snell Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- BUILDING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 71aedb10f55dd9..45e7f7dda3e6b5 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -237,7 +237,7 @@ test with Python 3. * GNU Make 3.81 or newer * Python (see note above) * Python 2.7 - * Python 3.5, 3.6, 3.7, and 3.8. + * Python 3.5, 3.6, 3.7, and 3.8 Installation via Linux package manager can be achieved with: @@ -256,7 +256,7 @@ Python 3 users may also need to install `python3-distutils`. * Xcode Command Line Tools >= 10 for macOS * Python (see note above) * Python 2.7 - * Python 3.5, 3.6, 3.7, and 3.8. + * Python 3.5, 3.6, 3.7, and 3.8 macOS users can install the `Xcode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode @@ -531,7 +531,7 @@ to run it again before invoking `make -j4`. [Visual Studio 2017 or 2019](https://visualstudio.microsoft.com/downloads/) or the "Visual C++ build tools" workload from the [Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019), - with the default optional components. + with the default optional components * Basic Unix tools required for some tests, [Git for Windows](https://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. @@ -546,7 +546,7 @@ Optional requirements to build the MSI installer package: [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension) or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension). * The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if - building for Windows 10 on ARM (ARM64). + building for Windows 10 on ARM (ARM64) Optional requirements for compiling for Windows 10 on ARM (ARM64): @@ -564,7 +564,7 @@ This script will install the following [Chocolatey](https://chocolatey.org/) packages: * [Git for Windows](https://chocolatey.org/packages/git) with the `git` and - Unix tools added to the `PATH`. + Unix tools added to the `PATH` * [Python 3.x](https://chocolatey.org/packages/python) and [legacy Python](https://chocolatey.org/packages/python2) * [Visual Studio 2019 Build Tools](https://chocolatey.org/packages/visualstudio2019buildtools) From e16b3e72f9fb64193695db3a62eb441e2b6e1f11 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 17 Aug 2020 22:33:22 -0700 Subject: [PATCH 086/104] test: fix test-cluster-net-listen-relative-path.js to run in / test-cluster-net-listen-relative-path fails if run from the root directory on POSIX because the socket filename isn't quite long enough. Increase it by 2 so that the path length always exceeds 100 characters. PR-URL: https://github.com/nodejs/node/pull/34820 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- test/parallel/test-cluster-net-listen-relative-path.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-cluster-net-listen-relative-path.js b/test/parallel/test-cluster-net-listen-relative-path.js index 0e1c3f7cf7cf4a..76676b2902730b 100644 --- a/test/parallel/test-cluster-net-listen-relative-path.js +++ b/test/parallel/test-cluster-net-listen-relative-path.js @@ -17,7 +17,7 @@ const tmpdir = require('../common/tmpdir'); // Choose a socket name such that the absolute path would exceed 100 bytes. const socketDir = './unix-socket-dir'; -const socketName = 'A'.repeat(100 - socketDir.length - 1); +const socketName = 'A'.repeat(101 - socketDir.length); // Make sure we're not in a weird environment. assert.ok(path.resolve(socketDir, socketName).length > 100, From 68b7a8db6f4667d89e4593d1e4238eabfbf0d07e Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Mon, 17 Aug 2020 17:58:47 -0400 Subject: [PATCH 087/104] deps: upgrade npm to 6.14.8 PR-URL: https://github.com/nodejs/node/pull/34834 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Daijiro Wachi Reviewed-By: Trivikram Kamat Reviewed-By: Myles Borins --- deps/npm/AUTHORS | 5 ++ deps/npm/CHANGELOG.md | 34 +++++++++++ deps/npm/docs/content/cli-commands/npm.md | 3 +- deps/npm/docs/content/using-npm/semver.md | 6 ++ .../public/cli-commands/npm-access/index.html | 4 +- .../cli-commands/npm-adduser/index.html | 4 +- .../public/cli-commands/npm-audit/index.html | 4 +- .../public/cli-commands/npm-bin/index.html | 4 +- .../public/cli-commands/npm-bugs/index.html | 4 +- .../public/cli-commands/npm-build/index.html | 4 +- .../public/cli-commands/npm-bundle/index.html | 4 +- .../public/cli-commands/npm-cache/index.html | 4 +- .../public/cli-commands/npm-ci/index.html | 4 +- .../cli-commands/npm-completion/index.html | 4 +- .../public/cli-commands/npm-config/index.html | 4 +- .../public/cli-commands/npm-dedupe/index.html | 4 +- .../cli-commands/npm-deprecate/index.html | 4 +- .../cli-commands/npm-dist-tag/index.html | 4 +- .../public/cli-commands/npm-docs/index.html | 4 +- .../public/cli-commands/npm-doctor/index.html | 4 +- .../public/cli-commands/npm-edit/index.html | 4 +- .../cli-commands/npm-explore/index.html | 4 +- .../public/cli-commands/npm-fund/index.html | 4 +- .../cli-commands/npm-help-search/index.html | 4 +- .../public/cli-commands/npm-help/index.html | 4 +- .../public/cli-commands/npm-hook/index.html | 4 +- .../public/cli-commands/npm-init/index.html | 4 +- .../npm-install-ci-test/index.html | 4 +- .../cli-commands/npm-install-test/index.html | 4 +- .../cli-commands/npm-install/index.html | 4 +- .../public/cli-commands/npm-link/index.html | 4 +- .../public/cli-commands/npm-logout/index.html | 4 +- .../public/cli-commands/npm-ls/index.html | 6 +- .../public/cli-commands/npm-org/index.html | 4 +- .../cli-commands/npm-outdated/index.html | 4 +- .../public/cli-commands/npm-owner/index.html | 4 +- .../public/cli-commands/npm-pack/index.html | 4 +- .../public/cli-commands/npm-ping/index.html | 4 +- .../public/cli-commands/npm-prefix/index.html | 4 +- .../cli-commands/npm-profile/index.html | 4 +- .../public/cli-commands/npm-prune/index.html | 4 +- .../cli-commands/npm-publish/index.html | 4 +- .../cli-commands/npm-rebuild/index.html | 4 +- .../public/cli-commands/npm-repo/index.html | 4 +- .../cli-commands/npm-restart/index.html | 4 +- .../public/cli-commands/npm-root/index.html | 4 +- .../cli-commands/npm-run-script/index.html | 4 +- .../public/cli-commands/npm-search/index.html | 4 +- .../cli-commands/npm-shrinkwrap/index.html | 4 +- .../public/cli-commands/npm-star/index.html | 4 +- .../public/cli-commands/npm-stars/index.html | 4 +- .../public/cli-commands/npm-start/index.html | 4 +- .../public/cli-commands/npm-stop/index.html | 4 +- .../public/cli-commands/npm-team/index.html | 4 +- .../public/cli-commands/npm-test/index.html | 4 +- .../public/cli-commands/npm-token/index.html | 4 +- .../cli-commands/npm-uninstall/index.html | 4 +- .../cli-commands/npm-unpublish/index.html | 4 +- .../public/cli-commands/npm-update/index.html | 4 +- .../cli-commands/npm-version/index.html | 4 +- .../public/cli-commands/npm-view/index.html | 4 +- .../public/cli-commands/npm-whoami/index.html | 4 +- .../docs/public/cli-commands/npm/index.html | 9 ++- .../public/configuring-npm/folders/index.html | 4 +- .../public/configuring-npm/install/index.html | 4 +- .../public/configuring-npm/npmrc/index.html | 4 +- .../configuring-npm/package-json/index.html | 4 +- .../package-lock-json/index.html | 4 +- .../configuring-npm/package-locks/index.html | 4 +- .../shrinkwrap-json/index.html | 4 +- deps/npm/docs/public/index.html | 2 +- deps/npm/docs/public/static/d/2215187023.json | 2 +- .../docs/public/using-npm/config/index.html | 4 +- .../public/using-npm/developers/index.html | 4 +- .../docs/public/using-npm/disputes/index.html | 4 +- .../npm/docs/public/using-npm/orgs/index.html | 4 +- .../docs/public/using-npm/registry/index.html | 4 +- .../docs/public/using-npm/removal/index.html | 4 +- .../docs/public/using-npm/scope/index.html | 4 +- .../docs/public/using-npm/scripts/index.html | 4 +- .../docs/public/using-npm/semver/index.html | 4 +- deps/npm/lib/ci.js | 4 ++ deps/npm/lib/hook.js | 13 ++++ deps/npm/lib/install.js | 2 +- deps/npm/lib/utils/replace-info.js | 2 +- deps/npm/man/man1/npm-README.1 | 2 +- deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-audit.1 | 2 +- deps/npm/man/man1/npm-bin.1 | 2 +- deps/npm/man/man1/npm-bugs.1 | 2 +- deps/npm/man/man1/npm-build.1 | 2 +- deps/npm/man/man1/npm-bundle.1 | 2 +- deps/npm/man/man1/npm-cache.1 | 2 +- deps/npm/man/man1/npm-ci.1 | 2 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 2 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-dist-tag.1 | 2 +- deps/npm/man/man1/npm-docs.1 | 2 +- deps/npm/man/man1/npm-doctor.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-fund.1 | 2 +- deps/npm/man/man1/npm-help-search.1 | 2 +- deps/npm/man/man1/npm-help.1 | 2 +- deps/npm/man/man1/npm-hook.1 | 2 +- deps/npm/man/man1/npm-init.1 | 2 +- deps/npm/man/man1/npm-install-ci-test.1 | 2 +- deps/npm/man/man1/npm-install-test.1 | 2 +- deps/npm/man/man1/npm-install.1 | 2 +- deps/npm/man/man1/npm-link.1 | 2 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 4 +- deps/npm/man/man1/npm-org.1 | 2 +- deps/npm/man/man1/npm-outdated.1 | 2 +- deps/npm/man/man1/npm-owner.1 | 2 +- deps/npm/man/man1/npm-pack.1 | 2 +- deps/npm/man/man1/npm-ping.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 2 +- deps/npm/man/man1/npm-profile.1 | 2 +- deps/npm/man/man1/npm-prune.1 | 2 +- deps/npm/man/man1/npm-publish.1 | 2 +- deps/npm/man/man1/npm-rebuild.1 | 2 +- deps/npm/man/man1/npm-repo.1 | 2 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 2 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-shrinkwrap.1 | 2 +- deps/npm/man/man1/npm-star.1 | 2 +- deps/npm/man/man1/npm-stars.1 | 2 +- deps/npm/man/man1/npm-start.1 | 2 +- deps/npm/man/man1/npm-stop.1 | 2 +- deps/npm/man/man1/npm-team.1 | 2 +- deps/npm/man/man1/npm-test.1 | 2 +- deps/npm/man/man1/npm-token.1 | 2 +- deps/npm/man/man1/npm-uninstall.1 | 2 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-update.1 | 2 +- deps/npm/man/man1/npm-version.1 | 2 +- deps/npm/man/man1/npm-view.1 | 2 +- deps/npm/man/man1/npm-whoami.1 | 2 +- deps/npm/man/man1/npm.1 | 7 +-- deps/npm/man/man5/folders.5 | 2 +- deps/npm/man/man5/install.5 | 2 +- deps/npm/man/man5/npmrc.5 | 2 +- deps/npm/man/man5/package-json.5 | 2 +- deps/npm/man/man5/package-lock-json.5 | 2 +- deps/npm/man/man5/package-locks.5 | 2 +- deps/npm/man/man5/shrinkwrap-json.5 | 2 +- deps/npm/man/man7/config.7 | 2 +- deps/npm/man/man7/developers.7 | 2 +- deps/npm/man/man7/disputes.7 | 2 +- deps/npm/man/man7/orgs.7 | 2 +- deps/npm/man/man7/registry.7 | 2 +- deps/npm/man/man7/removal.7 | 2 +- deps/npm/man/man7/scope.7 | 2 +- deps/npm/man/man7/scripts.7 | 2 +- deps/npm/man/man7/semver.7 | 2 +- .../npm/node_modules/configstore/package.json | 18 +++--- deps/npm/node_modules/configstore/readme.md | 2 +- deps/npm/node_modules/dot-prop/index.js | 18 ++++++ deps/npm/node_modules/dot-prop/package.json | 26 ++++---- deps/npm/node_modules/dot-prop/readme.md | 2 + .../meant/.github/workflows/ci.yml | 20 +++++++ deps/npm/node_modules/meant/.npmignore | 37 ------------ deps/npm/node_modules/meant/.travis.yml | 16 ----- deps/npm/node_modules/meant/CHANGELOG.md | 10 +++- deps/npm/node_modules/meant/README.md | 2 +- deps/npm/node_modules/meant/package.json | 36 ++++++----- .../node_modules => }/minimist/.travis.yml | 0 .../{rc/node_modules => }/minimist/LICENSE | 0 .../minimist/example/parse.js | 0 .../{rc/node_modules => }/minimist/index.js | 33 +++++----- .../node_modules => }/minimist/package.json | 4 +- .../minimist/readme.markdown | 0 .../minimist/test/all_bool.js | 8 +-- .../node_modules => }/minimist/test/bool.js | 16 ++--- .../node_modules => }/minimist/test/dash.js | 0 .../minimist/test/default_bool.js | 0 .../node_modules => }/minimist/test/dotted.js | 0 .../minimist/test/kv_short.js | 4 +- .../node_modules => }/minimist/test/long.js | 0 .../node_modules => }/minimist/test/num.js | 0 .../node_modules => }/minimist/test/parse.js | 12 ++-- .../minimist/test/parse_modified.js | 2 +- .../node_modules => }/minimist/test/proto.js | 0 .../node_modules => }/minimist/test/short.js | 4 +- .../minimist/test/stop_early.js | 0 .../minimist/test/unknown.js | 0 .../minimist/test/whitespace.js | 0 .../npm-registry-fetch/CHANGELOG.md | 20 +++++++ .../npm-registry-fetch/check-response.js | 7 ++- .../npm-registry-fetch/package.json | 24 ++++---- .../node_modules/update-notifier/package.json | 2 +- deps/npm/package.json | 6 +- .../test/fixtures/config/userconfig-with-gc | 2 +- .../test/tap/publish-invalid-semver-tag.js | 2 +- deps/npm/test/tap/referer.js | 60 +++++++++++++++++++ deps/npm/test/tap/semver-doc.js | 4 +- deps/npm/test/tap/whoami.js | 2 +- 203 files changed, 537 insertions(+), 401 deletions(-) create mode 100644 deps/npm/node_modules/meant/.github/workflows/ci.yml delete mode 100644 deps/npm/node_modules/meant/.npmignore delete mode 100644 deps/npm/node_modules/meant/.travis.yml rename deps/npm/node_modules/{rc/node_modules => }/minimist/.travis.yml (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/LICENSE (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/example/parse.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/index.js (97%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/package.json (93%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/readme.markdown (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/all_bool.js (97%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/bool.js (97%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/dash.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/default_bool.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/dotted.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/kv_short.js (97%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/long.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/num.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/parse.js (99%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/parse_modified.js (97%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/proto.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/short.js (99%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/stop_early.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/unknown.js (100%) rename deps/npm/node_modules/{rc/node_modules => }/minimist/test/whitespace.js (100%) diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 427166a068bf50..c390455e200fbe 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -702,3 +702,8 @@ vanishcode Jean-Charles Sisk Martin Packman Danielle Adams +Gianfranco Costamagna +Antonio +Sandra Tatarevićová +Antoine du Hamel +Assaf Sapir diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index f8f356d46cf026..0f07a687af988e 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,37 @@ +## 6.14.8 (2020-08-17) + +### BUG FIXES +* [`9262e8c88`](https://github.com/npm/cli/commit/9262e8c88f2f828206423928b8e21eea67f4801a) + [#1575](https://github.com/npm/cli/pull/1575) + npm install --dev deprecation message + ([@sandratatarevicova](https://github.com/sandratatarevicova)) +* [`765cfe0bc`](https://github.com/npm/cli/commit/765cfe0bc05a10b72026291ff0ca7c9ca5cb3f57) + [#1658](https://github.com/npm/cli/issues/1658) + remove unused broken require + ([@aduh95](https://github.com/aduh95)) +* [`4e28de79a`](https://github.com/npm/cli/commit/4e28de79a3a0aacc7603010a592beb448ceb6f5f) + [#1663](https://github.com/npm/cli/pull/1663) + Do not send user secret in the referer header + ([@assapir](https://github.com/assapir)) + +### DOCUMENTATION +* [`8abdf30c9`](https://github.com/npm/cli/commit/8abdf30c95ec90331456f3f2ed78e2703939bb74) + [#1572](https://github.com/npm/cli/pull/1572) + docs: add missing metadata in semver page + ([@tripu](https://github.com/tripu)) +* [`8cedcca46`](https://github.com/npm/cli/commit/8cedcca464ced5aab58be83dd5049c3df13384de) + [#1614](https://github.com/npm/cli/pull/1614) + Node-gyp supports both Python and legacy Python + ([@cclauss](https://github.com/cclauss)) + +### DEPENDENCIES +* [`a303b75fd`](https://github.com/npm/cli/commit/a303b75fd7c4b2644da02ad2ad46d80dfceec3c5) + `update-notifier@2.5.0` +* [`c48600832`](https://github.com/npm/cli/commit/c48600832aff4cc349f59997e08dc4bbde15bd49) + `npm-registry-fetch@4.0.7` +* [`a6e9fc4df`](https://github.com/npm/cli/commit/a6e9fc4df7092ba3eb5394193638b33c24855c36) + `meant@1.0.2`: + ## 6.14.7 (2020-07-21) ### BUG FIXES diff --git a/deps/npm/docs/content/cli-commands/npm.md b/deps/npm/docs/content/cli-commands/npm.md index 2d9789dd77c1c6..d95d24f7e0f764 100644 --- a/deps/npm/docs/content/cli-commands/npm.md +++ b/deps/npm/docs/content/cli-commands/npm.md @@ -60,8 +60,7 @@ requires compiling of C++ Code, npm will use [node-gyp](https://github.com/nodejs/node-gyp) for that task. For a Unix system, [node-gyp](https://github.com/nodejs/node-gyp) needs Python, make and a buildchain like GCC. On Windows, -Python and Microsoft Visual Studio C++ are needed. Python 3 is -not supported by [node-gyp](https://github.com/nodejs/node-gyp). +Python and Microsoft Visual Studio C++ are needed. For more information visit [the node-gyp repository](https://github.com/nodejs/node-gyp) and the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki). diff --git a/deps/npm/docs/content/using-npm/semver.md b/deps/npm/docs/content/using-npm/semver.md index 92c6381b7fe850..d8d7e1453ced7f 100644 --- a/deps/npm/docs/content/using-npm/semver.md +++ b/deps/npm/docs/content/using-npm/semver.md @@ -1,3 +1,9 @@ +--- +section: using-npm +title: semver +description: The semantic versioner for npm +--- + semver(7) -- The semantic versioner for npm =========================================== diff --git a/deps/npm/docs/public/cli-commands/npm-access/index.html b/deps/npm/docs/public/cli-commands/npm-access/index.html index 9ad76a3e9f5e91..1078ec62acb94c 100644 --- a/deps/npm/docs/public/cli-commands/npm-access/index.html +++ b/deps/npm/docs/public/cli-commands/npm-access/index.html @@ -74,7 +74,7 @@ } } }) -

npm access

+

npm access

Set access level on published packages

Synopsis

npm access public [<package>]
@@ -148,4 +148,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-adduser/index.html b/deps/npm/docs/public/cli-commands/npm-adduser/index.html index 8ed326ce683cb5..80d72bfe5b68f0 100644 --- a/deps/npm/docs/public/cli-commands/npm-adduser/index.html +++ b/deps/npm/docs/public/cli-commands/npm-adduser/index.html @@ -74,7 +74,7 @@ } } }) -

+

section: cli-commands title: npm-adduser description: Set access level on published packages

@@ -143,4 +143,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-audit/index.html b/deps/npm/docs/public/cli-commands/npm-audit/index.html index 8825351c97229c..1ce2b7d9d311d5 100644 --- a/deps/npm/docs/public/cli-commands/npm-audit/index.html +++ b/deps/npm/docs/public/cli-commands/npm-audit/index.html @@ -74,7 +74,7 @@ } } }) -

npm audit

+

npm audit

Run a security audit

Synopsis

npm audit [--json|--parseable|--audit-level=(low|moderate|high|critical)]
@@ -165,4 +165,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bin/index.html b/deps/npm/docs/public/cli-commands/npm-bin/index.html index a5ae1a0759c973..650cb7416279ef 100644 --- a/deps/npm/docs/public/cli-commands/npm-bin/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bin/index.html @@ -74,7 +74,7 @@ } } }) -

npm bin

+

npm bin

Display npm bin folder

Synopsis

npm bin [-g|--global]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bugs/index.html b/deps/npm/docs/public/cli-commands/npm-bugs/index.html index 3c32373c87467b..a3c06a02ea97de 100644 --- a/deps/npm/docs/public/cli-commands/npm-bugs/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bugs/index.html @@ -74,7 +74,7 @@ } } }) -

npm bugs

+

npm bugs

Bugs for a package in a web browser maybe

Synopsis

npm bugs [<pkgname>]
@@ -114,4 +114,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-build/index.html b/deps/npm/docs/public/cli-commands/npm-build/index.html index c79bdfe8387e5b..12afed16620096 100644 --- a/deps/npm/docs/public/cli-commands/npm-build/index.html +++ b/deps/npm/docs/public/cli-commands/npm-build/index.html @@ -74,7 +74,7 @@ } } }) -

npm build

+

npm build

Build a package

Synopsis

npm build [<package-folder>]
@@ -100,4 +100,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bundle/index.html b/deps/npm/docs/public/cli-commands/npm-bundle/index.html index e66fa96a322543..a686be6653710e 100644 --- a/deps/npm/docs/public/cli-commands/npm-bundle/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bundle/index.html @@ -74,7 +74,7 @@ } } }) -

npm bundle

+

npm bundle

REMOVED

Description

The npm bundle command has been removed in 1.0, for the simple reason @@ -91,4 +91,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-cache/index.html b/deps/npm/docs/public/cli-commands/npm-cache/index.html index d3c54c4c63ff52..a6275295a6e187 100644 --- a/deps/npm/docs/public/cli-commands/npm-cache/index.html +++ b/deps/npm/docs/public/cli-commands/npm-cache/index.html @@ -74,7 +74,7 @@ } } }) -

npm cache

+

npm cache

Manipulates packages cache

Synopsis

npm cache add <tarball file>
@@ -145,4 +145,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ci/index.html b/deps/npm/docs/public/cli-commands/npm-ci/index.html index 2714900c68c9f2..5c0d7722ded423 100644 --- a/deps/npm/docs/public/cli-commands/npm-ci/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ci/index.html @@ -74,7 +74,7 @@ } } }) -

npm ci

+

npm ci

Install a project with a clean slate

Synopsis

npm ci
@@ -122,4 +122,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-completion/index.html b/deps/npm/docs/public/cli-commands/npm-completion/index.html index aa609533076172..692f97359b3f97 100644 --- a/deps/npm/docs/public/cli-commands/npm-completion/index.html +++ b/deps/npm/docs/public/cli-commands/npm-completion/index.html @@ -74,7 +74,7 @@ } } }) -

npm completion

+

npm completion

Tab Completion for npm

Synopsis

source <(npm completion)
@@ -104,4 +104,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-config/index.html b/deps/npm/docs/public/cli-commands/npm-config/index.html index 3845bc0b44697d..8da04568e36128 100644 --- a/deps/npm/docs/public/cli-commands/npm-config/index.html +++ b/deps/npm/docs/public/cli-commands/npm-config/index.html @@ -74,7 +74,7 @@ } } }) -

npm config

+

npm config

Manage the npm configuration files

Synopsis

npm config set <key> <value> [-g|--global]
@@ -128,4 +128,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-dedupe/index.html b/deps/npm/docs/public/cli-commands/npm-dedupe/index.html index eb375342f73311..f5eed4eb8be125 100644 --- a/deps/npm/docs/public/cli-commands/npm-dedupe/index.html +++ b/deps/npm/docs/public/cli-commands/npm-dedupe/index.html @@ -74,7 +74,7 @@ } } }) -

npm dedupe

+

npm dedupe

Reduce duplication

Synopsis

npm dedupe
@@ -121,4 +121,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-deprecate/index.html b/deps/npm/docs/public/cli-commands/npm-deprecate/index.html index d33cee56047b30..6dedf68aa434e1 100644 --- a/deps/npm/docs/public/cli-commands/npm-deprecate/index.html +++ b/deps/npm/docs/public/cli-commands/npm-deprecate/index.html @@ -74,7 +74,7 @@ } } }) -

npm deprecate

+

npm deprecate

Deprecate a version of a package

Synopsis

npm deprecate <pkg>[@<version>] <message>
@@ -100,4 +100,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html b/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html index f1bee221ba743f..02a1d7e90e0ad5 100644 --- a/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html +++ b/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html @@ -74,7 +74,7 @@ } } }) -

+

section: cli-commands title: npm-dist-tag description: Modify package distribution tags

@@ -149,4 +149,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-docs/index.html b/deps/npm/docs/public/cli-commands/npm-docs/index.html index 36363aca0aa131..36ebdd7436459c 100644 --- a/deps/npm/docs/public/cli-commands/npm-docs/index.html +++ b/deps/npm/docs/public/cli-commands/npm-docs/index.html @@ -74,7 +74,7 @@ } } }) -

npm docs

+

npm docs

Docs for a package in a web browser maybe

Synopsis

npm docs [<pkgname> [<pkgname> ...]]
@@ -115,4 +115,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-doctor/index.html b/deps/npm/docs/public/cli-commands/npm-doctor/index.html index a8158fb8629899..e6827207474d10 100644 --- a/deps/npm/docs/public/cli-commands/npm-doctor/index.html +++ b/deps/npm/docs/public/cli-commands/npm-doctor/index.html @@ -74,7 +74,7 @@ } } }) -

npm doctor

+

npm doctor

Check your environments

Synopsis

npm doctor
@@ -163,4 +163,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-edit/index.html b/deps/npm/docs/public/cli-commands/npm-edit/index.html index 278352607aa08a..395a4970318e1e 100644 --- a/deps/npm/docs/public/cli-commands/npm-edit/index.html +++ b/deps/npm/docs/public/cli-commands/npm-edit/index.html @@ -74,7 +74,7 @@ } } }) -

npm edit

+

npm edit

Edit an installed package

Synopsis

npm edit <pkg>[/<subpkg>...]
@@ -110,4 +110,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-explore/index.html b/deps/npm/docs/public/cli-commands/npm-explore/index.html index bf53625afde152..c76f46551fcf5c 100644 --- a/deps/npm/docs/public/cli-commands/npm-explore/index.html +++ b/deps/npm/docs/public/cli-commands/npm-explore/index.html @@ -74,7 +74,7 @@ } } }) -

+

section: cli-commands title: npm-explore description: Browse an installed package

@@ -114,4 +114,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-fund/index.html b/deps/npm/docs/public/cli-commands/npm-fund/index.html index 8562c1c8911ca7..19fec68f2fb0c6 100644 --- a/deps/npm/docs/public/cli-commands/npm-fund/index.html +++ b/deps/npm/docs/public/cli-commands/npm-fund/index.html @@ -74,7 +74,7 @@ } } }) -

npm fund

+

npm fund

Retrieve funding information

Synopsis

    npm fund [<pkg>]
@@ -128,4 +128,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-help-search/index.html b/deps/npm/docs/public/cli-commands/npm-help-search/index.html index 3ab934e6396d52..7b1490aeb5a28a 100644 --- a/deps/npm/docs/public/cli-commands/npm-help-search/index.html +++ b/deps/npm/docs/public/cli-commands/npm-help-search/index.html @@ -74,7 +74,7 @@ } } }) -

npm help-search

+

npm help-search

Search npm help documentation

Synopsis

npm help-search <text>
@@ -105,4 +105,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-help/index.html b/deps/npm/docs/public/cli-commands/npm-help/index.html index 99cde2a28efada..293b23aff65b78 100644 --- a/deps/npm/docs/public/cli-commands/npm-help/index.html +++ b/deps/npm/docs/public/cli-commands/npm-help/index.html @@ -74,7 +74,7 @@ } } }) -

npm help

+

npm help

Get help on npm

Synopsis

npm help <term> [<terms..>]
@@ -107,4 +107,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-hook/index.html b/deps/npm/docs/public/cli-commands/npm-hook/index.html index 6620807093be85..7015de0f594777 100644 --- a/deps/npm/docs/public/cli-commands/npm-hook/index.html +++ b/deps/npm/docs/public/cli-commands/npm-hook/index.html @@ -74,7 +74,7 @@ } } }) -

npm hook

+

npm hook

Manage registry hooks

Synopsis

npm hook ls [pkg]
@@ -119,4 +119,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-init/index.html b/deps/npm/docs/public/cli-commands/npm-init/index.html index 9045b6726eea3d..94c30cb44613a2 100644 --- a/deps/npm/docs/public/cli-commands/npm-init/index.html +++ b/deps/npm/docs/public/cli-commands/npm-init/index.html @@ -74,7 +74,7 @@ } } }) -

npm init

+

npm init

create a package.json file

Synopsis

npm init [--force|-f|--yes|-y|--scope]
@@ -126,4 +126,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html b/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html index fecb8986a3e519..afa3f9c62587d8 100644 --- a/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html @@ -74,7 +74,7 @@ } } }) -

npm install-ci-test

+

npm install-ci-test

Install a project with a clean slate and run tests

Synopsis

npm install-ci-test
@@ -93,4 +93,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install-test/index.html b/deps/npm/docs/public/cli-commands/npm-install-test/index.html index f9712faea156c9..d03fba4d626dfc 100644 --- a/deps/npm/docs/public/cli-commands/npm-install-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install-test/index.html @@ -74,7 +74,7 @@ } } }) -

npm install-test

+

npm install-test

Install package(s) and run tests

Synopsis

npm install-test (with no args, in package dir)
@@ -102,4 +102,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install/index.html b/deps/npm/docs/public/cli-commands/npm-install/index.html index 75e44db559ae6b..ecca450abd7d7c 100644 --- a/deps/npm/docs/public/cli-commands/npm-install/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install/index.html @@ -74,7 +74,7 @@ } } }) -

npm install

+

npm install

Install a package

Synopsis

npm install (with no args, in package dir)
@@ -468,4 +468,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-link/index.html b/deps/npm/docs/public/cli-commands/npm-link/index.html index 4755b712232fcb..b46a285634ef37 100644 --- a/deps/npm/docs/public/cli-commands/npm-link/index.html +++ b/deps/npm/docs/public/cli-commands/npm-link/index.html @@ -74,7 +74,7 @@ } } }) -

npm link

+

npm link

Synopsis

npm link (in package dir)
@@ -134,4 +134,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-logout/index.html b/deps/npm/docs/public/cli-commands/npm-logout/index.html index 488d5f8e417618..7932b91253caa0 100644 --- a/deps/npm/docs/public/cli-commands/npm-logout/index.html +++ b/deps/npm/docs/public/cli-commands/npm-logout/index.html @@ -74,7 +74,7 @@ } } }) -

npm logout

+

npm logout

Log out of the registry

Synopsis

npm logout [--registry=<url>] [--scope=<@scope>]
@@ -109,4 +109,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ls/index.html b/deps/npm/docs/public/cli-commands/npm-ls/index.html index 1ea19ccbfe1af1..4ba2deedd6fcdf 100644 --- a/deps/npm/docs/public/cli-commands/npm-ls/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ls/index.html @@ -74,7 +74,7 @@ } } }) -

npm ls

+
\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-org/index.html b/deps/npm/docs/public/cli-commands/npm-org/index.html index 6c9bad4851dd6a..a787390433e401 100644 --- a/deps/npm/docs/public/cli-commands/npm-org/index.html +++ b/deps/npm/docs/public/cli-commands/npm-org/index.html @@ -74,7 +74,7 @@ } } }) -

npm org

+

npm org

Manage orgs

Synopsis

npm org set <orgname> <username> [developer | admin | owner]
@@ -107,4 +107,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-outdated/index.html b/deps/npm/docs/public/cli-commands/npm-outdated/index.html index 8d00c8be54f71e..7b06dc9aa23d9e 100644 --- a/deps/npm/docs/public/cli-commands/npm-outdated/index.html +++ b/deps/npm/docs/public/cli-commands/npm-outdated/index.html @@ -74,7 +74,7 @@ } } }) -

npm outdated

+

npm outdated

Check for outdated packages

Synopsis

npm outdated [[<@scope>/]<pkg> ...]
@@ -178,4 +178,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-owner/index.html b/deps/npm/docs/public/cli-commands/npm-owner/index.html index 1c12f4f6196402..f6fe631e3ced8f 100644 --- a/deps/npm/docs/public/cli-commands/npm-owner/index.html +++ b/deps/npm/docs/public/cli-commands/npm-owner/index.html @@ -74,7 +74,7 @@ } } }) -

npm owner

+

npm owner

Manage package owners

Synopsis

npm owner add <user> [<@scope>/]<pkg>
@@ -114,4 +114,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-pack/index.html b/deps/npm/docs/public/cli-commands/npm-pack/index.html index 7e71c5b22bbf31..289b9bb2d3e07d 100644 --- a/deps/npm/docs/public/cli-commands/npm-pack/index.html +++ b/deps/npm/docs/public/cli-commands/npm-pack/index.html @@ -74,7 +74,7 @@ } } }) -

npm pack

+

npm pack

Create a tarball from a package

Synopsis

npm pack [[<@scope>/]<pkg>...] [--dry-run]
@@ -102,4 +102,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ping/index.html b/deps/npm/docs/public/cli-commands/npm-ping/index.html index 0eae22ffe01083..078cdf8ce5f550 100644 --- a/deps/npm/docs/public/cli-commands/npm-ping/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ping/index.html @@ -74,7 +74,7 @@ } } }) -

npm ping

+

npm ping

Ping npm registry

Synopsis

npm ping [--registry <registry>]
@@ -95,4 +95,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-prefix/index.html b/deps/npm/docs/public/cli-commands/npm-prefix/index.html index eceda1227c0e7c..4c989a79782e10 100644 --- a/deps/npm/docs/public/cli-commands/npm-prefix/index.html +++ b/deps/npm/docs/public/cli-commands/npm-prefix/index.html @@ -74,7 +74,7 @@ } } }) -

npm prefix

+

npm prefix

Display prefix

Synopsis

npm prefix [-g]
@@ -98,4 +98,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-profile/index.html b/deps/npm/docs/public/cli-commands/npm-profile/index.html index 194196c9992a9e..5d93c29c31a7e4 100644 --- a/deps/npm/docs/public/cli-commands/npm-profile/index.html +++ b/deps/npm/docs/public/cli-commands/npm-profile/index.html @@ -74,7 +74,7 @@ } } }) -

npm profile

+

npm profile

Change settings on your registry profile

Synopsis

npm profile get [--json|--parseable] [<property>]
@@ -148,4 +148,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-prune/index.html b/deps/npm/docs/public/cli-commands/npm-prune/index.html index 2a53f28756d702..5b137b7433d092 100644 --- a/deps/npm/docs/public/cli-commands/npm-prune/index.html +++ b/deps/npm/docs/public/cli-commands/npm-prune/index.html @@ -74,7 +74,7 @@ } } }) -

npm prune

+

npm prune

Remove extraneous packages

Synopsis

npm prune [[<@scope>/]<pkg>...] [--production] [--dry-run] [--json]
@@ -108,4 +108,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-publish/index.html b/deps/npm/docs/public/cli-commands/npm-publish/index.html index 0b0b2e792e9574..4f3f77c6880f4d 100644 --- a/deps/npm/docs/public/cli-commands/npm-publish/index.html +++ b/deps/npm/docs/public/cli-commands/npm-publish/index.html @@ -74,7 +74,7 @@ } } }) -

npm publish

+

npm publish

Publish a package

Synopsis

npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>] [--otp otpcode] [--dry-run]
@@ -140,4 +140,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-rebuild/index.html b/deps/npm/docs/public/cli-commands/npm-rebuild/index.html index ed449954e381af..74fdf0e6924c7b 100644 --- a/deps/npm/docs/public/cli-commands/npm-rebuild/index.html +++ b/deps/npm/docs/public/cli-commands/npm-rebuild/index.html @@ -74,7 +74,7 @@ } } }) -

npm rebuild

+

npm rebuild

Rebuild a package

Synopsis

npm rebuild [[<@scope>/<name>]...]
@@ -93,4 +93,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-repo/index.html b/deps/npm/docs/public/cli-commands/npm-repo/index.html index 6df62a1a0978f0..46329c69ac4ceb 100644 --- a/deps/npm/docs/public/cli-commands/npm-repo/index.html +++ b/deps/npm/docs/public/cli-commands/npm-repo/index.html @@ -74,7 +74,7 @@ } } }) -

npm repo

+

npm repo

Open package repository page in the browser

Synopsis

npm repo [<pkg>]
@@ -101,4 +101,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-restart/index.html b/deps/npm/docs/public/cli-commands/npm-restart/index.html index a09224c6181e31..e6e6962beade64 100644 --- a/deps/npm/docs/public/cli-commands/npm-restart/index.html +++ b/deps/npm/docs/public/cli-commands/npm-restart/index.html @@ -74,7 +74,7 @@ } } }) -

npm restart

+

npm restart

Restart a package

Synopsis

npm restart [-- <args>]
@@ -113,4 +113,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-root/index.html b/deps/npm/docs/public/cli-commands/npm-root/index.html index d951e9e64b744d..6bea2a1e9464e2 100644 --- a/deps/npm/docs/public/cli-commands/npm-root/index.html +++ b/deps/npm/docs/public/cli-commands/npm-root/index.html @@ -74,7 +74,7 @@ } } }) -

npm root

+

npm root

Display npm root

Synopsis

npm root [-g]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-run-script/index.html b/deps/npm/docs/public/cli-commands/npm-run-script/index.html index 445bbe58b270aa..16a66c3754a7b8 100644 --- a/deps/npm/docs/public/cli-commands/npm-run-script/index.html +++ b/deps/npm/docs/public/cli-commands/npm-run-script/index.html @@ -74,7 +74,7 @@ } } }) -

npm run-script

+

npm run-script

Run arbitrary package scripts

Synopsis

npm run-script <command> [--silent] [-- <args>...]
@@ -143,4 +143,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-search/index.html b/deps/npm/docs/public/cli-commands/npm-search/index.html index 8269b12203d727..095a18d7c39b41 100644 --- a/deps/npm/docs/public/cli-commands/npm-search/index.html +++ b/deps/npm/docs/public/cli-commands/npm-search/index.html @@ -74,7 +74,7 @@ } } }) -

npm search

+

npm search

Search for packages

Synopsis

npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...]
@@ -168,4 +168,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html b/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html index 52fd8d568d0c99..1f27ce197b3e56 100644 --- a/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html +++ b/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html @@ -74,7 +74,7 @@ } } }) -

npm shrinkwrap

+

npm shrinkwrap

Lock down dependency versions for publication

Synopsis

npm shrinkwrap
@@ -101,4 +101,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-star/index.html b/deps/npm/docs/public/cli-commands/npm-star/index.html index 53add0203fc467..d70d5c15d43687 100644 --- a/deps/npm/docs/public/cli-commands/npm-star/index.html +++ b/deps/npm/docs/public/cli-commands/npm-star/index.html @@ -74,7 +74,7 @@ } } }) -

npm star

+

npm star

Mark your favorite packages

Synopsis

npm star [<pkg>...]
@@ -96,4 +96,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-stars/index.html b/deps/npm/docs/public/cli-commands/npm-stars/index.html index e87ca475a895d4..37e928f1548043 100644 --- a/deps/npm/docs/public/cli-commands/npm-stars/index.html +++ b/deps/npm/docs/public/cli-commands/npm-stars/index.html @@ -74,7 +74,7 @@ } } }) -

npm stars

+

npm stars

View packages marked as favorites

Synopsis

npm stars [<user>]
@@ -96,4 +96,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-start/index.html b/deps/npm/docs/public/cli-commands/npm-start/index.html index 0d2c010f195770..4598aad6aae334 100644 --- a/deps/npm/docs/public/cli-commands/npm-start/index.html +++ b/deps/npm/docs/public/cli-commands/npm-start/index.html @@ -74,7 +74,7 @@ } } }) -

npm start

+

npm start

Start a package

Synopsis

npm start [-- <args>]
@@ -98,4 +98,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-stop/index.html b/deps/npm/docs/public/cli-commands/npm-stop/index.html index 6f28d221cc5de4..3a72ea2b3014d3 100644 --- a/deps/npm/docs/public/cli-commands/npm-stop/index.html +++ b/deps/npm/docs/public/cli-commands/npm-stop/index.html @@ -74,7 +74,7 @@ } } }) -

npm stop

+

npm stop

Stop a package

Synopsis

npm stop [-- <args>]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-team/index.html b/deps/npm/docs/public/cli-commands/npm-team/index.html index b368026ba5a7b9..d4bfe61fa216d1 100644 --- a/deps/npm/docs/public/cli-commands/npm-team/index.html +++ b/deps/npm/docs/public/cli-commands/npm-team/index.html @@ -74,7 +74,7 @@ } } }) -

npm team

+

npm team

Manage organization teams and team memberships

Synopsis

npm team create <scope:team>
@@ -125,4 +125,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-test/index.html b/deps/npm/docs/public/cli-commands/npm-test/index.html index d02df67c554ae2..38b98aadeb4dbb 100644 --- a/deps/npm/docs/public/cli-commands/npm-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-test/index.html @@ -74,7 +74,7 @@ } } }) -

npm test

+

npm test

Test a package

Synopsis

npm test [-- <args>]
@@ -96,4 +96,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-token/index.html b/deps/npm/docs/public/cli-commands/npm-token/index.html index e460a9387a5062..8d72d3d1173f08 100644 --- a/deps/npm/docs/public/cli-commands/npm-token/index.html +++ b/deps/npm/docs/public/cli-commands/npm-token/index.html @@ -74,7 +74,7 @@ } } }) -

npm token

+

npm token

Manage your authentication tokens

Synopsis

  npm token list [--json|--parseable]
@@ -133,4 +133,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-uninstall/index.html b/deps/npm/docs/public/cli-commands/npm-uninstall/index.html index b9421f84640148..4277c248316486 100644 --- a/deps/npm/docs/public/cli-commands/npm-uninstall/index.html +++ b/deps/npm/docs/public/cli-commands/npm-uninstall/index.html @@ -74,7 +74,7 @@ } } }) -

npm uninstall

+

npm uninstall

Remove a package

Synopsis

npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
@@ -118,4 +118,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-unpublish/index.html b/deps/npm/docs/public/cli-commands/npm-unpublish/index.html index ca8a3dad1f8053..6d3c7322dbd27c 100644 --- a/deps/npm/docs/public/cli-commands/npm-unpublish/index.html +++ b/deps/npm/docs/public/cli-commands/npm-unpublish/index.html @@ -74,7 +74,7 @@ } } }) -

npm unpublish

+

npm unpublish

Remove a package from the registry

Synopsis

Unpublishing a single version of a package

@@ -106,4 +106,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-update/index.html b/deps/npm/docs/public/cli-commands/npm-update/index.html index f5ad2b56ca3a31..6c1ba709956308 100644 --- a/deps/npm/docs/public/cli-commands/npm-update/index.html +++ b/deps/npm/docs/public/cli-commands/npm-update/index.html @@ -74,7 +74,7 @@ } } }) -

npm update

+

npm update

Update a package

Synopsis

npm update [-g] [<pkg>...]
@@ -167,4 +167,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-version/index.html b/deps/npm/docs/public/cli-commands/npm-version/index.html index 6037a8b4c625b5..ed6c7f851efa25 100644 --- a/deps/npm/docs/public/cli-commands/npm-version/index.html +++ b/deps/npm/docs/public/cli-commands/npm-version/index.html @@ -74,7 +74,7 @@ } } }) -

npm version

+

npm version

Bump a package version

Synopsis

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
@@ -180,4 +180,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-view/index.html b/deps/npm/docs/public/cli-commands/npm-view/index.html index 0421f58c60312d..41817313312bb8 100644 --- a/deps/npm/docs/public/cli-commands/npm-view/index.html +++ b/deps/npm/docs/public/cli-commands/npm-view/index.html @@ -74,7 +74,7 @@ } } }) -

npm view

+

npm view

View registry info

Synopsis

npm view [<@scope>/]<name>[@<version>] [<field>[.<subfield>]...]
@@ -145,4 +145,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-whoami/index.html b/deps/npm/docs/public/cli-commands/npm-whoami/index.html index 41835b3cfb8c3e..f6f61b4b66378e 100644 --- a/deps/npm/docs/public/cli-commands/npm-whoami/index.html +++ b/deps/npm/docs/public/cli-commands/npm-whoami/index.html @@ -74,7 +74,7 @@ } } }) -

npm whoami

+

npm whoami

Display npm username

Synopsis

npm whoami [--registry <registry>]
@@ -92,4 +92,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm/index.html b/deps/npm/docs/public/cli-commands/npm/index.html index eb9061570b0382..8ce52572b982bb 100644 --- a/deps/npm/docs/public/cli-commands/npm/index.html +++ b/deps/npm/docs/public/cli-commands/npm/index.html @@ -74,12 +74,12 @@ } } }) -

npm

+

npm

javascript package manager

Synopsis

npm <command> [args]

Version

-

6.14.7

+

6.14.8

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -109,8 +109,7 @@

node-gyp for that task. For a Unix system, node-gyp needs Python, make and a buildchain like GCC. On Windows, -Python and Microsoft Visual Studio C++ are needed. Python 3 is -not supported by node-gyp. +Python and Microsoft Visual Studio C++ are needed. For more information visit the node-gyp repository and the node-gyp Wiki.

@@ -211,4 +210,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/folders/index.html b/deps/npm/docs/public/configuring-npm/folders/index.html index 66bed102877b3a..a48e497a09d4fc 100644 --- a/deps/npm/docs/public/configuring-npm/folders/index.html +++ b/deps/npm/docs/public/configuring-npm/folders/index.html @@ -74,7 +74,7 @@ } } }) -

folders

+

folders

Folder Structures Used by npm

Description

npm puts various things on your computer. That's its job.

@@ -240,4 +240,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/install/index.html b/deps/npm/docs/public/configuring-npm/install/index.html index 1c2c462c6cffd3..51d74d7182030d 100644 --- a/deps/npm/docs/public/configuring-npm/install/index.html +++ b/deps/npm/docs/public/configuring-npm/install/index.html @@ -74,7 +74,7 @@ } } }) -

install

+

install

Download and Install npm

Description

To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.

@@ -123,4 +123,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/npmrc/index.html b/deps/npm/docs/public/configuring-npm/npmrc/index.html index e885771095dd6a..5c64f020eff061 100644 --- a/deps/npm/docs/public/configuring-npm/npmrc/index.html +++ b/deps/npm/docs/public/configuring-npm/npmrc/index.html @@ -74,7 +74,7 @@ } } }) -

npmrc

+

npmrc

The npm config files

Description

npm gets its config settings from the command line, environment @@ -145,4 +145,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-json/index.html b/deps/npm/docs/public/configuring-npm/package-json/index.html index ab0a6a78bb91a5..3b0a40657b1298 100644 --- a/deps/npm/docs/public/configuring-npm/package-json/index.html +++ b/deps/npm/docs/public/configuring-npm/package-json/index.html @@ -74,7 +74,7 @@ } } }) -

package.json

+

package.json

Specifics of npm's package.json handling

Description

This document is all you need to know about what's required in your package.json @@ -711,4 +711,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-lock-json/index.html b/deps/npm/docs/public/configuring-npm/package-lock-json/index.html index 0201a325dc1427..9e465fcb37a4ec 100644 --- a/deps/npm/docs/public/configuring-npm/package-lock-json/index.html +++ b/deps/npm/docs/public/configuring-npm/package-lock-json/index.html @@ -74,7 +74,7 @@ } } }) -

package-lock.json

+

package-lock.json

A manifestation of the manifest

Description

package-lock.json is automatically generated for any operations where npm @@ -186,4 +186,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-locks/index.html b/deps/npm/docs/public/configuring-npm/package-locks/index.html index ecec79e8a961b1..ffd90b7b4fbd65 100644 --- a/deps/npm/docs/public/configuring-npm/package-locks/index.html +++ b/deps/npm/docs/public/configuring-npm/package-locks/index.html @@ -74,7 +74,7 @@ } } }) -

package-locks

+

package-locks

An explanation of npm lockfiles

Description

Conceptually, the "input" to npm install is a package.json, while its @@ -214,4 +214,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html b/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html index e3105b55b27b1b..2a526f39abc300 100644 --- a/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html +++ b/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html @@ -74,7 +74,7 @@ } } }) -

npm shrinkwrap.json

+

npm shrinkwrap.json

A publishable lockfile

Description

npm-shrinkwrap.json is a file created by npm shrinkwrap. It is identical to @@ -102,4 +102,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/index.html b/deps/npm/docs/public/index.html index 56d2a53c3c722b..8fcd55e6b7e868 100644 --- a/deps/npm/docs/public/index.html +++ b/deps/npm/docs/public/index.html @@ -128,4 +128,4 @@ } } }) -
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!

The current stable version of npm is available on GitHub.

To upgrade, run: npm install npm@latest -g

\ No newline at end of file +
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!

The current stable version of npm is available on GitHub.

To upgrade, run: npm install npm@latest -g

\ No newline at end of file diff --git a/deps/npm/docs/public/static/d/2215187023.json b/deps/npm/docs/public/static/d/2215187023.json index c26e85bd6966e2..e28be9a95bba41 100644 --- a/deps/npm/docs/public/static/d/2215187023.json +++ b/deps/npm/docs/public/static/d/2215187023.json @@ -1 +1 @@ -{"data":{"allMarkdownRemark":{"nodes":[{"fields":{"slug":"/using-npm/semver"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/cli-commands/npm-adduser"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/cli-commands/npm-dist-tag"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/cli-commands/npm-explore"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/using-npm/config"},"frontmatter":{"description":"More than you probably want to know about npm configuration","section":"using-npm","title":"config"}},{"fields":{"slug":"/using-npm/developers"},"frontmatter":{"description":"Developer Guide","section":"using-npm","title":"developers"}},{"fields":{"slug":"/using-npm/disputes"},"frontmatter":{"description":"Handling Module Name Disputes","section":"using-npm","title":"disputes"}},{"fields":{"slug":"/configuring-npm/folders"},"frontmatter":{"description":"Folder Structures Used by npm","section":"configuring-npm","title":"folders"}},{"fields":{"slug":"/configuring-npm/install"},"frontmatter":{"description":"Download and install node and npm","section":"configuring-npm","title":"install"}},{"fields":{"slug":"/cli-commands/npm"},"frontmatter":{"description":"javascript package manager","section":"cli-commands","title":"npm"}},{"fields":{"slug":"/cli-commands/npm-access"},"frontmatter":{"description":"Set access level on published packages","section":"cli-commands","title":"npm-access"}},{"fields":{"slug":"/cli-commands/npm-audit"},"frontmatter":{"description":"Run a security audit","section":"cli-commands","title":"npm-audit"}},{"fields":{"slug":"/cli-commands/npm-bin"},"frontmatter":{"description":"Display npm bin folder","section":"cli-commands","title":"npm-bin"}},{"fields":{"slug":"/cli-commands/npm-bugs"},"frontmatter":{"description":"Bugs for a package in a web browser maybe","section":"cli-commands","title":"npm-bugs"}},{"fields":{"slug":"/cli-commands/npm-build"},"frontmatter":{"description":"Build a package","section":"cli-commands","title":"npm-build"}},{"fields":{"slug":"/cli-commands/npm-bundle"},"frontmatter":{"description":"REMOVED","section":"cli-commands","title":"npm-bundle"}},{"fields":{"slug":"/cli-commands/npm-cache"},"frontmatter":{"description":"Manipulates packages cache","section":"cli-commands","title":"npm-cache"}},{"fields":{"slug":"/cli-commands/npm-ci"},"frontmatter":{"description":"Install a project with a clean slate","section":"cli-commands","title":"npm-ci"}},{"fields":{"slug":"/cli-commands/npm-completion"},"frontmatter":{"description":"Tab Completion for npm","section":"cli-commands","title":"npm-completion"}},{"fields":{"slug":"/cli-commands/npm-config"},"frontmatter":{"description":"Manage the npm configuration files","section":"cli-commands","title":"npm-config"}},{"fields":{"slug":"/cli-commands/npm-dedupe"},"frontmatter":{"description":"Reduce duplication","section":"cli-commands","title":"npm-dedupe"}},{"fields":{"slug":"/cli-commands/npm-deprecate"},"frontmatter":{"description":"Deprecate a version of a package","section":"cli-commands","title":"npm-deprecate"}},{"fields":{"slug":"/cli-commands/npm-docs"},"frontmatter":{"description":"Docs for a package in a web browser maybe","section":"cli-commands","title":"npm-docs"}},{"fields":{"slug":"/cli-commands/npm-doctor"},"frontmatter":{"description":"Check your environments","section":"cli-commands","title":"npm-doctor"}},{"fields":{"slug":"/cli-commands/npm-edit"},"frontmatter":{"description":"Edit an installed package","section":"cli-commands","title":"npm-edit"}},{"fields":{"slug":"/cli-commands/npm-fund"},"frontmatter":{"description":"Retrieve funding information","section":"cli-commands","title":"npm-fund"}},{"fields":{"slug":"/cli-commands/npm-help"},"frontmatter":{"description":"Get help on npm","section":"cli-commands","title":"npm-help"}},{"fields":{"slug":"/cli-commands/npm-help-search"},"frontmatter":{"description":"Search npm help documentation","section":"cli-commands","title":"npm-help-search"}},{"fields":{"slug":"/cli-commands/npm-hook"},"frontmatter":{"description":"Manage registry hooks","section":"cli-commands","title":"npm-hook"}},{"fields":{"slug":"/cli-commands/npm-init"},"frontmatter":{"description":"create a package.json file","section":"cli-commands","title":"npm-init"}},{"fields":{"slug":"/cli-commands/npm-install"},"frontmatter":{"description":"Install a package","section":"cli-commands","title":"npm-install"}},{"fields":{"slug":"/cli-commands/npm-install-ci-test"},"frontmatter":{"description":"Install a project with a clean slate and run tests","section":"cli-commands","title":"npm-install-ci-test"}},{"fields":{"slug":"/cli-commands/npm-install-test"},"frontmatter":{"description":"Install package(s) and run tests","section":"cli-commands","title":"npm-install-test"}},{"fields":{"slug":"/cli-commands/npm-link"},"frontmatter":{"description":"Symlink a package folder","section":"cli-commands","title":"npm-link"}},{"fields":{"slug":"/cli-commands/npm-logout"},"frontmatter":{"description":"Log out of the registry","section":"cli-commands","title":"npm-logout"}},{"fields":{"slug":"/cli-commands/npm-ls"},"frontmatter":{"description":"List installed packages","section":"cli-commands","title":"npm-ls"}},{"fields":{"slug":"/cli-commands/npm-org"},"frontmatter":{"description":"Manage orgs","section":"cli-commands","title":"npm-org"}},{"fields":{"slug":"/cli-commands/npm-outdated"},"frontmatter":{"description":"Check for outdated packages","section":"cli-commands","title":"npm-outdated"}},{"fields":{"slug":"/cli-commands/npm-owner"},"frontmatter":{"description":"Manage package owners","section":"cli-commands","title":"npm-owner"}},{"fields":{"slug":"/cli-commands/npm-pack"},"frontmatter":{"description":"Create a tarball from a package","section":"cli-commands","title":"npm-pack"}},{"fields":{"slug":"/cli-commands/npm-ping"},"frontmatter":{"description":"Ping npm registry","section":"cli-commands","title":"npm-ping"}},{"fields":{"slug":"/cli-commands/npm-prefix"},"frontmatter":{"description":"Display prefix","section":"cli-commands","title":"npm-prefix"}},{"fields":{"slug":"/cli-commands/npm-profile"},"frontmatter":{"description":"Change settings on your registry profile","section":"cli-commands","title":"npm-profile"}},{"fields":{"slug":"/cli-commands/npm-prune"},"frontmatter":{"description":"Remove extraneous packages","section":"cli-commands","title":"npm-prune"}},{"fields":{"slug":"/cli-commands/npm-publish"},"frontmatter":{"description":"Publish a package","section":"cli-commands","title":"npm-publish"}},{"fields":{"slug":"/cli-commands/npm-rebuild"},"frontmatter":{"description":"Rebuild a package","section":"cli-commands","title":"npm-rebuild"}},{"fields":{"slug":"/cli-commands/npm-repo"},"frontmatter":{"description":"Open package repository page in the browser","section":"cli-commands","title":"npm-repo"}},{"fields":{"slug":"/cli-commands/npm-restart"},"frontmatter":{"description":"Restart a package","section":"cli-commands","title":"npm-restart"}},{"fields":{"slug":"/cli-commands/npm-root"},"frontmatter":{"description":"Display npm root","section":"cli-commands","title":"npm-root"}},{"fields":{"slug":"/cli-commands/npm-run-script"},"frontmatter":{"description":"Run arbitrary package scripts","section":"cli-commands","title":"npm-run-script"}},{"fields":{"slug":"/cli-commands/npm-search"},"frontmatter":{"description":"Search for packages","section":"cli-commands","title":"npm-search"}},{"fields":{"slug":"/cli-commands/npm-shrinkwrap"},"frontmatter":{"description":"Lock down dependency versions for publication","section":"cli-commands","title":"npm-shrinkwrap"}},{"fields":{"slug":"/cli-commands/npm-star"},"frontmatter":{"description":"Mark your favorite packages","section":"cli-commands","title":"npm-star"}},{"fields":{"slug":"/cli-commands/npm-stars"},"frontmatter":{"description":"View packages marked as favorites","section":"cli-commands","title":"npm-stars"}},{"fields":{"slug":"/cli-commands/npm-start"},"frontmatter":{"description":"Start a package","section":"cli-commands","title":"npm-start"}},{"fields":{"slug":"/cli-commands/npm-stop"},"frontmatter":{"description":"Stop a package","section":"cli-commands","title":"npm-stop"}},{"fields":{"slug":"/cli-commands/npm-team"},"frontmatter":{"description":"Manage organization teams and team memberships","section":"cli-commands","title":"npm-team"}},{"fields":{"slug":"/cli-commands/npm-test"},"frontmatter":{"description":"Test a package","section":"cli-commands","title":"npm-test"}},{"fields":{"slug":"/cli-commands/npm-token"},"frontmatter":{"description":"Manage your authentication tokens","section":"cli-commands","title":"npm-token"}},{"fields":{"slug":"/cli-commands/npm-uninstall"},"frontmatter":{"description":"Remove a package","section":"cli-commands","title":"npm-uninstall"}},{"fields":{"slug":"/cli-commands/npm-unpublish"},"frontmatter":{"description":"Remove a package from the registry","section":"cli-commands","title":"npm-unpublish"}},{"fields":{"slug":"/cli-commands/npm-update"},"frontmatter":{"description":"Update a package","section":"cli-commands","title":"npm-update"}},{"fields":{"slug":"/cli-commands/npm-version"},"frontmatter":{"description":"Bump a package version","section":"cli-commands","title":"npm-version"}},{"fields":{"slug":"/cli-commands/npm-view"},"frontmatter":{"description":"View registry info","section":"cli-commands","title":"npm-view"}},{"fields":{"slug":"/cli-commands/npm-whoami"},"frontmatter":{"description":"Display npm username","section":"cli-commands","title":"npm-whoami"}},{"fields":{"slug":"/configuring-npm/npmrc"},"frontmatter":{"description":"The npm config files","section":"configuring-npm","title":"npmrc"}},{"fields":{"slug":"/using-npm/orgs"},"frontmatter":{"description":"Working with Teams & Orgs","section":"using-npm","title":"orgs"}},{"fields":{"slug":"/configuring-npm/package-lock-json"},"frontmatter":{"description":"A manifestation of the manifest","section":"configuring-npm","title":"package-lock.json"}},{"fields":{"slug":"/configuring-npm/package-locks"},"frontmatter":{"description":"An explanation of npm lockfiles","section":"configuring-npm","title":"package-locks"}},{"fields":{"slug":"/configuring-npm/package-json"},"frontmatter":{"description":"Specifics of npm's package.json handling","section":"configuring-npm","title":"package.json"}},{"fields":{"slug":"/using-npm/registry"},"frontmatter":{"description":"The JavaScript Package Registry","section":"using-npm","title":"registry"}},{"fields":{"slug":"/using-npm/removal"},"frontmatter":{"description":"Cleaning the Slate","section":"using-npm","title":"removal"}},{"fields":{"slug":"/using-npm/scope"},"frontmatter":{"description":"Scoped packages","section":"using-npm","title":"scope"}},{"fields":{"slug":"/using-npm/scripts"},"frontmatter":{"description":"How npm handles the \"scripts\" field","section":"using-npm","title":"scripts"}},{"fields":{"slug":"/configuring-npm/shrinkwrap-json"},"frontmatter":{"description":"A publishable lockfile","section":"configuring-npm","title":"shrinkwrap.json"}}]}}} \ No newline at end of file +{"data":{"allMarkdownRemark":{"nodes":[{"fields":{"slug":"/cli-commands/npm-adduser"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/cli-commands/npm-dist-tag"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/cli-commands/npm-explore"},"frontmatter":{"description":null,"section":null,"title":""}},{"fields":{"slug":"/using-npm/config"},"frontmatter":{"description":"More than you probably want to know about npm configuration","section":"using-npm","title":"config"}},{"fields":{"slug":"/using-npm/developers"},"frontmatter":{"description":"Developer Guide","section":"using-npm","title":"developers"}},{"fields":{"slug":"/using-npm/disputes"},"frontmatter":{"description":"Handling Module Name Disputes","section":"using-npm","title":"disputes"}},{"fields":{"slug":"/configuring-npm/folders"},"frontmatter":{"description":"Folder Structures Used by npm","section":"configuring-npm","title":"folders"}},{"fields":{"slug":"/configuring-npm/install"},"frontmatter":{"description":"Download and install node and npm","section":"configuring-npm","title":"install"}},{"fields":{"slug":"/cli-commands/npm"},"frontmatter":{"description":"javascript package manager","section":"cli-commands","title":"npm"}},{"fields":{"slug":"/cli-commands/npm-access"},"frontmatter":{"description":"Set access level on published packages","section":"cli-commands","title":"npm-access"}},{"fields":{"slug":"/cli-commands/npm-audit"},"frontmatter":{"description":"Run a security audit","section":"cli-commands","title":"npm-audit"}},{"fields":{"slug":"/cli-commands/npm-bin"},"frontmatter":{"description":"Display npm bin folder","section":"cli-commands","title":"npm-bin"}},{"fields":{"slug":"/cli-commands/npm-bugs"},"frontmatter":{"description":"Bugs for a package in a web browser maybe","section":"cli-commands","title":"npm-bugs"}},{"fields":{"slug":"/cli-commands/npm-build"},"frontmatter":{"description":"Build a package","section":"cli-commands","title":"npm-build"}},{"fields":{"slug":"/cli-commands/npm-bundle"},"frontmatter":{"description":"REMOVED","section":"cli-commands","title":"npm-bundle"}},{"fields":{"slug":"/cli-commands/npm-cache"},"frontmatter":{"description":"Manipulates packages cache","section":"cli-commands","title":"npm-cache"}},{"fields":{"slug":"/cli-commands/npm-ci"},"frontmatter":{"description":"Install a project with a clean slate","section":"cli-commands","title":"npm-ci"}},{"fields":{"slug":"/cli-commands/npm-completion"},"frontmatter":{"description":"Tab Completion for npm","section":"cli-commands","title":"npm-completion"}},{"fields":{"slug":"/cli-commands/npm-config"},"frontmatter":{"description":"Manage the npm configuration files","section":"cli-commands","title":"npm-config"}},{"fields":{"slug":"/cli-commands/npm-dedupe"},"frontmatter":{"description":"Reduce duplication","section":"cli-commands","title":"npm-dedupe"}},{"fields":{"slug":"/cli-commands/npm-deprecate"},"frontmatter":{"description":"Deprecate a version of a package","section":"cli-commands","title":"npm-deprecate"}},{"fields":{"slug":"/cli-commands/npm-docs"},"frontmatter":{"description":"Docs for a package in a web browser maybe","section":"cli-commands","title":"npm-docs"}},{"fields":{"slug":"/cli-commands/npm-doctor"},"frontmatter":{"description":"Check your environments","section":"cli-commands","title":"npm-doctor"}},{"fields":{"slug":"/cli-commands/npm-edit"},"frontmatter":{"description":"Edit an installed package","section":"cli-commands","title":"npm-edit"}},{"fields":{"slug":"/cli-commands/npm-fund"},"frontmatter":{"description":"Retrieve funding information","section":"cli-commands","title":"npm-fund"}},{"fields":{"slug":"/cli-commands/npm-help"},"frontmatter":{"description":"Get help on npm","section":"cli-commands","title":"npm-help"}},{"fields":{"slug":"/cli-commands/npm-help-search"},"frontmatter":{"description":"Search npm help documentation","section":"cli-commands","title":"npm-help-search"}},{"fields":{"slug":"/cli-commands/npm-hook"},"frontmatter":{"description":"Manage registry hooks","section":"cli-commands","title":"npm-hook"}},{"fields":{"slug":"/cli-commands/npm-init"},"frontmatter":{"description":"create a package.json file","section":"cli-commands","title":"npm-init"}},{"fields":{"slug":"/cli-commands/npm-install"},"frontmatter":{"description":"Install a package","section":"cli-commands","title":"npm-install"}},{"fields":{"slug":"/cli-commands/npm-install-ci-test"},"frontmatter":{"description":"Install a project with a clean slate and run tests","section":"cli-commands","title":"npm-install-ci-test"}},{"fields":{"slug":"/cli-commands/npm-install-test"},"frontmatter":{"description":"Install package(s) and run tests","section":"cli-commands","title":"npm-install-test"}},{"fields":{"slug":"/cli-commands/npm-link"},"frontmatter":{"description":"Symlink a package folder","section":"cli-commands","title":"npm-link"}},{"fields":{"slug":"/cli-commands/npm-logout"},"frontmatter":{"description":"Log out of the registry","section":"cli-commands","title":"npm-logout"}},{"fields":{"slug":"/cli-commands/npm-ls"},"frontmatter":{"description":"List installed packages","section":"cli-commands","title":"npm-ls"}},{"fields":{"slug":"/cli-commands/npm-org"},"frontmatter":{"description":"Manage orgs","section":"cli-commands","title":"npm-org"}},{"fields":{"slug":"/cli-commands/npm-outdated"},"frontmatter":{"description":"Check for outdated packages","section":"cli-commands","title":"npm-outdated"}},{"fields":{"slug":"/cli-commands/npm-owner"},"frontmatter":{"description":"Manage package owners","section":"cli-commands","title":"npm-owner"}},{"fields":{"slug":"/cli-commands/npm-pack"},"frontmatter":{"description":"Create a tarball from a package","section":"cli-commands","title":"npm-pack"}},{"fields":{"slug":"/cli-commands/npm-ping"},"frontmatter":{"description":"Ping npm registry","section":"cli-commands","title":"npm-ping"}},{"fields":{"slug":"/cli-commands/npm-prefix"},"frontmatter":{"description":"Display prefix","section":"cli-commands","title":"npm-prefix"}},{"fields":{"slug":"/cli-commands/npm-profile"},"frontmatter":{"description":"Change settings on your registry profile","section":"cli-commands","title":"npm-profile"}},{"fields":{"slug":"/cli-commands/npm-prune"},"frontmatter":{"description":"Remove extraneous packages","section":"cli-commands","title":"npm-prune"}},{"fields":{"slug":"/cli-commands/npm-publish"},"frontmatter":{"description":"Publish a package","section":"cli-commands","title":"npm-publish"}},{"fields":{"slug":"/cli-commands/npm-rebuild"},"frontmatter":{"description":"Rebuild a package","section":"cli-commands","title":"npm-rebuild"}},{"fields":{"slug":"/cli-commands/npm-repo"},"frontmatter":{"description":"Open package repository page in the browser","section":"cli-commands","title":"npm-repo"}},{"fields":{"slug":"/cli-commands/npm-restart"},"frontmatter":{"description":"Restart a package","section":"cli-commands","title":"npm-restart"}},{"fields":{"slug":"/cli-commands/npm-root"},"frontmatter":{"description":"Display npm root","section":"cli-commands","title":"npm-root"}},{"fields":{"slug":"/cli-commands/npm-run-script"},"frontmatter":{"description":"Run arbitrary package scripts","section":"cli-commands","title":"npm-run-script"}},{"fields":{"slug":"/cli-commands/npm-search"},"frontmatter":{"description":"Search for packages","section":"cli-commands","title":"npm-search"}},{"fields":{"slug":"/cli-commands/npm-shrinkwrap"},"frontmatter":{"description":"Lock down dependency versions for publication","section":"cli-commands","title":"npm-shrinkwrap"}},{"fields":{"slug":"/cli-commands/npm-star"},"frontmatter":{"description":"Mark your favorite packages","section":"cli-commands","title":"npm-star"}},{"fields":{"slug":"/cli-commands/npm-stars"},"frontmatter":{"description":"View packages marked as favorites","section":"cli-commands","title":"npm-stars"}},{"fields":{"slug":"/cli-commands/npm-start"},"frontmatter":{"description":"Start a package","section":"cli-commands","title":"npm-start"}},{"fields":{"slug":"/cli-commands/npm-stop"},"frontmatter":{"description":"Stop a package","section":"cli-commands","title":"npm-stop"}},{"fields":{"slug":"/cli-commands/npm-team"},"frontmatter":{"description":"Manage organization teams and team memberships","section":"cli-commands","title":"npm-team"}},{"fields":{"slug":"/cli-commands/npm-test"},"frontmatter":{"description":"Test a package","section":"cli-commands","title":"npm-test"}},{"fields":{"slug":"/cli-commands/npm-token"},"frontmatter":{"description":"Manage your authentication tokens","section":"cli-commands","title":"npm-token"}},{"fields":{"slug":"/cli-commands/npm-uninstall"},"frontmatter":{"description":"Remove a package","section":"cli-commands","title":"npm-uninstall"}},{"fields":{"slug":"/cli-commands/npm-unpublish"},"frontmatter":{"description":"Remove a package from the registry","section":"cli-commands","title":"npm-unpublish"}},{"fields":{"slug":"/cli-commands/npm-update"},"frontmatter":{"description":"Update a package","section":"cli-commands","title":"npm-update"}},{"fields":{"slug":"/cli-commands/npm-version"},"frontmatter":{"description":"Bump a package version","section":"cli-commands","title":"npm-version"}},{"fields":{"slug":"/cli-commands/npm-view"},"frontmatter":{"description":"View registry info","section":"cli-commands","title":"npm-view"}},{"fields":{"slug":"/cli-commands/npm-whoami"},"frontmatter":{"description":"Display npm username","section":"cli-commands","title":"npm-whoami"}},{"fields":{"slug":"/configuring-npm/npmrc"},"frontmatter":{"description":"The npm config files","section":"configuring-npm","title":"npmrc"}},{"fields":{"slug":"/using-npm/orgs"},"frontmatter":{"description":"Working with Teams & Orgs","section":"using-npm","title":"orgs"}},{"fields":{"slug":"/configuring-npm/package-lock-json"},"frontmatter":{"description":"A manifestation of the manifest","section":"configuring-npm","title":"package-lock.json"}},{"fields":{"slug":"/configuring-npm/package-locks"},"frontmatter":{"description":"An explanation of npm lockfiles","section":"configuring-npm","title":"package-locks"}},{"fields":{"slug":"/configuring-npm/package-json"},"frontmatter":{"description":"Specifics of npm's package.json handling","section":"configuring-npm","title":"package.json"}},{"fields":{"slug":"/using-npm/registry"},"frontmatter":{"description":"The JavaScript Package Registry","section":"using-npm","title":"registry"}},{"fields":{"slug":"/using-npm/removal"},"frontmatter":{"description":"Cleaning the Slate","section":"using-npm","title":"removal"}},{"fields":{"slug":"/using-npm/scope"},"frontmatter":{"description":"Scoped packages","section":"using-npm","title":"scope"}},{"fields":{"slug":"/using-npm/scripts"},"frontmatter":{"description":"How npm handles the \"scripts\" field","section":"using-npm","title":"scripts"}},{"fields":{"slug":"/using-npm/semver"},"frontmatter":{"description":"The semantic versioner for npm","section":"using-npm","title":"semver"}},{"fields":{"slug":"/configuring-npm/shrinkwrap-json"},"frontmatter":{"description":"A publishable lockfile","section":"configuring-npm","title":"shrinkwrap.json"}}]}}} \ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/config/index.html b/deps/npm/docs/public/using-npm/config/index.html index ace39d04339dbc..b14cf505b97d78 100644 --- a/deps/npm/docs/public/using-npm/config/index.html +++ b/deps/npm/docs/public/using-npm/config/index.html @@ -74,7 +74,7 @@ } } }) -

config

+

config

More than you probably want to know about npm configuration

Description

npm gets its configuration values from the following sources, sorted by priority:

@@ -1161,4 +1161,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/developers/index.html b/deps/npm/docs/public/using-npm/developers/index.html index 995a0cecdf5424..a5295c580a67a8 100644 --- a/deps/npm/docs/public/using-npm/developers/index.html +++ b/deps/npm/docs/public/using-npm/developers/index.html @@ -74,7 +74,7 @@ } } }) -

developers

+

developers

Developer Guide

Description

So, you've decided to use npm to develop (and maybe publish/deploy) @@ -259,4 +259,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/disputes/index.html b/deps/npm/docs/public/using-npm/disputes/index.html index 148e2fb96a11a1..93cbb66eb15adb 100644 --- a/deps/npm/docs/public/using-npm/disputes/index.html +++ b/deps/npm/docs/public/using-npm/disputes/index.html @@ -74,7 +74,7 @@ } } }) -

disputes

+

disputes

Handling Module Name Disputes

This document describes the steps that you should take to resolve module name disputes with other npm publishers. It also describes special steps you should @@ -192,4 +192,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/orgs/index.html b/deps/npm/docs/public/using-npm/orgs/index.html index 98d7ed33ae11e9..16d8f5ada127e8 100644 --- a/deps/npm/docs/public/using-npm/orgs/index.html +++ b/deps/npm/docs/public/using-npm/orgs/index.html @@ -74,7 +74,7 @@ } } }) -

orgs

+

orgs

Working with Teams & Orgs

Description

There are three levels of org users:

@@ -144,4 +144,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/registry/index.html b/deps/npm/docs/public/using-npm/registry/index.html index 5058b573dc1eb8..63a3a76f24f8e9 100644 --- a/deps/npm/docs/public/using-npm/registry/index.html +++ b/deps/npm/docs/public/using-npm/registry/index.html @@ -74,7 +74,7 @@ } } }) -

registry

+

registry

The JavaScript Package Registry

Description

To resolve packages by name and version, npm talks to a registry website @@ -156,4 +156,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/removal/index.html b/deps/npm/docs/public/using-npm/removal/index.html index da9c8fa79ae340..ae39dd10ad8d88 100644 --- a/deps/npm/docs/public/using-npm/removal/index.html +++ b/deps/npm/docs/public/using-npm/removal/index.html @@ -74,7 +74,7 @@ } } }) -

removal

+

removal

Cleaning the Slate

Synopsis

So sad to see you go.

@@ -116,4 +116,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/scope/index.html b/deps/npm/docs/public/using-npm/scope/index.html index cb798bc61b4480..dd243f1f9cf255 100644 --- a/deps/npm/docs/public/using-npm/scope/index.html +++ b/deps/npm/docs/public/using-npm/scope/index.html @@ -74,7 +74,7 @@ } } }) -

scope

+

scope

Scoped packages

Description

All npm packages have a name. Some package names also have a scope. A scope @@ -159,4 +159,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/scripts/index.html b/deps/npm/docs/public/using-npm/scripts/index.html index a9faac5c43ff98..8b2a03aafb7890 100644 --- a/deps/npm/docs/public/using-npm/scripts/index.html +++ b/deps/npm/docs/public/using-npm/scripts/index.html @@ -74,7 +74,7 @@ } } }) -

scripts

+

scripts

How npm handles the "scripts" field

Description

The "scripts" property of of your package.json file supports a number of built-in scripts and their preset life cycle events as well as arbitrary scripts. These all can be executed by running npm run-script <stage> or npm run <stage> for short. Pre and post commands with matching names will be run for those as well (e.g. premyscript, myscript, postmyscript). Scripts from dependencies can be run with npm explore <pkg> -- npm run <stage>.

@@ -323,4 +323,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/semver/index.html b/deps/npm/docs/public/using-npm/semver/index.html index 2e2d18d55e586c..218de1cc766fa0 100644 --- a/deps/npm/docs/public/using-npm/semver/index.html +++ b/deps/npm/docs/public/using-npm/semver/index.html @@ -74,7 +74,7 @@ } } }) -

semver(7) -- The semantic versioner for npm

+

semver(7) -- The semantic versioner for npm

Install

npm install --save semver

Usage

@@ -435,4 +435,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/lib/ci.js b/deps/npm/lib/ci.js index d5b5c15442512d..04b2984a9ac0ac 100644 --- a/deps/npm/lib/ci.js +++ b/deps/npm/lib/ci.js @@ -32,6 +32,10 @@ function ci (args, cb) { dirPacker: pack.packGitDep } + if (npm.config.get('dev')) { + log.warn('ci', 'Usage of the `--dev` option is deprecated. Use `--also=dev` instead.') + } + for (const key in npm.config.list[0]) { if (!['log', 'cache'].includes(key)) { opts[key] = npm.config.list[0][key] diff --git a/deps/npm/lib/hook.js b/deps/npm/lib/hook.js index 54aea9f1e9d207..4d980cf95d15e7 100644 --- a/deps/npm/lib/hook.js +++ b/deps/npm/lib/hook.js @@ -10,6 +10,7 @@ const pudding = require('figgy-pudding') const relativeDate = require('tiny-relative-date') const Table = require('cli-table3') const validate = require('aproba') +const npm = require('./npm') hook.usage = [ 'npm hook add [--type=]', @@ -40,6 +41,10 @@ module.exports = (args, cb) => BB.try(() => hook(args)).then( err => err.code === 'EUSAGE' ? cb(err.message) : cb(err) ) function hook (args) { + if (args.length === 4) { // secret is passed in the args + // we have the user secret in the CLI args, we need to redact it from the referer. + redactUserSecret() + } return otplease(npmConfig(), opts => { opts = HookConfig(opts) switch (args[0]) { @@ -150,3 +155,11 @@ function hookName (hook) { if (hook.type === 'owner') { target = '~' + target } return target } + +function redactUserSecret () { + const referer = npm.referer + if (!referer) return + const splittedReferer = referer.split(' ') + splittedReferer[4] = '[REDACTED]' + npm.referer = splittedReferer.join(' ') +} diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index ef492063b3a46e..082eda5165e3fb 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -197,7 +197,7 @@ function install (where, args, cb) { var dryrun = !!npm.config.get('dry-run') if (npm.config.get('dev')) { - log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--only=dev` instead.') + log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--also=dev` instead.') } if (where === globalTop && !args.length) { diff --git a/deps/npm/lib/utils/replace-info.js b/deps/npm/lib/utils/replace-info.js index a613a3755fab04..36e35b0785ab02 100644 --- a/deps/npm/lib/utils/replace-info.js +++ b/deps/npm/lib/utils/replace-info.js @@ -1,4 +1,4 @@ -const URL = require('url') +const URL = require('url').URL // replaces auth info in an array // of arguments or in a strings diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index d6480c26a4a2e4..2bead70fba6058 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "July 2020" "" "" +.TH "NPM" "1" "August 2020" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 512a69ad4df4af..0f55e9bf73daaf 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "July 2020" "" "" +.TH "NPM\-ACCESS" "1" "August 2020" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index f71e7c427f1443..9adc04819bbde5 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -4,7 +4,7 @@ section: cli\-commands title: npm\-adduser description: Set access level on published packages .HR -.TH "NPM\-ADDUSER" "1" "July 2020" "" "" +.TH "NPM\-ADDUSER" "1" "August 2020" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SS Synopsis diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index ad63338952fed1..ab632299949147 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-AUDIT" "1" "July 2020" "" "" +.TH "NPM\-AUDIT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-audit\fR \- Run a security audit .SS Synopsis diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 4a044ada095fce..16b61c2d58d40f 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "July 2020" "" "" +.TH "NPM\-BIN" "1" "August 2020" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 5cf62be9faa91d..c61c27de38a01b 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "July 2020" "" "" +.TH "NPM\-BUGS" "1" "August 2020" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SS Synopsis diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index 9cbfe4f84c942f..07f6ff013dfde2 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "July 2020" "" "" +.TH "NPM\-BUILD" "1" "August 2020" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index e210978abcf0dc..75fbd5cd9e5898 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "July 2020" "" "" +.TH "NPM\-BUNDLE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SS Description diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 8abbf7250ac2e6..9d2ee6447dca99 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "July 2020" "" "" +.TH "NPM\-CACHE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SS Synopsis diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 720092272a7e87..0b716af6892453 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CI" "1" "July 2020" "" "" +.TH "NPM\-CI" "1" "August 2020" "" "" .SH "NAME" \fBnpm-ci\fR \- Install a project with a clean slate .SS Synopsis diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index f8b341da6f5798..c47174226161f6 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "July 2020" "" "" +.TH "NPM\-COMPLETION" "1" "August 2020" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 0b1ce2d0bdfa65..fd7e75c5f5fe96 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "July 2020" "" "" +.TH "NPM\-CONFIG" "1" "August 2020" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SS Synopsis diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index e92c4869b61d61..fbfbbb64eaa9d8 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "July 2020" "" "" +.TH "NPM\-DEDUPE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SS Synopsis diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 43c4019b66d973..5024b478299954 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "July 2020" "" "" +.TH "NPM\-DEPRECATE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 9107230ac652d5..ebddc7e5a777a4 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -4,7 +4,7 @@ section: cli\-commands title: npm\-dist\-tag description: Modify package distribution tags .HR -.TH "NPM\-DIST\-TAG" "1" "July 2020" "" "" +.TH "NPM\-DIST\-TAG" "1" "August 2020" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SS Synopsis diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 3bb4dbbfc7958e..b5dc52d220b726 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "July 2020" "" "" +.TH "NPM\-DOCS" "1" "August 2020" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SS Synopsis diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 3ab5c8d94cf8b6..3e614110b87151 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "July 2020" "" "" +.TH "NPM\-DOCTOR" "1" "August 2020" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your environments .SS Synopsis diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 843447cf89c454..2f3ddd62e302fd 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "July 2020" "" "" +.TH "NPM\-EDIT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 2eda1a6698534e..93598500ea40df 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -4,7 +4,7 @@ section: cli\-commands title: npm\-explore description: Browse an installed package .HR -.TH "NPM\-EXPLORE" "1" "July 2020" "" "" +.TH "NPM\-EXPLORE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index cffe3070ba32e4..85312fb5cdf6a2 100644 --- a/deps/npm/man/man1/npm-fund.1 +++ b/deps/npm/man/man1/npm-fund.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FUND" "1" "July 2020" "" "" +.TH "NPM\-FUND" "1" "August 2020" "" "" .SH "NAME" \fBnpm-fund\fR \- Retrieve funding information .SS Synopsis diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 5219d10affc086..f2d5d0aa73e056 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "July 2020" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "August 2020" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SS Synopsis diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 95834ea0241300..f3d31009e70748 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "July 2020" "" "" +.TH "NPM\-HELP" "1" "August 2020" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 index 7ebd261618e350..bc7bfd69052130 100644 --- a/deps/npm/man/man1/npm-hook.1 +++ b/deps/npm/man/man1/npm-hook.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HOOK" "1" "July 2020" "" "" +.TH "NPM\-HOOK" "1" "August 2020" "" "" .SH "NAME" \fBnpm-hook\fR \- Manage registry hooks .SS Synopsis diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 45a47c8c024a6a..a6afe6f3c3c64c 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "July 2020" "" "" +.TH "NPM\-INIT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-init\fR \- create a package\.json file .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index e212b5e7529b2f..8e4081564a6ff5 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "July 2020" "" "" +.TH "NPM" "" "August 2020" "" "" .SH "NAME" \fBnpm\fR .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 1396995fa2398a..62d32764ba76e1 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "July 2020" "" "" +.TH "NPM" "" "August 2020" "" "" .SH "NAME" \fBnpm\fR .SS Synopsis diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 7b489b13b1d53c..0f2a87c7f8d3ab 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "July 2020" "" "" +.TH "NPM\-INSTALL" "1" "August 2020" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 9c0266bbe72fbc..870f1ca595cbba 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "July 2020" "" "" +.TH "NPM\-LINK" "1" "August 2020" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index ca1aa64c3e8c35..b5530624f4274f 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "July 2020" "" "" +.TH "NPM\-LOGOUT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index da9832cdd48e4f..41a3938b1b5128 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "July 2020" "" "" +.TH "NPM\-LS" "1" "August 2020" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SS Synopsis @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf - npm@6\.14\.7 /path/to/npm + npm@6\.14\.8 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 56218e8c4cf14b..474c363be9205b 100644 --- a/deps/npm/man/man1/npm-org.1 +++ b/deps/npm/man/man1/npm-org.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ORG" "1" "July 2020" "" "" +.TH "NPM\-ORG" "1" "August 2020" "" "" .SH "NAME" \fBnpm-org\fR \- Manage orgs .SS Synopsis diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 58d50dac8e52a3..983a5392c43349 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "July 2020" "" "" +.TH "NPM\-OUTDATED" "1" "August 2020" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 349ce09e101b85..416ef0ccf96d67 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "July 2020" "" "" +.TH "NPM\-OWNER" "1" "August 2020" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SS Synopsis diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 0e3feb8d618277..734df4a826c03c 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "July 2020" "" "" +.TH "NPM\-PACK" "1" "August 2020" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 2ce13ffb3eef19..dc64e9f2b9e758 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "July 2020" "" "" +.TH "NPM\-PING" "1" "August 2020" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index d0bd54abf261c4..097d1852089ff7 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "July 2020" "" "" +.TH "NPM\-PREFIX" "1" "August 2020" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SS Synopsis diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index f512fc44dd1dae..5b8ea7f16ec02c 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PROFILE" "1" "July 2020" "" "" +.TH "NPM\-PROFILE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-profile\fR \- Change settings on your registry profile .SS Synopsis diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index 211f20356a7fce..0f582fb8a066c1 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "July 2020" "" "" +.TH "NPM\-PRUNE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index de4307c87b50e5..5aeb1c9425290c 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "July 2020" "" "" +.TH "NPM\-PUBLISH" "1" "August 2020" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 9dda4956ac0f29..a339a77f6b5d3f 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "July 2020" "" "" +.TH "NPM\-REBUILD" "1" "August 2020" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index e1b384383b5efb..16494f20915634 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "July 2020" "" "" +.TH "NPM\-REPO" "1" "August 2020" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 0eb4ab0635cdf3..5606fab7f0792d 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "July 2020" "" "" +.TH "NPM\-RESTART" "1" "August 2020" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index 650dfa31f06029..ac8fac9ecde387 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "July 2020" "" "" +.TH "NPM\-ROOT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SS Synopsis diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 1553522d3627cb..d45689ca5c7653 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "July 2020" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "August 2020" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SS Synopsis diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index a02bf37151e5d4..37ab65ee5d03ce 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "July 2020" "" "" +.TH "NPM\-SEARCH" "1" "August 2020" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 8d3dfd93c5a3b6..5ec9f9cdd9f410 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "July 2020" "" "" +.TH "NPM\-SHRINKWRAP" "1" "August 2020" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SS Synopsis diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 13218af050a4c2..547a9e0c0acfb8 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "July 2020" "" "" +.TH "NPM\-STAR" "1" "August 2020" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 018b26402d7f91..dea4cf654d5f64 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "July 2020" "" "" +.TH "NPM\-STARS" "1" "August 2020" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SS Synopsis diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 68165e7251bc41..7a7766a04c696a 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "July 2020" "" "" +.TH "NPM\-START" "1" "August 2020" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 451bfec3661066..3f08b3fc5d4ba5 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "July 2020" "" "" +.TH "NPM\-STOP" "1" "August 2020" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index c6c762d1f904b1..aa402f20ea4178 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "July 2020" "" "" +.TH "NPM\-TEAM" "1" "August 2020" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SS Synopsis diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 462a56f4198c99..4653e0956ed5bd 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "July 2020" "" "" +.TH "NPM\-TEST" "1" "August 2020" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index 54f653b7790240..192f0166925f80 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TOKEN" "1" "July 2020" "" "" +.TH "NPM\-TOKEN" "1" "August 2020" "" "" .SH "NAME" \fBnpm-token\fR \- Manage your authentication tokens .SS Synopsis diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 2464df632544ad..0caa7e251efcf6 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "July 2020" "" "" +.TH "NPM\-UNINSTALL" "1" "August 2020" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 156cda6122235b..a81ef365d7a343 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "July 2020" "" "" +.TH "NPM\-UNPUBLISH" "1" "August 2020" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index ef431f2e4351a0..fb74d097ea549e 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "July 2020" "" "" +.TH "NPM\-UPDATE" "1" "August 2020" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index d2fb0733f134e8..f2e442e4517b87 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "July 2020" "" "" +.TH "NPM\-VERSION" "1" "August 2020" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SS Synopsis diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 11fad52c8c67c2..55de9cd0c0b57c 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "July 2020" "" "" +.TH "NPM\-VIEW" "1" "August 2020" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SS Synopsis diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 5360efecd8c124..ee27e158b060df 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "July 2020" "" "" +.TH "NPM\-WHOAMI" "1" "August 2020" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SS Synopsis diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 47aa62c9080ece..bfcfc11cc0dda1 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "July 2020" "" "" +.TH "NPM" "1" "August 2020" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis @@ -10,7 +10,7 @@ npm [args] .RE .SS Version .P -6\.14\.7 +6\.14\.8 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts @@ -50,8 +50,7 @@ requires compiling of C++ Code, npm will use node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR for that task\. For a Unix system, node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR needs Python, make and a buildchain like GCC\. On Windows, -Python and Microsoft Visual Studio C++ are needed\. Python 3 is -not supported by node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR\|\. +Python and Microsoft Visual Studio C++ are needed\. For more information visit the node\-gyp repository \fIhttps://github\.com/nodejs/node\-gyp\fR and the node\-gyp Wiki \fIhttps://github\.com/nodejs/node\-gyp/wiki\fR\|\. diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index f2c8dff898774d..0eb2760599b3cc 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "July 2020" "" "" +.TH "FOLDERS" "5" "August 2020" "" "" .SH "NAME" \fBfolders\fR \- Folder Structures Used by npm .SS Description diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index bc95d0251efbe6..125016ae4100bc 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "July 2020" "" "" +.TH "INSTALL" "5" "August 2020" "" "" .SH "NAME" \fBinstall\fR \- Download and Install npm .SS Description diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index d934d925a07674..1dc4ac5bbaf492 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "July 2020" "" "" +.TH "NPMRC" "5" "August 2020" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SS Description diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 5e80b634bd18e3..da9147f2763e3b 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "July 2020" "" "" +.TH "PACKAGE\.JSON" "5" "August 2020" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SS Description diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index 360d1d1d90a09c..5a61e250bd7ea6 100644 --- a/deps/npm/man/man5/package-lock-json.5 +++ b/deps/npm/man/man5/package-lock-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "July 2020" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "August 2020" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SS Description diff --git a/deps/npm/man/man5/package-locks.5 b/deps/npm/man/man5/package-locks.5 index f3d60b323d80cd..ec556d672dcd0b 100644 --- a/deps/npm/man/man5/package-locks.5 +++ b/deps/npm/man/man5/package-locks.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCKS" "5" "July 2020" "" "" +.TH "PACKAGE\-LOCKS" "5" "August 2020" "" "" .SH "NAME" \fBpackage-locks\fR \- An explanation of npm lockfiles .SS Description diff --git a/deps/npm/man/man5/shrinkwrap-json.5 b/deps/npm/man/man5/shrinkwrap-json.5 index 83db8b8b59d028..3bf7c478b1ec3e 100644 --- a/deps/npm/man/man5/shrinkwrap-json.5 +++ b/deps/npm/man/man5/shrinkwrap-json.5 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "July 2020" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "August 2020" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SS Description diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 6319a913412f61..4fadfd72346955 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "July 2020" "" "" +.TH "CONFIG" "7" "August 2020" "" "" .SH "NAME" \fBconfig\fR \- More than you probably want to know about npm configuration .SS Description diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index aeba674943092f..9758713ed81ccd 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "July 2020" "" "" +.TH "DEVELOPERS" "7" "August 2020" "" "" .SH "NAME" \fBdevelopers\fR \- Developer Guide .SS Description diff --git a/deps/npm/man/man7/disputes.7 b/deps/npm/man/man7/disputes.7 index e34955dc3861d0..4a4c6b43938c5a 100644 --- a/deps/npm/man/man7/disputes.7 +++ b/deps/npm/man/man7/disputes.7 @@ -1,4 +1,4 @@ -.TH "DISPUTES" "7" "July 2020" "" "" +.TH "DISPUTES" "7" "August 2020" "" "" .SH "NAME" \fBdisputes\fR \- Handling Module Name Disputes .P diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index da999a2ef5994e..3e87316c86f207 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "July 2020" "" "" +.TH "ORGS" "7" "August 2020" "" "" .SH "NAME" \fBorgs\fR \- Working with Teams & Orgs .SS Description diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index 2a3f371224d1cb..77f998292639eb 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "July 2020" "" "" +.TH "REGISTRY" "7" "August 2020" "" "" .SH "NAME" \fBregistry\fR \- The JavaScript Package Registry .SS Description diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index d04a5a975a378e..482b598f05efde 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "July 2020" "" "" +.TH "REMOVAL" "7" "August 2020" "" "" .SH "NAME" \fBremoval\fR \- Cleaning the Slate .SS Synopsis diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index 793e3d3e7ffa5d..dbb7d592065805 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "July 2020" "" "" +.TH "SCOPE" "7" "August 2020" "" "" .SH "NAME" \fBscope\fR \- Scoped packages .SS Description diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 8c92a706428de6..d74abc013aa199 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "July 2020" "" "" +.TH "SCRIPTS" "7" "August 2020" "" "" .SH "NAME" \fBscripts\fR \- How npm handles the "scripts" field .SS Description diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 80b13a15dc8e21..2614080cae61a2 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "July 2020" "" "" +.TH "SEMVER" "7" "August 2020" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Install diff --git a/deps/npm/node_modules/configstore/package.json b/deps/npm/node_modules/configstore/package.json index 828dc2ae6a8f8f..e51a0a4e3bca1f 100644 --- a/deps/npm/node_modules/configstore/package.json +++ b/deps/npm/node_modules/configstore/package.json @@ -1,8 +1,8 @@ { "_from": "configstore@^3.0.0", - "_id": "configstore@3.1.2", + "_id": "configstore@3.1.5", "_inBundle": false, - "_integrity": "sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw==", + "_integrity": "sha512-nlOhI4+fdzoK5xmJ+NY+1gZK56bwEaWZr8fYuXohZ9Vkc1o3a4T/R3M+yE/w7x/ZVJ1zF8c+oaOvF0dztdUgmA==", "_location": "/configstore", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/update-notifier" ], - "_resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", - "_shasum": "c6f25defaeef26df12dd33414b001fe81a543f8f", + "_resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.5.tgz", + "_shasum": "e9af331fadc14dabd544d3e7e76dc446a09a530f", "_spec": "configstore@^3.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest/node_modules/update-notifier", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -32,7 +32,7 @@ }, "bundleDependencies": false, "dependencies": { - "dot-prop": "^4.1.0", + "dot-prop": "^4.2.1", "graceful-fs": "^4.1.2", "make-dir": "^1.0.0", "unique-string": "^1.0.0", @@ -42,8 +42,8 @@ "deprecated": false, "description": "Easily load and save config without having to think about where and how", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^0.25.0", + "xo": "^0.20.3" }, "engines": { "node": ">=4" @@ -75,5 +75,5 @@ "scripts": { "test": "xo && ava" }, - "version": "3.1.2" + "version": "3.1.5" } diff --git a/deps/npm/node_modules/configstore/readme.md b/deps/npm/node_modules/configstore/readme.md index 6af37719bc0eab..5cdba305d40611 100644 --- a/deps/npm/node_modules/configstore/readme.md +++ b/deps/npm/node_modules/configstore/readme.md @@ -1,4 +1,4 @@ -# configstore [![Build Status](https://travis-ci.org/yeoman/configstore.svg?branch=master)](https://travis-ci.org/yeoman/configstore) +# configstore [![Build Status](https://travis-ci.org/yeoman/configstore.svg?branch=legacy-v3)](https://travis-ci.org/yeoman/configstore) > Easily load and persist config without having to think about where and how diff --git a/deps/npm/node_modules/dot-prop/index.js b/deps/npm/node_modules/dot-prop/index.js index 15282bb392402e..189831cf00f81d 100644 --- a/deps/npm/node_modules/dot-prop/index.js +++ b/deps/npm/node_modules/dot-prop/index.js @@ -1,6 +1,14 @@ 'use strict'; const isObj = require('is-obj'); +const disallowedKeys = [ + '__proto__', + 'prototype', + 'constructor' +]; + +const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment)); + function getPathSegments(path) { const pathArr = path.split('.'); const parts = []; @@ -16,6 +24,10 @@ function getPathSegments(path) { parts.push(p); } + if (!isValidPath(parts)) { + return []; + } + return parts; } @@ -26,6 +38,9 @@ module.exports = { } const pathArr = getPathSegments(path); + if (pathArr.length === 0) { + return; + } for (let i = 0; i < pathArr.length; i++) { if (!Object.prototype.propertyIsEnumerable.call(obj, pathArr[i])) { @@ -58,6 +73,9 @@ module.exports = { const root = obj; const pathArr = getPathSegments(path); + if (pathArr.length === 0) { + return; + } for (let i = 0; i < pathArr.length; i++) { const p = pathArr[i]; diff --git a/deps/npm/node_modules/dot-prop/package.json b/deps/npm/node_modules/dot-prop/package.json index 40fefa363d3536..674ab4308e6e2b 100644 --- a/deps/npm/node_modules/dot-prop/package.json +++ b/deps/npm/node_modules/dot-prop/package.json @@ -1,27 +1,27 @@ { - "_from": "dot-prop@^4.1.0", - "_id": "dot-prop@4.2.0", + "_from": "dot-prop@^4.2.1", + "_id": "dot-prop@4.2.1", "_inBundle": false, - "_integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "_integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", "_location": "/dot-prop", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "dot-prop@^4.1.0", + "raw": "dot-prop@^4.2.1", "name": "dot-prop", "escapedName": "dot-prop", - "rawSpec": "^4.1.0", + "rawSpec": "^4.2.1", "saveSpec": null, - "fetchSpec": "^4.1.0" + "fetchSpec": "^4.2.1" }, "_requiredBy": [ "/configstore" ], - "_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "_shasum": "1f19e0c2e1aa0e32797c49799f2837ac6af69c57", - "_spec": "dot-prop@^4.1.0", - "_where": "/Users/rebecca/code/npm/node_modules/configstore", + "_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", + "_shasum": "45884194a71fc2cda71cbb4bceb3a4dd2f433ba4", + "_spec": "dot-prop@^4.2.1", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest/node_modules/configstore", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -37,9 +37,9 @@ "deprecated": false, "description": "Get, set, or delete a property from a nested object using a dot path", "devDependencies": { - "ava": "*", + "ava": "1.4.1", "matcha": "^0.7.0", - "xo": "*" + "xo": "0.24.0" }, "engines": { "node": ">=4" @@ -73,7 +73,7 @@ "bench": "matcha bench.js", "test": "xo && ava" }, - "version": "4.2.0", + "version": "4.2.1", "xo": { "esnext": true } diff --git a/deps/npm/node_modules/dot-prop/readme.md b/deps/npm/node_modules/dot-prop/readme.md index fab3b7afe00ac2..0e18f786560349 100644 --- a/deps/npm/node_modules/dot-prop/readme.md +++ b/deps/npm/node_modules/dot-prop/readme.md @@ -85,6 +85,8 @@ Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. +The following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`. + #### value Type: `any` diff --git a/deps/npm/node_modules/meant/.github/workflows/ci.yml b/deps/npm/node_modules/meant/.github/workflows/ci.yml new file mode 100644 index 00000000000000..b11451fa603d54 --- /dev/null +++ b/deps/npm/node_modules/meant/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: Node.js CI + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + node-version: [6.x, 8.x, 10.x, 12.x] + os: [ubuntu-latest, windows-latest, macOS-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test diff --git a/deps/npm/node_modules/meant/.npmignore b/deps/npm/node_modules/meant/.npmignore deleted file mode 100644 index 5148e527a7e286..00000000000000 --- a/deps/npm/node_modules/meant/.npmignore +++ /dev/null @@ -1,37 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history diff --git a/deps/npm/node_modules/meant/.travis.yml b/deps/npm/node_modules/meant/.travis.yml deleted file mode 100644 index 413d5de7f1a649..00000000000000 --- a/deps/npm/node_modules/meant/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -script: - - "npm test" - -language: node_js - -node_js: - - "5" - - "4" - - iojs - - "0.12" - -sudo: false - -cache: - directories: - - node_modules diff --git a/deps/npm/node_modules/meant/CHANGELOG.md b/deps/npm/node_modules/meant/CHANGELOG.md index a26b8aadfa1f54..89b0e6f94e1ccf 100644 --- a/deps/npm/node_modules/meant/CHANGELOG.md +++ b/deps/npm/node_modules/meant/CHANGELOG.md @@ -1,7 +1,15 @@ -# Change Log +# Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.0.2](https://github.com/watilde/meant/compare/v1.0.1...v1.0.2) (2020-07-19) + + +### Bug Fixes + +* **deps:** bump standard, standard-version and tap ([d31fb06](https://github.com/watilde/meant/commit/d31fb064495b031dd1152726da9bd2198daa36ff)) +* **deps:** patch update in lock file ([4e699ee](https://github.com/watilde/meant/commit/4e699ee8751a69923dddf18c940acce630f4bf29)) + ## [1.0.1](https://github.com/watilde/meant/compare/v1.0.0...v1.0.1) (2017-08-23) diff --git a/deps/npm/node_modules/meant/README.md b/deps/npm/node_modules/meant/README.md index 90cc0ac77c16bb..2fe43b610a71de 100644 --- a/deps/npm/node_modules/meant/README.md +++ b/deps/npm/node_modules/meant/README.md @@ -1,4 +1,4 @@ -# meant [![Build Status](https://travis-ci.org/watilde/meant.png?branch=master)](https://travis-ci.org/watilde/meant) +# meant ![Build status](https://github.com/watilde/meant/workflows/Node.js%20CI/badge.svg) Like the `Did you mean?` in git for npm diff --git a/deps/npm/node_modules/meant/package.json b/deps/npm/node_modules/meant/package.json index a22398f4bd24e9..64fb15b983f088 100644 --- a/deps/npm/node_modules/meant/package.json +++ b/deps/npm/node_modules/meant/package.json @@ -1,43 +1,41 @@ { - "_args": [ - [ - "meant@1.0.1", - "/Users/rebecca/code/npm" - ] - ], - "_from": "meant@1.0.1", - "_id": "meant@1.0.1", + "_from": "meant@1.0.2", + "_id": "meant@1.0.2", "_inBundle": false, - "_integrity": "sha512-UakVLFjKkbbUwNWJ2frVLnnAtbb7D7DsloxRd3s/gDpI8rdv8W5Hp3NaDb+POBI1fQdeussER6NB8vpcRURvlg==", + "_integrity": "sha512-KN+1uowN/NK+sT/Lzx7WSGIj2u+3xe5n2LbwObfjOhPZiA+cCfCm6idVl0RkEfjThkw5XJ96CyRcanq6GmKtUg==", "_location": "/meant", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "meant@1.0.1", + "raw": "meant@1.0.2", "name": "meant", "escapedName": "meant", - "rawSpec": "1.0.1", + "rawSpec": "1.0.2", "saveSpec": null, - "fetchSpec": "1.0.1" + "fetchSpec": "1.0.2" }, "_requiredBy": [ + "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/meant/-/meant-1.0.1.tgz", - "_spec": "1.0.1", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/meant/-/meant-1.0.2.tgz", + "_shasum": "5d0c78310a3d8ae1408a16be0fe0bd42a969f560", + "_spec": "meant@1.0.2", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest", "author": { "name": "Daijiro Wachi" }, "bugs": { "url": "https://github.com/watilde/meant/issues" }, + "bundleDependencies": false, + "deprecated": false, "description": "Like the `Did you mean?` in git for npm", "devDependencies": { - "standard": "^8.0.0", - "standard-version": "^2.4.0", - "tap": "^7.1.1" + "standard": "^11.0.1", + "standard-version": "^8.0.1", + "tap": "^12.7.0" }, "homepage": "https://github.com/watilde/meant#readme", "keywords": [ @@ -54,5 +52,5 @@ "release": "standard-version", "test": "standard && tap test.js" }, - "version": "1.0.1" + "version": "1.0.2" } diff --git a/deps/npm/node_modules/rc/node_modules/minimist/.travis.yml b/deps/npm/node_modules/minimist/.travis.yml similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/.travis.yml rename to deps/npm/node_modules/minimist/.travis.yml diff --git a/deps/npm/node_modules/rc/node_modules/minimist/LICENSE b/deps/npm/node_modules/minimist/LICENSE similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/LICENSE rename to deps/npm/node_modules/minimist/LICENSE diff --git a/deps/npm/node_modules/rc/node_modules/minimist/example/parse.js b/deps/npm/node_modules/minimist/example/parse.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/example/parse.js rename to deps/npm/node_modules/minimist/example/parse.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/index.js b/deps/npm/node_modules/minimist/index.js similarity index 97% rename from deps/npm/node_modules/rc/node_modules/minimist/index.js rename to deps/npm/node_modules/minimist/index.js index d2afe5e4d4056e..d5fa9d510fa17e 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/index.js +++ b/deps/npm/node_modules/minimist/index.js @@ -1,6 +1,6 @@ module.exports = function (args, opts) { if (!opts) opts = {}; - + var flags = { bools : {}, strings : {}, unknownFn: null }; if (typeof opts['unknown'] === 'function') { @@ -14,7 +14,7 @@ module.exports = function (args, opts) { flags.bools[key] = true; }); } - + var aliases = {}; Object.keys(opts.alias || {}).forEach(function (key) { aliases[key] = [].concat(opts.alias[key]); @@ -33,12 +33,12 @@ module.exports = function (args, opts) { }); var defaults = opts['default'] || {}; - + var argv = { _ : [] }; Object.keys(flags.bools).forEach(function (key) { setArg(key, defaults[key] === undefined ? false : defaults[key]); }); - + var notFlags = []; if (args.indexOf('--') !== -1) { @@ -60,7 +60,7 @@ module.exports = function (args, opts) { ? Number(val) : val ; setKey(argv, key.split('.'), value); - + (aliases[key] || []).forEach(function (x) { setKey(argv, x.split('.'), value); }); @@ -93,7 +93,7 @@ module.exports = function (args, opts) { o[key] = [ o[key], value ]; } } - + function aliasIsBoolean(key) { return aliases[key].some(function (x) { return flags.bools[x]; @@ -102,7 +102,7 @@ module.exports = function (args, opts) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - + if (/^--.+=/.test(arg)) { // Using [\s\S] instead of . because js doesn't support the // 'dotall' regex modifier. See: @@ -139,29 +139,29 @@ module.exports = function (args, opts) { } else if (/^-[^-]+/.test(arg)) { var letters = arg.slice(1,-1).split(''); - + var broken = false; for (var j = 0; j < letters.length; j++) { var next = arg.slice(j+2); - + if (next === '-') { setArg(letters[j], next, arg) continue; } - + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { setArg(letters[j], next.split('=')[1], arg); broken = true; break; } - + if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { setArg(letters[j], next, arg); broken = true; break; } - + if (letters[j+1] && letters[j+1].match(/\W/)) { setArg(letters[j], arg.slice(j+2), arg); broken = true; @@ -171,7 +171,7 @@ module.exports = function (args, opts) { setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); } } - + var key = arg.slice(-1)[0]; if (!broken && key !== '-') { if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) @@ -201,17 +201,17 @@ module.exports = function (args, opts) { } } } - + Object.keys(defaults).forEach(function (key) { if (!hasKey(argv, key.split('.'))) { setKey(argv, key.split('.'), defaults[key]); - + (aliases[key] || []).forEach(function (x) { setKey(argv, x.split('.'), defaults[key]); }); } }); - + if (opts['--']) { argv['--'] = new Array(); notFlags.forEach(function(key) { @@ -242,4 +242,3 @@ function isNumber (x) { if (/^0x[0-9a-f]+$/i.test(x)) return true; return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); } - diff --git a/deps/npm/node_modules/rc/node_modules/minimist/package.json b/deps/npm/node_modules/minimist/package.json similarity index 93% rename from deps/npm/node_modules/rc/node_modules/minimist/package.json rename to deps/npm/node_modules/minimist/package.json index 86e9c8ee28bd2d..502b798942f818 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/package.json +++ b/deps/npm/node_modules/minimist/package.json @@ -3,7 +3,7 @@ "_id": "minimist@1.2.5", "_inBundle": false, "_integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "_location": "/rc/minimist", + "_location": "/minimist", "_phantomChildren": {}, "_requested": { "type": "range", @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "_shasum": "67d66014b66a6a8aaa0c083c5fd58df4e4e97602", "_spec": "minimist@^1.2.0", - "_where": "/Users/ruyadorno/Documents/workspace/cli/node_modules/rc", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest/node_modules/rc", "author": { "name": "James Halliday", "email": "mail@substack.net", diff --git a/deps/npm/node_modules/rc/node_modules/minimist/readme.markdown b/deps/npm/node_modules/minimist/readme.markdown similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/readme.markdown rename to deps/npm/node_modules/minimist/readme.markdown diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/all_bool.js b/deps/npm/node_modules/minimist/test/all_bool.js similarity index 97% rename from deps/npm/node_modules/rc/node_modules/minimist/test/all_bool.js rename to deps/npm/node_modules/minimist/test/all_bool.js index ac835483d9a659..25df1654bc99d9 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/all_bool.js +++ b/deps/npm/node_modules/minimist/test/all_bool.js @@ -5,12 +5,12 @@ test('flag boolean true (default all --args to boolean)', function (t) { var argv = parse(['moo', '--honk', 'cow'], { boolean: true }); - + t.deepEqual(argv, { honk: true, _: ['moo', 'cow'] }); - + t.deepEqual(typeof argv.honk, 'boolean'); t.end(); }); @@ -19,14 +19,14 @@ test('flag boolean true only affects double hyphen arguments without equals sign var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { boolean: true }); - + t.deepEqual(argv, { honk: true, tacos: 'good', p: 55, _: ['moo', 'cow'] }); - + t.deepEqual(typeof argv.honk, 'boolean'); t.end(); }); diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/bool.js b/deps/npm/node_modules/minimist/test/bool.js similarity index 97% rename from deps/npm/node_modules/rc/node_modules/minimist/test/bool.js rename to deps/npm/node_modules/minimist/test/bool.js index 5f7dbde16cc914..dc9666bc619755 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/bool.js +++ b/deps/npm/node_modules/minimist/test/bool.js @@ -6,13 +6,13 @@ test('flag boolean default false', function (t) { boolean: ['t', 'verbose'], default: { verbose: false, t: false } }); - + t.deepEqual(argv, { verbose: false, t: false, _: ['moo'] }); - + t.deepEqual(typeof argv.verbose, 'boolean'); t.deepEqual(typeof argv.t, 'boolean'); t.end(); @@ -23,14 +23,14 @@ test('boolean groups', function (t) { var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { boolean: ['x','y','z'] }); - + t.deepEqual(argv, { x : true, y : false, z : true, _ : [ 'one', 'two', 'three' ] }); - + t.deepEqual(typeof argv.x, 'boolean'); t.deepEqual(typeof argv.y, 'boolean'); t.deepEqual(typeof argv.z, 'boolean'); @@ -55,9 +55,9 @@ test('boolean and alias with chainable api', function (t) { h: true, '_': [ 'derp' ] }; - + t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); + t.same(propertyArgv, expected); t.end(); }); @@ -119,7 +119,7 @@ test('boolean and alias using explicit true', function (t) { }; t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); + t.same(propertyArgv, expected); t.end(); }); @@ -135,7 +135,7 @@ test('boolean and --x=true', function(t) { parsed = parse(['--boool', '--other=false'], { boolean: 'boool' }); - + t.same(parsed.boool, true); t.same(parsed.other, 'false'); t.end(); diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/dash.js b/deps/npm/node_modules/minimist/test/dash.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/dash.js rename to deps/npm/node_modules/minimist/test/dash.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/default_bool.js b/deps/npm/node_modules/minimist/test/default_bool.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/default_bool.js rename to deps/npm/node_modules/minimist/test/default_bool.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/dotted.js b/deps/npm/node_modules/minimist/test/dotted.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/dotted.js rename to deps/npm/node_modules/minimist/test/dotted.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/kv_short.js b/deps/npm/node_modules/minimist/test/kv_short.js similarity index 97% rename from deps/npm/node_modules/rc/node_modules/minimist/test/kv_short.js rename to deps/npm/node_modules/minimist/test/kv_short.js index f813b305057b0a..ae880be4661dd5 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/kv_short.js +++ b/deps/npm/node_modules/minimist/test/kv_short.js @@ -3,14 +3,14 @@ var test = require('tape'); test('short -k=v' , function (t) { t.plan(1); - + var argv = parse([ '-b=123' ]); t.deepEqual(argv, { b: 123, _: [] }); }); test('multi short -k=v' , function (t) { t.plan(1); - + var argv = parse([ '-a=whatever', '-b=robots' ]); t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); }); diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/long.js b/deps/npm/node_modules/minimist/test/long.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/long.js rename to deps/npm/node_modules/minimist/test/long.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/num.js b/deps/npm/node_modules/minimist/test/num.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/num.js rename to deps/npm/node_modules/minimist/test/num.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/parse.js b/deps/npm/node_modules/minimist/test/parse.js similarity index 99% rename from deps/npm/node_modules/rc/node_modules/minimist/test/parse.js rename to deps/npm/node_modules/minimist/test/parse.js index 7b4a2a17c0dda5..58f24572c47d86 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/parse.js +++ b/deps/npm/node_modules/minimist/test/parse.js @@ -14,7 +14,7 @@ test('parse args', function (t) { ); t.end(); }); - + test('comprehensive', function (t) { t.deepEqual( parse([ @@ -54,13 +54,13 @@ test('flag boolean value', function (t) { boolean: [ 't', 'verbose' ], default: { verbose: true } }); - + t.deepEqual(argv, { verbose: false, t: true, _: ['moo'] }); - + t.deepEqual(typeof argv.verbose, 'boolean'); t.deepEqual(typeof argv.t, 'boolean'); t.end(); @@ -69,7 +69,7 @@ test('flag boolean value', function (t) { test('newlines in params' , function (t) { var args = parse([ '-s', "X\nX" ]) t.deepEqual(args, { _ : [], s : "X\nX" }); - + // reproduce in bash: // VALUE="new // line" @@ -83,7 +83,7 @@ test('strings' , function (t) { var s = parse([ '-s', '0001234' ], { string: 's' }).s; t.equal(s, '0001234'); t.equal(typeof s, 'string'); - + var x = parse([ '-x', '56' ], { string: 'x' }).x; t.equal(x, '56'); t.equal(typeof x, 'string'); @@ -183,7 +183,7 @@ test('nested dotted objects', function (t) { '--foo.quux.quibble', '5', '--foo.quux.o_O', '--beep.boop' ]); - + t.same(argv.foo, { bar : 3, baz : 4, diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/parse_modified.js b/deps/npm/node_modules/minimist/test/parse_modified.js similarity index 97% rename from deps/npm/node_modules/rc/node_modules/minimist/test/parse_modified.js rename to deps/npm/node_modules/minimist/test/parse_modified.js index ab620dc5e4dc39..a22248532f0c6f 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/parse_modified.js +++ b/deps/npm/node_modules/minimist/test/parse_modified.js @@ -3,7 +3,7 @@ var test = require('tape'); test('parse with modifier functions' , function (t) { t.plan(1); - + var argv = parse([ '-b', '123' ], { boolean: 'b' }); t.deepEqual(argv, { b: true, _: [123] }); }); diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/proto.js b/deps/npm/node_modules/minimist/test/proto.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/proto.js rename to deps/npm/node_modules/minimist/test/proto.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/short.js b/deps/npm/node_modules/minimist/test/short.js similarity index 99% rename from deps/npm/node_modules/rc/node_modules/minimist/test/short.js rename to deps/npm/node_modules/minimist/test/short.js index d513a1c2529095..ac18880f1eb50c 100644 --- a/deps/npm/node_modules/rc/node_modules/minimist/test/short.js +++ b/deps/npm/node_modules/minimist/test/short.js @@ -43,7 +43,7 @@ test('short', function (t) { ); t.end(); }); - + test('mixed short bool and capture', function (t) { t.same( parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), @@ -54,7 +54,7 @@ test('mixed short bool and capture', function (t) { ); t.end(); }); - + test('short and long', function (t) { t.deepEqual( parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/stop_early.js b/deps/npm/node_modules/minimist/test/stop_early.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/stop_early.js rename to deps/npm/node_modules/minimist/test/stop_early.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/unknown.js b/deps/npm/node_modules/minimist/test/unknown.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/unknown.js rename to deps/npm/node_modules/minimist/test/unknown.js diff --git a/deps/npm/node_modules/rc/node_modules/minimist/test/whitespace.js b/deps/npm/node_modules/minimist/test/whitespace.js similarity index 100% rename from deps/npm/node_modules/rc/node_modules/minimist/test/whitespace.js rename to deps/npm/node_modules/minimist/test/whitespace.js diff --git a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md index 0340ab46e7acd5..04a4dd901b0f85 100644 --- a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md +++ b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [4.0.7](https://github.com/npm/registry-fetch/compare/v4.0.6...v4.0.7) (2020-08-17) + + +### Bug Fixes + +* correct password redaction ([110032b](https://github.com/npm/registry-fetch/commit/110032b)) + + + + +## [4.0.6](https://github.com/npm/registry-fetch/compare/v4.0.5...v4.0.6) (2020-08-14) + + +### Bug Fixes + +* import URL from url module ([cd35987](https://github.com/npm/registry-fetch/commit/cd35987)) + + + ## [4.0.5](https://github.com/npm/registry-fetch/compare/v4.0.4...v4.0.5) (2020-06-30) diff --git a/deps/npm/node_modules/npm-registry-fetch/check-response.js b/deps/npm/node_modules/npm-registry-fetch/check-response.js index 55139c93aff8d3..79170a7fbdaf3b 100644 --- a/deps/npm/node_modules/npm-registry-fetch/check-response.js +++ b/deps/npm/node_modules/npm-registry-fetch/check-response.js @@ -32,9 +32,12 @@ function logRequest (method, res, startTime, opts) { let urlStr try { - const URL = require('url') + const URL = require('url').URL const url = new URL(res.url) - urlStr = res.url.replace(url.password, '***') + if (url.password) { + url.password = '***' + } + urlStr = url.toString() } catch (er) { urlStr = res.url } diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index 8959c4c558a4d6..a5ac4817ff51ba 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,19 +1,19 @@ { - "_from": "npm-registry-fetch@4.0.5", - "_id": "npm-registry-fetch@4.0.5", + "_from": "npm-registry-fetch@4.0.7", + "_id": "npm-registry-fetch@4.0.7", "_inBundle": false, - "_integrity": "sha512-yQ0/U4fYpCCqmueB2g8sc+89ckQ3eXpmU4+Yi2j5o/r0WkKvE2+Y0tK3DEILAtn2UaQTkjTHxIXe2/CSdit+/Q==", + "_integrity": "sha512-cny9v0+Mq6Tjz+e0erFAB+RYJ/AVGzkjnISiobqP8OWj9c9FLoZZu8/SPSKJWE17F1tk4018wfjV+ZbIbqC7fQ==", "_location": "/npm-registry-fetch", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-registry-fetch@4.0.5", + "raw": "npm-registry-fetch@4.0.7", "name": "npm-registry-fetch", "escapedName": "npm-registry-fetch", - "rawSpec": "4.0.5", + "rawSpec": "4.0.7", "saveSpec": null, - "fetchSpec": "4.0.5" + "fetchSpec": "4.0.7" }, "_requiredBy": [ "#USER", @@ -28,10 +28,10 @@ "/npm-profile", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.5.tgz", - "_shasum": "cb87cf7f25bfb048d6c3ee19d115bebf93ea5bfa", - "_spec": "npm-registry-fetch@4.0.5", - "_where": "/Users/claudiahdz/npm/cli", + "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.7.tgz", + "_shasum": "57951bf6541e0246b34c9f9a38ab73607c9449d7", + "_spec": "npm-registry-fetch@4.0.7", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -95,12 +95,12 @@ }, "scripts": { "postrelease": "npm publish && git push --follow-tags", + "posttest": "standard", "prerelease": "npm t", - "pretest": "standard", "release": "standard-version -s", "test": "tap -J --coverage test/*.js", "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "4.0.5" + "version": "4.0.7" } diff --git a/deps/npm/node_modules/update-notifier/package.json b/deps/npm/node_modules/update-notifier/package.json index c2c81fb3c7d73c..fd049446e1301a 100644 --- a/deps/npm/node_modules/update-notifier/package.json +++ b/deps/npm/node_modules/update-notifier/package.json @@ -23,7 +23,7 @@ "_resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.5.0.tgz", "_shasum": "d0744593e13f161e406acb1d9408b72cad08aff6", "_spec": "update-notifier@2.5.0", - "_where": "/Users/ruyadorno/Documents/workspace/cli", + "_where": "/Users/ruyadorno/Documents/workspace/cli/latest", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/deps/npm/package.json b/deps/npm/package.json index c018aaf9784b7f..c9df68e3314dae 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "6.14.7", + "version": "6.14.8", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -89,7 +89,7 @@ "lodash.uniq": "~4.5.0", "lodash.without": "~4.4.0", "lru-cache": "^5.1.1", - "meant": "~1.0.1", + "meant": "^1.0.2", "mississippi": "^3.0.0", "mkdirp": "^0.5.5", "move-concurrently": "^1.0.1", @@ -104,7 +104,7 @@ "npm-packlist": "^1.4.8", "npm-pick-manifest": "^3.0.2", "npm-profile": "^4.0.4", - "npm-registry-fetch": "^4.0.5", + "npm-registry-fetch": "^4.0.7", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc index b00d5195bd8361..e2237dffc74347 100644 --- a/deps/npm/test/fixtures/config/userconfig-with-gc +++ b/deps/npm/test/fixtures/config/userconfig-with-gc @@ -1,4 +1,4 @@ -globalconfig = /Users/claudiahdz/npm/cli/test/fixtures/config/globalconfig +globalconfig = /Users/ruyadorno/Documents/workspace/cli/latest/test/fixtures/config/globalconfig email = i@izs.me env-thing = ${random_env_var} init.author.name = Isaac Z. Schlueter diff --git a/deps/npm/test/tap/publish-invalid-semver-tag.js b/deps/npm/test/tap/publish-invalid-semver-tag.js index b5d499f3772482..9c2f40813b06e4 100644 --- a/deps/npm/test/tap/publish-invalid-semver-tag.js +++ b/deps/npm/test/tap/publish-invalid-semver-tag.js @@ -28,7 +28,7 @@ function resetPackage (options) { chownSync(CACHE_DIR, sudoUID, sudoGID) } - fs.writeFileSync(path.resolve(PKG_DIR, 'package.json'), DEFAULT_PKG) + fs.writeFileSync(path.resolve(PKG_DIR, 'package.json'), JSON.stringify(DEFAULT_PKG)) } test('setup', function (t) { diff --git a/deps/npm/test/tap/referer.js b/deps/npm/test/tap/referer.js index 8c3dbed72c319d..6df676db62e279 100644 --- a/deps/npm/test/tap/referer.js +++ b/deps/npm/test/tap/referer.js @@ -21,3 +21,63 @@ test('should send referer http header', function (t) { }) }) }) + +test('should redact user secret from hook add command', function (t) { + http.createServer(function (q, s) { + t.equal(q.headers.referer, 'hook add ~zkat [REDACTED] [REDACTED]') + s.statusCode = 204 + s.end() + this.close() + }).listen(common.port, function () { + var reg = `http://localhost:${common.port}` + var args = [ 'hook', 'add', '~zkat', 'https://example.com', 'sekrit', '--registry', reg ] + common.npm(args, {}, function (er, code) { + if (er) { + throw er + } + // should not have ended nicely, since we returned an error + t.ok(code) + t.end() + }) + }) +}) + +test('should redact user secret from hook up command', function (t) { + http.createServer(function (q, s) { + t.equal(q.headers.referer, 'hook up ~zkat [REDACTED] [REDACTED]') + s.statusCode = 204 + s.end() + this.close() + }).listen(common.port, function () { + var reg = `http://localhost:${common.port}` + var args = [ 'hook', 'up', '~zkat', 'https://example.com', 'sekrit', '--registry', reg ] + common.npm(args, {}, function (er, code) { + if (er) { + throw er + } + // should not have ended nicely, since we returned an error + t.ok(code) + t.end() + }) + }) +}) + +test('should redact user secret from hook update command', function (t) { + http.createServer(function (q, s) { + t.equal(q.headers.referer, 'hook update ~zkat [REDACTED] [REDACTED]') + s.statusCode = 204 + s.end() + this.close() + }).listen(common.port, function () { + var reg = `http://localhost:${common.port}` + var args = [ 'hook', 'update', '~zkat', 'https://example.com', 'sekrit', '--registry', reg ] + common.npm(args, {}, function (er, code) { + if (er) { + throw er + } + // should not have ended nicely, since we returned an error + t.ok(code) + t.end() + }) + }) +}) diff --git a/deps/npm/test/tap/semver-doc.js b/deps/npm/test/tap/semver-doc.js index 1cc978201c7a47..fe2077660c1dd1 100644 --- a/deps/npm/test/tap/semver-doc.js +++ b/deps/npm/test/tap/semver-doc.js @@ -5,8 +5,10 @@ test('semver doc is up to date', function (t) { var moddoc = path.join(__dirname, '../../node_modules/semver/README.md') var mydoc = path.join(__dirname, '../../docs/content/using-npm/semver.md') var fs = require('fs') - var mod = fs.readFileSync(moddoc, 'utf8').replace(/semver\(1\)/, 'semver(7)') + var mod = fs.readFileSync(moddoc, 'utf8') + mod = mod.substr(mod.match(/^## Install$/m).index) var my = fs.readFileSync(mydoc, 'utf8') + my = my.substr(my.match(/^## Install$/m).index) t.equal(my, mod) t.end() }) diff --git a/deps/npm/test/tap/whoami.js b/deps/npm/test/tap/whoami.js index 9f4bf4266b74cd..aabf5b282160f1 100644 --- a/deps/npm/test/tap/whoami.js +++ b/deps/npm/test/tap/whoami.js @@ -36,7 +36,7 @@ test('npm whoami with basic auth', function (t) { ) }) -test('npm whoami with bearer auth', { timeout: 6000 }, function (t) { +test('npm whoami with bearer auth', { timeout: 8000 }, function (t) { var s = '//localhost:' + common.port + '/:_authToken = wombat-developers-union\n' fs.writeFileSync(FIXTURE_PATH, s, 'ascii') From 98f7d8ec81ca867156d04b1a004f465aae56d64c Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Tue, 18 Aug 2020 23:00:37 -0700 Subject: [PATCH 088/104] n-api: handle weak no-finalizer refs correctly When deleting a weak reference that has no finalizer we must not defer deletion until the non-existent finalizer gets called. Fixes: https://github.com/nodejs/node/issues/34731 Signed-off-by: Gabriel Schulhof PR-URL: https://github.com/nodejs/node/pull/34839 Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Rich Trott --- src/js_native_api_v8.cc | 6 ++++-- test/node-api/test_worker_terminate_finalization/test.js | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index b8455eb3a69b3e..0a069b3ae45b97 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -228,9 +228,10 @@ class RefBase : protected Finalizer, RefTracker { // from one of Unwrap or napi_delete_reference. // // When it is called from Unwrap or napi_delete_reference we only - // want to do the delete if the finalizer has already run or - // cannot have been queued to run (ie the reference count is > 0), + // want to do the delete if there is no finalizer or the finalizer has already + // run or cannot have been queued to run (i.e. the reference count is > 0), // otherwise we may crash when the finalizer does run. + // // If the finalizer may have been queued and has not already run // delay the delete until the finalizer runs by not doing the delete // and setting _delete_self to true so that the finalizer will @@ -242,6 +243,7 @@ class RefBase : protected Finalizer, RefTracker { static inline void Delete(RefBase* reference) { reference->Unlink(); if ((reference->RefCount() != 0) || + (reference->_finalize_callback == nullptr) || (reference->_delete_self) || (reference->_finalize_ran)) { delete reference; diff --git a/test/node-api/test_worker_terminate_finalization/test.js b/test/node-api/test_worker_terminate_finalization/test.js index d58324d5e5f696..7240520080e66c 100644 --- a/test/node-api/test_worker_terminate_finalization/test.js +++ b/test/node-api/test_worker_terminate_finalization/test.js @@ -1,10 +1,6 @@ 'use strict'; const common = require('../../common'); -// TODO(addaleax): Run this test once it stops failing under ASAN/valgrind. -// Refs: https://github.com/nodejs/node/issues/34731 -common.skip('Reference management in N-API leaks memory'); - const { Worker, isMainThread } = require('worker_threads'); if (isMainThread) { From e4679bd45d93ba62b12c8e0e5f03a3a5c187c474 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Aug 2020 16:52:26 -0700 Subject: [PATCH 089/104] doc: use 'console' info string for console output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34837 Reviewed-By: Michaël Zasso Reviewed-By: Richard Lau --- doc/api/esm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 2968e0385b3656..18efdb3c8b7ec1 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1895,7 +1895,7 @@ requires the full path to a module be provided to the loader. To enable the automatic extension resolution and importing from directories that include an index file use the `node` mode. -```bash +```console $ node index.mjs success! $ node index # Failure! From d6bb2ad5ea0e0f64b0a423c8106b02fd2f562ed2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 17 Aug 2020 23:01:10 -0700 Subject: [PATCH 090/104] doc: adopt Microsoft Style Guide officially MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34821 Reviewed-By: Michaël Zasso Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: James M Snell Reviewed-By: Derek Lewis --- doc/guides/doc-style-guide.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/guides/doc-style-guide.md b/doc/guides/doc-style-guide.md index 4813c4a1fbd282..46446692ded1f4 100644 --- a/doc/guides/doc-style-guide.md +++ b/doc/guides/doc-style-guide.md @@ -104,10 +104,13 @@ this guide. See also API documentation structure overview in [doctools README][]. +For topics not covered here, refer to the [Microsoft Writing Style Guide][]. + +[Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types +[Microsoft Writing Style Guide]: https://docs.microsoft.com/en-us/style-guide/welcome/ +[`remark-preset-lint-node`]: https://github.com/nodejs/remark-preset-lint-node +[doctools README]: ../../tools/doc/README.md [info string]: https://github.github.com/gfm/#info-string [language]: https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md -[Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types -[serial commas]: https://en.wikipedia.org/wiki/Serial_comma [plugin]: https://editorconfig.org/#download -[doctools README]: ../../tools/doc/README.md -[`remark-preset-lint-node`]: https://github.com/nodejs/remark-preset-lint-node +[serial commas]: https://en.wikipedia.org/wiki/Serial_comma From 4b3b0e3f98e6073f00e2d1cda0c1fca7324d2f0c Mon Sep 17 00:00:00 2001 From: Maksim Sinik Date: Thu, 20 Aug 2020 15:44:38 +0200 Subject: [PATCH 091/104] doc: fix ESM/CJS wrapper example PR-URL: https://github.com/nodejs/node/pull/34853 Refs: https://github.com/nodejs/node/issues/34714 Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- doc/api/esm.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/esm.md b/doc/api/esm.md index 18efdb3c8b7ec1..2c860c710c6ac4 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -689,6 +689,12 @@ CommonJS entry point for `require`. } ``` +The above example uses explicit extensions `.mjs` and `.cjs`. +If your files use the `.js` extension, `"type": "module"` will cause such files +to be treated as ES modules, just as `"type": "commonjs"` would cause them +to be treated as CommonJS. +See [Enabling](#esm_enabling). + ```js // ./node_modules/pkg/index.cjs exports.name = 'value'; From cc7258469c982b40dec562d710ccd785d2b9bef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lucas=20Lucchetta?= Date: Thu, 20 Aug 2020 00:01:57 -0300 Subject: [PATCH 092/104] http2: fix Http2Response.sendDate The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: https://github.com/nodejs/node/issues/34841 PR-URL: https://github.com/nodejs/node/pull/34850 Reviewed-By: Matteo Collina Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Denys Otrishko Reviewed-By: Rich Trott --- lib/internal/http2/compat.js | 8 ++++++ lib/internal/http2/core.js | 17 +++++++----- ...compat-serverresponse-headers-send-date.js | 26 +++++++++++++++++++ ...est-http2-compat-serverresponse-headers.js | 5 ++++ 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 test/parallel/test-http2-compat-serverresponse-headers-send-date.js diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 085ae11b9e5491..38413510de5ff3 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -583,6 +583,13 @@ class Http2ServerResponse extends Stream { throw new ERR_HTTP2_HEADERS_SENT(); name = name.trim().toLowerCase(); + + if (name === 'date') { + this[kState].sendDate = false; + + return; + } + delete this[kHeaders][name]; } @@ -775,6 +782,7 @@ class Http2ServerResponse extends Stream { const options = { endStream: state.ending, waitForTrailers: true, + sendDate: state.sendDate }; this[kStream].respond(headers, options); } diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 1bd0a9f7ae90bc..80f9834006ba56 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2257,7 +2257,7 @@ function callStreamClose(stream) { stream.close(); } -function processHeaders(oldHeaders) { +function processHeaders(oldHeaders, options) { assertIsObject(oldHeaders, 'headers'); const headers = ObjectCreate(null); @@ -2274,9 +2274,12 @@ function processHeaders(oldHeaders) { headers[HTTP2_HEADER_STATUS] = headers[HTTP2_HEADER_STATUS] | 0 || HTTP_STATUS_OK; - if (headers[HTTP2_HEADER_DATE] === null || - headers[HTTP2_HEADER_DATE] === undefined) - headers[HTTP2_HEADER_DATE] = utcDate(); + if (options.sendDate == null || options.sendDate) { + if (headers[HTTP2_HEADER_DATE] === null || + headers[HTTP2_HEADER_DATE] === undefined) { + headers[HTTP2_HEADER_DATE] = utcDate(); + } + } // This is intentionally stricter than the HTTP/1 implementation, which // allows values between 100 and 999 (inclusive) in order to allow for @@ -2602,7 +2605,7 @@ class ServerHttp2Stream extends Http2Stream { state.flags |= STREAM_FLAGS_HAS_TRAILERS; } - headers = processHeaders(headers); + headers = processHeaders(headers, options); const headersList = mapToHeaders(headers, assertValidPseudoHeaderResponse); this[kSentHeaders] = headers; @@ -2668,7 +2671,7 @@ class ServerHttp2Stream extends Http2Stream { this[kUpdateTimer](); this.ownsFd = false; - headers = processHeaders(headers); + headers = processHeaders(headers, options); const statusCode = headers[HTTP2_HEADER_STATUS] |= 0; // Payload/DATA frames are not permitted in these cases if (statusCode === HTTP_STATUS_NO_CONTENT || @@ -2729,7 +2732,7 @@ class ServerHttp2Stream extends Http2Stream { this[kUpdateTimer](); this.ownsFd = true; - headers = processHeaders(headers); + headers = processHeaders(headers, options); const statusCode = headers[HTTP2_HEADER_STATUS] |= 0; // Payload/DATA frames are not permitted in these cases if (statusCode === HTTP_STATUS_NO_CONTENT || diff --git a/test/parallel/test-http2-compat-serverresponse-headers-send-date.js b/test/parallel/test-http2-compat-serverresponse-headers-send-date.js new file mode 100644 index 00000000000000..b22b1f7304038e --- /dev/null +++ b/test/parallel/test-http2-compat-serverresponse-headers-send-date.js @@ -0,0 +1,26 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) { common.skip('missing crypto'); } +const assert = require('assert'); +const http2 = require('http2'); + +const server = http2.createServer(common.mustCall((request, response) => { + response.sendDate = false; + response.writeHead(200); + response.end(); +})); + +server.listen(0, common.mustCall(() => { + const session = http2.connect(`http://localhost:${server.address().port}`); + const req = session.request(); + + req.on('response', common.mustCall((headers, flags) => { + assert.strictEqual('Date' in headers, false); + assert.strictEqual('date' in headers, false); + })); + + req.on('end', common.mustCall(() => { + session.close(); + server.close(); + })); +})); diff --git a/test/parallel/test-http2-compat-serverresponse-headers.js b/test/parallel/test-http2-compat-serverresponse-headers.js index 96875e1bce3400..19720b1e41f2bd 100644 --- a/test/parallel/test-http2-compat-serverresponse-headers.js +++ b/test/parallel/test-http2-compat-serverresponse-headers.js @@ -114,6 +114,11 @@ server.listen(0, common.mustCall(function() { response.sendDate = false; assert.strictEqual(response.sendDate, false); + response.sendDate = true; + assert.strictEqual(response.sendDate, true); + response.removeHeader('Date'); + assert.strictEqual(response.sendDate, false); + response.on('finish', common.mustCall(function() { assert.strictEqual(response.headersSent, true); From e90cb49390df90a1370ce4c5fbdd31712860dce8 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 Aug 2020 10:05:43 -0700 Subject: [PATCH 093/104] tls: enable renegotiation when using BoringSSL PR-URL: https://github.com/nodejs/node/pull/34832 Reviewed-By: Colin Ihrig Reviewed-By: Shelley Vohr Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Rich Trott --- src/tls_wrap.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 04c035a1e8f3e5..91faeafb62b660 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -131,6 +131,12 @@ void TLSWrap::InitSSL() { // - https://wiki.openssl.org/index.php/TLS1.3#Non-application_data_records SSL_set_mode(ssl_.get(), SSL_MODE_AUTO_RETRY); +#ifdef OPENSSL_IS_BORINGSSL + // OpenSSL allows renegotiation by default, but BoringSSL disables it. + // Configure BoringSSL to match OpenSSL's behavior. + SSL_set_renegotiate_mode(ssl_.get(), ssl_renegotiate_freely); +#endif + SSL_set_app_data(ssl_.get(), this); // Using InfoCallback isn't how we are supposed to check handshake progress: // https://github.com/openssl/openssl/issues/7199#issuecomment-420915993 From f2c2f421957f43cbfc249a7598cbe0ef0b4037f0 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Aug 2020 17:11:53 -0700 Subject: [PATCH 094/104] doc: improve wording in deprecations.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * utilize -> use * may -> can/might as appropriate PR-URL: https://github.com/nodejs/node/pull/34860 Reviewed-By: Trivikram Kamat Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- doc/api/deprecations.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 687fa4b8489a67..24632e364ceeb4 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3,13 +3,13 @@ -Node.js may deprecate APIs for any of the following reasons: +Node.js APIs might be deprecated for any of the following reasons: * Use of the API is unsafe. * An improved alternative API is available. * Breaking changes to the API are expected in a future major release. -Node.js utilizes three kinds of Deprecations: +Node.js uses three kinds of Deprecations: * Documentation-only * Runtime @@ -34,7 +34,7 @@ from Node.js. ## Revoking deprecations -Occasionally, the deprecation of an API may be reversed. In such situations, +Occasionally, the deprecation of an API might be reversed. In such situations, this document will be updated with information relevant to the decision. However, the deprecation identifier will not be modified. @@ -1651,7 +1651,7 @@ Type: End-of-Life Using a property named `inspect` on an object to specify a custom inspection function for [`util.inspect()`][] is deprecated. Use [`util.inspect.custom`][] instead. For backward compatibility with Node.js prior to version 6.4.0, both -may be specified. +can be specified. ### DEP0080: `path._makeLong()` @@ -1752,7 +1752,7 @@ The `v8/*` modules do not have any exports, and if not imported in a specific order would in fact throw errors. As such there are virtually no legitimate use cases for importing them through `require()`. -On the other hand, `node-inspect` may be installed locally through a package +On the other hand, `node-inspect` can be installed locally through a package manager, as it is published on the npm registry under the same name. No source code modification is necessary if that is done. @@ -2053,7 +2053,7 @@ Type: Documentation-only (supports [`--pending-deprecation`][]) When assigning a non-string property to [`process.env`][], the assigned value is implicitly converted to a string. This behavior is deprecated if the assigned -value is not a string, boolean, or number. In the future, such assignment may +value is not a string, boolean, or number. In the future, such assignment might result in a thrown error. Please convert the property to a string before assigning it to `process.env`. @@ -2249,7 +2249,7 @@ Type: Documentation-only (supports [`--pending-deprecation`][]) In recent versions of Node.js, there is no difference between [`crypto.randomBytes()`][] and `crypto.pseudoRandomBytes()`. The latter is deprecated along with the undocumented aliases `crypto.prng()` and -`crypto.rng()` in favor of [`crypto.randomBytes()`][] and may be removed in a +`crypto.rng()` in favor of [`crypto.randomBytes()`][] and might be removed in a future release. @@ -2600,7 +2600,7 @@ changes: Type: Runtime Allowing a [`fs.FileHandle`][] object to be closed on garbage collection is -deprecated. In the future, doing so may result in a thrown error that will +deprecated. In the future, doing so might result in a thrown error that will terminate the process. Please ensure that all `fs.FileHandle` objects are explicitly closed using From bf7f492cb654673699d29d49d6794d24d225a951 Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 10:40:45 +0200 Subject: [PATCH 095/104] doc: rename module pages Using a "Modules:" prefix groups all the related pages together when using alphabetical order. Refs: https://github.com/nodejs/modules/issues/539 PR-URL: https://github.com/nodejs/node/pull/34663 Reviewed-By: James M Snell Reviewed-By: Guy Bedford Reviewed-By: Trivikram Kamat Reviewed-By: Geoffrey Booth Reviewed-By: Rich Trott --- doc/api/esm.md | 2 +- doc/api/index.md | 6 +++--- doc/api/module.md | 2 +- doc/api/modules.md | 2 +- doc/api/vm.md | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 2c860c710c6ac4..302f234c038b84 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1,4 +1,4 @@ -# ECMAScript modules +# Modules: ECMAScript modules diff --git a/doc/api/index.md b/doc/api/index.md index 38c2f550b7094c..f5ef2b312f72b3 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -25,7 +25,6 @@ * [Deprecated APIs](deprecations.html) * [DNS](dns.html) * [Domain](domain.html) -* [ECMAScript modules](esm.html) * [Errors](errors.html) * [Events](events.html) * [File system](fs.html) @@ -35,8 +34,9 @@ * [HTTPS](https.html) * [Inspector](inspector.html) * [Internationalization](intl.html) -* [Modules](modules.html) -* [Modules: `module` core module](module.html) +* [Modules: CommonJS modules](modules.html) +* [Modules: ECMAScript modules](esm.html) +* [Modules: `module` API](module.html) * [Net](net.html) * [OS](os.html) * [Path](path.html) diff --git a/doc/api/module.md b/doc/api/module.md index 46eafeb7b622bd..e5d2cd7dd70373 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -1,4 +1,4 @@ -# Modules: `module` core module +# Modules: `module` API diff --git a/doc/api/modules.md b/doc/api/modules.md index 044f2fdc068ab2..8b7f19a20cdf60 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -1,4 +1,4 @@ -# Modules +# Modules: CommonJS modules diff --git a/doc/api/vm.md b/doc/api/vm.md index 1694b26be52736..843f3f85cecbe9 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1316,7 +1316,7 @@ are not controllable through the timeout either. [`vm.runInContext()`]: #vm_vm_runincontext_code_contextifiedobject_options [`vm.runInThisContext()`]: #vm_vm_runinthiscontext_code_options [Cyclic Module Record]: https://tc39.es/ecma262/#sec-cyclic-module-records -[ECMAScript Module Loader]: esm.html#esm_ecmascript_modules +[ECMAScript Module Loader]: esm.html#esm_modules_ecmascript_modules [Evaluate() concrete method]: https://tc39.es/ecma262/#sec-moduleevaluation [GetModuleNamespace]: https://tc39.es/ecma262/#sec-getmodulenamespace [HostResolveImportedModule]: https://tc39.es/ecma262/#sec-hostresolveimportedmodule From 7666d95c7d80e323985ca19ca222a2f950b490c0 Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Mon, 17 Aug 2020 15:09:53 +0530 Subject: [PATCH 096/104] src: usage of modernize-use-equals-default Update the destructor and constructor calls to use the default member function. This will bascially enable the compiler to do better optimization as the functions as explicitly defined as trivial. Refs: https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html PR-URL: https://github.com/nodejs/node/pull/34807 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott --- src/node_file.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 4c368abb064fe1..247c1c530428e8 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -126,9 +126,9 @@ void FSContinuationData::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("paths", paths_); } -FileHandleReadWrap::~FileHandleReadWrap() {} +FileHandleReadWrap::~FileHandleReadWrap() = default; -FSReqBase::~FSReqBase() {} +FSReqBase::~FSReqBase() = default; void FSReqBase::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("continuation_data", continuation_data_); From fff1e7f86c83fd4d9452021052cbb062d87a5254 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 22 Aug 2020 10:40:05 +0200 Subject: [PATCH 097/104] src: fix abort on uv_loop_init() failure Fixes: https://github.com/nodejs/node/issues/34855 PR-URL: https://github.com/nodejs/node/pull/34874 Reviewed-By: Gireesh Punathil Reviewed-By: Denys Otrishko Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- src/spawn_sync.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index d7d06be34bdb10..1141aceae984fb 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -457,9 +457,17 @@ Maybe SyncProcessRunner::TryInitializeAndRunLoop(Local options) { SetError(UV_ENOMEM); return Just(false); } - CHECK_EQ(uv_loop_init(uv_loop_), 0); + + r = uv_loop_init(uv_loop_); + if (r < 0) { + delete uv_loop_; + uv_loop_ = nullptr; + SetError(r); + return Just(false); + } if (!ParseOptions(options).To(&r)) return Nothing(); + if (r < 0) { SetError(r); return Just(false); From dae93ca0cb13d3d25dab2ee56cf96dde06a1f43c Mon Sep 17 00:00:00 2001 From: Danny Guo Date: Fri, 21 Aug 2020 21:53:20 -0400 Subject: [PATCH 098/104] doc: indicate the format of process.version PR-URL: https://github.com/nodejs/node/pull/34872 Reviewed-By: Richard Lau Reviewed-By: Rich Trott --- doc/api/process.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 0e53a742cbc147..b2743104feebed 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2476,7 +2476,8 @@ added: v0.1.3 * {string} -The `process.version` property returns the Node.js version string. +The `process.version` property returns the Node.js version string in the form of +`v..`. ```js console.log(`Version: ${process.version}`); From 9ebae0a758544ed9fbd76b5b9e2c27ccd5f85a7e Mon Sep 17 00:00:00 2001 From: Jim Schlight Date: Fri, 21 Aug 2020 16:15:27 -0700 Subject: [PATCH 099/104] doc,n-api: add link to n-api tutorial website PR-URL: https://github.com/nodejs/node/pull/34870 Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- doc/api/n-api.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 4933f78dbd1bd1..d9b757721c8803 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -78,6 +78,10 @@ it still gets the benefits of the ABI stability provided by the C API. When using `node-addon-api` instead of the C APIs, start with the API [docs][] for `node-addon-api`. +The [N-API Resource](https://nodejs.github.io/node-addon-examples/) offers an +excellent orientation and tips for developers just getting started with N-API +and node-addon-api. + ## Implications of ABI stability Although N-API provides an ABI stability guarantee, other parts of Node.js do From ff15c92a7fa67c6aee79c8a74be85f8a2cd7f6f2 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 19 Aug 2020 12:56:13 -0700 Subject: [PATCH 100/104] doc: improve fs doc intro Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/34843 Reviewed-By: Anna Henningsen Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Anto Aravinth Reviewed-By: Luigi Pinca --- doc/api/fs.md | 100 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 40 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 244ebbe7767806..a8aa1388c5be94 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -8,8 +8,8 @@ -The `fs` module provides an API for interacting with the file system in a -manner closely modeled around standard POSIX functions. +The `fs` module enables interacting with the file system in a +way modeled on standard POSIX functions. To use this module: @@ -17,12 +17,33 @@ To use this module: const fs = require('fs'); ``` -All file system operations have synchronous and asynchronous forms. +All file system operations have synchronous, callback, and promise-based +forms. -The asynchronous form always takes a completion callback as its last argument. -The arguments passed to the completion callback depend on the method, but the -first argument is always reserved for an exception. If the operation was -completed successfully, then the first argument will be `null` or `undefined`. +## Synchronous example + +The synchronous form blocks the Node.js event loop and further JavaScript +execution until the operation is complete. Exceptions are thrown immediately +and can be handled using `try…catch`, or can be allowed to bubble up. + +```js +const fs = require('fs'); + +try { + fs.unlinkSync('/tmp/hello'); + console.log('successfully deleted /tmp/hello'); +} catch (err) { + // handle the error +} +``` + +## Callback example + +The callback form takes a completion callback function as its last +argument and invokes the operation asynchronously. The arguments passed to +the completion callback depend on the method, but the first argument is always +reserved for an exception. If the operation is completed successfully, then +the first argument is `null` or `undefined`. ```js const fs = require('fs'); @@ -33,23 +54,30 @@ fs.unlink('/tmp/hello', (err) => { }); ``` -Exceptions that occur using synchronous operations are thrown immediately and -may be handled using `try…catch`, or may be allowed to bubble up. +## Promise example + +Promise-based operations return a `Promise` that is resolved when the +asynchronous operation is complete. ```js -const fs = require('fs'); +const fs = require('fs/promises'); -try { - fs.unlinkSync('/tmp/hello'); - console.log('successfully deleted /tmp/hello'); -} catch (err) { - // handle the error -} +(async function(path) { + try { + await fs.unlink(path); + console.log(`successfully deleted ${path}`); + } catch (error) { + console.error('there was an error:', error.message); + } +})('/tmp/hello'); ``` -There is no guaranteed ordering when using asynchronous methods. So the -following is prone to error because the `fs.stat()` operation may complete -before the `fs.rename()` operation: +## Ordering of callback and promise-based operations + +There is no guaranteed ordering when using either the callback or +promise-based methods. For example, the following is prone to error +because the `fs.stat()` operation might complete before the `fs.rename()` +operation: ```js fs.rename('/tmp/hello', '/tmp/world', (err) => { @@ -75,28 +103,20 @@ fs.rename('/tmp/hello', '/tmp/world', (err) => { }); ``` -In busy processes, use the asynchronous versions of these calls. The synchronous -versions will block the entire process until they complete, halting all -connections. +Or, use the promise-based API: -Most asynchronous `fs` functions allow the callback argument to be omitted. -However, this usage is deprecated. When the callback is omitted, a default -callback is used that rethrows errors. To get a trace to the original call site, -set the `NODE_DEBUG` environment variable: +```js +const fs = require('fs/promises'); -```console -$ cat script.js -function bad() { - require('fs').readFile('/'); -} -bad(); - -$ env NODE_DEBUG=fs node script.js -fs.js:88 - throw backtrace; - ^ -Error: EISDIR: illegal operation on a directory, read - +(async function(from, to) { + try { + await fs.rename(from, to); + const stats = await fs.stat(to); + console.log(`stats: ${JSON.stringify(stats)}`); + } catch (error) { + console.error('there was an error:', error.message); + } +})('/tmp/hello', '/tmp/world'); ``` ## File paths @@ -106,7 +126,7 @@ a string, a [`Buffer`][], or a [`URL`][] object using the `file:` protocol. String form paths are interpreted as UTF-8 character sequences identifying the absolute or relative filename. Relative paths will be resolved relative -to the current working directory as specified by `process.cwd()`. +to the current working directory as determined by calling `process.cwd()`. Example using an absolute path on POSIX: From cf348542c6f4c0c754aea27dd7560ed9bbd9854c Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 24 Aug 2020 20:34:47 -0400 Subject: [PATCH 101/104] deps: upgrade to libuv 1.39.0 Notable changes: - uv_metrics_idle_time() and UV_METRICS_IDLE_TIME have been added for measuring the amount of time the event loop spends idle. - uv_udp_using_recvmmsg() has been added to determine if a buffer is large enough for multiple datagrams should be allocated in the allocation callback of uv_udp_recvstart(). - On MinGW, the installation location has been updated to match Unix systems rather than Windows. - uv_fs_copyfile() now tries to use copy_file_range() when possible. - The test suite is now reported to pass on Darwin ARM64 (Apple Silicon). - uv_{get,set}_process_title() now returns an error on platforms where uv_setup_args() is required, but has not yet been called. - The _POSIX_PATH_MAX constant is no longer used, which could lead to buffer overflows in uv_fs_readlink() and uv_fs_realpath(). PR-URL: https://github.com/nodejs/node/pull/34915 Reviewed-By: Jiawen Geng Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat Reviewed-By: David Carlier Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Beth Griggs --- deps/uv/.mailmap | 3 + deps/uv/AUTHORS | 8 + deps/uv/CMakeLists.txt | 15 +- deps/uv/ChangeLog | 76 ++++++++++ deps/uv/Makefile.am | 7 +- deps/uv/configure.ac | 2 +- deps/uv/docs/src/api.rst | 1 + deps/uv/docs/src/async.rst | 2 +- deps/uv/docs/src/errors.rst | 14 +- deps/uv/docs/src/fs.rst | 8 +- deps/uv/docs/src/handle.rst | 4 +- deps/uv/docs/src/loop.rst | 7 +- deps/uv/docs/src/metrics.rst | 25 ++++ deps/uv/docs/src/misc.rst | 42 ++++-- deps/uv/docs/src/process.rst | 33 ++--- deps/uv/docs/src/request.rst | 2 +- deps/uv/docs/src/sphinx-plugins/manpage.py | 2 +- deps/uv/docs/src/tty.rst | 5 +- deps/uv/docs/src/udp.rst | 12 +- deps/uv/include/uv.h | 21 ++- deps/uv/include/uv/version.h | 4 +- deps/uv/src/strscpy.c | 21 +++ deps/uv/src/strscpy.h | 21 +++ deps/uv/src/unix/aix-common.c | 110 +++----------- deps/uv/src/unix/aix.c | 70 ++++++++- deps/uv/src/unix/core.c | 83 +++++++++++ deps/uv/src/unix/darwin-stub.h | 16 ++ deps/uv/src/unix/darwin.c | 145 ++++++++++++++++++- deps/uv/src/unix/fs.c | 59 ++++++-- deps/uv/src/unix/ibmi.c | 40 +++++ deps/uv/src/unix/internal.h | 5 +- deps/uv/src/unix/kqueue.c | 46 +++++- deps/uv/src/unix/linux-core.c | 68 +++++++-- deps/uv/src/unix/linux-syscalls.c | 40 +++++ deps/uv/src/unix/linux-syscalls.h | 7 + deps/uv/src/unix/loop.c | 34 ++++- deps/uv/src/unix/os390.c | 110 ++++++-------- deps/uv/src/unix/posix-poll.c | 40 ++++- deps/uv/src/unix/proctitle.c | 8 + deps/uv/src/unix/signal.c | 2 + deps/uv/src/unix/sunos.c | 37 ++++- deps/uv/src/unix/udp.c | 24 ++- deps/uv/src/uv-common.c | 59 ++++++++ deps/uv/src/uv-common.h | 23 +++ deps/uv/src/uv-data-getter-setters.c | 21 +++ deps/uv/src/win/core.c | 91 ++++++++++++ deps/uv/src/win/detect-wakeup.c | 21 +++ deps/uv/src/win/fs-fd-hash-inl.h | 24 ++- deps/uv/src/win/fs.c | 93 ++++++------ deps/uv/src/win/pipe.c | 12 +- deps/uv/src/win/tcp.c | 62 +++++++- deps/uv/src/win/tty.c | 1 + deps/uv/src/win/udp.c | 5 + deps/uv/src/win/util.c | 8 +- deps/uv/src/win/winapi.h | 12 ++ deps/uv/test/task.h | 44 ++++-- deps/uv/test/test-close-fd.c | 4 +- deps/uv/test/test-fs-copyfile.c | 5 + deps/uv/test/test-fs-open-flags.c | 6 +- deps/uv/test/test-fs.c | 15 +- deps/uv/test/test-get-currentexe.c | 14 ++ deps/uv/test/test-getaddrinfo.c | 16 ++ deps/uv/test/test-getnameinfo.c | 10 ++ deps/uv/test/test-getters-setters.c | 21 +++ deps/uv/test/test-list.h | 21 ++- deps/uv/test/test-metrics.c | 135 +++++++++++++++++ deps/uv/test/test-ping-pong.c | 20 +-- deps/uv/test/test-pipe-set-non-blocking.c | 34 +++-- deps/uv/test/test-process-title-threadsafe.c | 15 +- deps/uv/test/test-spawn.c | 72 ++++----- deps/uv/test/test-tcp-connect-timeout.c | 105 ++++++++++++++ deps/uv/test/test-tcp-read-stop-start.c | 136 +++++++++++++++++ deps/uv/test/test-test-macros.c | 42 ++++++ deps/uv/test/test-thread.c | 5 + deps/uv/test/test-tty.c | 5 + deps/uv/test/test-udp-mmsg.c | 136 +++++++++++++++++ 76 files changed, 2154 insertions(+), 418 deletions(-) create mode 100644 deps/uv/docs/src/metrics.rst create mode 100644 deps/uv/test/test-metrics.c create mode 100644 deps/uv/test/test-tcp-read-stop-start.c create mode 100644 deps/uv/test/test-test-macros.c create mode 100644 deps/uv/test/test-udp-mmsg.c diff --git a/deps/uv/.mailmap b/deps/uv/.mailmap index 2ae2968c83208d..56a80f586b3c17 100644 --- a/deps/uv/.mailmap +++ b/deps/uv/.mailmap @@ -27,6 +27,7 @@ Maciej Małecki Marc Schlaich Michael Michael Neumann +Michael Penick Nicholas Vavilov Nick Logan Rasmus Christian Pedersen @@ -41,10 +42,12 @@ Santiago Gimeno Saúl Ibarra Corretgé Saúl Ibarra Corretgé Shigeki Ohtsu +TK-one Timothy J. Fontaine Yasuhiro Matsumoto Yazhong Liu Yuki Okumura +gengjiawen jBarz jBarz ptlomholt diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 38fee1f4498284..9078925bb07669 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -435,3 +435,11 @@ MasterDuke17 Alexander Tokmakov Arenoros lander0s +Turbinya +OleksandrKvl +Carter Li +Juan Sebastian velez Posada +escherstair +Evan Lucas +tjarlama <59913901+tjarlama@users.noreply.github.com> +司徒玟琅 diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index 2518c74748be5b..e9bf77f7c36de0 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -56,6 +56,8 @@ check_c_compiler_flag(-Wno-unused-parameter UV_LINT_NO_UNUSED_PARAMETER) check_c_compiler_flag(-Wstrict-prototypes UV_LINT_STRICT_PROTOTYPES) check_c_compiler_flag(-Wextra UV_LINT_EXTRA) +check_c_compiler_flag(/utf-8 UV_LINT_UTF8_MSVC) + set(lint-no-unused-parameter $<$:-Wno-unused-parameter>) set(lint-strict-prototypes $<$:-Wstrict-prototypes>) set(lint-extra $<$:-Wextra>) @@ -76,6 +78,7 @@ set(lint-no-unsafe-msvc $<$:/wd4996>) string(CONCAT lint-default $< $,$>:-Wall >) +set(lint-utf8-msvc $<$:/utf-8>) list(APPEND uv_cflags ${lint-strict-prototypes} ${lint-extra} ${lint-default} ${lint-w4}) list(APPEND uv_cflags ${lint-no-unused-parameter}) @@ -90,6 +93,7 @@ list(APPEND uv_cflags ${lint-no-hides-param-msvc}) list(APPEND uv_cflags ${lint-no-hides-global-msvc}) list(APPEND uv_cflags ${lint-no-conditional-assignment-msvc}) list(APPEND uv_cflags ${lint-no-unsafe-msvc}) +list(APPEND uv_cflags ${lint-utf8-msvc} ) set(uv_sources src/fs-poll.c @@ -107,6 +111,8 @@ if(WIN32) list(APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0600) list(APPEND uv_libraries psapi + user32 + advapi32 iphlpapi userenv ws2_32) @@ -283,7 +289,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS400") src/unix/aix-common.c src/unix/ibmi.c src/unix/no-fsevents.c - src/unix/no-proctitle.c src/unix/posix-poll.c) endif() @@ -416,6 +421,7 @@ if(LIBUV_BUILD_TESTS) test/test-loop-handles.c test/test-loop-stop.c test/test-loop-time.c + test/test-metrics.c test/test-multiple-listen.c test/test-mutexes.c test/test-osx-select.c @@ -473,6 +479,7 @@ if(LIBUV_BUILD_TESTS) test/test-tcp-oob.c test/test-tcp-open.c test/test-tcp-read-stop.c + test/test-tcp-read-stop-start.c test/test-tcp-shutdown-after-write.c test/test-tcp-try-write.c test/test-tcp-try-write-error.c @@ -482,6 +489,7 @@ if(LIBUV_BUILD_TESTS) test/test-tcp-write-queue-order.c test/test-tcp-write-to-half-open-connection.c test/test-tcp-writealot.c + test/test-test-macros.c test/test-thread-equal.c test/test-thread.c test/test-threadpool-cancel.c @@ -499,6 +507,7 @@ if(LIBUV_BUILD_TESTS) test/test-udp-create-socket-early.c test/test-udp-dgram-too-big.c test/test-udp-ipv6.c + test/test-udp-mmsg.c test/test-udp-multicast-interface.c test/test-udp-multicast-interface6.c test/test-udp-multicast-join.c @@ -541,7 +550,7 @@ if(LIBUV_BUILD_TESTS) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() -if(UNIX) +if(UNIX OR MINGW) # Now for some gibbering horrors from beyond the stars... foreach(lib IN LISTS uv_libraries) list(APPEND LIBS "-l${lib}") @@ -568,7 +577,7 @@ if(UNIX) install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -if(WIN32) +if(MSVC) install(DIRECTORY include/ DESTINATION include) install(FILES LICENSE DESTINATION .) install(TARGETS uv uv_a diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 7da3f9902efbf9..06509e7d15857d 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,79 @@ +2020.08.26, Version 1.39.0 (Stable), 25f4b8b8a3c0f934158cd37a37b0525d75ca488e + +Changes since version 1.38.1: + +* unix: use relaxed loads/stores for clock id (Ben Noordhuis) + +* build,win: link to user32.lib and advapi32.lib (George Zhao) + +* unix: squelch harmless valgrind warning (ssrlive) + +* include: fx c++ style comments warnings (Turbinya) + +* build,cmake: Change installation location on MinGW (erw7) + +* linux: use copy_file_range for uv_fs_copyfile when possible (Carter Li) + +* win,tcp: avoid reinserting a pending request ( + +* docs: improve the descriptions for get memory info (Juan Sebastian velez + Posada) + +* test: add udp-mmsg test (Ryan Liptak) + +* udp: add uv_udp_using_recvmmsg query (Ryan Liptak) + +* doc: add more error constants (TK-one) + +* zos: fix potential event loop stall (Trevor Norris) + +* include: add internal fields struct to uv_loop_t (Trevor Norris) + +* core: add API to measure event loop idle time (Trevor Norris) + +* win,fs: use CreateDirectoryW instead of _wmkdir (Mustafa M) + +* win,nfc: fix integer comparison signedness (escherstair) + +* win,nfc: use + +* win,nfc: removed some unused variables (escherstair) + +* win,nfc: add missing return statement (escherstair) + +* win,nfc: disable clang-format for + +* darwin: use IOKit for uv_cpu_info (Evan Lucas) + +* test: fix thread race in process_title_threadsafe (Ben Noordhuis) + +* win,fs: avoid implicit access to _doserrno (Jameson Nash) + +* test: give hrtime test a custom 20s timeout (Jameson Nash) + +* build: add more failed test, for qemu version bump (gengjiawen) + +* unix: handle src, dest same in uv_fs_copyfile() (cjihrig) + +* unix: error when uv_setup_args() is not called (Ryan Liptak) + +* aix: protect uv_exepath() from uv_set_process_title() (Richard Lau) + +* fs: clobber req->path on uv_fs_mkstemp() error (tjarlama) + +* cmake: fix compile error C2001 on Chinese Windows (司徒玟琅) + +* test: avoid double evaluation in ASSERT_BASE macro (tjarlama) + +* tcp: fail instantly if local port is unbound (Bartosz Sosnowski) + +* doc: fix most sphinx warnings (Jameson Nash) + +* nfci: address some style nits (Jameson Nash) + +* unix: don't use _POSIX_PATH_MAX (Ben Noordhuis) + + 2020.07.04, Version 1.38.1 (Stable), e8b989ea1f7f9d4083511a2caec7791e9abd1871 Changes since version 1.38.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 13f27bc4c443b4..46308eaae28ee4 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -203,6 +203,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-loop-stop.c \ test/test-loop-time.c \ test/test-loop-configure.c \ + test/test-metrics.c \ test/test-multiple-listen.c \ test/test-mutexes.c \ test/test-osx-select.c \ @@ -259,6 +260,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-tcp-flags.c \ test/test-tcp-open.c \ test/test-tcp-read-stop.c \ + test/test-tcp-read-stop-start.c \ test/test-tcp-shutdown-after-write.c \ test/test-tcp-unexpected-read.c \ test/test-tcp-oob.c \ @@ -269,6 +271,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-tcp-try-write.c \ test/test-tcp-try-write-error.c \ test/test-tcp-write-queue-order.c \ + test/test-test-macros.c \ test/test-thread-equal.c \ test/test-thread.c \ test/test-threadpool-cancel.c \ @@ -286,6 +289,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-udp-create-socket-early.c \ test/test-udp-dgram-too-big.c \ test/test-udp-ipv6.c \ + test/test-udp-mmsg.c \ test/test-udp-multicast-interface.c \ test/test-udp-multicast-interface6.c \ test/test-udp-multicast-join.c \ @@ -374,8 +378,7 @@ uvinclude_HEADERS += include/uv/posix.h libuv_la_SOURCES += src/unix/aix-common.c \ src/unix/ibmi.c \ src/unix/posix-poll.c \ - src/unix/no-fsevents.c \ - src/unix/no-proctitle.c + src/unix/no-fsevents.c endif if ANDROID diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index b39ba69e46ec89..8f5c89b1a99ffb 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.38.1], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.39.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff --git a/deps/uv/docs/src/api.rst b/deps/uv/docs/src/api.rst index 22f0640f549ec8..c8e837dd15fdfa 100644 --- a/deps/uv/docs/src/api.rst +++ b/deps/uv/docs/src/api.rst @@ -32,4 +32,5 @@ API documentation dll threading misc + metrics diff --git a/deps/uv/docs/src/async.rst b/deps/uv/docs/src/async.rst index bf611692f460a2..029c051cfcd0ef 100644 --- a/deps/uv/docs/src/async.rst +++ b/deps/uv/docs/src/async.rst @@ -51,7 +51,7 @@ API loop thread. .. note:: - :c:func:`uv_async_send` is `async-signal-safe `_. + :c:func:`uv_async_send` is `async-signal-safe `_. It's safe to call this function from a signal handler. .. warning:: diff --git a/deps/uv/docs/src/errors.rst b/deps/uv/docs/src/errors.rst index b8f971f5763511..c2daa8584eb9c3 100644 --- a/deps/uv/docs/src/errors.rst +++ b/deps/uv/docs/src/errors.rst @@ -319,11 +319,23 @@ Error constants too many links +.. c:macro:: UV_ENOTTY + + inappropriate ioctl for device + +.. c:macro:: UV_EFTYPE + + inappropriate file type or format + +.. c:macro:: UV_EILSEQ + + illegal byte sequence + API --- -.. c:function:: UV_ERRNO_MAP(iter_macro) +.. c:macro:: UV_ERRNO_MAP(iter_macro) Macro that expands to a series of invocations of `iter_macro` for each of the error constants above. `iter_macro` is invoked with two diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index 73666f3cd87c29..0bf2abed5e128a 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -58,7 +58,7 @@ Data types uv_timespec_t st_birthtim; } uv_stat_t; -.. c:type:: uv_fs_type +.. c:enum:: uv_fs_type File system request type. @@ -122,7 +122,7 @@ Data types uint64_t f_spare[4]; } uv_statfs_t; -.. c:type:: uv_dirent_t +.. c:enum:: uv_dirent_t Cross platform (reduced) equivalent of ``struct dirent``. Used in :c:func:`uv_fs_scandir_next`. @@ -535,8 +535,8 @@ Helper functions For a OS-dependent handle, get the file descriptor in the C runtime. On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle `_. - Note that the return value is still owned by the CRT, - any attempts to close it or to use it after closing the handle may lead to malfunction. + Note that this consumes the argument, any attempts to close it or to use it + after closing the return value may lead to malfunction. .. versionadded:: 1.23.0 diff --git a/deps/uv/docs/src/handle.rst b/deps/uv/docs/src/handle.rst index 943c51d94ba6c4..0edb7d7adf23ed 100644 --- a/deps/uv/docs/src/handle.rst +++ b/deps/uv/docs/src/handle.rst @@ -20,7 +20,7 @@ Data types The base libuv handle type. -.. c:type:: uv_handle_type +.. c:enum:: uv_handle_type The kind of the libuv handle. @@ -104,7 +104,7 @@ Public members API --- -.. c:function:: UV_HANDLE_TYPE_MAP(iter_macro) +.. c:macro:: UV_HANDLE_TYPE_MAP(iter_macro) Macro that expands to a series of invocations of `iter_macro` for each of the handle types. `iter_macro` is invoked with two diff --git a/deps/uv/docs/src/loop.rst b/deps/uv/docs/src/loop.rst index d642ac1d2f6ee8..f9ebb9d4a4f0c2 100644 --- a/deps/uv/docs/src/loop.rst +++ b/deps/uv/docs/src/loop.rst @@ -16,7 +16,7 @@ Data types Loop data type. -.. c:type:: uv_run_mode +.. c:enum:: uv_run_mode Mode used to run the loop with :c:func:`uv_run`. @@ -68,6 +68,11 @@ API to suppress unnecessary wakeups when using a sampling profiler. Requesting other signals will fail with UV_EINVAL. + - UV_METRICS_IDLE_TIME: Accumulate the amount of idle time the event loop + spends in the event provider. + + This option is necessary to use :c:func:`uv_metrics_idle_time`. + .. c:function:: int uv_loop_close(uv_loop_t* loop) Releases all internal loop resources. Call this function only when the loop diff --git a/deps/uv/docs/src/metrics.rst b/deps/uv/docs/src/metrics.rst new file mode 100644 index 00000000000000..223f7feb8fdfee --- /dev/null +++ b/deps/uv/docs/src/metrics.rst @@ -0,0 +1,25 @@ + +.. _metrics: + +Metrics operations +====================== + +libuv provides a metrics API to track the amount of time the event loop has +spent idle in the kernel's event provider. + +API +--- + +.. c:function:: uint64_t uv_metrics_idle_time(uv_loop_t* loop) + + Retrieve the amount of time the event loop has been idle in the kernel's + event provider (e.g. ``epoll_wait``). The call is thread safe. + + The return value is the accumulated time spent idle in the kernel's event + provider starting from when the :c:type:`uv_loop_t` was configured to + collect the idle time. + + .. note:: + The event loop will not begin accumulating the event provider's idle + time until calling :c:type:`uv_loop_configure` with + :c:type:`UV_METRICS_IDLE_TIME`. diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst index 906ca8ff75d345..b2725c399e431d 100644 --- a/deps/uv/docs/src/misc.rst +++ b/deps/uv/docs/src/misc.rst @@ -261,9 +261,9 @@ API .. c:function:: char** uv_setup_args(int argc, char** argv) - Store the program arguments. Required for getting / setting the process title. - Libuv may take ownership of the memory that `argv` points to. This function - should be called exactly once, at program start-up. + Store the program arguments. Required for getting / setting the process title + or the executable path. Libuv may take ownership of the memory that `argv` + points to. This function should be called exactly once, at program start-up. Example: @@ -275,22 +275,37 @@ API .. c:function:: int uv_get_process_title(char* buffer, size_t size) Gets the title of the current process. You *must* call `uv_setup_args` - before calling this function. If `buffer` is `NULL` or `size` is zero, - `UV_EINVAL` is returned. If `size` cannot accommodate the process title and - terminating `NULL` character, the function returns `UV_ENOBUFS`. + before calling this function on Unix and AIX systems. If `uv_setup_args` + has not been called on systems that require it, then `UV_ENOBUFS` is + returned. If `buffer` is `NULL` or `size` is zero, `UV_EINVAL` is returned. + If `size` cannot accommodate the process title and terminating `nul` + character, the function returns `UV_ENOBUFS`. + + .. note:: + On BSD systems, `uv_setup_args` is needed for getting the initial process + title. The process title returned will be an empty string until either + `uv_setup_args` or `uv_set_process_title` is called. .. versionchanged:: 1.18.1 now thread-safe on all supported platforms. + .. versionchanged:: 1.39.0 now returns an error if `uv_setup_args` is needed + but hasn't been called. + .. c:function:: int uv_set_process_title(const char* title) Sets the current process title. You *must* call `uv_setup_args` before - calling this function. On platforms with a fixed size buffer for the process - title the contents of `title` will be copied to the buffer and truncated if - larger than the available space. Other platforms will return `UV_ENOMEM` if - they cannot allocate enough space to duplicate the contents of `title`. + calling this function on Unix and AIX systems. If `uv_setup_args` has not + been called on systems that require it, then `UV_ENOBUFS` is returned. On + platforms with a fixed size buffer for the process title the contents of + `title` will be copied to the buffer and truncated if larger than the + available space. Other platforms will return `UV_ENOMEM` if they cannot + allocate enough space to duplicate the contents of `title`. .. versionchanged:: 1.18.1 now thread-safe on all supported platforms. + .. versionchanged:: 1.39.0 now returns an error if `uv_setup_args` is needed + but hasn't been called. + .. c:function:: int uv_resident_set_memory(size_t* rss) Gets the resident set size (RSS) for the current process. @@ -425,7 +440,8 @@ API .. c:function:: int uv_exepath(char* buffer, size_t* size) - Gets the executable path. + Gets the executable path. You *must* call `uv_setup_args` before calling + this function. .. c:function:: int uv_cwd(char* buffer, size_t* size) @@ -502,11 +518,11 @@ API .. c:function:: uint64_t uv_get_free_memory(void) - Gets memory information (in bytes). + Gets the amount of free memory available in the system, as reported by the kernel (in bytes). .. c:function:: uint64_t uv_get_total_memory(void) - Gets memory information (in bytes). + Gets the total amount of physical memory in the system (in bytes). .. c:function:: uint64_t uv_get_constrained_memory(void) diff --git a/deps/uv/docs/src/process.rst b/deps/uv/docs/src/process.rst index f2b3be219bf299..8ff19add57849f 100644 --- a/deps/uv/docs/src/process.rst +++ b/deps/uv/docs/src/process.rst @@ -102,7 +102,7 @@ Data types } data; } uv_stdio_container_t; -.. c:type:: uv_stdio_flags +.. c:enum:: uv_stdio_flags Flags specifying how a stdio should be transmitted to the child process. @@ -131,43 +131,43 @@ Data types Public members ^^^^^^^^^^^^^^ -.. c:member:: uv_process_t.pid +.. c:member:: int uv_process_t.pid The PID of the spawned process. It's set after calling :c:func:`uv_spawn`. .. note:: The :c:type:`uv_handle_t` members also apply. -.. c:member:: uv_process_options_t.exit_cb +.. c:member:: uv_exit_cb uv_process_options_t.exit_cb Callback called after the process exits. -.. c:member:: uv_process_options_t.file +.. c:member:: const char* uv_process_options_t.file Path pointing to the program to be executed. -.. c:member:: uv_process_options_t.args +.. c:member:: char** uv_process_options_t.args Command line arguments. args[0] should be the path to the program. On Windows this uses `CreateProcess` which concatenates the arguments into a string this can cause some strange errors. See the ``UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS`` flag on :c:type:`uv_process_flags`. -.. c:member:: uv_process_options_t.env +.. c:member:: char** uv_process_options_t.env Environment for the new process. If NULL the parents environment is used. -.. c:member:: uv_process_options_t.cwd +.. c:member:: const char* uv_process_options_t.cwd Current working directory for the subprocess. -.. c:member:: uv_process_options_t.flags +.. c:member:: unsigned int uv_process_options_t.flags Various flags that control how :c:func:`uv_spawn` behaves. See :c:type:`uv_process_flags`. -.. c:member:: uv_process_options_t.stdio_count -.. c:member:: uv_process_options_t.stdio +.. c:member:: int uv_process_options_t.stdio_count +.. c:member:: uv_stdio_container_t* uv_process_options_t.stdio The `stdio` field points to an array of :c:type:`uv_stdio_container_t` structs that describe the file descriptors that will be made available to @@ -178,8 +178,8 @@ Public members On Windows file descriptors greater than 2 are available to the child process only if the child processes uses the MSVCRT runtime. -.. c:member:: uv_process_options_t.uid -.. c:member:: uv_process_options_t.gid +.. c:member:: uv_uid_t uv_process_options_t.uid +.. c:member:: uv_gid_t uv_process_options_t.gid Libuv can change the child process' user/group id. This happens only when the appropriate bits are set in the flags fields. @@ -188,14 +188,13 @@ Public members This is not supported on Windows, :c:func:`uv_spawn` will fail and set the error to ``UV_ENOTSUP``. -.. c:member:: uv_stdio_container_t.flags +.. c:member:: uv_stdio_flags uv_stdio_container_t.flags - Flags specifying how the stdio container should be passed to the child. See - :c:type:`uv_stdio_flags`. + Flags specifying how the stdio container should be passed to the child. -.. c:member:: uv_stdio_container_t.data +.. c:member:: union @0 uv_stdio_container_t.data - Union containing either the stream or fd to be passed on to the child + Union containing either the `stream` or `fd` to be passed on to the child process. diff --git a/deps/uv/docs/src/request.rst b/deps/uv/docs/src/request.rst index 5807ccba4a748e..a0414431b0e092 100644 --- a/deps/uv/docs/src/request.rst +++ b/deps/uv/docs/src/request.rst @@ -53,7 +53,7 @@ Public members API --- -.. c:function:: UV_REQ_TYPE_MAP(iter_macro) +.. c:macro:: UV_REQ_TYPE_MAP(iter_macro) Macro that expands to a series of invocations of `iter_macro` for each of the request types. `iter_macro` is invoked with two diff --git a/deps/uv/docs/src/sphinx-plugins/manpage.py b/deps/uv/docs/src/sphinx-plugins/manpage.py index 672b0020bddb2c..6570aeaf33ebce 100644 --- a/deps/uv/docs/src/sphinx-plugins/manpage.py +++ b/deps/uv/docs/src/sphinx-plugins/manpage.py @@ -18,7 +18,7 @@ def make_link_node(rawtext, app, name, manpage_num, options): ref = app.config.man_url_regex if not ref: - ref = "http://man7.org/linux/man-pages/man%s/%s.%s.html" %(manpage_num, name, manpage_num) + ref = "https://man7.org/linux/man-pages/man%s/%s.%s.html" %(manpage_num, name, manpage_num) else: s = Template(ref) ref = s.substitute(num=manpage_num, topic=name) diff --git a/deps/uv/docs/src/tty.rst b/deps/uv/docs/src/tty.rst index ad379dab0dd001..f1acfdc1372940 100644 --- a/deps/uv/docs/src/tty.rst +++ b/deps/uv/docs/src/tty.rst @@ -16,7 +16,7 @@ Data types TTY handle type. -.. c:type:: uv_tty_mode_t +.. c:enum:: uv_tty_mode_t .. versionadded:: 1.2.0 @@ -33,7 +33,8 @@ Data types UV_TTY_MODE_IO } uv_tty_mode_t; -.. c:type:: uv_tty_vtermstate_t +.. c:enum:: uv_tty_vtermstate_t + Console virtual terminal mode type: :: diff --git a/deps/uv/docs/src/udp.rst b/deps/uv/docs/src/udp.rst index 6be20345280d90..aed7ce22716557 100644 --- a/deps/uv/docs/src/udp.rst +++ b/deps/uv/docs/src/udp.rst @@ -88,7 +88,7 @@ Data types nothing to read, and with `nread` == 0 and `addr` != NULL when an empty UDP packet is received. -.. c:type:: uv_membership +.. c:enum:: uv_membership Membership type for a multicast address. @@ -391,6 +391,16 @@ API .. versionchanged:: 1.37.0 :man:`recvmmsg(2)` support is no longer enabled implicitly, it must be explicitly requested by passing the `UV_UDP_RECVMMSG` flag to :c:func:`uv_udp_init_ex`. + .. versionchanged:: 1.39.0 :c:func:`uv_udp_using_recvmmsg` can be used in `alloc_cb` to + determine if a buffer sized for use with :man:`recvmmsg(2)` should be + allocated for the current handle/platform. + +.. c:function:: int uv_udp_using_recvmmsg(uv_udp_t* handle) + + Returns 1 if the UDP handle was created with the `UV_UDP_RECVMMSG` flag + and the platform supports :man:`recvmmsg(2)`, 0 otherwise. + + .. versionadded:: 1.39.0 .. c:function:: int uv_udp_recv_stop(uv_udp_t* handle) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index fec663136a4ff1..06b6d001040e04 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -247,7 +247,8 @@ typedef struct uv_utsname_s uv_utsname_t; typedef struct uv_statfs_s uv_statfs_t; typedef enum { - UV_LOOP_BLOCK_SIGNAL + UV_LOOP_BLOCK_SIGNAL = 0, + UV_METRICS_IDLE_TIME } uv_loop_option; typedef enum { @@ -693,6 +694,7 @@ UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb); +UV_EXTERN int uv_udp_using_recvmmsg(const uv_udp_t* handle); UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle); UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle); @@ -1191,12 +1193,12 @@ UV_EXTERN uv_pid_t uv_os_getppid(void); #if defined(__PASE__) /* On IBM i PASE, the highest process priority is -10 */ -# define UV_PRIORITY_LOW 39 // RUNPTY(99) -# define UV_PRIORITY_BELOW_NORMAL 15 // RUNPTY(50) -# define UV_PRIORITY_NORMAL 0 // RUNPTY(20) -# define UV_PRIORITY_ABOVE_NORMAL -4 // RUNTY(12) -# define UV_PRIORITY_HIGH -7 // RUNPTY(6) -# define UV_PRIORITY_HIGHEST -10 // RUNPTY(1) +# define UV_PRIORITY_LOW 39 /* RUNPTY(99) */ +# define UV_PRIORITY_BELOW_NORMAL 15 /* RUNPTY(50) */ +# define UV_PRIORITY_NORMAL 0 /* RUNPTY(20) */ +# define UV_PRIORITY_ABOVE_NORMAL -4 /* RUNTY(12) */ +# define UV_PRIORITY_HIGH -7 /* RUNPTY(6) */ +# define UV_PRIORITY_HIGHEST -10 /* RUNPTY(1) */ #else # define UV_PRIORITY_LOW 19 # define UV_PRIORITY_BELOW_NORMAL 10 @@ -1243,6 +1245,7 @@ UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); +UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop); typedef enum { UV_FS_UNKNOWN = -1, @@ -1774,9 +1777,11 @@ struct uv_loop_s { unsigned int active_handles; void* handle_queue[2]; union { - void* unused[2]; + void* unused; unsigned int count; } active_reqs; + /* Internal storage for future extensions. */ + void* internal_fields; /* Internal flag to signal loop stop. */ unsigned int stop_flag; UV_LOOP_PRIVATE_FIELDS diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index 16b0914c41ede4..3219e9637f4510 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 38 -#define UV_VERSION_PATCH 1 +#define UV_VERSION_MINOR 39 +#define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/src/strscpy.c b/deps/uv/src/strscpy.c index 2a2bdce7450113..20df6fcbed29e9 100644 --- a/deps/uv/src/strscpy.c +++ b/deps/uv/src/strscpy.c @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #include "strscpy.h" #include /* SSIZE_MAX */ diff --git a/deps/uv/src/strscpy.h b/deps/uv/src/strscpy.h index fbe0a393f20542..cc78149db5f4cb 100644 --- a/deps/uv/src/strscpy.h +++ b/deps/uv/src/strscpy.h @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #ifndef UV_STRSCPY_H_ #define UV_STRSCPY_H_ diff --git a/deps/uv/src/unix/aix-common.c b/deps/uv/src/unix/aix-common.c index c18a5298cec6a4..abc4c901a574dc 100644 --- a/deps/uv/src/unix/aix-common.c +++ b/deps/uv/src/unix/aix-common.c @@ -22,42 +22,23 @@ #include "uv.h" #include "internal.h" -#include #include #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include #include -#include -#include -#include - -#include #include -#include -#include -#include -#include -#include +extern char* original_exepath; +extern uv_mutex_t process_title_mutex; +extern uv_once_t process_title_mutex_once; +extern void init_process_title_mutex_once(void); uint64_t uv__hrtime(uv_clocktype_t type) { uint64_t G = 1000000000; @@ -78,80 +59,31 @@ uint64_t uv__hrtime(uv_clocktype_t type) { */ int uv_exepath(char* buffer, size_t* size) { int res; - char args[PATH_MAX]; - char abspath[PATH_MAX]; - size_t abspath_size; + char args[UV__PATH_MAX]; + size_t cached_len; struct procsinfo pi; if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL; - pi.pi_pid = getpid(); - res = getargs(&pi, sizeof(pi), args, sizeof(args)); - if (res < 0) - return UV_EINVAL; - - /* - * Possibilities for args: - * i) an absolute path such as: /home/user/myprojects/nodejs/node - * ii) a relative path such as: ./node or ../myprojects/nodejs/node - * iii) a bare filename such as "node", after exporting PATH variable - * to its location. - */ - - /* Case i) and ii) absolute or relative paths */ - if (strchr(args, '/') != NULL) { - if (realpath(args, abspath) != abspath) - return UV__ERR(errno); - - abspath_size = strlen(abspath); - + uv_once(&process_title_mutex_once, init_process_title_mutex_once); + uv_mutex_lock(&process_title_mutex); + if (original_exepath != NULL) { + cached_len = strlen(original_exepath); *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); + if (*size > cached_len) + *size = cached_len; + memcpy(buffer, original_exepath, *size); buffer[*size] = '\0'; - + uv_mutex_unlock(&process_title_mutex); return 0; - } else { - /* Case iii). Search PATH environment variable */ - char trypath[PATH_MAX]; - char *clonedpath = NULL; - char *token = NULL; - char *path = getenv("PATH"); - - if (path == NULL) - return UV_EINVAL; - - clonedpath = uv__strdup(path); - if (clonedpath == NULL) - return UV_ENOMEM; - - token = strtok(clonedpath, ":"); - while (token != NULL) { - snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); - if (realpath(trypath, abspath) == abspath) { - /* Check the match is executable */ - if (access(abspath, X_OK) == 0) { - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - uv__free(clonedpath); - return 0; - } - } - token = strtok(NULL, ":"); - } - uv__free(clonedpath); + } + uv_mutex_unlock(&process_title_mutex); + pi.pi_pid = getpid(); + res = getargs(&pi, sizeof(pi), args, sizeof(args)); - /* Out of tokens (path entries), and no match found */ + if (res < 0) return UV_EINVAL; - } + + return uv__search_path(args, buffer, size); } diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c index 6b4594b43e9777..6a013d43e3ae4b 100644 --- a/deps/uv/src/unix/aix.c +++ b/deps/uv/src/unix/aix.c @@ -65,14 +65,15 @@ #define RDWR_BUF_SIZE 4096 #define EQ(a,b) (strcmp(a,b) == 0) -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; +char* original_exepath = NULL; +uv_mutex_t process_title_mutex; +uv_once_t process_title_mutex_once = UV_ONCE_INIT; static void* args_mem = NULL; static char** process_argv = NULL; static int process_argc = 0; static char* process_title_ptr = NULL; -static void init_process_title_mutex_once(void) { +void init_process_title_mutex_once(void) { uv_mutex_init(&process_title_mutex); } @@ -145,6 +146,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int i; int rc; int add_failed; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -214,7 +217,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { base = loop->time; count = 48; /* Benchmarks suggest this gives the best throughput. */ + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + for (;;) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + nfds = pollset_poll(loop->backend_fd, events, ARRAY_SIZE(events), @@ -227,6 +244,15 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { SAVE_ERRNO(uv__update_time(loop)); if (nfds == 0) { + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + if (timeout == -1) + continue; + if (timeout > 0) + goto update_timeout; + } + assert(timeout != -1); return; } @@ -236,6 +262,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { abort(); } + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == -1) continue; @@ -280,16 +311,25 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* Run signal watchers last. This also affects child process watchers * because those are implemented in terms of signal watchers. */ - if (w == &loop->signal_io_watcher) + if (w == &loop->signal_io_watcher) { have_signals = 1; - else + } else { + uv__metrics_update_idle_time(loop); w->cb(loop, w, pe->revents); + } nevents++; } - if (have_signals != 0) + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (have_signals != 0) { + uv__metrics_update_idle_time(loop); loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + } loop->watchers[loop->nwatchers] = NULL; loop->watchers[loop->nwatchers + 1] = NULL; @@ -830,6 +870,7 @@ void uv__fs_event_close(uv_fs_event_t* handle) { char** uv_setup_args(int argc, char** argv) { + char exepath[UV__PATH_MAX]; char** new_argv; size_t size; char* s; @@ -845,6 +886,15 @@ char** uv_setup_args(int argc, char** argv) { process_argv = argv; process_argc = argc; + /* Use argv[0] to determine value for uv_exepath(). */ + size = sizeof(exepath); + if (uv__search_path(argv[0], exepath, &size) == 0) { + uv_once(&process_title_mutex_once, init_process_title_mutex_once); + uv_mutex_lock(&process_title_mutex); + original_exepath = uv__strdup(exepath); + uv_mutex_unlock(&process_title_mutex); + } + /* Calculate how much memory we need for the argv strings. */ size = 0; for (i = 0; i < argc; i++) @@ -875,6 +925,10 @@ char** uv_setup_args(int argc, char** argv) { int uv_set_process_title(const char* title) { char* new_title; + /* If uv_setup_args wasn't called or failed, we can't continue. */ + if (process_argv == NULL || args_mem == NULL) + return UV_ENOBUFS; + /* We cannot free this pointer when libuv shuts down, * the process may still be using it. */ @@ -908,6 +962,10 @@ int uv_get_process_title(char* buffer, size_t size) { if (buffer == NULL || size == 0) return UV_EINVAL; + /* If uv_setup_args wasn't called, we can't continue. */ + if (process_argv == NULL) + return UV_ENOBUFS; + uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index 5b0b64dd4b778f..1597828c868b38 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -383,6 +383,14 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) { timeout = uv_backend_timeout(loop); uv__io_poll(loop, timeout); + + /* Run one final update on the provider_idle_time in case uv__io_poll + * returned because the timeout expired, but no events were received. This + * call will be ignored if the provider_entry_time was either never set (if + * the timeout == 0) or was already updated b/c an event was received. + */ + uv__metrics_update_idle_time(loop); + uv__run_check(loop); uv__run_closing_handles(loop); @@ -1528,3 +1536,78 @@ void uv_sleep(unsigned int msec) { assert(rc == 0); } + +int uv__search_path(const char* prog, char* buf, size_t* buflen) { + char abspath[UV__PATH_MAX]; + size_t abspath_size; + char trypath[UV__PATH_MAX]; + char* cloned_path; + char* path_env; + char* token; + + if (buf == NULL || buflen == NULL || *buflen == 0) + return UV_EINVAL; + + /* + * Possibilities for prog: + * i) an absolute path such as: /home/user/myprojects/nodejs/node + * ii) a relative path such as: ./node or ../myprojects/nodejs/node + * iii) a bare filename such as "node", after exporting PATH variable + * to its location. + */ + + /* Case i) and ii) absolute or relative paths */ + if (strchr(prog, '/') != NULL) { + if (realpath(prog, abspath) != abspath) + return UV__ERR(errno); + + abspath_size = strlen(abspath); + + *buflen -= 1; + if (*buflen > abspath_size) + *buflen = abspath_size; + + memcpy(buf, abspath, *buflen); + buf[*buflen] = '\0'; + + return 0; + } + + /* Case iii). Search PATH environment variable */ + cloned_path = NULL; + token = NULL; + path_env = getenv("PATH"); + + if (path_env == NULL) + return UV_EINVAL; + + cloned_path = uv__strdup(path_env); + if (cloned_path == NULL) + return UV_ENOMEM; + + token = strtok(cloned_path, ":"); + while (token != NULL) { + snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, prog); + if (realpath(trypath, abspath) == abspath) { + /* Check the match is executable */ + if (access(abspath, X_OK) == 0) { + abspath_size = strlen(abspath); + + *buflen -= 1; + if (*buflen > abspath_size) + *buflen = abspath_size; + + memcpy(buf, abspath, *buflen); + buf[*buflen] = '\0'; + + uv__free(cloned_path); + return 0; + } + } + token = strtok(NULL, ":"); + } + uv__free(cloned_path); + + /* Out of tokens (path entries), and no match found */ + return UV_EINVAL; +} diff --git a/deps/uv/src/unix/darwin-stub.h b/deps/uv/src/unix/darwin-stub.h index b93cf67c596285..433e3efa73079e 100644 --- a/deps/uv/src/unix/darwin-stub.h +++ b/deps/uv/src/unix/darwin-stub.h @@ -27,6 +27,7 @@ struct CFArrayCallBacks; struct CFRunLoopSourceContext; struct FSEventStreamContext; +struct CFRange; typedef double CFAbsoluteTime; typedef double CFTimeInterval; @@ -42,13 +43,23 @@ typedef unsigned CFStringEncoding; typedef void* CFAllocatorRef; typedef void* CFArrayRef; typedef void* CFBundleRef; +typedef void* CFDataRef; typedef void* CFDictionaryRef; +typedef void* CFMutableDictionaryRef; +typedef struct CFRange CFRange; typedef void* CFRunLoopRef; typedef void* CFRunLoopSourceRef; typedef void* CFStringRef; typedef void* CFTypeRef; typedef void* FSEventStreamRef; +typedef uint32_t IOOptionBits; +typedef unsigned int io_iterator_t; +typedef unsigned int io_object_t; +typedef unsigned int io_service_t; +typedef unsigned int io_registry_entry_t; + + typedef void (*FSEventStreamCallback)(const FSEventStreamRef, void*, size_t, @@ -69,6 +80,11 @@ struct FSEventStreamContext { void* pad[3]; }; +struct CFRange { + CFIndex location; + CFIndex length; +}; + static const CFStringEncoding kCFStringEncodingUTF8 = 0x8000100; static const OSStatus noErr = 0; diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c index 4f53ad1fc7f190..d0ecd452d87c68 100644 --- a/deps/uv/src/unix/darwin.c +++ b/deps/uv/src/unix/darwin.c @@ -33,10 +33,15 @@ #include #include /* sysconf */ +#if !TARGET_OS_IPHONE +#include "darwin-stub.h" +#endif + static uv_once_t once = UV_ONCE_INIT; static uint64_t (*time_func)(void); static mach_timebase_info_data_t timebase; +typedef unsigned char UInt8; int uv__platform_loop_init(uv_loop_t* loop) { loop->cf_state = NULL; @@ -180,17 +185,149 @@ int uv_uptime(double* uptime) { return 0; } +static int uv__get_cpu_speed(uint64_t* speed) { + /* IOKit */ + void (*pIOObjectRelease)(io_object_t); + kern_return_t (*pIOMasterPort)(mach_port_t, mach_port_t*); + CFMutableDictionaryRef (*pIOServiceMatching)(const char*); + kern_return_t (*pIOServiceGetMatchingServices)(mach_port_t, + CFMutableDictionaryRef, + io_iterator_t*); + io_service_t (*pIOIteratorNext)(io_iterator_t); + CFTypeRef (*pIORegistryEntryCreateCFProperty)(io_registry_entry_t, + CFStringRef, + CFAllocatorRef, + IOOptionBits); + + /* CoreFoundation */ + CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, + const char*, + CFStringEncoding); + CFStringEncoding (*pCFStringGetSystemEncoding)(void); + UInt8 *(*pCFDataGetBytePtr)(CFDataRef); + CFIndex (*pCFDataGetLength)(CFDataRef); + void (*pCFDataGetBytes)(CFDataRef, CFRange, UInt8*); + void (*pCFRelease)(CFTypeRef); + + void* core_foundation_handle; + void* iokit_handle; + int err; + + kern_return_t kr; + mach_port_t mach_port; + io_iterator_t it; + io_object_t service; + + mach_port = 0; + + err = UV_ENOENT; + core_foundation_handle = dlopen("/System/Library/Frameworks/" + "CoreFoundation.framework/" + "Versions/A/CoreFoundation", + RTLD_LAZY | RTLD_LOCAL); + iokit_handle = dlopen("/System/Library/Frameworks/IOKit.framework/" + "Versions/A/IOKit", + RTLD_LAZY | RTLD_LOCAL); + + if (core_foundation_handle == NULL || iokit_handle == NULL) + goto out; + +#define V(handle, symbol) \ + do { \ + *(void **)(&p ## symbol) = dlsym((handle), #symbol); \ + if (p ## symbol == NULL) \ + goto out; \ + } \ + while (0) + V(iokit_handle, IOMasterPort); + V(iokit_handle, IOServiceMatching); + V(iokit_handle, IOServiceGetMatchingServices); + V(iokit_handle, IOIteratorNext); + V(iokit_handle, IOObjectRelease); + V(iokit_handle, IORegistryEntryCreateCFProperty); + V(core_foundation_handle, CFStringCreateWithCString); + V(core_foundation_handle, CFStringGetSystemEncoding); + V(core_foundation_handle, CFDataGetBytePtr); + V(core_foundation_handle, CFDataGetLength); + V(core_foundation_handle, CFDataGetBytes); + V(core_foundation_handle, CFRelease); +#undef V + +#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) + + kr = pIOMasterPort(MACH_PORT_NULL, &mach_port); + assert(kr == KERN_SUCCESS); + CFMutableDictionaryRef classes_to_match + = pIOServiceMatching("IOPlatformDevice"); + kr = pIOServiceGetMatchingServices(mach_port, classes_to_match, &it); + assert(kr == KERN_SUCCESS); + service = pIOIteratorNext(it); + + CFStringRef device_type_str = S("device_type"); + CFStringRef clock_frequency_str = S("clock-frequency"); + + while (service != 0) { + CFDataRef data; + data = pIORegistryEntryCreateCFProperty(service, + device_type_str, + NULL, + 0); + if (data) { + const UInt8* raw = pCFDataGetBytePtr(data); + if (strncmp((char*)raw, "cpu", 3) == 0 || + strncmp((char*)raw, "processor", 9) == 0) { + CFDataRef freq_ref; + freq_ref = pIORegistryEntryCreateCFProperty(service, + clock_frequency_str, + NULL, + 0); + if (freq_ref) { + uint32_t freq; + CFIndex len = pCFDataGetLength(freq_ref); + CFRange range; + range.location = 0; + range.length = len; + + pCFDataGetBytes(freq_ref, range, (UInt8*)&freq); + *speed = freq; + pCFRelease(freq_ref); + pCFRelease(data); + break; + } + } + pCFRelease(data); + } + + service = pIOIteratorNext(it); + } + + pIOObjectRelease(it); + + err = 0; +out: + if (core_foundation_handle != NULL) + dlclose(core_foundation_handle); + + if (iokit_handle != NULL) + dlclose(iokit_handle); + + mach_port_deallocate(mach_task_self(), mach_port); + + return err; +} + int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), multiplier = ((uint64_t)1000L / ticks); char model[512]; - uint64_t cpuspeed; size_t size; unsigned int i; natural_t numcpus; mach_msg_type_number_t msg_type; processor_cpu_load_info_data_t *info; uv_cpu_info_t* cpu_info; + uint64_t cpuspeed; + int err; size = sizeof(model); if (sysctlbyname("machdep.cpu.brand_string", &model, &size, NULL, 0) && @@ -198,9 +335,9 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { return UV__ERR(errno); } - size = sizeof(cpuspeed); - if (sysctlbyname("hw.cpufrequency", &cpuspeed, &size, NULL, 0)) - return UV__ERR(errno); + err = uv__get_cpu_speed(&cpuspeed); + if (err < 0) + return err; if (host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numcpus, (processor_info_array_t*)&info, diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index dd08ea541763f1..87cb8b816aea39 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -306,7 +306,8 @@ static int uv__fs_mkstemp(uv_fs_t* req) { if (path_length < pattern_size || strcmp(path + path_length - pattern_size, pattern)) { errno = EINVAL; - return -1; + r = -1; + goto clobber; } uv_once(&once, uv__mkostemp_initonce); @@ -321,7 +322,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { /* If mkostemp() returns EINVAL, it means the kernel doesn't support O_CLOEXEC, so we just fallback to mkstemp() below. */ if (errno != EINVAL) - return r; + goto clobber; /* We set the static variable so that next calls don't even try to use mkostemp. */ @@ -347,6 +348,9 @@ static int uv__fs_mkstemp(uv_fs_t* req) { if (req->cb != NULL) uv_rwlock_rdunlock(&req->loop->cloexec_lock); +clobber: + if (r < 0) + path[0] = '\0'; return r; } @@ -883,8 +887,27 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { ssize_t r; off = req->off; + +#ifdef __linux__ + { + static int copy_file_range_support = 1; + + if (copy_file_range_support) { + r = uv__fs_copy_file_range(in_fd, NULL, out_fd, &off, req->bufsml[0].len, 0); + + if (r == -1 && errno == ENOSYS) { + errno = 0; + copy_file_range_support = 0; + } else { + goto ok; + } + } + } +#endif + r = sendfile(out_fd, in_fd, &off, req->bufsml[0].len); +ok: /* sendfile() on SunOS returns EINVAL if the target fd is not a socket but * it still writes out data. Fortunately, we can detect it by checking if * the offset has been updated. @@ -1127,7 +1150,7 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { goto out; } - dst_flags = O_WRONLY | O_CREAT | O_TRUNC; + dst_flags = O_WRONLY | O_CREAT; if (req->flags & UV_FS_COPYFILE_EXCL) dst_flags |= O_EXCL; @@ -1146,16 +1169,26 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { goto out; } - /* Get the destination file's mode. */ - if (fstat(dstfd, &dst_statsbuf)) { - err = UV__ERR(errno); - goto out; - } + /* If the file is not being opened exclusively, verify that the source and + destination are not the same file. If they are the same, bail out early. */ + if ((req->flags & UV_FS_COPYFILE_EXCL) == 0) { + /* Get the destination file's mode. */ + if (fstat(dstfd, &dst_statsbuf)) { + err = UV__ERR(errno); + goto out; + } - /* Check if srcfd and dstfd refer to the same file */ - if (src_statsbuf.st_dev == dst_statsbuf.st_dev && - src_statsbuf.st_ino == dst_statsbuf.st_ino) { - goto out; + /* Check if srcfd and dstfd refer to the same file */ + if (src_statsbuf.st_dev == dst_statsbuf.st_dev && + src_statsbuf.st_ino == dst_statsbuf.st_ino) { + goto out; + } + + /* Truncate the file in case the destination already existed. */ + if (ftruncate(dstfd, 0) != 0) { + err = UV__ERR(errno); + goto out; + } } if (fchmod(dstfd, src_statsbuf.st_mode) == -1) { @@ -2027,7 +2060,7 @@ void uv_fs_req_cleanup(uv_fs_t* req) { /* Only necessary for asychronous requests, i.e., requests with a callback. * Synchronous ones don't copy their arguments and have req->path and - * req->new_path pointing to user-owned memory. UV_FS_MKDTEMP and + * req->new_path pointing to user-owned memory. UV_FS_MKDTEMP and * UV_FS_MKSTEMP are the exception to the rule, they always allocate memory. */ if (req->path != NULL && diff --git a/deps/uv/src/unix/ibmi.c b/deps/uv/src/unix/ibmi.c index ff300ea5f8f79f..96efc02bad6071 100644 --- a/deps/uv/src/unix/ibmi.c +++ b/deps/uv/src/unix/ibmi.c @@ -58,6 +58,9 @@ #include #include +char* original_exepath = NULL; +uv_mutex_t process_title_mutex; +uv_once_t process_title_mutex_once = UV_ONCE_INIT; typedef struct { int bytes_available; @@ -171,6 +174,9 @@ static void iconv_a2e(const char* src, unsigned char dst[], size_t length) { dst[i] = a2e[' ']; } +void init_process_title_mutex_once(void) { + uv_mutex_init(&process_title_mutex); +} static int get_ibmi_system_status(SSTS0200* rcvr) { /* rcvrlen is input parameter 2 to QWCRSSTS */ @@ -459,3 +465,37 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses, int count) { uv__free(addresses); } + +char** uv_setup_args(int argc, char** argv) { + char exepath[UV__PATH_MAX]; + char* s; + size_t size; + + if (argc > 0) { + /* Use argv[0] to determine value for uv_exepath(). */ + size = sizeof(exepath); + if (uv__search_path(argv[0], exepath, &size) == 0) { + uv_once(&process_title_mutex_once, init_process_title_mutex_once); + uv_mutex_lock(&process_title_mutex); + original_exepath = uv__strdup(exepath); + uv_mutex_unlock(&process_title_mutex); + } + } + + return argv; +} + +int uv_set_process_title(const char* title) { + return 0; +} + +int uv_get_process_title(char* buffer, size_t size) { + if (buffer == NULL || size == 0) + return UV_EINVAL; + + buffer[0] = '\0'; + return 0; +} + +void uv__process_title_cleanup(void) { +} \ No newline at end of file diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 402ee877d076b6..9d3c2297f8d764 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -62,9 +62,7 @@ # include #endif -#if defined(_POSIX_PATH_MAX) -# define UV__PATH_MAX _POSIX_PATH_MAX -#elif defined(PATH_MAX) +#if defined(PATH_MAX) # define UV__PATH_MAX PATH_MAX #else # define UV__PATH_MAX 8192 @@ -268,6 +266,7 @@ void uv__udp_finish_close(uv_udp_t* handle); uv_handle_type uv__handle_type(int fd); FILE* uv__open_file(const char* path); int uv__getpwuid_r(uv_passwd_t* pwd); +int uv__search_path(const char* prog, char* buf, size_t* buflen); /* random */ int uv__random_devurandom(void* buf, size_t buflen); diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c index 27a0d3df5e3176..bf183d5fdc0ba8 100644 --- a/deps/uv/src/unix/kqueue.c +++ b/deps/uv/src/unix/kqueue.c @@ -129,6 +129,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int fd; int op; int i; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -202,7 +204,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { base = loop->time; count = 48; /* Benchmarks suggest this gives the best throughput. */ + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + for (;; nevents = 0) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + if (timeout != -1) { spec.tv_sec = timeout / 1000; spec.tv_nsec = (timeout % 1000) * 1000000; @@ -228,6 +244,15 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { SAVE_ERRNO(uv__update_time(loop)); if (nfds == 0) { + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + if (timeout == -1) + continue; + if (timeout > 0) + goto update_timeout; + } + assert(timeout != -1); return; } @@ -236,6 +261,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (errno != EINTR) abort(); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == 0) return; @@ -276,6 +306,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (ev->filter == EVFILT_VNODE) { assert(w->events == POLLIN); assert(w->pevents == POLLIN); + uv__metrics_update_idle_time(loop); w->cb(loop, w, ev->fflags); /* XXX always uv__fs_event() */ nevents++; continue; @@ -337,16 +368,25 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* Run signal watchers last. This also affects child process watchers * because those are implemented in terms of signal watchers. */ - if (w == &loop->signal_io_watcher) + if (w == &loop->signal_io_watcher) { have_signals = 1; - else + } else { + uv__metrics_update_idle_time(loop); w->cb(loop, w, revents); + } nevents++; } - if (have_signals != 0) + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (have_signals != 0) { + uv__metrics_update_idle_time(loop); loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + } loop->watchers[loop->nwatchers] = NULL; loop->watchers[loop->nwatchers + 1] = NULL; diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 80ca75eea3d678..14d5f0c04a93bc 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -218,6 +218,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int fd; int op; int i; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -273,6 +275,14 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { count = 48; /* Benchmarks suggest this gives the best throughput. */ real_timeout = timeout; + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + /* You could argue there is a dependency between these two but * ultimately we don't care about their ordering with respect * to one another. Worst case, we make a few system calls that @@ -283,6 +293,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { no_epoll_wait = uv__load_relaxed(&no_epoll_wait_cached); for (;;) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + /* See the comment for max_safe_timeout for an explanation of why * this is necessary. Executive summary: kernel bug workaround. */ @@ -327,6 +343,14 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (nfds == 0) { assert(timeout != -1); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (timeout == -1) + continue; + if (timeout == 0) return; @@ -346,6 +370,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (errno != EINTR) abort(); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == -1) continue; @@ -425,17 +454,26 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* Run signal watchers last. This also affects child process watchers * because those are implemented in terms of signal watchers. */ - if (w == &loop->signal_io_watcher) + if (w == &loop->signal_io_watcher) { have_signals = 1; - else + } else { + uv__metrics_update_idle_time(loop); w->cb(loop, w, pe->events); + } nevents++; } } - if (have_signals != 0) + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (have_signals != 0) { + uv__metrics_update_idle_time(loop); loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + } loop->watchers[loop->nwatchers] = NULL; loop->watchers[loop->nwatchers + 1] = NULL; @@ -483,18 +521,22 @@ uint64_t uv__hrtime(uv_clocktype_t type) { /* TODO(bnoordhuis) Use CLOCK_MONOTONIC_COARSE for UV_CLOCK_PRECISE * when it has microsecond granularity or better (unlikely). */ - if (type == UV_CLOCK_FAST && fast_clock_id == -1) { - if (clock_getres(CLOCK_MONOTONIC_COARSE, &t) == 0 && - t.tv_nsec <= 1 * 1000 * 1000) { - fast_clock_id = CLOCK_MONOTONIC_COARSE; - } else { - fast_clock_id = CLOCK_MONOTONIC; - } - } + clock_id = CLOCK_MONOTONIC; + if (type != UV_CLOCK_FAST) + goto done; + + clock_id = uv__load_relaxed(&fast_clock_id); + if (clock_id != -1) + goto done; clock_id = CLOCK_MONOTONIC; - if (type == UV_CLOCK_FAST) - clock_id = fast_clock_id; + if (0 == clock_getres(CLOCK_MONOTONIC_COARSE, &t)) + if (t.tv_nsec <= 1 * 1000 * 1000) + clock_id = CLOCK_MONOTONIC_COARSE; + + uv__store_relaxed(&fast_clock_id, clock_id); + +done: if (clock_gettime(clock_id, &t)) return 0; /* Not really possible. */ diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c index 742f26ada8218c..160056b46ec383 100644 --- a/deps/uv/src/unix/linux-syscalls.c +++ b/deps/uv/src/unix/linux-syscalls.c @@ -94,6 +94,24 @@ # endif #endif /* __NR_pwritev */ +#ifndef __NR_copy_file_range +# if defined(__x86_64__) +# define __NR_copy_file_range 326 +# elif defined(__i386__) +# define __NR_copy_file_range 377 +# elif defined(__s390__) +# define __NR_copy_file_range 375 +# elif defined(__arm__) +# define __NR_copy_file_range (UV_SYSCALL_BASE + 391) +# elif defined(__aarch64__) +# define __NR_copy_file_range 285 +# elif defined(__powerpc__) +# define __NR_copy_file_range 379 +# elif defined(__arc__) +# define __NR_copy_file_range 285 +# endif +#endif /* __NR_copy_file_range */ + #ifndef __NR_statx # if defined(__x86_64__) # define __NR_statx 332 @@ -180,6 +198,28 @@ int uv__dup3(int oldfd, int newfd, int flags) { } +ssize_t +uv__fs_copy_file_range(int fd_in, + ssize_t* off_in, + int fd_out, + ssize_t* off_out, + size_t len, + unsigned int flags) +{ +#ifdef __NR_copy_file_range + return syscall(__NR_copy_file_range, + fd_in, + off_in, + fd_out, + off_out, + len, + flags); +#else + return errno = ENOSYS, -1; +#endif +} + + int uv__statx(int dirfd, const char* path, int flags, diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h index 2e8fa2a51979c6..761ff32e21bc53 100644 --- a/deps/uv/src/unix/linux-syscalls.h +++ b/deps/uv/src/unix/linux-syscalls.h @@ -64,6 +64,13 @@ struct uv__statx { ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset); ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset); int uv__dup3(int oldfd, int newfd, int flags); +ssize_t +uv__fs_copy_file_range(int fd_in, + ssize_t* off_in, + int fd_out, + ssize_t* off_out, + size_t len, + unsigned int flags); int uv__statx(int dirfd, const char* path, int flags, diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c index e5b2889560a516..a88e71c339351f 100644 --- a/deps/uv/src/unix/loop.c +++ b/deps/uv/src/unix/loop.c @@ -28,6 +28,7 @@ #include int uv_loop_init(uv_loop_t* loop) { + uv__loop_internal_fields_t* lfields; void* saved_data; int err; @@ -36,6 +37,15 @@ int uv_loop_init(uv_loop_t* loop) { memset(loop, 0, sizeof(*loop)); loop->data = saved_data; + lfields = (uv__loop_internal_fields_t*) uv__calloc(1, sizeof(*lfields)); + if (lfields == NULL) + return UV_ENOMEM; + loop->internal_fields = lfields; + + err = uv_mutex_init(&lfields->loop_metrics.lock); + if (err) + goto fail_metrics_mutex_init; + heap_init((struct heap*) &loop->timer_heap); QUEUE_INIT(&loop->wq); QUEUE_INIT(&loop->idle_handles); @@ -66,7 +76,7 @@ int uv_loop_init(uv_loop_t* loop) { err = uv__platform_loop_init(loop); if (err) - return err; + goto fail_platform_init; uv__signal_global_once_init(); err = uv_signal_init(loop, &loop->child_watcher); @@ -106,6 +116,13 @@ int uv_loop_init(uv_loop_t* loop) { fail_signal_init: uv__platform_loop_delete(loop); +fail_platform_init: + uv_mutex_destroy(&lfields->loop_metrics.lock); + +fail_metrics_mutex_init: + uv__free(lfields); + loop->internal_fields = NULL; + uv__free(loop->watchers); loop->nwatchers = 0; return err; @@ -146,6 +163,8 @@ int uv_loop_fork(uv_loop_t* loop) { void uv__loop_close(uv_loop_t* loop) { + uv__loop_internal_fields_t* lfields; + uv__signal_loop_cleanup(loop); uv__platform_loop_delete(loop); uv__async_stop(loop); @@ -181,10 +200,23 @@ void uv__loop_close(uv_loop_t* loop) { uv__free(loop->watchers); loop->watchers = NULL; loop->nwatchers = 0; + + lfields = uv__get_internal_fields(loop); + uv_mutex_destroy(&lfields->loop_metrics.lock); + uv__free(lfields); + loop->internal_fields = NULL; } int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { + uv__loop_internal_fields_t* lfields; + + lfields = uv__get_internal_fields(loop); + if (option == UV_METRICS_IDLE_TIME) { + lfields->flags |= UV_METRICS_IDLE_TIME; + return 0; + } + if (option != UV_LOOP_BLOCK_SIGNAL) return UV_ENOSYS; diff --git a/deps/uv/src/unix/os390.c b/deps/uv/src/unix/os390.c index dce169b9fb4268..3bb44266d93cc1 100644 --- a/deps/uv/src/unix/os390.c +++ b/deps/uv/src/unix/os390.c @@ -254,8 +254,6 @@ static int getexe(const int pid, char* buf, size_t len) { int uv_exepath(char* buffer, size_t* size) { int res; char args[PATH_MAX]; - char abspath[PATH_MAX]; - size_t abspath_size; int pid; if (buffer == NULL || size == NULL || *size == 0) @@ -266,69 +264,7 @@ int uv_exepath(char* buffer, size_t* size) { if (res < 0) return UV_EINVAL; - /* - * Possibilities for args: - * i) an absolute path such as: /home/user/myprojects/nodejs/node - * ii) a relative path such as: ./node or ../myprojects/nodejs/node - * iii) a bare filename such as "node", after exporting PATH variable - * to its location. - */ - - /* Case i) and ii) absolute or relative paths */ - if (strchr(args, '/') != NULL) { - if (realpath(args, abspath) != abspath) - return UV__ERR(errno); - - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - return 0; - } else { - /* Case iii). Search PATH environment variable */ - char trypath[PATH_MAX]; - char* clonedpath = NULL; - char* token = NULL; - char* path = getenv("PATH"); - - if (path == NULL) - return UV_EINVAL; - - clonedpath = uv__strdup(path); - if (clonedpath == NULL) - return UV_ENOMEM; - - token = strtok(clonedpath, ":"); - while (token != NULL) { - snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); - if (realpath(trypath, abspath) == abspath) { - /* Check the match is executable */ - if (access(abspath, X_OK) == 0) { - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - uv__free(clonedpath); - return 0; - } - } - token = strtok(NULL, ":"); - } - uv__free(clonedpath); - - /* Out of tokens (path entries), and no match found */ - return UV_EINVAL; - } + return uv__search_path(args, buffer, size); } @@ -818,6 +754,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int fd; int op; int i; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -870,8 +808,22 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { real_timeout = timeout; int nevents = 0; + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + nfds = 0; for (;;) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout) timeout = max_safe_timeout; @@ -887,12 +839,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (nfds == 0) { assert(timeout != -1); - if (timeout > 0) { - timeout = real_timeout - timeout; - continue; + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; } - return; + if (timeout == -1) + continue; + + if (timeout == 0) + return; + + /* We may have been inside the system call for longer than |timeout| + * milliseconds so we need to update the timestamp to avoid drift. + */ + goto update_timeout; } if (nfds == -1) { @@ -900,6 +861,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (errno != EINTR) abort(); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == -1) continue; @@ -954,6 +920,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { pe->events |= w->pevents & (POLLIN | POLLOUT); if (pe->events != 0) { + uv__metrics_update_idle_time(loop); w->cb(loop, w, pe->events); nevents++; } @@ -961,6 +928,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { loop->watchers[loop->nwatchers] = NULL; loop->watchers[loop->nwatchers + 1] = NULL; + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (nevents != 0) { if (nfds == ARRAY_SIZE(events) && --count != 0) { /* Poll for more events but don't block this time. */ diff --git a/deps/uv/src/unix/posix-poll.c b/deps/uv/src/unix/posix-poll.c index 766e83205d053f..0f4bf93874be89 100644 --- a/deps/uv/src/unix/posix-poll.c +++ b/deps/uv/src/unix/posix-poll.c @@ -144,6 +144,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int have_signals; struct pollfd* pe; int fd; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -177,11 +179,25 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { assert(timeout >= -1); time_base = loop->time; + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + /* Loop calls to poll() and processing of results. If we get some * results from poll() but they turn out not to be interesting to * our caller then we need to loop around and poll() again. */ for (;;) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + if (pset != NULL) if (pthread_sigmask(SIG_BLOCK, pset, NULL)) abort(); @@ -197,6 +213,15 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { SAVE_ERRNO(uv__update_time(loop)); if (nfds == 0) { + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + if (timeout == -1) + continue; + if (timeout > 0) + goto update_timeout; + } + assert(timeout != -1); return; } @@ -205,6 +230,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (errno != EINTR) abort(); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == -1) continue; @@ -254,6 +284,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (w == &loop->signal_io_watcher) { have_signals = 1; } else { + uv__metrics_update_idle_time(loop); w->cb(loop, w, pe->revents); } @@ -261,8 +292,15 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { } } - if (have_signals != 0) + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (have_signals != 0) { + uv__metrics_update_idle_time(loop); loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + } loop->poll_fds_iterating = 0; diff --git a/deps/uv/src/unix/proctitle.c b/deps/uv/src/unix/proctitle.c index 4ee991fcc32466..9ffe5b629c2554 100644 --- a/deps/uv/src/unix/proctitle.c +++ b/deps/uv/src/unix/proctitle.c @@ -100,6 +100,10 @@ int uv_set_process_title(const char* title) { struct uv__process_title* pt; size_t len; + /* If uv_setup_args wasn't called or failed, we can't continue. */ + if (args_mem == NULL) + return UV_ENOBUFS; + pt = &process_title; len = strlen(title); @@ -126,6 +130,10 @@ int uv_get_process_title(char* buffer, size_t size) { if (buffer == NULL || size == 0) return UV_EINVAL; + /* If uv_setup_args wasn't called or failed, we can't continue. */ + if (args_mem == NULL) + return UV_ENOBUFS; + uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c index 1c83e095bcdead..f40a3e54ebb74e 100644 --- a/deps/uv/src/unix/signal.c +++ b/deps/uv/src/unix/signal.c @@ -143,6 +143,8 @@ static void uv__signal_block_and_lock(sigset_t* saved_sigmask) { if (sigfillset(&new_mask)) abort(); + /* to shut up valgrind */ + sigemptyset(saved_sigmask); if (pthread_sigmask(SIG_SETMASK, &new_mask, saved_sigmask)) abort(); diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c index 180cc84651db37..d511c18b85e8ee 100644 --- a/deps/uv/src/unix/sunos.c +++ b/deps/uv/src/unix/sunos.c @@ -154,6 +154,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { sigset_t set; uint64_t base; uint64_t diff; + uint64_t idle_poll; unsigned int nfds; unsigned int i; int saved_errno; @@ -162,6 +163,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { int count; int err; int fd; + int user_timeout; + int reset_timeout; if (loop->nfds == 0) { assert(QUEUE_EMPTY(&loop->watcher_queue)); @@ -199,7 +202,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { base = loop->time; count = 48; /* Benchmarks suggest this gives the best throughput. */ + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + for (;;) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + if (timeout != -1) { spec.tv_sec = timeout / 1000; spec.tv_nsec = (timeout % 1000) * 1000000; @@ -242,6 +259,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { SAVE_ERRNO(uv__update_time(loop)); if (events[0].portev_source == 0) { + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + if (timeout == 0) return; @@ -282,10 +304,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* Run signal watchers last. This also affects child process watchers * because those are implemented in terms of signal watchers. */ - if (w == &loop->signal_io_watcher) + if (w == &loop->signal_io_watcher) { have_signals = 1; - else + } else { + uv__metrics_update_idle_time(loop); w->cb(loop, w, pe->portev_events); + } nevents++; @@ -297,8 +321,15 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); } - if (have_signals != 0) + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + if (have_signals != 0) { + uv__metrics_update_idle_time(loop); loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + } loop->watchers[loop->nwatchers] = NULL; loop->watchers[loop->nwatchers + 1] = NULL; diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c index 508c619fa84310..16c7f38ae82473 100644 --- a/deps/uv/src/unix/udp.c +++ b/deps/uv/src/unix/udp.c @@ -270,14 +270,11 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { assert(buf.base != NULL); #if HAVE_MMSG - if (handle->flags & UV_HANDLE_UDP_RECVMMSG) { - uv_once(&once, uv__udp_mmsg_init); - if (uv__recvmmsg_avail) { - nread = uv__udp_recvmmsg(handle, &buf); - if (nread > 0) - count -= nread; - continue; - } + if (uv_udp_using_recvmmsg(handle)) { + nread = uv__udp_recvmmsg(handle, &buf); + if (nread > 0) + count -= nread; + continue; } #endif @@ -976,6 +973,17 @@ int uv__udp_init_ex(uv_loop_t* loop, } +int uv_udp_using_recvmmsg(const uv_udp_t* handle) { +#if HAVE_MMSG + if (handle->flags & UV_HANDLE_UDP_RECVMMSG) { + uv_once(&once, uv__udp_mmsg_init); + return uv__recvmmsg_avail; + } +#endif + return 0; +} + + int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { int err; diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 0cfb921e697447..602e5f492fd2be 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -867,3 +867,62 @@ void uv_library_shutdown(void) { uv__threadpool_cleanup(); uv__store_relaxed(&was_shutdown, 1); } + + +void uv__metrics_update_idle_time(uv_loop_t* loop) { + uv__loop_metrics_t* loop_metrics; + uint64_t entry_time; + uint64_t exit_time; + + if (!(uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME)) + return; + + loop_metrics = uv__get_loop_metrics(loop); + + /* The thread running uv__metrics_update_idle_time() is always the same + * thread that sets provider_entry_time. So it's unnecessary to lock before + * retrieving this value. + */ + if (loop_metrics->provider_entry_time == 0) + return; + + exit_time = uv_hrtime(); + + uv_mutex_lock(&loop_metrics->lock); + entry_time = loop_metrics->provider_entry_time; + loop_metrics->provider_entry_time = 0; + loop_metrics->provider_idle_time += exit_time - entry_time; + uv_mutex_unlock(&loop_metrics->lock); +} + + +void uv__metrics_set_provider_entry_time(uv_loop_t* loop) { + uv__loop_metrics_t* loop_metrics; + uint64_t now; + + if (!(uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME)) + return; + + now = uv_hrtime(); + loop_metrics = uv__get_loop_metrics(loop); + uv_mutex_lock(&loop_metrics->lock); + loop_metrics->provider_entry_time = now; + uv_mutex_unlock(&loop_metrics->lock); +} + + +uint64_t uv_metrics_idle_time(uv_loop_t* loop) { + uv__loop_metrics_t* loop_metrics; + uint64_t entry_time; + uint64_t idle_time; + + loop_metrics = uv__get_loop_metrics(loop); + uv_mutex_lock(&loop_metrics->lock); + idle_time = loop_metrics->provider_idle_time; + entry_time = loop_metrics->provider_entry_time; + uv_mutex_unlock(&loop_metrics->lock); + + if (entry_time > 0) + idle_time += uv_hrtime() - entry_time; + return idle_time; +} diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h index 063588eac97773..e851291cc06e01 100644 --- a/deps/uv/src/uv-common.h +++ b/deps/uv/src/uv-common.h @@ -333,6 +333,12 @@ void uv__threadpool_cleanup(void); } \ while (0) +#define uv__get_internal_fields(loop) \ + ((uv__loop_internal_fields_t*) loop->internal_fields) + +#define uv__get_loop_metrics(loop) \ + (&uv__get_internal_fields(loop)->loop_metrics) + /* Allocator prototypes */ void *uv__calloc(size_t count, size_t size); char *uv__strdup(const char* s); @@ -342,4 +348,21 @@ void uv__free(void* ptr); void* uv__realloc(void* ptr, size_t size); void* uv__reallocf(void* ptr, size_t size); +typedef struct uv__loop_metrics_s uv__loop_metrics_t; +typedef struct uv__loop_internal_fields_s uv__loop_internal_fields_t; + +struct uv__loop_metrics_s { + uint64_t provider_entry_time; + uint64_t provider_idle_time; + uv_mutex_t lock; +}; + +void uv__metrics_update_idle_time(uv_loop_t* loop); +void uv__metrics_set_provider_entry_time(uv_loop_t* loop); + +struct uv__loop_internal_fields_s { + unsigned int flags; + uv__loop_metrics_t loop_metrics; +}; + #endif /* UV_COMMON_H_ */ diff --git a/deps/uv/src/uv-data-getter-setters.c b/deps/uv/src/uv-data-getter-setters.c index c3025662fa108b..0bd04486117b72 100644 --- a/deps/uv/src/uv-data-getter-setters.c +++ b/deps/uv/src/uv-data-getter-setters.c @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #include "uv.h" const char* uv_handle_type_name(uv_handle_type type) { diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c index 9974a115534320..e53a0f8e28637a 100644 --- a/deps/uv/src/win/core.c +++ b/deps/uv/src/win/core.c @@ -222,6 +222,7 @@ static void uv_init(void) { int uv_loop_init(uv_loop_t* loop) { + uv__loop_internal_fields_t* lfields; struct heap* timer_heap; int err; @@ -233,6 +234,15 @@ int uv_loop_init(uv_loop_t* loop) { if (loop->iocp == NULL) return uv_translate_sys_error(GetLastError()); + lfields = (uv__loop_internal_fields_t*) uv__calloc(1, sizeof(*lfields)); + if (lfields == NULL) + return UV_ENOMEM; + loop->internal_fields = lfields; + + err = uv_mutex_init(&lfields->loop_metrics.lock); + if (err) + goto fail_metrics_mutex_init; + /* To prevent uninitialized memory access, loop->time must be initialized * to zero before calling uv_update_time for the first time. */ @@ -297,6 +307,11 @@ int uv_loop_init(uv_loop_t* loop) { loop->timer_heap = NULL; fail_timers_alloc: + uv_mutex_destroy(&lfields->loop_metrics.lock); + +fail_metrics_mutex_init: + uv__free(lfields); + loop->internal_fields = NULL; CloseHandle(loop->iocp); loop->iocp = INVALID_HANDLE_VALUE; @@ -317,6 +332,7 @@ void uv__once_init(void) { void uv__loop_close(uv_loop_t* loop) { + uv__loop_internal_fields_t* lfields; size_t i; uv__loops_remove(loop); @@ -347,11 +363,24 @@ void uv__loop_close(uv_loop_t* loop) { uv__free(loop->timer_heap); loop->timer_heap = NULL; + lfields = uv__get_internal_fields(loop); + uv_mutex_destroy(&lfields->loop_metrics.lock); + uv__free(lfields); + loop->internal_fields = NULL; + CloseHandle(loop->iocp); } int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { + uv__loop_internal_fields_t* lfields; + + lfields = uv__get_internal_fields(loop); + if (option == UV_METRICS_IDLE_TIME) { + lfields->flags |= UV_METRICS_IDLE_TIME; + return 0; + } + return UV_ENOSYS; } @@ -393,16 +422,44 @@ static void uv__poll_wine(uv_loop_t* loop, DWORD timeout) { uv_req_t* req; int repeat; uint64_t timeout_time; + uint64_t user_timeout; + int reset_timeout; timeout_time = loop->time + timeout; + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + for (repeat = 0; ; repeat++) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + GetQueuedCompletionStatus(loop->iocp, &bytes, &key, &overlapped, timeout); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + /* Placed here because on success the loop will break whether there is an + * empty package or not, or if GetQueuedCompletionStatus returned early then + * the timeout will be updated and the loop will run again. In either case + * the idle time will need to be updated. + */ + uv__metrics_update_idle_time(loop); + if (overlapped) { /* Package was dequeued */ req = uv_overlapped_to_req(overlapped); @@ -445,10 +502,26 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) { ULONG i; int repeat; uint64_t timeout_time; + uint64_t user_timeout; + int reset_timeout; timeout_time = loop->time + timeout; + if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { + reset_timeout = 1; + user_timeout = timeout; + timeout = 0; + } else { + reset_timeout = 0; + } + for (repeat = 0; ; repeat++) { + /* Only need to set the provider_entry_time if timeout != 0. The function + * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. + */ + if (timeout != 0) + uv__metrics_set_provider_entry_time(loop); + success = pGetQueuedCompletionStatusEx(loop->iocp, overlappeds, ARRAY_SIZE(overlappeds), @@ -456,6 +529,18 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) { timeout, FALSE); + if (reset_timeout != 0) { + timeout = user_timeout; + reset_timeout = 0; + } + + /* Placed here because on success the loop will break whether there is an + * empty package or not, or if GetQueuedCompletionStatus returned early then + * the timeout will be updated and the loop will run again. In either case + * the idle time will need to be updated. + */ + uv__metrics_update_idle_time(loop); + if (success) { for (i = 0; i < count; i++) { /* Package was dequeued, but see if it is not a empty package @@ -534,6 +619,12 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) { else uv__poll_wine(loop, timeout); + /* Run one final update on the provider_idle_time in case uv__poll* + * returned because the timeout expired, but no events were received. This + * call will be ignored if the provider_entry_time was either never set (if + * the timeout == 0) or was already updated b/c an event was received. + */ + uv__metrics_update_idle_time(loop); uv_check_invoke(loop); uv_process_endgames(loop); diff --git a/deps/uv/src/win/detect-wakeup.c b/deps/uv/src/win/detect-wakeup.c index 72dfb7a1771765..ab193615783ea7 100644 --- a/deps/uv/src/win/detect-wakeup.c +++ b/deps/uv/src/win/detect-wakeup.c @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #include "uv.h" #include "internal.h" #include "winapi.h" diff --git a/deps/uv/src/win/fs-fd-hash-inl.h b/deps/uv/src/win/fs-fd-hash-inl.h index 7a203d232d35b4..0b532af12d4371 100644 --- a/deps/uv/src/win/fs-fd-hash-inl.h +++ b/deps/uv/src/win/fs-fd-hash-inl.h @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #ifndef UV_WIN_FS_FD_HASH_INL_H_ #define UV_WIN_FS_FD_HASH_INL_H_ @@ -53,7 +74,8 @@ static struct uv__fd_hash_bucket_s uv__fd_hash[UV__FD_HASH_SIZE]; INLINE static void uv__fd_hash_init(void) { - int i, err; + size_t i; + int err; err = uv_mutex_init(&uv__fd_hash_mutex); if (err) { diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 9577bc02d3cf24..8a801749d472b0 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -70,10 +70,7 @@ #define SET_REQ_RESULT(req, result_value) \ do { \ req->result = (result_value); \ - if (req->result == -1) { \ - req->sys_errno_ = _doserrno; \ - req->result = uv_translate_sys_error(req->sys_errno_); \ - } \ + assert(req->result != -1); \ } while (0) #define SET_REQ_WIN32_ERROR(req, sys_errno) \ @@ -730,14 +727,14 @@ void fs__close(uv_fs_t* req) { assert(errno == EBADF); SET_REQ_UV_ERROR(req, UV_EBADF, ERROR_INVALID_HANDLE); } else { - req->result = 0; + SET_REQ_RESULT(req, 0); } } LONG fs__filemap_ex_filter(LONG excode, PEXCEPTION_POINTERS pep, int* perror) { - if (excode != EXCEPTION_IN_PAGE_ERROR) { + if (excode != (LONG)EXCEPTION_IN_PAGE_ERROR) { return EXCEPTION_CONTINUE_SEARCH; } @@ -816,10 +813,10 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) { for (index = 0; index < req->fs.info.nbufs && done_read < read_size; ++index) { - int err = 0; size_t this_read_size = MIN(req->fs.info.bufs[index].len, read_size - done_read); #ifdef _MSC_VER + int err = 0; __try { #endif memcpy(req->fs.info.bufs[index].base, @@ -938,7 +935,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file, (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR); size_t write_size, done_write; unsigned int index; - LARGE_INTEGER zero, pos, end_pos; + LARGE_INTEGER pos, end_pos; size_t view_offset; LARGE_INTEGER view_base; void* view; @@ -963,7 +960,6 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file, return; } - zero.QuadPart = 0; if (force_append) { pos = fd_info->size; } else if (req->fs.info.offset == -1) { @@ -1014,8 +1010,8 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file, done_write = 0; for (index = 0; index < req->fs.info.nbufs; ++index) { - int err = 0; #ifdef _MSC_VER + int err = 0; __try { #endif memcpy((char*)view + view_offset + done_write, @@ -1128,7 +1124,10 @@ void fs__write(uv_fs_t* req) { void fs__rmdir(uv_fs_t* req) { int result = _wrmdir(req->file.pathw); - SET_REQ_RESULT(req, result); + if (result == -1) + SET_REQ_WIN32_ERROR(req, _doserrno); + else + SET_REQ_RESULT(req, 0); } @@ -1221,12 +1220,12 @@ void fs__unlink(uv_fs_t* req) { void fs__mkdir(uv_fs_t* req) { /* TODO: use req->mode. */ - req->result = _wmkdir(req->file.pathw); - if (req->result == -1) { - req->sys_errno_ = _doserrno; - req->result = req->sys_errno_ == ERROR_INVALID_NAME - ? UV_EINVAL - : uv_translate_sys_error(req->sys_errno_); + if (CreateDirectoryW(req->file.pathw, NULL)) { + SET_REQ_RESULT(req, 0); + } else { + SET_REQ_WIN32_ERROR(req, GetLastError()); + if (req->sys_errno_ == ERROR_INVALID_NAME) + req->result = UV_EINVAL; } } @@ -1242,19 +1241,21 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { unsigned int tries, i; size_t len; uint64_t v; - + char* path; + + path = req->path; len = wcslen(req->file.pathw); ep = req->file.pathw + len; if (len < num_x || wcsncmp(ep - num_x, L"XXXXXX", num_x)) { SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); - return; + goto clobber; } tries = TMP_MAX; do { if (uv__random_rtlgenrandom((void *)&v, sizeof(v)) < 0) { SET_REQ_UV_ERROR(req, UV_EIO, ERROR_IO_DEVICE); - break; + goto clobber; } cp = ep - num_x; @@ -1265,25 +1266,29 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { if (func(req)) { if (req->result >= 0) { - len = strlen(req->path); - wcstombs((char*) req->path + len - num_x, ep - num_x, num_x); + len = strlen(path); + wcstombs(path + len - num_x, ep - num_x, num_x); } - break; + return; } } while (--tries); - if (tries == 0) { - SET_REQ_RESULT(req, -1); - } + SET_REQ_WIN32_ERROR(req, GetLastError()); + +clobber: + path[0] = '\0'; } static int fs__mkdtemp_func(uv_fs_t* req) { - if (_wmkdir(req->file.pathw) == 0) { + DWORD error; + if (CreateDirectoryW(req->file.pathw, NULL)) { SET_REQ_RESULT(req, 0); return 1; - } else if (errno != EEXIST) { - SET_REQ_RESULT(req, -1); + } + error = GetLastError(); + if (error != ERROR_ALREADY_EXISTS) { + SET_REQ_WIN32_ERROR(req, error); return 1; } @@ -1404,7 +1409,7 @@ void fs__scandir(uv_fs_t* req) { /* If the handle is not a directory, we'll get STATUS_INVALID_PARAMETER. * This should be reported back as UV_ENOTDIR. */ - if (status == STATUS_INVALID_PARAMETER) + if (status == (NTSTATUS)STATUS_INVALID_PARAMETER) goto not_a_directory_error; while (NT_SUCCESS(status)) { @@ -1895,7 +1900,7 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { } req->ptr = &req->statbuf; - req->result = 0; + SET_REQ_RESULT(req, 0); } @@ -1930,7 +1935,7 @@ static void fs__fstat(uv_fs_t* req) { } req->ptr = &req->statbuf; - req->result = 0; + SET_REQ_RESULT(req, 0); } @@ -2157,7 +2162,10 @@ static void fs__access(uv_fs_t* req) { static void fs__chmod(uv_fs_t* req) { int result = _wchmod(req->file.pathw, req->fs.info.mode); - SET_REQ_RESULT(req, result); + if (result == -1) + SET_REQ_WIN32_ERROR(req, _doserrno); + else + SET_REQ_RESULT(req, 0); } @@ -2315,7 +2323,7 @@ INLINE static void fs__utime_impl(uv_fs_t* req, int do_lutime) { return; } - req->result = 0; + SET_REQ_RESULT(req, 0); } static void fs__utime(uv_fs_t* req) { @@ -2340,7 +2348,7 @@ static void fs__futime(uv_fs_t* req) { return; } - req->result = 0; + SET_REQ_RESULT(req, 0); } static void fs__lutime(uv_fs_t* req) { @@ -2350,11 +2358,10 @@ static void fs__lutime(uv_fs_t* req) { static void fs__link(uv_fs_t* req) { DWORD r = CreateHardLinkW(req->fs.info.new_pathw, req->file.pathw, NULL); - if (r == 0) { + if (r == 0) SET_REQ_WIN32_ERROR(req, GetLastError()); - } else { - req->result = 0; - } + else + SET_REQ_RESULT(req, 0); } @@ -2674,17 +2681,17 @@ static void fs__realpath(uv_fs_t* req) { static void fs__chown(uv_fs_t* req) { - req->result = 0; + SET_REQ_RESULT(req, 0); } static void fs__fchown(uv_fs_t* req) { - req->result = 0; + SET_REQ_RESULT(req, 0); } static void fs__lchown(uv_fs_t* req) { - req->result = 0; + SET_REQ_RESULT(req, 0); } @@ -2829,7 +2836,7 @@ static void uv__fs_done(struct uv__work* w, int status) { if (status == UV_ECANCELED) { assert(req->result == 0); - req->result = UV_ECANCELED; + SET_REQ_UV_ERROR(req, UV_ECANCELED, 0); } req->cb(req); diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index fc0112a33cf62f..f81245ec606fcb 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -244,9 +244,8 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, return 0; error: - if (pipeHandle != INVALID_HANDLE_VALUE) { + if (pipeHandle != INVALID_HANDLE_VALUE) CloseHandle(pipeHandle); - } return err; } @@ -554,7 +553,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { /* Convert name to UTF16. */ nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR); - handle->name = (WCHAR*)uv__malloc(nameSize); + handle->name = uv__malloc(nameSize); if (!handle->name) { uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); } @@ -621,9 +620,8 @@ static DWORD WINAPI pipe_connect_thread_proc(void* parameter) { while (WaitNamedPipeW(handle->name, 30000)) { /* The pipe is now available, try to connect. */ pipeHandle = open_named_pipe(handle->name, &duplex_flags); - if (pipeHandle != INVALID_HANDLE_VALUE) { + if (pipeHandle != INVALID_HANDLE_VALUE) break; - } SwitchToThread(); } @@ -655,7 +653,7 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, /* Convert name to UTF16. */ nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR); - handle->name = (WCHAR*)uv__malloc(nameSize); + handle->name = uv__malloc(nameSize); if (!handle->name) { uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); } @@ -2147,7 +2145,7 @@ int uv_pipe_open(uv_pipe_t* pipe, uv_file file) { if (pipe->ipc) { assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); pipe->pipe.conn.ipc_remote_pid = uv_os_getppid(); - assert(pipe->pipe.conn.ipc_remote_pid != (DWORD) -1); + assert(pipe->pipe.conn.ipc_remote_pid != (DWORD)(uv_pid_t) -1); } return 0; } diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index 941c8010d3f699..0dcaa97df70821 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -523,16 +523,15 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) { &req->u.io.overlapped, NULL); + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { /* Process the req without IOCP. */ - handle->flags |= UV_HANDLE_READ_PENDING; req->u.io.overlapped.InternalHigh = bytes; - handle->reqs_pending++; uv_insert_pending_req(loop, (uv_req_t*)req); } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { /* The req will be processed with IOCP. */ - handle->flags |= UV_HANDLE_READ_PENDING; - handle->reqs_pending++; if (handle->flags & UV_HANDLE_EMULATE_IOCP && req->wait_handle == INVALID_HANDLE_VALUE && !RegisterWaitForSingleObject(&req->wait_handle, @@ -545,7 +544,6 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) { /* Make this req pending reporting an error. */ SET_REQ_ERROR(req, WSAGetLastError()); uv_insert_pending_req(loop, (uv_req_t*)req); - handle->reqs_pending++; } } @@ -750,6 +748,40 @@ int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, return 0; } +static int uv__is_loopback(const struct sockaddr_storage* storage) { + const struct sockaddr_in* in4; + const struct sockaddr_in6* in6; + int i; + + if (storage->ss_family == AF_INET) { + in4 = (const struct sockaddr_in*) storage; + return in4->sin_addr.S_un.S_un_b.s_b1 == 127; + } + if (storage->ss_family == AF_INET6) { + in6 = (const struct sockaddr_in6*) storage; + for (i = 0; i < 7; ++i) { + if (in6->sin6_addr.u.Word[i] != 0) + return 0; + } + return in6->sin6_addr.u.Word[7] == htons(1); + } + return 0; +} + +// Check if Windows version is 10.0.16299 or later +static int uv__is_fast_loopback_fail_supported() { + OSVERSIONINFOW os_info; + if (!pRtlGetVersion) + return 0; + pRtlGetVersion(&os_info); + if (os_info.dwMajorVersion < 10) + return 0; + if (os_info.dwMajorVersion > 10) + return 1; + if (os_info.dwMinorVersion > 0) + return 1; + return os_info.dwBuildNumber >= 16299; +} static int uv_tcp_try_connect(uv_connect_t* req, uv_tcp_t* handle, @@ -757,6 +789,7 @@ static int uv_tcp_try_connect(uv_connect_t* req, unsigned int addrlen, uv_connect_cb cb) { uv_loop_t* loop = handle->loop; + TCP_INITIAL_RTO_PARAMETERS retransmit_ioctl; const struct sockaddr* bind_addr; struct sockaddr_storage converted; BOOL success; @@ -792,6 +825,25 @@ static int uv_tcp_try_connect(uv_connect_t* req, } } + /* This makes connect() fail instantly if the target port on the localhost + * is not reachable, instead of waiting for 2s. We do not care if this fails. + * This only works on Windows version 10.0.16299 and later. + */ + if (uv__is_fast_loopback_fail_supported() && uv__is_loopback(&converted)) { + memset(&retransmit_ioctl, 0, sizeof(retransmit_ioctl)); + retransmit_ioctl.Rtt = TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS; + retransmit_ioctl.MaxSynRetransmissions = TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS; + WSAIoctl(handle->socket, + SIO_TCP_INITIAL_RTO, + &retransmit_ioctl, + sizeof(retransmit_ioctl), + NULL, + 0, + &bytes, + NULL, + NULL); + } + UV_REQ_INIT(req, UV_CONNECT); req->handle = (uv_stream_t*) handle; req->cb = cb; diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index 046aa3e46e1ffb..4604fb0c874694 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -2413,6 +2413,7 @@ static DWORD WINAPI uv__tty_console_resize_watcher_thread(void* param) { uv__tty_console_signal_resize(); ResetEvent(uv__tty_console_resized); } + return 0; } static void uv__tty_console_signal_resize(void) { diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c index 33407a89460e1c..7032b685dedfd6 100644 --- a/deps/uv/src/win/udp.c +++ b/deps/uv/src/win/udp.c @@ -189,6 +189,11 @@ void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle) { } +int uv_udp_using_recvmmsg(const uv_udp_t* handle) { + return 0; +} + + static int uv_udp_maybe_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int addrlen, diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index 8acdbd7c21f741..aad8f1a15e9cb6 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -30,12 +30,14 @@ #include "uv.h" #include "internal.h" +/* clang-format off */ #include #include #include #include #include #include +/* clang-format on */ #include #include @@ -1806,7 +1808,9 @@ int uv_os_uname(uv_utsname_t* buffer) { pRtlGetVersion(&os_info); } else { /* Silence GetVersionEx() deprecation warning. */ + #ifdef _MSC_VER #pragma warning(suppress : 4996) + #endif if (GetVersionExW(&os_info) == 0) { r = uv_translate_sys_error(GetLastError()); goto error; @@ -1873,7 +1877,7 @@ int uv_os_uname(uv_utsname_t* buffer) { "MINGW32_NT-%u.%u", (unsigned int) os_info.dwMajorVersion, (unsigned int) os_info.dwMinorVersion); - assert(r < sizeof(buffer->sysname)); + assert((size_t)r < sizeof(buffer->sysname)); #else uv__strscpy(buffer->sysname, "Windows_NT", sizeof(buffer->sysname)); #endif @@ -1885,7 +1889,7 @@ int uv_os_uname(uv_utsname_t* buffer) { (unsigned int) os_info.dwMajorVersion, (unsigned int) os_info.dwMinorVersion, (unsigned int) os_info.dwBuildNumber); - assert(r < sizeof(buffer->release)); + assert((size_t)r < sizeof(buffer->release)); /* Populate the machine field. */ GetSystemInfo(&system_info); diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h index cbe1437a42e6bd..0b66b5634bca88 100644 --- a/deps/uv/src/win/winapi.h +++ b/deps/uv/src/win/winapi.h @@ -4726,6 +4726,18 @@ typedef HWINEVENTHOOK (WINAPI *sSetWinEventHook) DWORD idThread, UINT dwflags); +/* From mstcpip.h */ +typedef struct _TCP_INITIAL_RTO_PARAMETERS { + USHORT Rtt; + UCHAR MaxSynRetransmissions; +} TCP_INITIAL_RTO_PARAMETERS, *PTCP_INITIAL_RTO_PARAMETERS; + +#ifndef TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS +# define TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS ((UCHAR) -2) +#endif +#ifndef SIO_TCP_INITIAL_RTO +# define SIO_TCP_INITIAL_RTO _WSAIOW(IOC_VENDOR,17) +#endif /* Ntdll function pointers */ extern sRtlGetVersion pRtlGetVersion; diff --git a/deps/uv/test/task.h b/deps/uv/test/task.h index e95e3bde5a7e3e..8250f949b2bfbc 100644 --- a/deps/uv/test/task.h +++ b/deps/uv/test/task.h @@ -111,24 +111,44 @@ typedef enum { } \ } while (0) -#define ASSERT_BASE(expr, a, operator, b, type, conv) \ +#define ASSERT_BASE(a, operator, b, type, conv) \ do { \ - if (!(expr)) { \ + type eval_a = (type) (a); \ + type eval_b = (type) (b); \ + if (!(eval_a operator eval_b)) { \ fprintf(stderr, \ "Assertion failed in %s on line %d: `%s %s %s` " \ - "(%"conv" %s %"conv")\n", \ + "(%"conv" %s %"conv")\n", \ __FILE__, \ __LINE__, \ #a, \ #operator, \ #b, \ - (type)a, \ + eval_a, \ #operator, \ - (type)b); \ + eval_b); \ abort(); \ } \ } while (0) +#define ASSERT_BASE_STR(expr, a, operator, b, type, conv) \ + do { \ + if (!(expr)) { \ + fprintf(stderr, \ + "Assertion failed in %s on line %d: `%s %s %s` " \ + "(%"conv" %s %"conv")\n", \ + __FILE__, \ + __LINE__, \ + #a, \ + #operator, \ + #b, \ + (type)a, \ + #operator, \ + (type)b); \ + abort(); \ + } \ + } while (0) + #define ASSERT_BASE_LEN(expr, a, operator, b, conv, len) \ do { \ if (!(expr)) { \ @@ -177,7 +197,7 @@ typedef enum { } while (0) #define ASSERT_INT_BASE(a, operator, b, type, conv) \ - ASSERT_BASE(a operator b, a, operator, b, type, conv) + ASSERT_BASE(a, operator, b, type, conv) #define ASSERT_EQ(a, b) ASSERT_INT_BASE(a, ==, b, int64_t, PRId64) #define ASSERT_GE(a, b) ASSERT_INT_BASE(a, >=, b, int64_t, PRId64) @@ -194,10 +214,10 @@ typedef enum { #define ASSERT_UINT64_NE(a, b) ASSERT_INT_BASE(a, !=, b, uint64_t, PRIu64) #define ASSERT_STR_EQ(a, b) \ - ASSERT_BASE(strcmp(a, b) == 0, a, ==, b, char*, "s") + ASSERT_BASE_STR(strcmp(a, b) == 0, a, == , b, char*, "s") #define ASSERT_STR_NE(a, b) \ - ASSERT_BASE(strcmp(a, b) != 0, a, !=, b, char*, "s") + ASSERT_BASE_STR(strcmp(a, b) != 0, a, !=, b, char*, "s") #define ASSERT_MEM_EQ(a, b, size) \ ASSERT_BASE_LEN(memcmp(a, b, size) == 0, a, ==, b, s, size) @@ -212,16 +232,16 @@ typedef enum { ASSERT_BASE_HEX(memcmp(a, b, size) != 0, a, !=, b, size) #define ASSERT_NULL(a) \ - ASSERT_BASE(a == NULL, a, ==, NULL, void*, "p") + ASSERT_BASE(a, ==, NULL, void*, "p") #define ASSERT_NOT_NULL(a) \ - ASSERT_BASE(a != NULL, a, !=, NULL, void*, "p") + ASSERT_BASE(a, !=, NULL, void*, "p") #define ASSERT_PTR_EQ(a, b) \ - ASSERT_BASE((void*)a == (void*)b, a, ==, b, void*, "p") + ASSERT_BASE(a, ==, b, void*, "p") #define ASSERT_PTR_NE(a, b) \ - ASSERT_BASE((void*)a != (void*)b, a, !=, b, void*, "p") + ASSERT_BASE(a, !=, b, void*, "p") /* This macro cleans up the main loop. This is used to avoid valgrind * warnings about memory being "leaked" by the main event loop. diff --git a/deps/uv/test/test-close-fd.c b/deps/uv/test/test-close-fd.c index 2ed9a10032dfe6..cea4a1b0b80bb4 100644 --- a/deps/uv/test/test-close-fd.c +++ b/deps/uv/test/test-close-fd.c @@ -28,13 +28,13 @@ static unsigned int read_cb_called; -static void alloc_cb(uv_handle_t *handle, size_t size, uv_buf_t *buf) { +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { static char slab[1]; buf->base = slab; buf->len = sizeof(slab); } -static void read_cb(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf) { +static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { switch (++read_cb_called) { case 1: ASSERT(nread == 1); diff --git a/deps/uv/test/test-fs-copyfile.c b/deps/uv/test/test-fs-copyfile.c index 3335c881064ffd..e6f06e6eac5a2b 100644 --- a/deps/uv/test/test-fs-copyfile.c +++ b/deps/uv/test/test-fs-copyfile.c @@ -125,6 +125,11 @@ TEST_IMPL(fs_copyfile) { r = uv_fs_copyfile(NULL, &req, src, src, 0, NULL); ASSERT(r == 0); uv_fs_req_cleanup(&req); + /* Verify that the src file did not get truncated. */ + r = uv_fs_stat(NULL, &req, src, NULL); + ASSERT_EQ(r, 0); + ASSERT_EQ(req.statbuf.st_size, 12); + uv_fs_req_cleanup(&req); unlink(src); /* Copies file synchronously. Creates new file. */ diff --git a/deps/uv/test/test-fs-open-flags.c b/deps/uv/test/test-fs-open-flags.c index fcef2fb0819f74..5f61007adde65a 100644 --- a/deps/uv/test/test-fs-open-flags.c +++ b/deps/uv/test/test-fs-open-flags.c @@ -58,7 +58,7 @@ static char empty_file[FILE_NAME_SIZE]; static char dummy_file[FILE_NAME_SIZE]; static char empty_dir[] = "empty_dir"; -static void setup() { +static void setup(void) { int r; /* empty_dir */ @@ -73,7 +73,7 @@ static void setup() { uv_fs_req_cleanup(&mkdir_req); } -static void refresh() { +static void refresh(void) { int r; /* absent_file */ @@ -119,7 +119,7 @@ static void refresh() { uv_fs_req_cleanup(&close_req); } -static void cleanup() { +static void cleanup(void) { unlink(absent_file); unlink(empty_file); unlink(dummy_file); diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index ae9923a9a16ec3..63189d01d5adc1 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -28,12 +28,8 @@ #include #include /* INT_MAX, PATH_MAX, IOV_MAX */ -/* FIXME we shouldn't need to branch in this file */ -#if defined(__unix__) || defined(__POSIX__) || \ - defined(__APPLE__) || defined(__sun) || \ - defined(_AIX) || defined(__MVS__) || \ - defined(__HAIKU__) -#include /* unlink, rmdir, etc. */ +#ifndef _WIN32 +# include /* unlink, rmdir, etc. */ #else # include # include @@ -1290,7 +1286,10 @@ TEST_IMPL(fs_mkstemp) { ASSERT(strcmp(mkstemp_req1.path, mkstemp_req2.path) != 0); /* invalid template returns EINVAL */ - ASSERT(uv_fs_mkstemp(NULL, &mkstemp_req3, "test_file", NULL) == UV_EINVAL); + ASSERT_EQ(UV_EINVAL, uv_fs_mkstemp(NULL, &mkstemp_req3, "test_file", NULL)); + + /* Make sure that path is empty string */ + ASSERT_EQ(0, strlen(mkstemp_req3.path)); /* We can write to the opened file */ iov = uv_buf_init(test_buf, sizeof(test_buf)); @@ -3885,7 +3884,7 @@ TEST_IMPL(fs_file_pos_after_op_with_offset) { } #ifdef _WIN32 -static void fs_file_pos_common() { +static void fs_file_pos_common(void) { int r; iov = uv_buf_init("abc", 3); diff --git a/deps/uv/test/test-get-currentexe.c b/deps/uv/test/test-get-currentexe.c index 5e4a083f3060b7..8eba7b73b7b036 100644 --- a/deps/uv/test/test-get-currentexe.c +++ b/deps/uv/test/test-get-currentexe.c @@ -88,5 +88,19 @@ TEST_IMPL(get_currentexe) { ASSERT(buffer[0] != '\0'); ASSERT(buffer[1] == '\0'); + /* Verify uv_exepath is not affected by uv_set_process_title(). */ + r = uv_set_process_title("foobar"); + ASSERT_EQ(r, 0); + size = sizeof(buffer); + r = uv_exepath(buffer, &size); + ASSERT_EQ(r, 0); + + match = strstr(buffer, path); + /* Verify that the path returned from uv_exepath is a subdirectory of + * executable_path. + */ + ASSERT_NOT_NULL(match); + ASSERT_STR_EQ(match, path); + ASSERT_EQ(size, strlen(buffer)); return 0; } diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c index f2b4e03cd74cdb..628e4d13cc60db 100644 --- a/deps/uv/test/test-getaddrinfo.c +++ b/deps/uv/test/test-getaddrinfo.c @@ -39,6 +39,7 @@ static int fail_cb_called; static void getaddrinfo_fail_cb(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { + ASSERT(fail_cb_called == 0); ASSERT(status < 0); ASSERT(res == NULL); @@ -81,6 +82,11 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle, TEST_IMPL(getaddrinfo_fail) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + uv_getaddrinfo_t req; ASSERT(UV_EINVAL == uv_getaddrinfo(uv_default_loop(), @@ -127,6 +133,11 @@ TEST_IMPL(getaddrinfo_fail_sync) { TEST_IMPL(getaddrinfo_basic) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; getaddrinfo_handle = (uv_getaddrinfo_t*)malloc(sizeof(uv_getaddrinfo_t)); @@ -168,6 +179,11 @@ TEST_IMPL(getaddrinfo_basic_sync) { TEST_IMPL(getaddrinfo_concurrent) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int i, r; int* data; diff --git a/deps/uv/test/test-getnameinfo.c b/deps/uv/test/test-getnameinfo.c index 3767ffd9aea5de..eb3264515ce509 100644 --- a/deps/uv/test/test-getnameinfo.c +++ b/deps/uv/test/test-getnameinfo.c @@ -46,6 +46,11 @@ static void getnameinfo_req(uv_getnameinfo_t* handle, TEST_IMPL(getnameinfo_basic_ip4) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; r = uv_ip4_addr(address_ip4, port, &addr4); @@ -87,6 +92,11 @@ TEST_IMPL(getnameinfo_basic_ip4_sync) { TEST_IMPL(getnameinfo_basic_ip6) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; r = uv_ip6_addr(address_ip6, port, &addr6); diff --git a/deps/uv/test/test-getters-setters.c b/deps/uv/test/test-getters-setters.c index 60a1b9264da179..42c9dcaf0cb2c7 100644 --- a/deps/uv/test/test-getters-setters.c +++ b/deps/uv/test/test-getters-setters.c @@ -1,3 +1,24 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + #include "uv.h" #include "task.h" #include diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 58e174d1deeedd..52b17a69147aa0 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -127,6 +127,8 @@ TEST_DECLARE (tcp_bind_writable_flags) TEST_DECLARE (tcp_listen_without_bind) TEST_DECLARE (tcp_connect_error_fault) TEST_DECLARE (tcp_connect_timeout) +TEST_DECLARE (tcp_local_connect_timeout) +TEST_DECLARE (tcp6_local_connect_timeout) TEST_DECLARE (tcp_close_while_connecting) TEST_DECLARE (tcp_close) TEST_DECLARE (tcp_close_reset_accepted) @@ -145,6 +147,7 @@ TEST_DECLARE (tcp_flags) TEST_DECLARE (tcp_write_to_half_open_connection) TEST_DECLARE (tcp_unexpected_read) TEST_DECLARE (tcp_read_stop) +TEST_DECLARE (tcp_read_stop_start) TEST_DECLARE (tcp_bind6_error_addrinuse) TEST_DECLARE (tcp_bind6_error_addrnotavail) TEST_DECLARE (tcp_bind6_error_fault) @@ -162,6 +165,7 @@ TEST_DECLARE (udp_send_and_recv) TEST_DECLARE (udp_send_hang_loop) TEST_DECLARE (udp_send_immediate) TEST_DECLARE (udp_send_unreachable) +TEST_DECLARE (udp_mmsg) TEST_DECLARE (udp_multicast_join) TEST_DECLARE (udp_multicast_join6) TEST_DECLARE (udp_multicast_ttl) @@ -281,6 +285,7 @@ TEST_DECLARE (getnameinfo_basic_ip6) TEST_DECLARE (getsockname_tcp) TEST_DECLARE (getsockname_udp) TEST_DECLARE (gettimeofday) +TEST_DECLARE (test_macros) TEST_DECLARE (fail_always) TEST_DECLARE (pass_always) TEST_DECLARE (socket_buffer_size) @@ -518,12 +523,17 @@ TEST_DECLARE (idna_toascii) TEST_DECLARE (utf8_decode1) TEST_DECLARE (uname) +TEST_DECLARE (metrics_idle_time) +TEST_DECLARE (metrics_idle_time_thread) +TEST_DECLARE (metrics_idle_time_zero) + TASK_LIST_START TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000) #if 0 TEST_ENTRY (callback_order) #endif + TEST_ENTRY (test_macros) TEST_ENTRY (close_order) TEST_ENTRY (run_once) TEST_ENTRY (run_nowait) @@ -672,6 +682,8 @@ TASK_LIST_START TEST_ENTRY (tcp_listen_without_bind) TEST_ENTRY (tcp_connect_error_fault) TEST_ENTRY (tcp_connect_timeout) + TEST_ENTRY (tcp_local_connect_timeout) + TEST_ENTRY (tcp6_local_connect_timeout) TEST_ENTRY (tcp_close_while_connecting) TEST_ENTRY (tcp_close) TEST_ENTRY (tcp_close_reset_accepted) @@ -693,6 +705,8 @@ TASK_LIST_START TEST_ENTRY (tcp_read_stop) TEST_HELPER (tcp_read_stop, tcp4_echo_server) + TEST_ENTRY (tcp_read_stop_start) + TEST_ENTRY (tcp_bind6_error_addrinuse) TEST_ENTRY (tcp_bind6_error_addrnotavail) TEST_ENTRY (tcp_bind6_error_fault) @@ -716,6 +730,7 @@ TASK_LIST_START TEST_ENTRY (udp_options) TEST_ENTRY (udp_options6) TEST_ENTRY (udp_no_autobind) + TEST_ENTRY (udp_mmsg) TEST_ENTRY (udp_multicast_interface) TEST_ENTRY (udp_multicast_interface6) TEST_ENTRY (udp_multicast_join) @@ -844,7 +859,7 @@ TASK_LIST_START TEST_ENTRY (tmpdir) - TEST_ENTRY_CUSTOM (hrtime, 0, 0, 10000) + TEST_ENTRY_CUSTOM (hrtime, 0, 0, 20000) TEST_ENTRY_CUSTOM (getaddrinfo_fail, 0, 0, 10000) TEST_ENTRY_CUSTOM (getaddrinfo_fail_sync, 0, 0, 10000) @@ -1100,6 +1115,10 @@ TASK_LIST_START TEST_ENTRY (idna_toascii) #endif + TEST_ENTRY (metrics_idle_time) + TEST_ENTRY (metrics_idle_time_thread) + TEST_ENTRY (metrics_idle_time_zero) + #if 0 /* These are for testing the test runner. */ TEST_ENTRY (fail_always) diff --git a/deps/uv/test/test-metrics.c b/deps/uv/test/test-metrics.c new file mode 100644 index 00000000000000..f527494470e920 --- /dev/null +++ b/deps/uv/test/test-metrics.c @@ -0,0 +1,135 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include /* memset */ + +#define UV_NS_TO_MS 1000000 + + +static void timer_spin_cb(uv_timer_t* handle) { + uint64_t t; + + (*(int*) handle->data)++; + t = uv_hrtime(); + /* Spin for 500 ms to spin loop time out of the delta check. */ + while (uv_hrtime() - t < 600 * UV_NS_TO_MS) { } +} + + +TEST_IMPL(metrics_idle_time) { + const uint64_t timeout = 1000; + uv_timer_t timer; + uint64_t idle_time; + int cntr; + + cntr = 0; + timer.data = &cntr; + + ASSERT_EQ(0, uv_loop_configure(uv_default_loop(), UV_METRICS_IDLE_TIME)); + ASSERT_EQ(0, uv_timer_init(uv_default_loop(), &timer)); + ASSERT_EQ(0, uv_timer_start(&timer, timer_spin_cb, timeout, 0)); + + ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT_GT(cntr, 0); + + idle_time = uv_metrics_idle_time(uv_default_loop()); + + /* Permissive check that the idle time matches within the timeout ±500 ms. */ + ASSERT((idle_time <= (timeout + 500) * UV_NS_TO_MS) && + (idle_time >= (timeout - 500) * UV_NS_TO_MS)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void metrics_routine_cb(void* arg) { + const uint64_t timeout = 1000; + uv_loop_t loop; + uv_timer_t timer; + uint64_t idle_time; + int cntr; + + cntr = 0; + timer.data = &cntr; + + ASSERT_EQ(0, uv_loop_init(&loop)); + ASSERT_EQ(0, uv_loop_configure(&loop, UV_METRICS_IDLE_TIME)); + ASSERT_EQ(0, uv_timer_init(&loop, &timer)); + ASSERT_EQ(0, uv_timer_start(&timer, timer_spin_cb, timeout, 0)); + + ASSERT_EQ(0, uv_run(&loop, UV_RUN_DEFAULT)); + ASSERT_GT(cntr, 0); + + idle_time = uv_metrics_idle_time(&loop); + + /* Only checking that idle time is greater than the lower bound since there + * may have been thread contention, causing the event loop to be delayed in + * the idle phase longer than expected. + */ + ASSERT_GE(idle_time, (timeout - 500) * UV_NS_TO_MS); + + close_loop(&loop); + ASSERT_EQ(0, uv_loop_close(&loop)); +} + + +TEST_IMPL(metrics_idle_time_thread) { + uv_thread_t threads[5]; + int i; + + for (i = 0; i < 5; i++) { + ASSERT_EQ(0, uv_thread_create(&threads[i], metrics_routine_cb, NULL)); + } + + for (i = 0; i < 5; i++) { + uv_thread_join(&threads[i]); + } + + return 0; +} + + +static void timer_noop_cb(uv_timer_t* handle) { + (*(int*) handle->data)++; +} + + +TEST_IMPL(metrics_idle_time_zero) { + uv_timer_t timer; + int cntr; + + cntr = 0; + timer.data = &cntr; + ASSERT_EQ(0, uv_loop_configure(uv_default_loop(), UV_METRICS_IDLE_TIME)); + ASSERT_EQ(0, uv_timer_init(uv_default_loop(), &timer)); + ASSERT_EQ(0, uv_timer_start(&timer, timer_noop_cb, 0, 0)); + + ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT_GT(cntr, 0); + ASSERT_EQ(0, uv_metrics_idle_time(uv_default_loop())); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/test/test-ping-pong.c b/deps/uv/test/test-ping-pong.c index c86a3f4a66592f..7f7758b3b2ebea 100644 --- a/deps/uv/test/test-ping-pong.c +++ b/deps/uv/test/test-ping-pong.c @@ -70,14 +70,14 @@ static void pinger_on_close(uv_handle_t* handle) { } -static void pinger_after_write(uv_write_t *req, int status) { +static void pinger_after_write(uv_write_t* req, int status) { ASSERT(status == 0); free(req); } static void pinger_write_ping(pinger_t* pinger) { - uv_write_t *req; + uv_write_t* req; uv_buf_t bufs[sizeof PING - 1]; int i, nbufs; @@ -112,7 +112,7 @@ static void pinger_read_cb(uv_stream_t* stream, ssize_t i; pinger_t* pinger; - pinger = (pinger_t*)stream->data; + pinger = (pinger_t*) stream->data; if (nread < 0) { ASSERT(nread == UV_EOF); @@ -148,8 +148,8 @@ static void pinger_read_cb(uv_stream_t* stream, } -static void pinger_on_connect(uv_connect_t *req, int status) { - pinger_t *pinger = (pinger_t*)req->handle->data; +static void pinger_on_connect(uv_connect_t* req, int status) { + pinger_t* pinger = (pinger_t*)req->handle->data; pinger_on_connect_count++; @@ -169,10 +169,10 @@ static void pinger_on_connect(uv_connect_t *req, int status) { static void tcp_pinger_v6_new(int vectored_writes) { int r; struct sockaddr_in6 server_addr; - pinger_t *pinger; + pinger_t* pinger; - ASSERT(0 ==uv_ip6_addr("::1", TEST_PORT, &server_addr)); + ASSERT(0 == uv_ip6_addr("::1", TEST_PORT, &server_addr)); pinger = malloc(sizeof(*pinger)); ASSERT(pinger != NULL); pinger->vectored_writes = vectored_writes; @@ -200,7 +200,7 @@ static void tcp_pinger_v6_new(int vectored_writes) { static void tcp_pinger_new(int vectored_writes) { int r; struct sockaddr_in server_addr; - pinger_t *pinger; + pinger_t* pinger; ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); pinger = malloc(sizeof(*pinger)); @@ -229,9 +229,9 @@ static void tcp_pinger_new(int vectored_writes) { static void pipe_pinger_new(int vectored_writes) { int r; - pinger_t *pinger; + pinger_t* pinger; - pinger = (pinger_t*)malloc(sizeof(*pinger)); + pinger = malloc(sizeof(*pinger)); ASSERT(pinger != NULL); pinger->vectored_writes = vectored_writes; pinger->state = 0; diff --git a/deps/uv/test/test-pipe-set-non-blocking.c b/deps/uv/test/test-pipe-set-non-blocking.c index fcc9fc0da85e99..626b53f09a2776 100644 --- a/deps/uv/test/test-pipe-set-non-blocking.c +++ b/deps/uv/test/test-pipe-set-non-blocking.c @@ -24,29 +24,35 @@ TEST_IMPL(pipe_set_non_blocking) { #else /* !_WIN32 */ -#include -#include -#include +#include /* memset */ +#include /* close */ #include -#include -#include +#include struct thread_ctx { uv_barrier_t barrier; - int fd; + uv_file fd; }; static void thread_main(void* arg) { struct thread_ctx* ctx; + uv_fs_t req; + uv_buf_t bufs[1]; char buf[4096]; ssize_t n; + int uv_errno; + + bufs[0] = uv_buf_init(buf, sizeof(buf)); ctx = arg; uv_barrier_wait(&ctx->barrier); - do - n = read(ctx->fd, buf, sizeof(buf)); - while (n > 0 || (n == -1 && errno == EINTR)); + uv_sleep(100); /* make sure we are forcing the writer to block a bit */ + do { + uv_errno = uv_fs_read(NULL, &req, ctx->fd, bufs, 1, -1, NULL); + n = req.result; + uv_fs_req_cleanup(&req); + } while (n > 0 || (n == -1 && uv_errno == UV_EINTR)); ASSERT(n == 0); } @@ -58,15 +64,16 @@ TEST_IMPL(pipe_set_non_blocking) { size_t nwritten; char data[4096]; uv_buf_t buf; - int fd[2]; + uv_file fd[2]; int n; ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0)); ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, fd)); - ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0])); + ASSERT(0 == uv_pipe_open(&pipe_handle, fd[1])); ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &pipe_handle, 1)); + fd[1] = -1; /* fd[1] is owned by pipe_handle now. */ - ctx.fd = fd[1]; + ctx.fd = fd[0]; ASSERT(0 == uv_barrier_init(&ctx.barrier, 2)); ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx)); uv_barrier_wait(&ctx.barrier); @@ -89,7 +96,8 @@ TEST_IMPL(pipe_set_non_blocking) { ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); ASSERT(0 == uv_thread_join(&thread)); - ASSERT(0 == close(fd[1])); /* fd[0] is closed by uv_close(). */ + ASSERT(0 == close(fd[0])); /* fd[1] is closed by uv_close(). */ + fd[0] = -1; uv_barrier_destroy(&ctx.barrier); MAKE_VALGRIND_HAPPY(); diff --git a/deps/uv/test/test-process-title-threadsafe.c b/deps/uv/test/test-process-title-threadsafe.c index 3b4168be84c6b4..927643cc8c90c9 100644 --- a/deps/uv/test/test-process-title-threadsafe.c +++ b/deps/uv/test/test-process-title-threadsafe.c @@ -39,10 +39,13 @@ static const char* titles[] = { }; static void getter_thread_body(void* arg) { + uv_sem_t* getter_sem; char buffer[512]; size_t len; - for (;;) { + getter_sem = arg; + + while (UV_EAGAIN == uv_sem_trywait(getter_sem)) { ASSERT(0 == uv_get_process_title(buffer, sizeof(buffer))); /* The maximum size of the process title on some platforms depends on @@ -78,6 +81,7 @@ static void setter_thread_body(void* arg) { TEST_IMPL(process_title_threadsafe) { uv_thread_t setter_threads[4]; uv_thread_t getter_thread; + uv_sem_t getter_sem; int i; #if defined(__sun) || defined(__CYGWIN__) || defined(__MSYS__) || \ @@ -86,7 +90,10 @@ TEST_IMPL(process_title_threadsafe) { #endif ASSERT(0 == uv_set_process_title(titles[0])); - ASSERT(0 == uv_thread_create(&getter_thread, getter_thread_body, NULL)); + + ASSERT_EQ(0, uv_sem_init(&getter_sem, 0)); + ASSERT_EQ(0, + uv_thread_create(&getter_thread, getter_thread_body, &getter_sem)); for (i = 0; i < (int) ARRAY_SIZE(setter_threads); i++) ASSERT(0 == uv_thread_create(&setter_threads[i], setter_thread_body, NULL)); @@ -94,5 +101,9 @@ TEST_IMPL(process_title_threadsafe) { for (i = 0; i < (int) ARRAY_SIZE(setter_threads); i++) ASSERT(0 == uv_thread_join(&setter_threads[i])); + uv_sem_post(&getter_sem); + ASSERT_EQ(0, uv_thread_join(&getter_thread)); + uv_sem_destroy(&getter_sem); + return 0; } diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index 5e1c6d613003c0..d1757337a6d468 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -71,7 +71,7 @@ static void exit_cb(uv_process_t* process, exit_cb_called++; ASSERT(exit_status == 1); ASSERT(term_signal == 0); - uv_close((uv_handle_t*)process, close_cb); + uv_close((uv_handle_t*) process, close_cb); } @@ -104,7 +104,7 @@ static void kill_cb(uv_process_t* process, #else ASSERT(no_term_signal || term_signal == SIGTERM); #endif - uv_close((uv_handle_t*)process, close_cb); + uv_close((uv_handle_t*) process, close_cb); /* * Sending signum == 0 should check if the @@ -135,7 +135,7 @@ static void on_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { output_used += nread; } else if (nread < 0) { ASSERT(nread == UV_EOF); - uv_close((uv_handle_t*)tcp, close_cb); + uv_close((uv_handle_t*) tcp, close_cb); } } @@ -150,7 +150,7 @@ static void on_read_once(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { static void write_cb(uv_write_t* req, int status) { ASSERT(status == 0); - uv_close((uv_handle_t*)req->handle, close_cb); + uv_close((uv_handle_t*) req->handle, close_cb); } @@ -172,8 +172,8 @@ static void init_process_options(char* test, uv_exit_cb exit_cb) { static void timer_cb(uv_timer_t* handle) { - uv_process_kill(&process, /* SIGTERM */ 15); - uv_close((uv_handle_t*)handle, close_cb); + uv_process_kill(&process, SIGTERM); + uv_close((uv_handle_t*) handle, close_cb); } @@ -291,7 +291,7 @@ TEST_IMPL(spawn_stdout) { options.stdio = stdio; options.stdio[0].flags = UV_IGNORE; options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio_count = 2; r = uv_spawn(uv_default_loop(), &process, &options); @@ -595,9 +595,9 @@ TEST_IMPL(spawn_stdin) { uv_pipe_init(uv_default_loop(), &in, 0); options.stdio = stdio; options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; - options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[0].data.stream = (uv_stream_t*) ∈ options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio_count = 2; r = uv_spawn(uv_default_loop(), &process, &options); @@ -605,7 +605,7 @@ TEST_IMPL(spawn_stdin) { buf.base = buffer; buf.len = sizeof(buffer); - r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + r = uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb); ASSERT(r == 0); r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); @@ -636,7 +636,7 @@ TEST_IMPL(spawn_stdio_greater_than_3) { options.stdio[1].flags = UV_IGNORE; options.stdio[2].flags = UV_IGNORE; options.stdio[3].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[3].data.stream = (uv_stream_t*)&pipe; + options.stdio[3].data.stream = (uv_stream_t*) &pipe; options.stdio_count = 4; r = uv_spawn(uv_default_loop(), &process, &options); @@ -677,7 +677,7 @@ int spawn_tcp_server_helper(void) { /* Make sure that we can listen on a socket that was * passed down from the parent process */ - r = uv_listen((uv_stream_t*)&tcp, SOMAXCONN, NULL); + r = uv_listen((uv_stream_t*) &tcp, SOMAXCONN, NULL); ASSERT(r == 0); return 1; @@ -703,10 +703,10 @@ TEST_IMPL(spawn_tcp_server) { r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); ASSERT(r == 0); #ifdef _WIN32 - r = uv_fileno((uv_handle_t*)&tcp_server, &handle); + r = uv_fileno((uv_handle_t*) &tcp_server, &handle); fd = _open_osfhandle((intptr_t) handle, 0); #else - r = uv_fileno((uv_handle_t*)&tcp_server, &fd); + r = uv_fileno((uv_handle_t*) &tcp_server, &fd); #endif ASSERT(r == 0); ASSERT(fd > 0); @@ -833,7 +833,7 @@ TEST_IMPL(spawn_detached) { r = uv_spawn(uv_default_loop(), &process, &options); ASSERT(r == 0); - uv_unref((uv_handle_t*)&process); + uv_unref((uv_handle_t*) &process); r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); ASSERT(r == 0); @@ -845,7 +845,7 @@ TEST_IMPL(spawn_detached) { r = uv_kill(process.pid, 0); ASSERT(r == 0); - r = uv_kill(process.pid, 15); + r = uv_kill(process.pid, SIGTERM); ASSERT(r == 0); MAKE_VALGRIND_HAPPY(); @@ -874,11 +874,11 @@ TEST_IMPL(spawn_and_kill_with_std) { options.stdio = stdio; options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; - options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[0].data.stream = (uv_stream_t*) ∈ options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[2].data.stream = (uv_stream_t*)&err; + options.stdio[2].data.stream = (uv_stream_t*) &err; options.stdio_count = 3; r = uv_spawn(uv_default_loop(), &process, &options); @@ -925,9 +925,9 @@ TEST_IMPL(spawn_and_ping) { uv_pipe_init(uv_default_loop(), &in, 0); options.stdio = stdio; options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; - options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[0].data.stream = (uv_stream_t*) ∈ options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio_count = 2; r = uv_spawn(uv_default_loop(), &process, &options); @@ -939,10 +939,10 @@ TEST_IMPL(spawn_and_ping) { r = uv_process_kill(&process, 0); ASSERT(r == 0); - r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + r = uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb); ASSERT(r == 0); - r = uv_read_start((uv_stream_t*)&out, on_alloc, on_read); + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); ASSERT(r == 0); ASSERT(exit_cb_called == 0); @@ -972,9 +972,9 @@ TEST_IMPL(spawn_same_stdout_stderr) { uv_pipe_init(uv_default_loop(), &in, 0); options.stdio = stdio; options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; - options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[0].data.stream = (uv_stream_t*) ∈ options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio_count = 2; r = uv_spawn(uv_default_loop(), &process, &options); @@ -986,10 +986,10 @@ TEST_IMPL(spawn_same_stdout_stderr) { r = uv_process_kill(&process, 0); ASSERT(r == 0); - r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + r = uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb); ASSERT(r == 0); - r = uv_read_start((uv_stream_t*)&out, on_alloc, on_read); + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); ASSERT(r == 0); ASSERT(exit_cb_called == 0); @@ -1077,7 +1077,7 @@ TEST_IMPL(kill) { ASSERT(r == 0); /* Kill the process. */ - r = uv_kill(process.pid, /* SIGTERM */ 15); + r = uv_kill(process.pid, SIGTERM); ASSERT(r == 0); r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); @@ -1105,7 +1105,7 @@ TEST_IMPL(spawn_detect_pipe_name_collisions_on_windows) { options.stdio = stdio; options.stdio[0].flags = UV_IGNORE; options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[1].data.stream = (uv_stream_t*) &out; options.stdio_count = 2; /* Create a pipe that'll cause a collision. */ @@ -1821,32 +1821,32 @@ TEST_IMPL(spawn_inherit_streams) { ASSERT(uv_is_writable((uv_stream_t*) &pipe_stdout_parent) == bidir); child_stdio[0].flags = UV_INHERIT_STREAM; - child_stdio[0].data.stream = (uv_stream_t *)&pipe_stdin_child; + child_stdio[0].data.stream = (uv_stream_t *) &pipe_stdin_child; child_stdio[1].flags = UV_INHERIT_STREAM; - child_stdio[1].data.stream = (uv_stream_t *)&pipe_stdout_child; + child_stdio[1].data.stream = (uv_stream_t *) &pipe_stdout_child; options.stdio = child_stdio; options.stdio_count = 2; ASSERT(uv_spawn(loop, &child_req, &options) == 0); - uv_close((uv_handle_t*)&pipe_stdin_child, NULL); - uv_close((uv_handle_t*)&pipe_stdout_child, NULL); + uv_close((uv_handle_t*) &pipe_stdin_child, NULL); + uv_close((uv_handle_t*) &pipe_stdout_child, NULL); - buf = uv_buf_init((char*)ubuf, sizeof ubuf); + buf = uv_buf_init((char*) ubuf, sizeof ubuf); for (i = 0; i < sizeof ubuf; ++i) ubuf[i] = i & 255u; memset(output, 0, sizeof ubuf); r = uv_write(&write_req, - (uv_stream_t*)&pipe_stdin_parent, + (uv_stream_t*) &pipe_stdin_parent, &buf, 1, write_cb); ASSERT(r == 0); - r = uv_read_start((uv_stream_t*)&pipe_stdout_parent, on_alloc, on_read); + r = uv_read_start((uv_stream_t*) &pipe_stdout_parent, on_alloc, on_read); ASSERT(r == 0); r = uv_run(loop, UV_RUN_DEFAULT); diff --git a/deps/uv/test/test-tcp-connect-timeout.c b/deps/uv/test/test-tcp-connect-timeout.c index 081424b80023cf..6b455276c516b1 100644 --- a/deps/uv/test/test-tcp-connect-timeout.c +++ b/deps/uv/test/test-tcp-connect-timeout.c @@ -89,3 +89,108 @@ TEST_IMPL(tcp_connect_timeout) { MAKE_VALGRIND_HAPPY(); return 0; } + +/* Make sure connect fails instantly if the target is nonexisting + * local port. + */ + +static void connect_local_cb(uv_connect_t* req, int status) { + ASSERT_PTR_EQ(req, &connect_req); + ASSERT_NE(status, UV_ECANCELED); + connect_cb_called++; +} + +static int is_supported_system() { + int semver[3]; + int min_semver[3] = {10, 0, 16299}; + int cnt; + uv_utsname_t uname; + ASSERT_EQ(uv_os_uname(&uname), 0); + if (strcmp(uname.sysname, "Windows_NT") == 0) { + cnt = sscanf(uname.release, "%d.%d.%d", &semver[0], &semver[1], &semver[2]); + if (cnt != 3) { + return 0; + } + // relase >= 10.0.16299 + for (cnt = 0; cnt < 3; ++cnt) { + if (semver[cnt] > min_semver[cnt]) + return 1; + if (semver[cnt] < min_semver[cnt]) + return 0; + } + return 1; + } + return 1; +} + +TEST_IMPL(tcp_local_connect_timeout) { + struct sockaddr_in addr; + int r; + + if (!is_supported_system()) { + RETURN_SKIP("Unsupported system"); + } + ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT_EQ(r, 0); + + /* Give it 1s to timeout. */ + r = uv_timer_start(&timer, timer_cb, 1000, 0); + ASSERT_EQ(r, 0); + + r = uv_tcp_init(uv_default_loop(), &conn); + ASSERT_EQ(r, 0); + + r = uv_tcp_connect(&connect_req, + &conn, + (const struct sockaddr*) &addr, + connect_local_cb); + if (r == UV_ENETUNREACH) + RETURN_SKIP("Network unreachable."); + ASSERT_EQ(r, 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(tcp6_local_connect_timeout) { + struct sockaddr_in6 addr; + int r; + + if (!is_supported_system()) { + RETURN_SKIP("Unsupported system"); + } + if (!can_ipv6()) { + RETURN_SKIP("IPv6 not supported"); + } + + ASSERT_EQ(0, uv_ip6_addr("::1", 9999, &addr)); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT_EQ(r, 0); + + /* Give it 1s to timeout. */ + r = uv_timer_start(&timer, timer_cb, 1000, 0); + ASSERT_EQ(r, 0); + + r = uv_tcp_init(uv_default_loop(), &conn); + ASSERT_EQ(r, 0); + + r = uv_tcp_connect(&connect_req, + &conn, + (const struct sockaddr*) &addr, + connect_local_cb); + if (r == UV_ENETUNREACH) + RETURN_SKIP("Network unreachable."); + ASSERT_EQ(r, 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT_EQ(r, 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/test/test-tcp-read-stop-start.c b/deps/uv/test/test-tcp-read-stop-start.c new file mode 100644 index 00000000000000..9bccbc12fc58e6 --- /dev/null +++ b/deps/uv/test/test-tcp-read-stop-start.c @@ -0,0 +1,136 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_tcp_t server; +static uv_tcp_t connection; +static int read_cb_called = 0; + +static uv_tcp_t client; +static uv_connect_t connect_req; + + +static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); + +static void on_write_close_immediately(uv_write_t* req, int status) { + ASSERT(0 == status); + + uv_close((uv_handle_t*)req->handle, NULL); /* Close immediately */ + free(req); +} + +static void on_write(uv_write_t* req, int status) { + ASSERT(0 == status); + + free(req); +} + +static void do_write(uv_stream_t* stream, uv_write_cb cb) { + uv_write_t* req = malloc(sizeof(*req)); + uv_buf_t buf; + buf.base = "1234578"; + buf.len = 8; + ASSERT(0 == uv_write(req, stream, &buf, 1, cb)); +} + +static void on_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + buf->base = slab; + buf->len = sizeof(slab); +} + +static void on_read1(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread >= 0); + + /* Do write on a half open connection to force WSAECONNABORTED (on Windows) + * in the subsequent uv_read_start() + */ + do_write(stream, on_write); + + ASSERT(0 == uv_read_stop(stream)); + + ASSERT(0 == uv_read_start(stream, on_alloc, on_read2)); + + read_cb_called++; +} + +static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread < 0); + + uv_close((uv_handle_t*)stream, NULL); + uv_close((uv_handle_t*)&server, NULL); + + read_cb_called++; +} + +static void on_connection(uv_stream_t* server, int status) { + ASSERT(0 == status); + + ASSERT(0 == uv_tcp_init(server->loop, &connection)); + + ASSERT(0 == uv_accept(server, (uv_stream_t* )&connection)); + + ASSERT(0 == uv_read_start((uv_stream_t*)&connection, on_alloc, on_read1)); +} + +static void on_connect(uv_connect_t* req, int status) { + ASSERT(0 == status); + + do_write((uv_stream_t*)&client, on_write_close_immediately); +} + +TEST_IMPL(tcp_read_stop_start) { + uv_loop_t* loop = uv_default_loop(); + + { /* Server */ + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(loop, &server)); + + ASSERT(0 == uv_tcp_bind(&server, (struct sockaddr*) & addr, 0)); + + ASSERT(0 == uv_listen((uv_stream_t*)&server, 10, on_connection)); + } + + { /* Client */ + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(loop, &client)); + + ASSERT(0 == uv_tcp_connect(&connect_req, &client, + (const struct sockaddr*) & addr, on_connect)); + } + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(read_cb_called >= 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/test/test-test-macros.c b/deps/uv/test/test-test-macros.c new file mode 100644 index 00000000000000..72a3992db5d508 --- /dev/null +++ b/deps/uv/test/test-test-macros.c @@ -0,0 +1,42 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" + +int test_macros_evil(void) { + static int x; + return x++; +} + + +TEST_IMPL(test_macros) { + char* a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + char* b = "ABCDEFGHIJKLMNOPQRSTUVWXYz"; + char* c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + int i; + + i = test_macros_evil(); + ASSERT_STR_NE(a, b); + ASSERT_STR_EQ(a, c); + ASSERT_EQ(i + 1, test_macros_evil()); + ASSERT_EQ(i + 2, test_macros_evil()); + return 0; +} diff --git a/deps/uv/test/test-thread.c b/deps/uv/test/test-thread.c index f53bce0601cea9..432c243999fb15 100644 --- a/deps/uv/test/test-thread.c +++ b/deps/uv/test/test-thread.c @@ -167,6 +167,11 @@ TEST_IMPL(thread_create) { * that each "finished" callback is run in its originating thread. */ TEST_IMPL(threadpool_multiple_event_loops) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + struct test_thread threads[8]; size_t i; int r; diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c index 0c6548f95f38c8..a9d38f22117afd 100644 --- a/deps/uv/test/test-tty.c +++ b/deps/uv/test/test-tty.c @@ -422,6 +422,11 @@ TEST_IMPL(tty_file) { } TEST_IMPL(tty_pty) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + #if defined(__APPLE__) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ diff --git a/deps/uv/test/test-udp-mmsg.c b/deps/uv/test/test-udp-mmsg.c new file mode 100644 index 00000000000000..94e8d5b82b9246 --- /dev/null +++ b/deps/uv/test/test-udp-mmsg.c @@ -0,0 +1,136 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &recver || (uv_udp_t*)(handle) == &sender) + +#define BUFFER_MULTIPLIER 4 +#define MAX_DGRAM_SIZE (64 * 1024) +#define NUM_SENDS 8 +#define EXPECTED_MMSG_ALLOCS (NUM_SENDS / BUFFER_MULTIPLIER) + +static uv_udp_t recver; +static uv_udp_t sender; +static int recv_cb_called; +static int close_cb_called; +static int alloc_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + size_t buffer_size; + CHECK_HANDLE(handle); + + /* Only allocate enough room for multiple dgrams if we can actually recv them */ + buffer_size = MAX_DGRAM_SIZE; + if (uv_udp_using_recvmmsg((uv_udp_t*)handle)) + buffer_size *= BUFFER_MULTIPLIER; + + /* Actually malloc to exercise free'ing the buffer later */ + buf->base = malloc(buffer_size); + ASSERT(buf->base != NULL); + buf->len = buffer_size; + alloc_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + ASSERT(uv_is_closing(handle)); + close_cb_called++; +} + + +static void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + ASSERT_GE(nread, 0); + + if (nread > 0) { + ASSERT_EQ(nread, 4); + ASSERT(addr != NULL); + ASSERT_MEM_EQ("PING", rcvbuf->base, nread); + + recv_cb_called++; + if (recv_cb_called == NUM_SENDS) { + uv_close((uv_handle_t*)handle, close_cb); + uv_close((uv_handle_t*)&sender, close_cb); + } + } + + /* Don't free if the buffer could be reused via mmsg */ + if (rcvbuf && !(flags & UV_UDP_MMSG_CHUNK)) + free(rcvbuf->base); +} + + +TEST_IMPL(udp_mmsg) { + struct sockaddr_in addr; + uv_buf_t buf; + int i; + + ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + ASSERT_EQ(0, uv_udp_init_ex(uv_default_loop(), &recver, + AF_UNSPEC | UV_UDP_RECVMMSG)); + + ASSERT_EQ(0, uv_udp_bind(&recver, (const struct sockaddr*) &addr, 0)); + + ASSERT_EQ(0, uv_udp_recv_start(&recver, alloc_cb, recv_cb)); + + ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT_EQ(0, uv_udp_init(uv_default_loop(), &sender)); + + buf = uv_buf_init("PING", 4); + for (i = 0; i < NUM_SENDS; i++) { + ASSERT_EQ(4, uv_udp_try_send(&sender, &buf, 1, (const struct sockaddr*) &addr)); + } + + ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT_EQ(close_cb_called, 2); + ASSERT_EQ(recv_cb_called, NUM_SENDS); + + ASSERT_EQ(sender.send_queue_size, 0); + ASSERT_EQ(recver.send_queue_size, 0); + + printf("%d allocs for %d recvs\n", alloc_cb_called, recv_cb_called); + + /* On platforms that don't support mmsg, each recv gets its own alloc */ + if (uv_udp_using_recvmmsg(&recver)) + ASSERT_EQ(alloc_cb_called, EXPECTED_MMSG_ALLOCS); + else + ASSERT_EQ(alloc_cb_called, recv_cb_called); + + MAKE_VALGRIND_HAPPY(); + return 0; +} From a69d30eb3f6e955075022a7cf738eeebe1340299 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 26 Aug 2020 09:56:55 -0400 Subject: [PATCH 102/104] module: drop `-u` alias for `--conditions` Old versions of mocha break after https://github.com/nodejs/node/pull/34637. This was a bug in mocha, but since this is a widely used module we can expect ecosystem breakage until modules are updated to the latest version of mocha. Drop the conflicting `-u` alias -- we can potentially bring it back once modules have been updated. PR-URL: https://github.com/nodejs/node/pull/34935 Refs: https://github.com/mochajs/mocha/issues/4417 Refs: https://github.com/nodejs/node/pull/34637 Reviewed-By: Anna Henningsen Reviewed-By: Jan Krems Reviewed-By: Beth Griggs Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig Reviewed-By: Shelley Vohr --- doc/api/cli.md | 4 ++-- doc/node.1 | 2 +- src/node_options.cc | 1 - test/es-module/test-esm-custom-exports.mjs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 6d9969fd361713..ba009b5313f4ae 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -76,7 +76,7 @@ $ node --completion-bash > node_bash_completion $ source node_bash_completion ``` -### `-u`, `--conditions=condition` +### `--conditions=condition` @@ -1214,7 +1214,7 @@ node --require "./a.js" --require "./b.js" Node.js options that are allowed are: -* `--conditions`, `-u` +* `--conditions` * `--diagnostic-dir` * `--disable-proto` * `--enable-fips` diff --git a/doc/node.1 b/doc/node.1 index 7eb877bb1c8b4d..b6b062cd346b5b 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -78,7 +78,7 @@ Aborting instead of exiting causes a core file to be generated for analysis. .It Fl -completion-bash Print source-able bash completion script for Node.js. . -.It Fl u , Fl -conditions Ar string +.It Fl -conditions Ar string Use custom conditional exports conditions .Ar string . diff --git a/src/node_options.cc b/src/node_options.cc index 0cc0b234826600..2854ec072bf1c6 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -285,7 +285,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "additional user conditions for conditional exports and imports", &EnvironmentOptions::conditions, kAllowedInEnvironment); - AddAlias("-u", "--conditions"); AddOption("--diagnostic-dir", "set dir for all output files" " (default: current working directory)", diff --git a/test/es-module/test-esm-custom-exports.mjs b/test/es-module/test-esm-custom-exports.mjs index ad81abfdafd861..cf0557fa44215e 100644 --- a/test/es-module/test-esm-custom-exports.mjs +++ b/test/es-module/test-esm-custom-exports.mjs @@ -1,4 +1,4 @@ -// Flags: --conditions=custom-condition -u another +// Flags: --conditions=custom-condition --conditions another import { mustCall } from '../common/index.mjs'; import { strictEqual } from 'assert'; import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; From cd32522c924e1cda85cd806f8019b15b5b16019e Mon Sep 17 00:00:00 2001 From: Beth Griggs Date: Wed, 26 Aug 2020 22:12:24 +0100 Subject: [PATCH 103/104] doc: add missing DEP ID for 'new crypto.Certificate()' PR-URL: https://github.com/nodejs/node/pull/34940 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- doc/api/deprecations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 24632e364ceeb4..3eb363290b24e6 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2753,8 +2753,8 @@ Type: Documentation-only [`socket.bufferSize`][] is just an alias for [`writable.writableLength`][]. - -### DEP0XXX: `new crypto.Certificate()` + +### DEP0146: `new crypto.Certificate()` > Stability: 1 - Experimental diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 3eb363290b24e6..b540dc00828c6d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2757,7 +2757,7 @@ Type: Documentation-only ### DEP0146: `new crypto.Certificate()` diff --git a/doc/api/timers.md b/doc/api/timers.md index 70c66785bf5a54..f114d0f1766c6e 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -127,7 +127,7 @@ of the Node.js application. ### `timeout[Symbol.toPrimitive]()` * Returns: {integer} number that can be used to reference this `timeout` diff --git a/doc/api/util.md b/doc/api/util.md index bf4bc0e2f62a0a..e39fb08e240a04 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -138,7 +138,7 @@ let debuglog = util.debuglog('internals', (debug) => { ### `debuglog().enabled` * {boolean} @@ -166,7 +166,7 @@ hello from foo [123] ## `util.debug(section)` Alias for `util.debuglog`. Usage allows for readability of that doesn't imply diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index b3562e44022a8d..2a9ce9f2d31be2 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -621,11 +621,11 @@ if (isMainThread) {