From 247119709916970885d0f718feae2a1bcb763e0f Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sat, 7 Dec 2019 19:04:12 +0200 Subject: [PATCH 001/117] http2: wait for session to finish writing before destroy Backport-PR-URL: https://github.com/nodejs/node/pull/34845 PR-URL: https://github.com/nodejs/node/pull/30854 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Rich Trott --- lib/internal/http2/core.js | 14 ++++++-------- src/node_http2.cc | 13 +++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 7515227fa82be4..a7f963f221b326 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1022,6 +1022,8 @@ function emitClose(self, error) { } function finishSessionDestroy(session, error) { + debugSessionObj(session, 'finishSessionDestroy'); + const socket = session[kSocket]; if (!socket.destroyed) socket.destroy(error); @@ -1390,16 +1392,12 @@ class Http2Session extends EventEmitter { const handle = this[kHandle]; // Destroy the handle if it exists at this point - if (handle !== undefined) + if (handle !== undefined) { + handle.ondone = finishSessionDestroy.bind(null, this, error); handle.destroy(code, socket.destroyed); - - // If the socket is alive, use setImmediate to destroy the session on the - // next iteration of the event loop in order to give data time to transmit. - // Otherwise, destroy immediately. - if (!socket.destroyed) - setImmediate(finishSessionDestroy, this, error); - else + } else { finishSessionDestroy(this, error); + } } // Closing the session will: diff --git a/src/node_http2.cc b/src/node_http2.cc index f2b9f40a04c0b4..d317d1f32ccaba 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -693,6 +693,13 @@ void Http2Session::Close(uint32_t code, bool socket_closed) { flags_ |= SESSION_STATE_CLOSED; + // If we are writing we will get to make the callback in OnStreamAfterWrite. + if ((flags_ & SESSION_STATE_WRITE_IN_PROGRESS) == 0) { + Debug(this, "make done session callback"); + HandleScope scope(env()->isolate()); + MakeCallback(env()->ondone_string(), 0, nullptr); + } + // If there are outstanding pings, those will need to be canceled, do // so on the next iteration of the event loop to avoid calling out into // javascript since this may be called during garbage collection. @@ -1530,6 +1537,12 @@ void Http2Session::OnStreamAfterWrite(WriteWrap* w, int status) { stream_->ReadStart(); } + if ((flags_ & SESSION_STATE_CLOSED) != 0) { + HandleScope scope(env()->isolate()); + MakeCallback(env()->ondone_string(), 0, nullptr); + return; + } + // If there is more incoming data queued up, consume it. if (stream_buf_offset_ > 0) { ConsumeHTTP2Data(); From e85ca7af4322a82b00ad3abb045281a90bed3ff8 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sun, 8 Dec 2019 13:23:19 +0200 Subject: [PATCH 002/117] http2: wait for session socket writable end on close/destroy This slightly alters the behaviour of session close by first using .end() on a session socket to finish writing the data and only then calls .destroy() to make sure the Readable side is closed. This allows the socket to finish transmitting data, receive proper FIN packet and avoid ECONNRESET errors upon graceful close. onStreamClose now directly calls stream.destroy() instead of kMaybeDestroy because the latter will first check that the stream has writableFinished set. And that may not be true as we have just (synchronously) called .end() on the stream if it was not closed and that doesn't give it enough time to finish. Furthermore there is no point in waiting for 'finish' as the other party have already closed the stream and we won't be able to write anyway. This also changes a few tests to correctly handle graceful session close. This includes: * not reading request data (on client side) * not reading push stream data (on client side) * relying on socket.destroy() (on client) to finish server session due to the destroy of the socket without closing the server session. As the goaway itself is *not* a session close. Added few 'close' event mustCall checks. Backport-PR-URL: https://github.com/nodejs/node/pull/34845 PR-URL: https://github.com/nodejs/node/pull/30854 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Rich Trott --- lib/internal/http2/core.js | 107 ++++++++++++------ src/node_http2.cc | 2 +- test/parallel/test-http2-capture-rejection.js | 2 +- test/parallel/test-http2-client-destroy.js | 1 + ...p2-client-stream-destroy-before-connect.js | 9 +- .../test-http2-compat-client-upload-reject.js | 2 + .../test-http2-create-client-connect.js | 4 +- test/parallel/test-http2-goaway-opaquedata.js | 8 +- .../test-http2-ping-settings-heapdump.js | 9 +- .../parallel/test-http2-server-push-stream.js | 2 + 10 files changed, 101 insertions(+), 45 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index a7f963f221b326..acdf8e8e03cd4b 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -501,7 +501,10 @@ function onStreamClose(code) { if (!stream || stream.destroyed) return false; - debugStreamObj(stream, 'closed with code %d', code); + debugStreamObj( + stream, 'closed with code %d, closed %s, readable %s', + code, stream.closed, stream.readable + ); if (!stream.closed) closeStream(stream, code, kNoRstStream); @@ -510,7 +513,7 @@ function onStreamClose(code) { // Defer destroy we actually emit end. if (!stream.readable || code !== NGHTTP2_NO_ERROR) { // If errored or ended, we can destroy immediately. - stream[kMaybeDestroy](code); + stream.destroy(); } else { // Wait for end to destroy. stream.on('end', stream[kMaybeDestroy]); @@ -1021,22 +1024,76 @@ function emitClose(self, error) { self.emit('close'); } -function finishSessionDestroy(session, error) { - debugSessionObj(session, 'finishSessionDestroy'); - +function cleanupSession(session) { const socket = session[kSocket]; - if (!socket.destroyed) - socket.destroy(error); - + const handle = session[kHandle]; session[kProxySocket] = undefined; session[kSocket] = undefined; session[kHandle] = undefined; session[kNativeFields] = new Uint8Array(kSessionUint8FieldCount); - socket[kSession] = undefined; - socket[kServer] = undefined; + if (handle) + handle.ondone = null; + if (socket) { + socket[kSession] = undefined; + socket[kServer] = undefined; + } +} + +function finishSessionClose(session, error) { + debugSessionObj(session, 'finishSessionClose'); + + const socket = session[kSocket]; + cleanupSession(session); + + if (socket && !socket.destroyed) { + // Always wait for writable side to finish. + socket.end((err) => { + debugSessionObj(session, 'finishSessionClose socket end', err); + // Due to the way the underlying stream is handled in Http2Session we + // won't get graceful Readable end from the other side even if it was sent + // as the stream is already considered closed and will neither be read + // from nor keep the event loop alive. + // Therefore destroy the socket immediately. + // Fixing this would require some heavy juggling of ReadStart/ReadStop + // mostly on Windows as on Unix it will be fine with just ReadStart + // after this 'ondone' callback. + socket.destroy(error); + emitClose(session, error); + }); + } else { + process.nextTick(emitClose, session, error); + } +} + +function closeSession(session, code, error) { + debugSessionObj(session, 'start closing/destroying'); + + const state = session[kState]; + state.flags |= SESSION_FLAGS_DESTROYED; + state.destroyCode = code; + + // Clear timeout and remove timeout listeners. + session.setTimeout(0); + session.removeAllListeners('timeout'); + + // Destroy any pending and open streams + if (state.pendingStreams.size > 0 || state.streams.size > 0) { + const cancel = new ERR_HTTP2_STREAM_CANCEL(error); + state.pendingStreams.forEach((stream) => stream.destroy(cancel)); + state.streams.forEach((stream) => stream.destroy(error)); + } - // Finally, emit the close and error events (if necessary) on next tick. - process.nextTick(emitClose, session, error); + // Disassociate from the socket and server. + const socket = session[kSocket]; + const handle = session[kHandle]; + + // Destroy the handle if it exists at this point. + if (handle !== undefined) { + handle.ondone = finishSessionClose.bind(null, session, error); + handle.destroy(code, socket.destroyed); + } else { + finishSessionClose(session, error); + } } // Upon creation, the Http2Session takes ownership of the socket. The session @@ -1363,6 +1420,7 @@ class Http2Session extends EventEmitter { destroy(error = NGHTTP2_NO_ERROR, code) { if (this.destroyed) return; + debugSessionObj(this, 'destroying'); if (typeof error === 'number') { @@ -1374,30 +1432,7 @@ class Http2Session extends EventEmitter { if (code === undefined && error != null) code = NGHTTP2_INTERNAL_ERROR; - const state = this[kState]; - state.flags |= SESSION_FLAGS_DESTROYED; - state.destroyCode = code; - - // Clear timeout and remove timeout listeners - this.setTimeout(0); - this.removeAllListeners('timeout'); - - // Destroy any pending and open streams - const cancel = new ERR_HTTP2_STREAM_CANCEL(error); - state.pendingStreams.forEach((stream) => stream.destroy(cancel)); - state.streams.forEach((stream) => stream.destroy(error)); - - // Disassociate from the socket and server - const socket = this[kSocket]; - const handle = this[kHandle]; - - // Destroy the handle if it exists at this point - if (handle !== undefined) { - handle.ondone = finishSessionDestroy.bind(null, this, error); - handle.destroy(code, socket.destroyed); - } else { - finishSessionDestroy(this, error); - } + closeSession(this, code, error); } // Closing the session will: diff --git a/src/node_http2.cc b/src/node_http2.cc index d317d1f32ccaba..76ef72005a3087 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1827,7 +1827,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { Context::Scope context_scope(env()->context()); Http2Scope h2scope(this); CHECK_NOT_NULL(stream_); - Debug(this, "receiving %d bytes", nread); + Debug(this, "receiving %d bytes, offset %d", nread, stream_buf_offset_); AllocatedBuffer buf(env(), buf_); // Only pass data on if nread > 0 diff --git a/test/parallel/test-http2-capture-rejection.js b/test/parallel/test-http2-capture-rejection.js index 58f43581eb6bd3..4469c6b7e64d20 100644 --- a/test/parallel/test-http2-capture-rejection.js +++ b/test/parallel/test-http2-capture-rejection.js @@ -72,7 +72,6 @@ events.captureRejections = true; })); } - { // Test error thrown in 'request' event @@ -136,6 +135,7 @@ events.captureRejections = true; const session = connect(`http://localhost:${port}`); const req = session.request(); + req.resume(); session.on('stream', common.mustCall(async (stream) => { session.close(); diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js index 35ee20723c15b7..88850b9db51ccc 100644 --- a/test/parallel/test-http2-client-destroy.js +++ b/test/parallel/test-http2-client-destroy.js @@ -145,6 +145,7 @@ const Countdown = require('../common/countdown'); server.on('stream', common.mustNotCall()); server.listen(0, common.mustCall(() => { const client = h2.connect(`http://localhost:${server.address().port}`); + client.on('close', common.mustCall()); const socket = client[kSocket]; socket.on('close', common.mustCall(() => { assert(socket.destroyed); diff --git a/test/parallel/test-http2-client-stream-destroy-before-connect.js b/test/parallel/test-http2-client-stream-destroy-before-connect.js index 902657bd58fb3e..09667750ae16fd 100644 --- a/test/parallel/test-http2-client-stream-destroy-before-connect.js +++ b/test/parallel/test-http2-client-stream-destroy-before-connect.js @@ -6,6 +6,7 @@ if (!common.hasCrypto) const assert = require('assert'); const h2 = require('http2'); const NGHTTP2_INTERNAL_ERROR = h2.constants.NGHTTP2_INTERNAL_ERROR; +const Countdown = require('../common/countdown'); const server = h2.createServer(); @@ -27,6 +28,11 @@ server.on('stream', (stream) => { server.listen(0, common.mustCall(() => { const client = h2.connect(`http://localhost:${server.address().port}`); + const countdown = new Countdown(2, () => { + server.close(); + client.close(); + }); + client.on('connect', () => countdown.dec()); const req = client.request(); req.destroy(new Error('test')); @@ -39,8 +45,7 @@ server.listen(0, common.mustCall(() => { req.on('close', common.mustCall(() => { assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); - server.close(); - client.close(); + countdown.dec(); })); req.on('response', common.mustNotCall()); diff --git a/test/parallel/test-http2-compat-client-upload-reject.js b/test/parallel/test-http2-compat-client-upload-reject.js index e6a187cb12b264..6e3fee2e7c2ce3 100644 --- a/test/parallel/test-http2-compat-client-upload-reject.js +++ b/test/parallel/test-http2-compat-client-upload-reject.js @@ -23,9 +23,11 @@ fs.readFile(loc, common.mustCall((err, data) => { res.end(); }); })); + server.on('close', common.mustCall()); server.listen(0, common.mustCall(() => { const client = http2.connect(`http://localhost:${server.address().port}`); + client.on('close', common.mustCall()); const req = client.request({ ':method': 'POST' }); req.on('response', common.mustCall((headers) => { diff --git a/test/parallel/test-http2-create-client-connect.js b/test/parallel/test-http2-create-client-connect.js index 02c6c70642acb0..8a4fc9a1d0e075 100644 --- a/test/parallel/test-http2-create-client-connect.js +++ b/test/parallel/test-http2-create-client-connect.js @@ -38,11 +38,13 @@ const URL = url.URL; const client = h2.connect.apply(null, i) .on('connect', common.mustCall(() => maybeClose(client))); + client.on('close', common.mustCall()); }); // Will fail because protocol does not match the server. - h2.connect({ port: port, protocol: 'https:' }) + const client = h2.connect({ port: port, protocol: 'https:' }) .on('error', common.mustCall(() => serverClose.dec())); + client.on('close', common.mustCall()); })); } diff --git a/test/parallel/test-http2-goaway-opaquedata.js b/test/parallel/test-http2-goaway-opaquedata.js index 3f1fb4d7954414..56c0ae168c0c8b 100644 --- a/test/parallel/test-http2-goaway-opaquedata.js +++ b/test/parallel/test-http2-goaway-opaquedata.js @@ -8,20 +8,24 @@ const http2 = require('http2'); const server = http2.createServer(); const data = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); +let session; server.on('stream', common.mustCall((stream) => { - stream.session.goaway(0, 0, data); + session = stream.session; + session.on('close', common.mustCall()); + session.goaway(0, 0, data); stream.respond(); stream.end(); })); +server.on('close', common.mustCall()); server.listen(0, () => { - const client = http2.connect(`http://localhost:${server.address().port}`); client.once('goaway', common.mustCall((code, lastStreamID, buf) => { assert.deepStrictEqual(code, 0); assert.deepStrictEqual(lastStreamID, 1); assert.deepStrictEqual(data, buf); + session.close(); server.close(); })); const req = client.request(); diff --git a/test/parallel/test-http2-ping-settings-heapdump.js b/test/parallel/test-http2-ping-settings-heapdump.js index 78b3c8cd74f506..7d27310700c7a8 100644 --- a/test/parallel/test-http2-ping-settings-heapdump.js +++ b/test/parallel/test-http2-ping-settings-heapdump.js @@ -30,7 +30,12 @@ for (const variant of ['ping', 'settings']) { })); server.listen(0, common.mustCall(() => { - http2.connect(`http://localhost:${server.address().port}`, - common.mustCall()); + const client = http2.connect(`http://localhost:${server.address().port}`, + common.mustCall()); + client.on('error', (err) => { + // We destroy the session so it's possible to get ECONNRESET here. + if (err.code !== 'ECONNRESET') + throw err; + }); })); } diff --git a/test/parallel/test-http2-server-push-stream.js b/test/parallel/test-http2-server-push-stream.js index 95dd065bde9dd3..43e0e8d9320928 100644 --- a/test/parallel/test-http2-server-push-stream.js +++ b/test/parallel/test-http2-server-push-stream.js @@ -55,6 +55,8 @@ server.listen(0, common.mustCall(() => { assert.strictEqual(headers['x-push-data'], 'pushed by server'); })); stream.on('aborted', common.mustNotCall()); + // We have to read the data of the push stream to end gracefully. + stream.resume(); })); let data = ''; From 82af8acc8e8b99f8b50401ffe977113fbe033b9e Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Mon, 27 Apr 2020 03:15:07 +0200 Subject: [PATCH 003/117] http2,doc: minor fixes Some small fixes on HTTP/2 and its documentation: - Add a note that, on server streams, it's not necessary to start data flow. - Set EOF flag if we have marked all data for sending: there's no need to wait until the queue is actually empty (and send a separate, empty DATA). (Note that, even with this change, a separate DATA frame will always be sent, because the streams layer waits until data has been flushed before dispatching EOF) Backport-PR-URL: https://github.com/nodejs/node/pull/34845 PR-URL: https://github.com/nodejs/node/pull/28044 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen --- doc/api/http2.md | 5 +++-- src/node_http2.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 00837bfc0e413b..219a837c06d12f 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -927,8 +927,9 @@ the value is `undefined`, the stream is not yet ready for use. All [`Http2Stream`][] instances are destroyed either when: * An `RST_STREAM` frame for the stream is received by the connected peer, - and pending data has been read. -* The `http2stream.close()` method is called, and pending data has been read. + and (for client streams only) pending data has been read. +* The `http2stream.close()` method is called, and (for client streams only) + pending data has been read. * The `http2stream.destroy()` or `http2session.destroy()` methods are called. When an `Http2Stream` instance is destroyed, an attempt will be made to send an diff --git a/src/node_http2.cc b/src/node_http2.cc index 76ef72005a3087..566a1b7c55c3f5 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2367,7 +2367,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle, return NGHTTP2_ERR_DEFERRED; } - if (stream->queue_.empty() && !stream->IsWritable()) { + if (stream->available_outbound_length_ == 0 && !stream->IsWritable()) { Debug(session, "no more data for stream %d", id); *flags |= NGHTTP2_DATA_FLAG_EOF; if (stream->HasTrailers()) { From bfce0eb13aa3a317d471389139d1d806f2418a87 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 11 Jul 2020 16:17:31 -0700 Subject: [PATCH 004/117] Revert "http2: streamline OnStreamRead streamline memory accounting" This reverts commit 51ccf1b5e90540a11c33866da15d4a7f52d7fddb. Fixes: https://github.com/nodejs/node/issues/31089 Backport-PR-URL: https://github.com/nodejs/node/pull/34845 PR-URL: https://github.com/nodejs/node/pull/34315 Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Denys Otrishko --- src/node_http2.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 566a1b7c55c3f5..bc6adf793d0a22 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1840,11 +1840,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { statistics_.data_received += nread; - if (LIKELY(stream_buf_offset_ == 0)) { - // Shrink to the actual amount of used data. - buf.Resize(nread); - IncrementCurrentSessionMemory(nread); - } else { + if (UNLIKELY(stream_buf_offset_ > 0)) { // This is a very unlikely case, and should only happen if the ReadStart() // call in OnStreamAfterWrite() immediately provides data. If that does // happen, we concatenate the data we received with the already-stored @@ -1854,17 +1850,20 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { memcpy(new_buf.data(), stream_buf_.base + stream_buf_offset_, pending_len); memcpy(new_buf.data() + pending_len, buf.data(), nread); - // The data in stream_buf_ is already accounted for, add nread received - // bytes to session memory but remove the already processed - // stream_buf_offset_ bytes. - IncrementCurrentSessionMemory(nread - stream_buf_offset_); - buf = std::move(new_buf); nread = buf.size(); stream_buf_offset_ = 0; stream_buf_ab_.Reset(); + + // We have now fully processed the stream_buf_ input chunk (by moving the + // remaining part into buf, which will be accounted for below). + DecrementCurrentSessionMemory(stream_buf_.len); } + // Shrink to the actual amount of used data. + buf.Resize(nread); + IncrementCurrentSessionMemory(nread); + // Remember the current buffer, so that OnDataChunkReceived knows the // offset of a DATA frame's data into the socket read buffer. stream_buf_ = uv_buf_init(buf.data(), nread); From b732c92e3db554bc954adfb95965e09bb61a4076 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sun, 14 Jun 2020 11:10:32 -0400 Subject: [PATCH 005/117] 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 Backport-PR-URL: https://github.com/nodejs/node/pull/34845 PR-URL: https://github.com/nodejs/node/pull/33875 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- lib/internal/http2/core.js | 106 ++++++++++++++---- 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, 193 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 acdf8e8e03cd4b..7e77ac61cca2e7 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1158,6 +1158,7 @@ class Http2Session extends EventEmitter { streams: new Map(), pendingStreams: new Set(), pendingAck: 0, + shutdownWritableCalled: false, writeQueueSize: 0, originSet: undefined }; @@ -1724,6 +1725,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 v12.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. @@ -1983,10 +2004,50 @@ 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 || + // Backport v12.x: _writableState.buffered does not exist + // this._writableState.buffered.length || + this._writableState.bufferedRequest || + (this[kState].flags & STREAM_FLAGS_HAS_TRAILERS)) + return endCheckCallback(); + // Backport v12.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); } @@ -2000,21 +2061,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 v12.x: Session required for debugging stream object + // debugStreamObj(this, 'shutting down writable on _final'); + shutdownWritable.call(this, cb); } _read(nread) { @@ -2119,11 +2172,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) @@ -2132,13 +2194,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 bc6adf793d0a22..ee084a11ea18e5 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -811,7 +811,7 @@ ssize_t Http2Session::OnCallbackPadding(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. @@ -832,11 +832,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. @@ -1174,6 +1174,7 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle, if (session->flags_ & SESSION_STATE_WRITE_IN_PROGRESS) { CHECK_NE(session->flags_ & SESSION_STATE_READING_STOPPED, 0); session->flags_ |= SESSION_STATE_NGHTTP2_RECV_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 183eaef7389360..88b321b55d1da5 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 f10d7217377d9db56a7a4d77c327f31964dad388 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 31 Jul 2020 14:42:39 +0200 Subject: [PATCH 006/117] http: reset headers timeout on headers complete headers timeout should not occur *after* headers have been received. Fixes: https://github.com/nodejs/node/issues/35661 PR-URL: https://github.com/nodejs/node/pull/34578 Backport-PR-URL: https://github.com/nodejs/node/pull/35819 Reviewed-By: Anna Henningsen Reviewed-By: Fedor Indutny Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Pranshu Srivastava (cherry picked from commit da4d8de9d09f98e6d81b9d5778fa44c26c25ec75) --- src/node_http_parser_impl.h | 1 + .../test-http-parser-timeout-reset.js | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 test/parallel/test-http-parser-timeout-reset.js diff --git a/src/node_http_parser_impl.h b/src/node_http_parser_impl.h index 22aebad0057b71..7c39bc15c72a38 100644 --- a/src/node_http_parser_impl.h +++ b/src/node_http_parser_impl.h @@ -265,6 +265,7 @@ class Parser : public AsyncWrap, public StreamListener { #ifdef NODE_EXPERIMENTAL_HTTP header_nread_ = 0; #endif /* NODE_EXPERIMENTAL_HTTP */ + header_parsing_start_time_ = 0; // Arguments for the on-headers-complete javascript callback. This // list needs to be kept in sync with the actual argument list for diff --git a/test/parallel/test-http-parser-timeout-reset.js b/test/parallel/test-http-parser-timeout-reset.js new file mode 100644 index 00000000000000..e395c1c4573030 --- /dev/null +++ b/test/parallel/test-http-parser-timeout-reset.js @@ -0,0 +1,44 @@ +'use strict'; +const common = require('../common'); + +const net = require('net'); +const { HTTPParser } = process.binding('http_parser'); + +const server = net.createServer((socket) => { + socket.write('HTTP/1.1 200 OK\r\n'); + socket.write('Transfer-Encoding: chunked\r\n\r\n'); + setTimeout(() => { + socket.write('1\r\n'); + socket.write('\n\r\n'); + setTimeout(() => { + socket.write('1\r\n'); + socket.write('\n\r\n'); + setImmediate(() => { + socket.destroy(); + server.close(); + }); + }, 500); + }, 500); +}).listen(0, () => { + const socket = net.connect(server.address().port); + const parser = new HTTPParser(HTTPParser.RESPONSE, false); + parser.initialize( + HTTPParser.RESPONSE, + {}, + 1e3 + ); + + parser[HTTPParser.kOnTimeout] = common.mustNotCall(); + + parser[HTTPParser.kOnHeaders] = common.mustNotCall(); + + parser[HTTPParser.kOnExecute] = common.mustCallAtLeast(3); + + parser[HTTPParser.kOnHeadersComplete] = common.mustCall(); + + parser[HTTPParser.kOnBody] = common.mustCall(2); + + parser[HTTPParser.kOnMessageComplete] = common.mustNotCall(); + + parser.consume(socket._handle); +}); From fb9b66bdd7fb56435019d5315c675cfacc793b8b Mon Sep 17 00:00:00 2001 From: Jucke Date: Sat, 18 Jul 2020 15:00:36 +0100 Subject: [PATCH 007/117] doc: fix typos in n-api, tls and worker_threads PR-URL: https://github.com/nodejs/node/pull/34419 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen --- doc/api/n-api.md | 2 +- doc/api/tls.md | 6 +++--- doc/api/worker_threads.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 75f0c6ac83a620..38f5983868cf74 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -131,7 +131,7 @@ the native addon will also need to have a C/C++ toolchain installed. For Linux developers, the necessary C/C++ toolchain packages are readily available. [GCC][] is widely used in the Node.js community to build and -test across a variety of plarforms. For many developers, the [LLVM][] +test across a variety of platforms. For many developers, the [LLVM][] compiler infrastructure is also a good choice. For Mac developers, [Xcode][] offers all the required compiler tools. diff --git a/doc/api/tls.md b/doc/api/tls.md index 12d724e4d48f78..c9fabbc5b59cf9 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -85,8 +85,8 @@ all sessions). Methods implementing this technique are called "ephemeral". Currently two methods are commonly used to achieve perfect forward secrecy (note the character "E" appended to the traditional abbreviations): -* [DHE][]: An ephemeral version of the Diffie Hellman key-agreement protocol. -* [ECDHE][]: An ephemeral version of the Elliptic Curve Diffie Hellman +* [DHE][]: An ephemeral version of the Diffie-Hellman key-agreement protocol. +* [ECDHE][]: An ephemeral version of the Elliptic Curve Diffie-Hellman key-agreement protocol. Ephemeral methods may have some performance drawbacks, because key generation @@ -1617,7 +1617,7 @@ changes: client certificate. * `crl` {string|string[]|Buffer|Buffer[]} PEM formatted CRLs (Certificate Revocation Lists). - * `dhparam` {string|Buffer} Diffie Hellman parameters, required for + * `dhparam` {string|Buffer} Diffie-Hellman parameters, required for [perfect forward secrecy][]. Use `openssl dhparam` to create the parameters. The key length must be greater than or equal to 1024 bits or else an error will be thrown. Although 1024 bits is permissible, use 2048 bits or larger diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 864fcca225017e..ad29a54a3ed259 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -110,7 +110,7 @@ const { port1 } = new MessageChannel(); port1.postMessage(typedArray1, [ typedArray1.buffer ]); // The following line prints the contents of typedArray1 -- it still owns its -// memory and has been cloned, not transfered. Without `markAsUntransferable()`, +// memory and has been cloned, not transferred. Without `markAsUntransferable()`, // this would print an empty Uint8Array. typedArray2 is intact as well. console.log(typedArray1); console.log(typedArray2); From b644ab6ae685404a130217e6f4ec8b033f9077f8 Mon Sep 17 00:00:00 2001 From: Jucke Date: Sat, 18 Jul 2020 15:26:54 +0100 Subject: [PATCH 008/117] doc: fix line length in worker_threads.md PR-URL: https://github.com/nodejs/node/pull/34419 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen --- doc/api/worker_threads.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index ad29a54a3ed259..ab016f66732ac5 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -109,9 +109,10 @@ markAsUntransferable(pooledBuffer); const { port1 } = new MessageChannel(); port1.postMessage(typedArray1, [ typedArray1.buffer ]); -// The following line prints the contents of typedArray1 -- it still owns its -// memory and has been cloned, not transferred. Without `markAsUntransferable()`, -// this would print an empty Uint8Array. typedArray2 is intact as well. +// The following line prints the contents of typedArray1 -- it still owns +// its memory and has been cloned, not transferred. Without +// `markAsUntransferable()`, this would print an empty Uint8Array. +// typedArray2 is intact as well. console.log(typedArray1); console.log(typedArray2); ``` From c8a778985bdf79ce5aa79c0d2561d72b017b64c5 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 22 Jul 2020 19:18:28 +0300 Subject: [PATCH 009/117] http2: avoid unnecessary buffer resize Refs: https://github.com/nodejs/node/pull/34315 Refs: https://github.com/nodejs/node/pull/30351 PR-URL: https://github.com/nodejs/node/pull/34480 Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: David Carlier --- src/node_http2.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index ee084a11ea18e5..ba39610d64cbac 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1841,7 +1841,10 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { statistics_.data_received += nread; - if (UNLIKELY(stream_buf_offset_ > 0)) { + if (LIKELY(stream_buf_offset_ == 0)) { + // Shrink to the actual amount of used data. + buf.Resize(nread); + } else { // This is a very unlikely case, and should only happen if the ReadStart() // call in OnStreamAfterWrite() immediately provides data. If that does // happen, we concatenate the data we received with the already-stored @@ -1861,8 +1864,6 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { DecrementCurrentSessionMemory(stream_buf_.len); } - // Shrink to the actual amount of used data. - buf.Resize(nread); IncrementCurrentSessionMemory(nread); // Remember the current buffer, so that OnDataChunkReceived knows the From 70768ce109972c8b2f0278779b0e5b944ff30edf Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Tue, 14 Jul 2020 16:31:29 -0500 Subject: [PATCH 010/117] repl: give repl entries unique names This is a workaround for the REPL for a problem when multiple of the entries have the same source text Fixes: https://github.com/nodejs/node/issues/1337 Refs: https://bugs.chromium.org/p/v8/issues/detail?id=10284 PR-URL: https://github.com/nodejs/node/pull/34372 Reviewed-By: Ruben Bridgewater Reviewed-By: Anto Aravinth --- lib/repl.js | 14 +++++++++---- test/parallel/test-repl-dynamic-import.js | 20 +++++++++++++++++++ .../parallel/test-repl-pretty-custom-stack.js | 12 +++++------ test/parallel/test-repl-pretty-stack.js | 14 ++++++------- 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 test/parallel/test-repl-dynamic-import.js diff --git a/lib/repl.js b/lib/repl.js index 2c0dcc7757a70e..a37e8e0be7bab2 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -124,6 +124,12 @@ const { } = internalBinding('contextify'); const history = require('internal/repl/history'); +let nextREPLResourceNumber = 1; +// This prevents v8 code cache from getting confused and using a different +// cache from a resource of the same name +function getREPLResourceName() { + return `REPL${nextREPLResourceNumber++}`; +} // Lazy-loaded. let processTopLevelAwait; @@ -541,10 +547,10 @@ function REPLServer(prompt, if (e.name === 'SyntaxError') { // Remove stack trace. e.stack = e.stack - .replace(/^repl:\d+\r?\n/, '') + .replace(/^REPL\d+:\d+\r?\n/, '') .replace(/^\s+at\s.*\n?/gm, ''); } else if (self.replMode === exports.REPL_MODE_STRICT) { - e.stack = e.stack.replace(/(\s+at\s+repl:)(\d+)/, + e.stack = e.stack.replace(/(\s+at\s+REPL\d+:)(\d+)/, (_, pre, line) => pre + (line - 1)); } } @@ -759,7 +765,7 @@ function REPLServer(prompt, const evalCmd = self[kBufferedCommandSymbol] + cmd + '\n'; debug('eval %j', evalCmd); - self.eval(evalCmd, self.context, 'repl', finish); + self.eval(evalCmd, self.context, getREPLResourceName(), finish); function finish(e, ret) { debug('finish', e, ret); @@ -1275,7 +1281,7 @@ function complete(line, callback) { } const evalExpr = `try { ${expr} } catch {}`; - this.eval(evalExpr, this.context, 'repl', (e, obj) => { + this.eval(evalExpr, this.context, getREPLResourceName(), (e, obj) => { if (obj != null) { if (typeof obj === 'object' || typeof obj === 'function') { try { diff --git a/test/parallel/test-repl-dynamic-import.js b/test/parallel/test-repl-dynamic-import.js new file mode 100644 index 00000000000000..1f7a01575aa89b --- /dev/null +++ b/test/parallel/test-repl-dynamic-import.js @@ -0,0 +1,20 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); +const child = child_process.spawn(process.execPath, [ + '--interactive', + '--expose-gc' +], { + stdio: 'pipe' +}); +child.stdin.write('\nimport("fs");\n_.then(gc);\n'); +// Wait for concurrent GC to finish +setTimeout(() => { + child.stdin.write('\nimport("fs");\n'); + child.stdin.write('\nprocess.exit(0);\n'); +}, common.platformTimeout(50)); +child.on('exit', (code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); +}); diff --git a/test/parallel/test-repl-pretty-custom-stack.js b/test/parallel/test-repl-pretty-custom-stack.js index 8f633a4d4808c5..d04a394a2e249e 100644 --- a/test/parallel/test-repl-pretty-custom-stack.js +++ b/test/parallel/test-repl-pretty-custom-stack.js @@ -5,7 +5,7 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const repl = require('repl'); -const stackRegExp = /repl:[0-9]+:[0-9]+/g; +const stackRegExp = /(REPL\d+):[0-9]+:[0-9]+/g; function run({ command, expected }) { let accum = ''; @@ -25,8 +25,8 @@ function run({ command, expected }) { r.write(`${command}\n`); assert.strictEqual( - accum.replace(stackRegExp, 'repl:*:*'), - expected.replace(stackRegExp, 'repl:*:*') + accum.replace(stackRegExp, '$1:*:*'), + expected.replace(stackRegExp, '$1:*:*') ); r.close(); } @@ -48,8 +48,8 @@ const tests = [ { // test .load for a file that throws command: `.load ${fixtures.path('repl-pretty-stack.js')}`, - expected: 'Uncaught Error: Whoops!--->\nrepl:*:*--->\nd (repl:*:*)' + - '--->\nc (repl:*:*)--->\nb (repl:*:*)--->\na (repl:*:*)\n' + expected: 'Uncaught Error: Whoops!--->\nREPL1:*:*--->\nd (REPL1:*:*)' + + '--->\nc (REPL1:*:*)--->\nb (REPL1:*:*)--->\na (REPL1:*:*)\n' }, { command: 'let x y;', @@ -67,7 +67,7 @@ const tests = [ // test anonymous IIFE { command: '(function() { throw new Error(\'Whoops!\'); })()', - expected: 'Uncaught Error: Whoops!--->\nrepl:*:*\n' + expected: 'Uncaught Error: Whoops!--->\nREPL5:*:*\n' } ]; diff --git a/test/parallel/test-repl-pretty-stack.js b/test/parallel/test-repl-pretty-stack.js index 456e866b7b20f9..8ab3fef2aaa033 100644 --- a/test/parallel/test-repl-pretty-stack.js +++ b/test/parallel/test-repl-pretty-stack.js @@ -5,7 +5,7 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const repl = require('repl'); -const stackRegExp = /(at .*repl:)[0-9]+:[0-9]+/g; +const stackRegExp = /(at .*REPL\d+:)[0-9]+:[0-9]+/g; function run({ command, expected, ...extraREPLOptions }, i) { let accum = ''; @@ -37,9 +37,9 @@ const tests = [ { // Test .load for a file that throws. command: `.load ${fixtures.path('repl-pretty-stack.js')}`, - expected: 'Uncaught Error: Whoops!\n at repl:*:*\n' + - ' at d (repl:*:*)\n at c (repl:*:*)\n' + - ' at b (repl:*:*)\n at a (repl:*:*)\n' + expected: 'Uncaught Error: Whoops!\n at REPL1:*:*\n' + + ' at d (REPL1:*:*)\n at c (REPL1:*:*)\n' + + ' at b (REPL1:*:*)\n at a (REPL1:*:*)\n' }, { command: 'let x y;', @@ -53,12 +53,12 @@ const tests = [ { command: '(() => { const err = Error(\'Whoops!\'); ' + 'err.foo = \'bar\'; throw err; })()', - expected: "Uncaught Error: Whoops!\n at repl:*:* {\n foo: 'bar'\n}\n", + expected: "Uncaught Error: Whoops!\n at REPL4:*:* {\n foo: 'bar'\n}\n", }, { command: '(() => { const err = Error(\'Whoops!\'); ' + 'err.foo = \'bar\'; throw err; })()', - expected: 'Uncaught Error: Whoops!\n at repl:*:* {\n foo: ' + + expected: 'Uncaught Error: Whoops!\n at REPL5:*:* {\n foo: ' + "\u001b[32m'bar'\u001b[39m\n}\n", useColors: true }, @@ -69,7 +69,7 @@ const tests = [ // Test anonymous IIFE. { command: '(function() { throw new Error(\'Whoops!\'); })()', - expected: 'Uncaught Error: Whoops!\n at repl:*:*\n' + expected: 'Uncaught Error: Whoops!\n at REPL7:*:*\n' } ]; From 12d76b8e8ef830f2137d8b192f082624b602e18e Mon Sep 17 00:00:00 2001 From: David Halls Date: Sat, 2 May 2020 07:42:26 +0100 Subject: [PATCH 011/117] tls: reset secureConnecting on client socket secureConnecting is never set to false on client TLS sockets. So if Http2Session constructor (in lib/internal/http2/core.js) is called after secureConnect is emitted, then it will wrongly wait for a secureConnect event. This fix sets secureConnecting to false when a client TLS socket has connected. Backport-PR-URL: https://github.com/nodejs/node/pull/34859 PR-URL: https://github.com/nodejs/node/pull/33209 Reviewed-By: Luigi Pinca Reviewed-By: Sam Roberts --- lib/_tls_wrap.js | 2 ++ test/parallel/test-http2-connect.js | 34 ++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 154d6a0a1fd9ea..1982261b80e86b 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1523,10 +1523,12 @@ function onConnectSecure() { debug('client emit secureConnect. rejectUnauthorized: %s, ' + 'authorizationError: %s', options.rejectUnauthorized, this.authorizationError); + this.secureConnecting = false; this.emit('secureConnect'); } else { this.authorized = true; debug('client emit secureConnect. authorized:', this.authorized); + this.secureConnecting = false; this.emit('secureConnect'); } diff --git a/test/parallel/test-http2-connect.js b/test/parallel/test-http2-connect.js index 6f62f55a93b7f2..9ee2e4347f600b 100644 --- a/test/parallel/test-http2-connect.js +++ b/test/parallel/test-http2-connect.js @@ -9,9 +9,11 @@ const { } = require('../common'); if (!hasCrypto) skip('missing crypto'); +const fixtures = require('../common/fixtures'); const assert = require('assert'); -const { createServer, connect } = require('http2'); +const { createServer, createSecureServer, connect } = require('http2'); const { connect: netConnect } = require('net'); +const { connect: tlsConnect } = require('tls'); // Check for session connect callback and event { @@ -70,6 +72,36 @@ const { connect: netConnect } = require('net'); connect(authority).on('error', () => {}); } +// Check for session connect callback on already connected TLS socket +{ + const serverOptions = { + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') + }; + const server = createSecureServer(serverOptions); + server.listen(0, mustCall(() => { + const { port } = server.address(); + + const onSocketConnect = () => { + const authority = `https://localhost:${port}`; + const createConnection = mustCall(() => socket); + const options = { createConnection }; + connect(authority, options, mustCall(onSessionConnect)); + }; + + const onSessionConnect = (session) => { + session.close(); + server.close(); + }; + + const clientOptions = { + port, + rejectUnauthorized: false + }; + const socket = tlsConnect(clientOptions, mustCall(onSocketConnect)); + })); +} + // Check for error for init settings error { createServer(function() { From 02787ce5d1605e2360ecc50c0b46b9e45463a6fb Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 3 Oct 2020 19:32:32 +0200 Subject: [PATCH 012/117] test: add ALPNProtocols option to clientOptions Without this, the session is destroyed with the following error ``` Error [ERR_HTTP2_ERROR]: Protocol error at Http2Session.onSessionInternalError (internal/http2/core.js:756:26) Emitted 'error' event on ClientHttp2Session instance at: at emitClose (internal/http2/core.js:1010:10) at internal/http2/core.js:1048:7 at finish (internal/streams/writable.js:731:5) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'ERR_HTTP2_ERROR', errno: -505 } ``` The test then calls `session.close()` which tries to write to a destroyed socket. As a result, an unhandled `ECONNRESET` error is emitted in the v12 release line. Backport-PR-URL: https://github.com/nodejs/node/pull/34859 PR-URL: https://github.com/nodejs/node/pull/35482 Refs: https://github.com/nodejs/node/pull/34859 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-http2-connect.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-http2-connect.js b/test/parallel/test-http2-connect.js index 9ee2e4347f600b..9b4055373f25bd 100644 --- a/test/parallel/test-http2-connect.js +++ b/test/parallel/test-http2-connect.js @@ -95,6 +95,7 @@ const { connect: tlsConnect } = require('tls'); }; const clientOptions = { + ALPNProtocols: ['h2'], port, rejectUnauthorized: false }; From decfc2ae5c1a5664eaf85f71829919cd4765fca9 Mon Sep 17 00:00:00 2001 From: rickyes Date: Wed, 29 Apr 2020 02:00:35 +0800 Subject: [PATCH 013/117] fs: add .ref() and .unref() methods to watcher classes Backport-PR-URL: https://github.com/nodejs/node/pull/35555 PR-URL: https://github.com/nodejs/node/pull/33134 Fixes: https://github.com/nodejs/node/issues/33096 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/fs.md | 67 ++++++++++++++++++++ lib/fs.js | 6 ++ lib/internal/fs/watchers.js | 56 +++++++++++++++- src/fs_event_wrap.cc | 3 +- test/parallel/test-fs-watch-ref-unref.js | 20 ++++++ test/parallel/test-fs-watchfile-ref-unref.js | 35 ++++++++++ tools/doc/type-parser.js | 1 + 7 files changed, 184 insertions(+), 4 deletions(-) create mode 100644 test/parallel/test-fs-watch-ref-unref.js create mode 100644 test/parallel/test-fs-watchfile-ref-unref.js diff --git a/doc/api/fs.md b/doc/api/fs.md index 57af737a2f6444..f48f2e3b2ddf6a 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -598,6 +598,72 @@ added: v0.5.8 Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. +### `watcher.ref()` + + +* Returns: {fs.FSWatcher} + +When called, requests that the Node.js event loop *not* exit so long as the +`FSWatcher` is active. Calling `watcher.ref()` multiple times will have +no effect. + +By default, all `FSWatcher` objects are "ref'ed", making it normally +unnecessary to call `watcher.ref()` unless `watcher.unref()` had been +called previously. + +### `watcher.unref()` + + +* Returns: {fs.FSWatcher} + +When called, the active `FSWatcher` object will not require the Node.js +event loop to remain active. If there is no other activity keeping the +event loop running, the process may exit before the `FSWatcher` object's +callback is invoked. Calling `watcher.unref()` multiple times will have +no effect. + +## Class: `fs.StatWatcher` + + +* Extends {EventEmitter} + +A successful call to `fs.watchFile()` method will return a new `fs.StatWatcher` +object. + +### `watcher.ref()` + + +* Returns: {fs.StatWatcher} + +When called, requests that the Node.js event loop *not* exit so long as the +`StatWatcher` is active. Calling `watcher.ref()` multiple times will have +no effect. + +By default, all `StatWatcher` objects are "ref'ed", making it normally +unnecessary to call `watcher.ref()` unless `watcher.unref()` had been +called previously. + +### `watcher.unref()` + + +* Returns: {fs.StatWatcher} + +When called, the active `StatWatcher` object will not require the Node.js +event loop to remain active. If there is no other activity keeping the +event loop running, the process may exit before the `StatWatcher` object's +callback is invoked. Calling `watcher.unref()` multiple times will have +no effect. + ## Class: `fs.ReadStream` * `options` {Object} Set of configurable options to set on the agent. @@ -142,6 +146,18 @@ changes: * `maxFreeSockets` {number} Maximum number of sockets to leave open in a free state. Only relevant if `keepAlive` is set to `true`. **Default:** `256`. + * `scheduling` {string} Scheduling strategy to apply when picking + the next free socket to use. It can be `'fifo'` or `'lifo'`. + The main difference between the two scheduling strategies is that `'lifo'` + selects the most recently used socket, while `'fifo'` selects + the least recently used socket. + In case of a low rate of request per second, the `'lifo'` scheduling + will lower the risk of picking a socket that might have been closed + by the server due to inactivity. + In case of a high rate of request per second, + the `'fifo'` scheduling will maximize the number of open sockets, + while the `'lifo'` scheduling will keep it as low as possible. + **Default:** `'fifo'`. * `timeout` {number} Socket timeout in milliseconds. This will set the timeout when the socket is created. diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 73b9ed2c32896e..875c01b201fb7b 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -38,6 +38,7 @@ const { async_id_symbol } = require('internal/async_hooks').symbols; const { codes: { ERR_OUT_OF_RANGE, + ERR_INVALID_OPT_VALUE, }, } = require('internal/errors'); const { validateNumber } = require('internal/validators'); @@ -102,6 +103,12 @@ function Agent(options) { this.maxTotalSockets = Infinity; } + this.scheduling = this.options.scheduling || 'fifo'; + + if (this.scheduling !== 'fifo' && this.scheduling !== 'lifo') { + throw new ERR_INVALID_OPT_VALUE('scheduling', this.scheduling); + } + this.on('free', (socket, options) => { const name = this.getName(options); debug('agent.on(free)', name); @@ -238,7 +245,9 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, while (freeSockets.length && freeSockets[0].destroyed) { freeSockets.shift(); } - socket = freeSockets.shift(); + socket = this.scheduling === 'fifo' ? + freeSockets.shift() : + freeSockets.pop(); if (!freeSockets.length) delete this.freeSockets[name]; } diff --git a/test/parallel/test-http-agent-scheduling.js b/test/parallel/test-http-agent-scheduling.js new file mode 100644 index 00000000000000..bcf07863b0fb61 --- /dev/null +++ b/test/parallel/test-http-agent-scheduling.js @@ -0,0 +1,148 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); + +function createServer(count) { + return http.createServer(common.mustCallAtLeast((req, res) => { + // Return the remote port number used for this connection. + res.end(req.socket.remotePort.toString(10)); + }), count); +} + +function makeRequest(url, agent, callback) { + http + .request(url, { agent }, (res) => { + let data = ''; + res.setEncoding('ascii'); + res.on('data', (c) => { + data += c; + }); + res.on('end', () => { + process.nextTick(callback, data); + }); + }) + .end(); +} + +function bulkRequest(url, agent, done) { + const ports = []; + let count = agent.maxSockets; + + for (let i = 0; i < agent.maxSockets; i++) { + makeRequest(url, agent, callback); + } + + function callback(port) { + count -= 1; + ports.push(port); + if (count === 0) { + done(ports); + } + } +} + +function defaultTest() { + const server = createServer(8); + server.listen(0, onListen); + + function onListen() { + const url = `http://localhost:${server.address().port}`; + const agent = new http.Agent({ + keepAlive: true, + maxSockets: 5 + }); + + bulkRequest(url, agent, (ports) => { + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[0], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[1], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[2], port); + server.close(); + agent.destroy(); + }); + }); + }); + }); + } +} + +function fifoTest() { + const server = createServer(8); + server.listen(0, onListen); + + function onListen() { + const url = `http://localhost:${server.address().port}`; + const agent = new http.Agent({ + keepAlive: true, + maxSockets: 5, + scheduling: 'fifo' + }); + + bulkRequest(url, agent, (ports) => { + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[0], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[1], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[2], port); + server.close(); + agent.destroy(); + }); + }); + }); + }); + } +} + +function lifoTest() { + const server = createServer(8); + server.listen(0, onListen); + + function onListen() { + const url = `http://localhost:${server.address().port}`; + const agent = new http.Agent({ + keepAlive: true, + maxSockets: 5, + scheduling: 'lifo' + }); + + bulkRequest(url, agent, (ports) => { + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[ports.length - 1], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[ports.length - 1], port); + makeRequest(url, agent, (port) => { + assert.strictEqual(ports[ports.length - 1], port); + server.close(); + agent.destroy(); + }); + }); + }); + }); + } +} + +function badSchedulingOptionTest() { + try { + new http.Agent({ + keepAlive: true, + maxSockets: 5, + scheduling: 'filo' + }); + } catch (err) { + assert.strictEqual(err.code, 'ERR_INVALID_OPT_VALUE'); + assert.strictEqual( + err.message, + 'The value "filo" is invalid for option "scheduling"' + ); + } +} + +defaultTest(); +fifoTest(); +lifoTest(); +badSchedulingOptionTest(); From 9eb1fa19248949dfc716807b1dc97dedf36da14e Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 14 May 2020 22:40:37 -0700 Subject: [PATCH 017/117] module: named exports for CJS via static analysis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35249 Reviewed-By: Mary Marchini Reviewed-By: Geoffrey Booth Reviewed-By: Matteo Collina Reviewed-By: Myles Borins Reviewed-By: Michaël Zasso Reviewed-By: Zeyu Yang Reviewed-By: Richard Lau --- LICENSE | 14 + deps/cjs-module-lexer/.gitignore | 11 + deps/cjs-module-lexer/LICENSE | 10 + deps/cjs-module-lexer/README.md | 331 ++++++ deps/cjs-module-lexer/lexer.js | 1152 +++++++++++++++++++ deps/cjs-module-lexer/package.json | 41 + doc/api/esm.md | 123 +- lib/internal/modules/cjs/loader.js | 34 +- lib/internal/modules/esm/module_job.js | 27 +- lib/internal/modules/esm/translators.js | 101 +- node.gyp | 1 + src/node_native_module.cc | 6 +- test/es-module/test-esm-cjs-exports.js | 21 + test/es-module/test-esm-cjs-named-error.mjs | 42 +- test/fixtures/es-modules/cjs-exports.mjs | 34 + test/fixtures/es-modules/exports-cases.js | 7 + test/fixtures/es-modules/exports-cases2.js | 29 + test/fixtures/es-modules/exports-cases3.js | 25 + test/parallel/test-bootstrap-modules.js | 1 + tools/license-builder.sh | 1 + 20 files changed, 1926 insertions(+), 85 deletions(-) create mode 100755 deps/cjs-module-lexer/.gitignore create mode 100755 deps/cjs-module-lexer/LICENSE create mode 100755 deps/cjs-module-lexer/README.md create mode 100755 deps/cjs-module-lexer/lexer.js create mode 100755 deps/cjs-module-lexer/package.json create mode 100644 test/es-module/test-esm-cjs-exports.js create mode 100644 test/fixtures/es-modules/cjs-exports.mjs create mode 100644 test/fixtures/es-modules/exports-cases.js create mode 100644 test/fixtures/es-modules/exports-cases2.js create mode 100644 test/fixtures/es-modules/exports-cases3.js diff --git a/LICENSE b/LICENSE index a42e1d52038bb0..298631ee09e2dd 100644 --- a/LICENSE +++ b/LICENSE @@ -137,6 +137,20 @@ The externally maintained libraries used by Node.js are: IN THE SOFTWARE. """ +- cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows: + """ + MIT License + ----------- + + Copyright (C) 2018-2020 Guy Bedford + + 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. + """ + - ICU, located at deps/icu-small, is licensed as follows: """ COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later) diff --git a/deps/cjs-module-lexer/.gitignore b/deps/cjs-module-lexer/.gitignore new file mode 100755 index 00000000000000..55ee2f0d6cfb5d --- /dev/null +++ b/deps/cjs-module-lexer/.gitignore @@ -0,0 +1,11 @@ +node_modules +*.lock +test +.* +Makefile +bench +build.js +include-wasm +include +lib +src diff --git a/deps/cjs-module-lexer/LICENSE b/deps/cjs-module-lexer/LICENSE new file mode 100755 index 00000000000000..935b357962d08b --- /dev/null +++ b/deps/cjs-module-lexer/LICENSE @@ -0,0 +1,10 @@ +MIT License +----------- + +Copyright (C) 2018-2020 Guy Bedford + +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. diff --git a/deps/cjs-module-lexer/README.md b/deps/cjs-module-lexer/README.md new file mode 100755 index 00000000000000..726dd407769398 --- /dev/null +++ b/deps/cjs-module-lexer/README.md @@ -0,0 +1,331 @@ +# CJS Module Lexer + +[![Build Status][travis-image]][travis-url] + +A [very fast](#benchmarks) JS CommonJS module syntax lexer used to detect the most likely list of named exports of a CommonJS module. + +Outputs the list of named exports (`exports.name = ...`) and possible module reexports (`module.exports = require('...')`), including the common transpiler variations of these cases. + +Forked from https://github.com/guybedford/es-module-lexer. + +_Comprehensively handles the JS language grammar while remaining small and fast. - ~90ms per MB of JS cold and ~15ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._ + +### Usage + +``` +npm install cjs-module-lexer +``` + +For use in CommonJS: + +```js +const parse = require('cjs-module-lexer'); + +const { exports, reexports } = parse(` + // named exports detection + module.exports.a = 'a'; + (function () { + exports.b = 'b'; + })(); + Object.defineProperty(exports, 'c', { value: 'c' }); + /* exports.d = 'not detected'; */ + + // reexports detection + if (maybe) module.exports = require('./dep1.js'); + if (another) module.exports = require('./dep2.js'); + + // literal exports assignments + module.exports = { a, b: c, d, 'e': f } + + // __esModule detection + Object.defineProperty(module.exports, '__esModule', { value: true }) +`); + +// exports === ['a', 'b', 'c', '__esModule'] +// reexports === ['./dep1.js', './dep2.js'] +``` + +When using the ESM version, Wasm is supported instead: + +```js +import { parse, init } from 'cjs-module-lexer'; +// init needs to be called and waited upon +await init(); +const { exports, reexports } = parse(source); +``` + +The Wasm build is around 1.5x faster and without a cold start. + +### Grammar + +CommonJS exports matches are run against the source token stream. + +The token grammar is: + +``` +IDENTIFIER: As defined by ECMA-262, without support for identifier `\` escapes, filtered to remove strict reserved words: + "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "enum" + +STRING_LITERAL: A `"` or `'` bounded ECMA-262 string literal. + +IDENTIFIER_STRING: ( `"` IDENTIFIER `"` | `'` IDENTIFIER `'` ) + +COMMENT_SPACE: Any ECMA-262 whitespace, ECMA-262 block comment or ECMA-262 line comment + +MODULE_EXPORTS: `module` COMMENT_SPACE `.` COMMENT_SPACE `exports` + +EXPORTS_IDENTIFIER: MODULE_EXPORTS_IDENTIFIER | `exports` + +EXPORTS_DOT_ASSIGN: EXPORTS_IDENTIFIER COMMENT_SPACE `.` COMMENT_SPACE IDENTIFIER COMMENT_SPACE `=` + +EXPORTS_LITERAL_COMPUTED_ASSIGN: EXPORTS_IDENTIFIER COMMENT_SPACE `[` COMMENT_SPACE IDENTIFIER_STRING COMMENT_SPACE `]` COMMENT_SPACE `=` + +EXPORTS_LITERAL_PROP: (IDENTIFIER (COMMENT_SPACE `:` COMMENT_SPACE IDENTIFIER)?) | (IDENTIFIER_STRING COMMENT_SPACE `:` COMMENT_SPACE IDENTIFIER) + +EXPORTS_MEMBER: EXPORTS_DOT_ASSIGN | EXPORTS_LITERAL_COMPUTED_ASSIGN + +EXPORTS_DEFINE: `Object` COMMENT_SPACE `.` COMMENT_SPACE `defineProperty COMMENT_SPACE `(` EXPORTS_IDENTIFIER COMMENT_SPACE `,` COMMENT_SPACE IDENTIFIER_STRING + +EXPORTS_LITERAL: MODULE_EXPORTS COMMENT_SPACE `=` COMMENT_SPACE `{` COMMENT_SPACE (EXPORTS_LITERAL_PROP COMMENT_SPACE `,` COMMENT_SPACE)+ `}` + +REQUIRE: `require` COMMENT_SPACE `(` COMMENT_SPACE STRING_LITERAL COMMENT_SPACE `)` + +EXPORTS_ASSIGN: (`var` | `const` | `let`) IDENTIFIER `=` REQUIRE + +MODULE_EXPORTS_ASSIGN: MODULE_EXPORTS COMMENT_SPACE `=` COMMENT_SPACE REQUIRE + +EXPORT_STAR: (`__export` | `__exportStar`) `(` REQUIRE + +EXPORT_STAR_LIB: `Object.keys(` IDENTIFIER$1 `).forEach(function (` IDENTIFIER$2 `) {` + ( + `if (` IDENTIFIER$2 `===` ( `'default'` | `"default"` ) `||` IDENTIFIER$2 `===` ( '__esModule' | `"__esModule"` ) `) return` `;`? | + `if (` IDENTIFIER$2 `!==` ( `'default'` | `"default"` ) `)` + ) + ( + EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] =` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? | + `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: function () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? } })` `;`? + ) + `})` +``` + +* The returned export names are the matched `IDENTIFIER` and `IDENTIFIER_STRING` slots for all `EXPORTS_MEMBER`, `EXPORTS_DEFINE` and `EXPORTS_LITERAL` matches. +* The reexport specifiers are taken to be the `STRING_LITERAL` slots of all `MODULE_EXPORTS_ASSIGN` as well as all _top-level_ `EXPORT_STAR` `REQUIRE` matches and `EXPORTS_ASSIGN` matches whose `IDENTIFIER` also matches the first `IDENTIFIER` in `EXPORT_STAR_LIB`. + +### Parsing Examples + +#### Named Exports Parsing + +The basic matching rules for named exports are `exports.name`, `exports['name']` or `Object.defineProperty(exports, 'name', ...)`. This matching is done without scope analysis and regardless of the expression position: + +```js +// DETECTS EXPORTS: a, b, c +(function (exports) { + exports.a = 'a'; + exports['b'] = 'b'; + Object.defineProperty(exports, 'c', { value: 'c' }); +})(exports); +``` + +Because there is no scope analysis, the above detection may overclassify: + +```js +// DETECTS EXPORTS: a, b, c +(function (exports, Object) { + exports.a = 'a'; + exports['b'] = 'b'; + if (false) + Object.defineProperty(exports, 'c', { value: 'c' }); +})(NOT_EXPORTS, NOT_OBJECT); +``` + +It will in turn underclassify in cases where the identifiers are renamed: + +```js +// DETECTS: NO EXPORTS +(function (e, defineProperty) { + e.a = 'a'; + e['b'] = 'b'; + defineProperty(e, 'c', { value: 'c' }); +})(exports, defineProperty); +``` + +#### Exports Object Assignment + +A best-effort is made to detect `module.exports` object assignments, but because this is not a full parser, arbitrary expressions are not handled in the +object parsing process. + +Simple object definitions are supported: + +```js +// DETECTS EXPORTS: a, b, c +module.exports = { + a, + b: 'c', + c: c +}; +``` + +Object properties that are not identifiers or string expressions will bail out of the object detection: + +```js +// DETECTS EXPORTS: a, b +module.exports = { + a, + b: require('c'), + c: "not detected since require('c') above bails the object detection" +} +``` + +`Object.defineProperties` is not currently supported either. + +#### module.exports reexport assignment + +Any `module.exports = require('mod')` assignment is detected as a reexport: + +```js +// DETECTS REEXPORTS: a, b, c +module.exports = require('a'); +(module => module.exports = require('b'))(NOT_MODULE); +if (false) module.exports = require('c'); +``` + +As a result, the total list of exports would be inferred as the union of all of these reexported modules, which can lead to possible over-classification. + +#### Transpiler Re-exports + +For named exports, transpiler output works well with the rules described above. + +But for star re-exports, special care is taken to support common patterns of transpiler outputs from Babel and TypeScript as well as bundlers like RollupJS. +These reexport and star reexport patterns are restricted to only be detected at the top-level as provided by the direct output of these tools. + +For example, `export * from 'external'` is output by Babel as: + +```js +"use strict"; + +exports.__esModule = true; + +var _external = require("external"); + +Object.keys(_external).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + exports[key] = _external[key]; +}); +``` + +Where the `var _external = require("external")` is specifically detected as well as the `Object.keys(_external)` statement, down to the exact +for of that entire expression including minor variations of the output. The `_external` and `key` identifiers are carefully matched in this +detection. + +Similarly for TypeScript, `export * from 'external'` is output as: + +```js +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(require("external")); +``` + +Where the `__export(require("external"))` statement is explicitly detected as a reexport, including variations `tslib.__export` and `__exportStar`. + +### Environment Support + +Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm). + +### JS Grammar Support + +* Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators. +* Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking. +* Always correctly parses valid JS source, but may parse invalid JS source without errors. + +### Benchmarks + +Benchmarks can be run with `npm run bench`. + +Current results: + +JS Build: + +``` +Module load time +> 2ms +Cold Run, All Samples +test/samples/*.js (3635 KiB) +> 333ms + +Warm Runs (average of 25 runs) +test/samples/angular.js (1410 KiB) +> 16.48ms +test/samples/angular.min.js (303 KiB) +> 5.36ms +test/samples/d3.js (553 KiB) +> 8.32ms +test/samples/d3.min.js (250 KiB) +> 4.28ms +test/samples/magic-string.js (34 KiB) +> 1ms +test/samples/magic-string.min.js (20 KiB) +> 0.36ms +test/samples/rollup.js (698 KiB) +> 10.48ms +test/samples/rollup.min.js (367 KiB) +> 6.64ms + +Warm Runs, All Samples (average of 25 runs) +test/samples/*.js (3635 KiB) +> 49.28ms +``` + +Wasm Build: +``` +Module load time +> 11ms +Cold Run, All Samples +test/samples/*.js (3635 KiB) +> 48ms + +Warm Runs (average of 25 runs) +test/samples/angular.js (1410 KiB) +> 12.32ms +test/samples/angular.min.js (303 KiB) +> 3.76ms +test/samples/d3.js (553 KiB) +> 6.08ms +test/samples/d3.min.js (250 KiB) +> 3ms +test/samples/magic-string.js (34 KiB) +> 0.24ms +test/samples/magic-string.min.js (20 KiB) +> 0ms +test/samples/rollup.js (698 KiB) +> 7.2ms +test/samples/rollup.min.js (367 KiB) +> 4.2ms + +Warm Runs, All Samples (average of 25 runs) +test/samples/*.js (3635 KiB) +> 33.6ms +``` + +### Wasm Build Steps + +To build download the WASI SDK from https://github.com/CraneStation/wasi-sdk/releases. + +The Makefile assumes the existence of "wasi-sdk-10.0", "binaryen" and "wabt" (both optional) as sibling folders to this project. + +The build through the Makefile is then run via `make lib/lexer.wasm`, which can also be triggered via `npm run build-wasm` to create `dist/lexer.js`. + +On Windows it may be preferable to use the Linux subsystem. + +After the Web Assembly build, the CJS build can be triggered via `npm run build`. + +Optimization passes are run with [Binaryen](https://github.com/WebAssembly/binaryen) prior to publish to reduce the Web Assembly footprint. + +### License + +MIT + +[travis-url]: https://travis-ci.org/guybedford/es-module-lexer +[travis-image]: https://travis-ci.org/guybedford/es-module-lexer.svg?branch=master diff --git a/deps/cjs-module-lexer/lexer.js b/deps/cjs-module-lexer/lexer.js new file mode 100755 index 00000000000000..6a9eef9edd7c21 --- /dev/null +++ b/deps/cjs-module-lexer/lexer.js @@ -0,0 +1,1152 @@ +let source, pos, end; +let openTokenDepth, + templateDepth, + lastTokenPos, + lastSlashWasDivision, + templateStack, + templateStackDepth, + openTokenPosStack, + openClassPosStack, + nextBraceIsClass, + starExportMap, + lastStarExportSpecifier, + _exports, + reexports; + +function resetState () { + openTokenDepth = 0; + templateDepth = -1; + lastTokenPos = -1; + lastSlashWasDivision = false; + templateStack = new Array(1024); + templateStackDepth = 0; + openTokenPosStack = new Array(1024); + openClassPosStack = new Array(1024); + nextBraceIsClass = false; + starExportMap = Object.create(null); + lastStarExportSpecifier = null; + + _exports = new Set(); + reexports = new Set(); +} + +const strictReserved = new Set(['implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'enum']); + +module.exports = function parseCJS (source, name = '@') { + resetState(); + try { + parseSource(source); + } + catch (e) { + e.message += `\n at ${name}:${source.slice(0, pos).split('\n').length}:${pos - source.lastIndexOf('\n', pos - 1)}`; + e.loc = pos; + throw e; + } + const result = { exports: [..._exports], reexports: [...reexports] }; + resetState(); + return result; +} + +function addExport (name) { + if (!strictReserved.has(name)) + _exports.add(name); +} + +function parseSource (cjsSource) { + source = cjsSource; + pos = -1; + end = source.length - 1; + let ch = 0; + + // Handle #! + if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { + if (source.length === 2) + return true; + pos += 2; + while (pos++ < end) { + ch = source.charCodeAt(pos); + if (ch === 10/*\n*/ || ch === 13/*\r*/) + break; + } + } + + while (pos++ < end) { + ch = source.charCodeAt(pos); + + if (ch === 32 || ch < 14 && ch > 8) + continue; + + if (openTokenDepth === 0) { + switch (ch) { + case 105/*i*/: + if (source.slice(pos + 1, pos + 6) === 'mport' && keywordStart(pos)) + throwIfImportStatement(); + lastTokenPos = pos; + continue; + case 114/*r*/: + const startPos = pos; + if (tryParseRequire(false) && keywordStart(startPos)) + tryBacktrackAddStarExportBinding(startPos - 1); + lastTokenPos = pos; + continue; + case 95/*_*/: + if (source.slice(pos + 1, pos + 8) === '_export' && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { + pos += 8; + if (source.slice(pos, pos + 4) === 'Star') + pos += 4; + if (source.charCodeAt(pos) === 40/*(*/) { + openTokenPosStack[openTokenDepth++] = lastTokenPos; + if (source.charCodeAt(++pos) === 114/*r*/) + tryParseRequire(true); + } + } + lastTokenPos = pos; + continue; + } + } + + switch (ch) { + case 101/*e*/: + if (source.slice(pos + 1, pos + 6) === 'xport' && keywordStart(pos)) { + if (source.charCodeAt(pos + 6) === 115/*s*/) + tryParseExportsDotAssign(false); + else if (openTokenDepth === 0) + throwIfExportStatement(); + } + break; + case 99/*c*/: + if (keywordStart(pos) && source.slice(pos + 1, pos + 5) === 'lass' && isBrOrWs(source.charCodeAt(pos + 5))) + nextBraceIsClass = true; + break; + case 109/*m*/: + if (source.slice(pos + 1, pos + 6) === 'odule' && keywordStart(pos)) + tryParseModuleExportsDotAssign(); + break; + case 79/*O*/: + if (source.slice(pos + 1, pos + 6) === 'bject' && keywordStart(pos)) + tryParseObjectDefineOrKeys(openTokenDepth === 0); + break; + case 40/*(*/: + openTokenPosStack[openTokenDepth++] = lastTokenPos; + break; + case 41/*)*/: + if (openTokenDepth === 0) + throw new Error('Unexpected closing bracket.'); + openTokenDepth--; + break; + case 123/*{*/: + openClassPosStack[openTokenDepth] = nextBraceIsClass; + nextBraceIsClass = false; + openTokenPosStack[openTokenDepth++] = lastTokenPos; + break; + case 125/*}*/: + if (openTokenDepth === 0) + throw new Error('Unexpected closing brace.'); + if (openTokenDepth-- === templateDepth) { + templateDepth = templateStack[--templateStackDepth]; + templateString(); + } + else { + if (templateDepth !== -1 && openTokenDepth < templateDepth) + throw new Error('Unexpected closing brace.'); + } + break; + case 60/*>*/: + // TODO: ```js -import packageMain from 'commonjs-package'; // Works +import { default as cjs } from 'cjs'; -import { method } from 'commonjs-package'; // Errors +// The following import statement is "syntax sugar" (equivalent but sweeter) +// for `{ default as cjsSugar }` in the above import statement: +import cjsSugar from 'cjs'; + +console.log(cjs); +console.log(cjs === cjsSugar); +// Prints: +// +// true ``` -It is also possible to -[import an ES or CommonJS module for its side effects only][]. +The ECMAScript Module Namespace representation of a CommonJS module will always +be a namespace with a `default` export key pointing to the CommonJS +`module.exports` value. -### `import()` expressions +This Module Namespace Exotic Object can be directly observed either when using +`import * as m from 'cjs'` or a dynamic import: -[Dynamic `import()`][] is supported in both CommonJS and ES modules. It can be -used to include ES module files from CommonJS code. + +```js +import * as m from 'cjs'; +console.log(m); +console.log(m === await import('cjs')); +// Prints: +// [Module] { default: } +// true +``` -## CommonJS, JSON, and native modules +For better compatibility with existing usage in the JS ecosystem, Node.js will +in addition attempt to determine the CommonJS named exports of every imported +CommonJS module to provide them as separate ES module exports using a static +analysis process. -CommonJS, JSON, and native modules can be used with -[`module.createRequire()`][]. +For example, a CommonJS module written: ```js // cjs.cjs -module.exports = 'cjs'; +exports.name = 'exported'; +``` -// esm.mjs -import { createRequire } from 'module'; +will support named imports in ES modules: -const require = createRequire(import.meta.url); + +```js +import { name } from './cjs.cjs'; +console.log(name); +// Prints: 'exported' -const cjs = require('./cjs.cjs'); -cjs === 'cjs'; // true +import cjs from './cjs.cjs'; +console.log(cjs); +// Prints: { name: 'exported' } + +import * as m from './cjs.cjs'; +console.log(m); +// Prints: [Module] { default: { name: 'exported' }, name: 'exported' } ``` +As can be seen from the last example of the Module Namespace Exotic Object being +logged, the `name` export is copied off of the `module.exports` object and set +directly on the ES module namespace when the module is imported. + +Live binding updates or new exports added to `module.exports` are not detected +for these named exports. + +The detection of named exports is based on common syntax patterns but will not +always correctly detect named exports, in these cases using the default +import form described above can be a better option. + +Named exports detection covers many common export patterns, reexport patterns +and build tool and transpiler outputs. See [cjs-module-lexer][] for the exact +semantics implemented. + ## Builtin modules Builtin modules will provide named exports of their public API. A @@ -1111,6 +1171,24 @@ syncBuiltinESMExports(); fs.readFileSync === readFileSync; ``` +## CommonJS, JSON, and native modules + +CommonJS, JSON, and native modules can be used with +[`module.createRequire()`][]. + +```js +// cjs.cjs +module.exports = 'cjs'; + +// esm.mjs +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); + +const cjs = require('./cjs.cjs'); +cjs === 'cjs'; // true +``` + ## Experimental JSON modules Currently importing JSON modules are only supported in the `commonjs` mode @@ -1894,6 +1972,7 @@ $ node --experimental-specifier-resolution=node index success! ``` + [Babel]: https://babeljs.io/ [CommonJS]: modules.html [Conditional exports]: #esm_conditional_exports @@ -1919,8 +1998,8 @@ success! [TypedArray]: https://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects [Uint8Array]: https://www.ecma-international.org/ecma-262/6.0/#sec-uint8array [`util.TextDecoder`]: util.html#util_class_util_textdecoder +[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.3.1 [dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook -[import an ES or CommonJS module for its side effects only]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only [special scheme]: https://url.spec.whatwg.org/#special-scheme [the full specifier path]: #esm_mandatory_file_extensions [the official standard format]: https://tc39.github.io/ecma262/#sec-modules diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 4a0bfed2aa0fdb..f07ff6c830c608 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -21,12 +21,6 @@ 'use strict'; -// Set first due to cycle with ESM loader functions. -module.exports = { - wrapSafe, Module, toRealPath, readPackageScope, - get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; } -}; - const { ArrayIsArray, ArrayPrototypeJoin, @@ -41,6 +35,7 @@ const { RegExpPrototypeTest, SafeMap, SafeSet, + SafeWeakMap, StringPrototypeEndsWith, StringPrototypeIndexOf, StringPrototypeLastIndexOf, @@ -49,6 +44,15 @@ const { StringPrototypeStartsWith, } = primordials; +// Map used to store CJS parsing data. +const cjsParseCache = new SafeWeakMap(); + +// Set first due to cycle with ESM loader functions. +module.exports = { + wrapSafe, Module, toRealPath, readPackageScope, cjsParseCache, + get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; } +}; + const { NativeModule } = require('internal/bootstrap/loaders'); const { maybeCacheSourceMap, @@ -689,14 +693,18 @@ Module._load = function(request, parent, isMain) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); - return cachedModule.exports; + const parseCachedModule = cjsParseCache.get(cachedModule); + if (parseCachedModule && !parseCachedModule.loaded) + parseCachedModule.loaded = true; + else + return cachedModule.exports; } const mod = loadNativeModule(filename, request); if (mod && mod.canBeRequiredByUsers) return mod.exports; // Don't call updateChildren(), Module constructor already does. - const module = new Module(filename, parent); + const module = cachedModule || new Module(filename, parent); if (isMain) { process.mainModule = module; @@ -1031,7 +1039,15 @@ Module._extensions['.js'] = function(module, filename) { throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); } } - const content = fs.readFileSync(filename, 'utf8'); + // If already analyzed the source, then it will be cached. + const cached = cjsParseCache.get(module); + let content; + if (cached && cached.source) { + content = cached.source; + cached.source = undefined; + } else { + content = fs.readFileSync(filename, 'utf8'); + } module._compile(content, filename); }; diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index ed681541d12723..e2f7523ea25402 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -102,28 +102,27 @@ class ModuleJob { ' does not provide an export named')) { const splitStack = StringPrototypeSplit(e.stack, '\n'); const parentFileUrl = splitStack[0]; - const childSpecifier = StringPrototypeMatch(e.message, /module '(.*)' does/)[1]; + const [, childSpecifier, name] = StringPrototypeMatch(e.message, + /module '(.*)' does not provide an export named '(.+)'/); const childFileURL = - await this.loader.resolve(childSpecifier, parentFileUrl); + await this.loader.resolve(childSpecifier, parentFileUrl); const format = await this.loader.getFormat(childFileURL); if (format === 'commonjs') { - e.message = `The requested module '${childSpecifier}' is expected ` + - 'to be of type CommonJS, which does not support named exports. ' + - 'CommonJS modules can be imported by importing the default ' + - 'export.'; + const importStatement = splitStack[1]; // TODO(@ctavan): The original error stack only provides the single // line which causes the error. For multi-line import statements we // cannot generate an equivalent object descructuring assignment by // just parsing the error stack. - const importStatement = splitStack[1]; const oneLineNamedImports = StringPrototypeMatch(importStatement, /{.*}/); - if (oneLineNamedImports) { - const destructuringAssignment = - StringPrototypeReplace(oneLineNamedImports[0], /\s+as\s+/g, ': '); - e.message += '\nFor example:\n' + - `import pkg from '${childSpecifier}';\n` + - `const ${destructuringAssignment} = pkg;`; - } + const destructuringAssignment = oneLineNamedImports && + StringPrototypeReplace(oneLineNamedImports, /\s+as\s+/g, ': '); + e.message = `Named export '${name}' not found. The requested module` + + ` '${childSpecifier}' is a CommonJS module, which may not support` + + ' all module.exports as named exports.\nCommonJS modules can ' + + 'always be imported via the default export, for example using:' + + `\n\nimport pkg from '${childSpecifier}';\n${ + destructuringAssignment ? + `const ${destructuringAssignment} = pkg;\n` : ''}`; const newStack = StringPrototypeSplit(e.stack, '\n'); newStack[3] = `SyntaxError: ${e.message}`; e.stack = ArrayPrototypeJoin(newStack, '\n'); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index bb095446bc27eb..5e4de5d5af0f39 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -3,11 +3,14 @@ /* global WebAssembly */ const { + Boolean, JSONParse, + ObjectPrototypeHasOwnProperty, ObjectKeys, PromisePrototypeCatch, PromiseReject, SafeMap, + SafeSet, StringPrototypeReplace, } = primordials; @@ -17,11 +20,16 @@ function lazyTypes() { return _TYPES = require('internal/util/types'); } +const { readFileSync } = require('fs'); +const { extname } = require('path'); const { stripBOM, loadNativeModule } = require('internal/modules/cjs/helpers'); -const CJSModule = require('internal/modules/cjs/loader').Module; +const { + Module: CJSModule, + cjsParseCache +} = require('internal/modules/cjs/loader'); const internalURLModule = require('internal/url'); const { defaultGetSource } = require( 'internal/modules/esm/get_source'); @@ -44,12 +52,12 @@ const { ModuleWrap } = moduleWrap; const { getOptionValue } = require('internal/options'); const experimentalImportMetaResolve = getOptionValue('--experimental-import-meta-resolve'); +const asyncESM = require('internal/process/esm_loader'); +const cjsParse = require('internal/deps/cjs-module-lexer/lexer'); 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') { @@ -104,7 +112,7 @@ function initializeImportMeta(meta, { url }) { meta.url = url; } -// Strategy for loading a standard JavaScript module +// Strategy for loading a standard JavaScript module. translators.set('module', async function moduleStrategy(url) { let { source } = await this._getSource( url, { format: 'module' }, defaultGetSource); @@ -125,23 +133,92 @@ translators.set('module', async function moduleStrategy(url) { // Strategy for loading a node-style CommonJS module const isWindows = process.platform === 'win32'; const winSepRegEx = /\//g; -translators.set('commonjs', function commonjsStrategy(url, isMain) { +translators.set('commonjs', async function commonjsStrategy(url, isMain) { debug(`Translating CJSModule ${url}`); - return new ModuleWrap(url, undefined, ['default'], function() { + + let filename = internalURLModule.fileURLToPath(new URL(url)); + if (isWindows) + filename = StringPrototypeReplace(filename, winSepRegEx, '\\'); + + const { module, exportNames } = cjsPreparseModuleExports(filename); + const namesWithDefault = exportNames.has('default') ? + [...exportNames] : ['default', ...exportNames]; + + return new ModuleWrap(url, undefined, namesWithDefault, function() { debug(`Loading CJSModule ${url}`); - 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); + if (asyncESM.ESMLoader.cjsCache.has(module)) { + exports = asyncESM.ESMLoader.cjsCache.get(module); + asyncESM.ESMLoader.cjsCache.delete(module); } else { - exports = CJSModule._load(pathname, undefined, isMain); + exports = CJSModule._load(filename, undefined, isMain); + } + + for (const exportName of exportNames) { + if (!ObjectPrototypeHasOwnProperty(exports, exportName) || + exportName === 'default') + continue; + // We might trigger a getter -> dont fail. + let value; + try { + value = exports[exportName]; + } catch {} + this.setExport(exportName, value); } this.setExport('default', exports); }); }); +function cjsPreparseModuleExports(filename) { + let module = CJSModule._cache[filename]; + if (module) { + const cached = cjsParseCache.get(module); + if (cached) + return { module, exportNames: cached.exportNames }; + } + const loaded = Boolean(module); + if (!loaded) { + module = new CJSModule(filename); + module.filename = filename; + module.paths = CJSModule._nodeModulePaths(module.path); + CJSModule._cache[filename] = module; + } + + let source; + try { + source = readFileSync(filename, 'utf8'); + } catch {} + + const { exports, reexports } = cjsParse(source || ''); + + const exportNames = new SafeSet(exports); + + // Set first for cycles. + cjsParseCache.set(module, { source, exportNames, loaded }); + + if (reexports.length) { + module.filename = filename; + module.paths = CJSModule._nodeModulePaths(module.path); + } + for (const reexport of reexports) { + let resolved; + try { + resolved = CJSModule._resolveFilename(reexport, module); + } catch { + continue; + } + const ext = extname(resolved); + if (ext === '.js' || ext === '.cjs' || !CJSModule._extensions[ext]) { + const { exportNames: reexportNames } = cjsPreparseModuleExports(resolved); + for (const name of reexportNames) + exportNames.add(name); + } + } + + return { module, exportNames }; +} + // Strategy for loading a node builtin CommonJS module that isn't // through normal resolution translators.set('builtin', async function builtinStrategy(url) { diff --git a/node.gyp b/node.gyp index 1ecd8756610d98..21f4aab7f0adee 100644 --- a/node.gyp +++ b/node.gyp @@ -249,6 +249,7 @@ 'deps/acorn-plugins/acorn-private-class-elements/index.js', 'deps/acorn-plugins/acorn-private-methods/index.js', 'deps/acorn-plugins/acorn-static-class-features/index.js', + 'deps/cjs-module-lexer/lexer.js', ], 'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)', 'mkcodecache_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mkcodecache<(EXECUTABLE_SUFFIX)', diff --git a/src/node_native_module.cc b/src/node_native_module.cc index 74729c412674be..4c3633e06c6026 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -78,6 +78,9 @@ void NativeModuleLoader::InitializeModuleCategories() { "internal/main/" }; + module_categories_.can_be_required.emplace( + "internal/deps/cjs-module-lexer/lexer"); + module_categories_.cannot_be_required = std::set { #if !HAVE_INSPECTOR "inspector", @@ -115,7 +118,8 @@ void NativeModuleLoader::InitializeModuleCategories() { if (prefix.length() > id.length()) { continue; } - if (id.find(prefix) == 0) { + if (id.find(prefix) == 0 && + module_categories_.can_be_required.count(id) == 0) { module_categories_.cannot_be_required.emplace(id); } } diff --git a/test/es-module/test-esm-cjs-exports.js b/test/es-module/test-esm-cjs-exports.js new file mode 100644 index 00000000000000..37aa70d3880f2b --- /dev/null +++ b/test/es-module/test-esm-cjs-exports.js @@ -0,0 +1,21 @@ +'use strict'; + +const common = require('../common'); +const fixtures = require('../common/fixtures'); +const { spawn } = require('child_process'); +const assert = require('assert'); + +const entry = fixtures.path('/es-modules/cjs-exports.mjs'); + +const child = spawn(process.execPath, [entry]); +child.stderr.setEncoding('utf8'); +let stdout = ''; +child.stdout.setEncoding('utf8'); +child.stdout.on('data', (data) => { + stdout += data; +}); +child.on('close', common.mustCall((code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + assert.strictEqual(stdout, 'ok\n'); +})); diff --git a/test/es-module/test-esm-cjs-named-error.mjs b/test/es-module/test-esm-cjs-named-error.mjs index e9ddc67c0fbcea..4ef75a22f92674 100644 --- a/test/es-module/test-esm-cjs-named-error.mjs +++ b/test/es-module/test-esm-cjs-named-error.mjs @@ -3,37 +3,25 @@ import { rejects } from 'assert'; const fixtureBase = '../fixtures/es-modules/package-cjs-named-error'; -const expectedRelative = 'The requested module \'./fail.cjs\' is expected to ' + - 'be of type CommonJS, which does not support named exports. CommonJS ' + - 'modules can be imported by importing the default export.\n' + - 'For example:\n' + - 'import pkg from \'./fail.cjs\';\n' + - 'const { comeOn } = pkg;'; +const errTemplate = (specifier, name, namedImports) => + `Named export '${name}' not found. The requested module` + + ` '${specifier}' is a CommonJS module, which may not support ` + + 'all module.exports as named exports.\nCommonJS modules can ' + + 'always be imported via the default export, for example using:' + + `\n\nimport pkg from '${specifier}';\n` + (namedImports ? + `const ${namedImports} = pkg;\n` : ''); -const expectedWithoutExample = 'The requested module \'./fail.cjs\' is ' + - 'expected to be of type CommonJS, which does not support named exports. ' + - 'CommonJS modules can be imported by importing the default export.'; +const expectedWithoutExample = errTemplate('./fail.cjs', 'comeOn'); -const expectedRenamed = 'The requested module \'./fail.cjs\' is expected to ' + - 'be of type CommonJS, which does not support named exports. CommonJS ' + - 'modules can be imported by importing the default export.\n' + - 'For example:\n' + - 'import pkg from \'./fail.cjs\';\n' + - 'const { comeOn: comeOnRenamed } = pkg;'; +const expectedRelative = errTemplate('./fail.cjs', 'comeOn', '{ comeOn }'); -const expectedPackageHack = 'The requested module \'./json-hack/fail.js\' is ' + - 'expected to be of type CommonJS, which does not support named exports. ' + - 'CommonJS modules can be imported by importing the default export.\n' + - 'For example:\n' + - 'import pkg from \'./json-hack/fail.js\';\n' + - 'const { comeOn } = pkg;'; +const expectedRenamed = errTemplate('./fail.cjs', 'comeOn', + '{ comeOn: comeOnRenamed }'); -const expectedBare = 'The requested module \'deep-fail\' is expected to ' + - 'be of type CommonJS, which does not support named exports. CommonJS ' + - 'modules can be imported by importing the default export.\n' + - 'For example:\n' + - 'import pkg from \'deep-fail\';\n' + - 'const { comeOn } = pkg;'; +const expectedPackageHack = + errTemplate('./json-hack/fail.js', 'comeOn', '{ comeOn }'); + +const expectedBare = errTemplate('deep-fail', 'comeOn', '{ comeOn }'); rejects(async () => { await import(`${fixtureBase}/single-quote.mjs`); diff --git a/test/fixtures/es-modules/cjs-exports.mjs b/test/fixtures/es-modules/cjs-exports.mjs new file mode 100644 index 00000000000000..47bb4926af03aa --- /dev/null +++ b/test/fixtures/es-modules/cjs-exports.mjs @@ -0,0 +1,34 @@ +import { strictEqual, deepEqual } from 'assert'; + +import m, { π, z } from './exports-cases.js'; +import * as ns from './exports-cases.js'; + +deepEqual(Object.keys(ns), ['default', 'isObject', 'z', 'π']); +strictEqual(π, 'yes'); +strictEqual(z, 'yes'); +strictEqual(typeof m.isObject, 'undefined'); +strictEqual(m.π, 'yes'); +strictEqual(m.z, 'yes'); + +import m2, { __esModule as __esModule2, name as name2 } from './exports-cases2.js'; +import * as ns2 from './exports-cases2.js'; + +strictEqual(__esModule2, true); +strictEqual(name2, 'name'); +strictEqual(typeof m2, 'object'); +strictEqual(m2.default, 'the default'); +strictEqual(ns2.__esModule, true); +strictEqual(ns2.name, 'name'); +deepEqual(Object.keys(ns2), ['__esModule', 'case2', 'default', 'name', 'pi']); + +import m3, { __esModule as __esModule3, name as name3 } from './exports-cases3.js'; +import * as ns3 from './exports-cases3.js'; + +strictEqual(__esModule3, true); +strictEqual(name3, 'name'); +deepEqual(Object.keys(m3), ['name', 'default', 'pi', 'case2']); +strictEqual(ns3.__esModule, true); +strictEqual(ns3.name, 'name'); +strictEqual(ns3.case2, 'case2'); + +console.log('ok'); diff --git a/test/fixtures/es-modules/exports-cases.js b/test/fixtures/es-modules/exports-cases.js new file mode 100644 index 00000000000000..eec3d31bc7290c --- /dev/null +++ b/test/fixtures/es-modules/exports-cases.js @@ -0,0 +1,7 @@ +if (global.maybe) + module.exports = require('../is-object'); +exports['invalid identifier'] = 'no'; +module.exports['?invalid'] = 'no'; +module.exports['π'] = 'yes'; +exports.package = 10; // reserved word -> not used +Object.defineProperty(exports, 'z', { value: 'yes' }); diff --git a/test/fixtures/es-modules/exports-cases2.js b/test/fixtures/es-modules/exports-cases2.js new file mode 100644 index 00000000000000..189eebb9f3b1b7 --- /dev/null +++ b/test/fixtures/es-modules/exports-cases2.js @@ -0,0 +1,29 @@ +/* + * Transpiled with Babel from: + * + * export { π as pi } from './exports-cases.js'; + * export default 'the default'; + * export const name = 'name'; + */ + +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "pi", { + enumerable: true, + get: function () { + return _exportsCases.π; + } +}); +exports.name = exports.default = void 0; + +var _exportsCases = require("./exports-cases.js"); + +var _default = 'the default'; +exports.default = _default; +const name = 'name'; +exports.name = name; + +exports.case2 = 'case2'; diff --git a/test/fixtures/es-modules/exports-cases3.js b/test/fixtures/es-modules/exports-cases3.js new file mode 100644 index 00000000000000..c48b78cc4106be --- /dev/null +++ b/test/fixtures/es-modules/exports-cases3.js @@ -0,0 +1,25 @@ +/* + * Transpiled with TypeScript from: + * + * export { π as pi } from './exports-cases.js'; + * export default 'the default'; + * export const name = 'name'; + */ + +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.name = void 0; +exports.default = 'the default'; +exports.name = 'name'; + +var _external = require("./exports-cases2.js"); + +Object.keys(_external).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _external[key]; + } + }); +}); \ No newline at end of file diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index e6bf26ee0ab016..4778128cb09ae0 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -54,6 +54,7 @@ const expectedModules = new Set([ 'NativeModule internal/modules/cjs/helpers', 'NativeModule internal/modules/cjs/loader', 'NativeModule internal/modules/esm/create_dynamic_module', + 'NativeModule internal/deps/cjs-module-lexer/lexer', 'NativeModule internal/modules/esm/get_format', 'NativeModule internal/modules/esm/get_source', 'NativeModule internal/modules/esm/loader', diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 8f58a8f2986660..e9f4e1fb954021 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -33,6 +33,7 @@ addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)" addlicense "Acorn plugins" "deps/acorn-plugins" "$(cat ${rootdir}/deps/acorn-plugins/acorn-class-fields/LICENSE)" addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)" addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)" +addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$(cat ${rootdir}/deps/cjs-module-lexer/LICENSE)" if [ -f "${rootdir}/deps/icu/LICENSE" ]; then # ICU 57 and following. Drop the BOM addlicense "ICU" "deps/icu" \ From 6ca8fb552d1d1fc5b0cbf16f19f5968422ed7c8b Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 30 Sep 2020 04:24:34 -0700 Subject: [PATCH 018/117] module: refine module type mismatch error cases Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35426 Reviewed-By: Matteo Collina Reviewed-By: Bradley Farias Reviewed-By: Myles Borins --- lib/internal/modules/cjs/loader.js | 26 +----------- lib/internal/modules/esm/translators.js | 42 ++++++++++++++++++- test/es-module/test-esm-cjs-exports.js | 16 ++++++- .../es-modules/cjs-exports-invalid.mjs | 1 + test/fixtures/es-modules/invalid-cjs.js | 1 + 5 files changed, 58 insertions(+), 28 deletions(-) create mode 100644 test/fixtures/es-modules/cjs-exports-invalid.mjs create mode 100644 test/fixtures/es-modules/invalid-cjs.js diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index f07ff6c830c608..99579d6ad62c81 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -105,6 +105,7 @@ const { } = require('internal/constants'); const asyncESM = require('internal/process/esm_loader'); +const { enrichCJSError } = require('internal/modules/esm/translators'); const { kEvaluated } = internalBinding('module_wrap'); const { encodedSepRegEx, @@ -119,31 +120,6 @@ const relativeResolveCache = ObjectCreate(null); let requireDepth = 0; let statCache = null; -function enrichCJSError(err) { - const stack = err.stack.split('\n'); - - const lineWithErr = stack[1]; - - /* - The regular expression below targets the most common import statement - usage. However, some cases are not matching, cases like import statement - after a comment block and/or after a variable definition. - */ - if (err.message.startsWith('Unexpected token \'export\'') || - (RegExpPrototypeTest(/^\s*import(?=[ {'"*])\s*(?![ (])/, lineWithErr))) { - // Emit the warning synchronously because we are in the middle of handling - // a SyntaxError that will throw and likely terminate the process before an - // asynchronous warning would be emitted. - process.emitWarning( - 'To load an ES module, set "type": "module" in the package.json or use ' + - 'the .mjs extension.', - undefined, - undefined, - undefined, - true); - } -} - function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 5e4de5d5af0f39..acbf1ab1480dea 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -9,9 +9,12 @@ const { ObjectKeys, PromisePrototypeCatch, PromiseReject, + RegExpPrototypeTest, SafeMap, SafeSet, StringPrototypeReplace, + StringPrototypeSplit, + StringPrototypeStartsWith, } = primordials; let _TYPES = null; @@ -57,6 +60,7 @@ const cjsParse = require('internal/deps/cjs-module-lexer/lexer'); const translators = new SafeMap(); exports.translators = translators; +exports.enrichCJSError = enrichCJSError; let DECODER = null; function assertBufferSource(body, allowString, hookName) { @@ -130,6 +134,29 @@ translators.set('module', async function moduleStrategy(url) { return module; }); + +function enrichCJSError(err) { + const stack = StringPrototypeSplit(err.stack, '\n'); + /* + The regular expression below targets the most common import statement + usage. However, some cases are not matching, cases like import statement + after a comment block and/or after a variable definition. + */ + if (StringPrototypeStartsWith(err.message, 'Unexpected token \'export\'') || + (RegExpPrototypeTest(/^\s*import(?=[ {'"*])\s*(?![ (])/, stack[1]))) { + // Emit the warning synchronously because we are in the middle of handling + // a SyntaxError that will throw and likely terminate the process before an + // asynchronous warning would be emitted. + process.emitWarning( + 'To load an ES module, set "type": "module" in the package.json or use ' + + 'the .mjs extension.', + undefined, + undefined, + undefined, + true); + } +} + // Strategy for loading a node-style CommonJS module const isWindows = process.platform === 'win32'; const winSepRegEx = /\//g; @@ -152,7 +179,12 @@ translators.set('commonjs', async function commonjsStrategy(url, isMain) { exports = asyncESM.ESMLoader.cjsCache.get(module); asyncESM.ESMLoader.cjsCache.delete(module); } else { - exports = CJSModule._load(filename, undefined, isMain); + try { + exports = CJSModule._load(filename, undefined, isMain); + } catch (err) { + enrichCJSError(err); + throw err; + } } for (const exportName of exportNames) { @@ -190,7 +222,13 @@ function cjsPreparseModuleExports(filename) { source = readFileSync(filename, 'utf8'); } catch {} - const { exports, reexports } = cjsParse(source || ''); + let exports, reexports; + try { + ({ exports, reexports } = cjsParse(source || '')); + } catch { + exports = []; + reexports = []; + } const exportNames = new SafeSet(exports); diff --git a/test/es-module/test-esm-cjs-exports.js b/test/es-module/test-esm-cjs-exports.js index 37aa70d3880f2b..7db2c6fdb5971b 100644 --- a/test/es-module/test-esm-cjs-exports.js +++ b/test/es-module/test-esm-cjs-exports.js @@ -7,7 +7,7 @@ const assert = require('assert'); const entry = fixtures.path('/es-modules/cjs-exports.mjs'); -const child = spawn(process.execPath, [entry]); +let child = spawn(process.execPath, [entry]); child.stderr.setEncoding('utf8'); let stdout = ''; child.stdout.setEncoding('utf8'); @@ -19,3 +19,17 @@ child.on('close', common.mustCall((code, signal) => { assert.strictEqual(signal, null); assert.strictEqual(stdout, 'ok\n'); })); + +const entryInvalid = fixtures.path('/es-modules/cjs-exports-invalid.mjs'); +child = spawn(process.execPath, [entryInvalid]); +let stderr = ''; +child.stderr.setEncoding('utf8'); +child.stderr.on('data', (data) => { + stderr += data; +}); +child.on('close', common.mustCall((code, signal) => { + assert.strictEqual(code, 1); + assert.strictEqual(signal, null); + assert.ok(stderr.includes('Warning: To load an ES module')); + assert.ok(stderr.includes('Unexpected token \'export\'')); +})); diff --git a/test/fixtures/es-modules/cjs-exports-invalid.mjs b/test/fixtures/es-modules/cjs-exports-invalid.mjs new file mode 100644 index 00000000000000..67428fc27c277d --- /dev/null +++ b/test/fixtures/es-modules/cjs-exports-invalid.mjs @@ -0,0 +1 @@ +import cjs from './invalid-cjs.js'; diff --git a/test/fixtures/es-modules/invalid-cjs.js b/test/fixtures/es-modules/invalid-cjs.js new file mode 100644 index 00000000000000..15cae6690f1362 --- /dev/null +++ b/test/fixtures/es-modules/invalid-cjs.js @@ -0,0 +1 @@ +export var name = 5; From a18d0df33a04154e67ea8b1224b0018815b8caa6 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 4 Oct 2020 07:43:21 -0700 Subject: [PATCH 019/117] module: update to cjs-module-lexer@0.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35501 Reviewed-By: Michaël Zasso Reviewed-By: Masashi Hirano Reviewed-By: James M Snell Reviewed-By: Myles Borins Reviewed-By: Rich Trott --- deps/cjs-module-lexer/lexer.js | 129 ++++++++++++++++------------- deps/cjs-module-lexer/package.json | 2 +- doc/api/esm.md | 2 +- 3 files changed, 75 insertions(+), 58 deletions(-) diff --git a/deps/cjs-module-lexer/lexer.js b/deps/cjs-module-lexer/lexer.js index 6a9eef9edd7c21..7f7c971fcc15bd 100755 --- a/deps/cjs-module-lexer/lexer.js +++ b/deps/cjs-module-lexer/lexer.js @@ -10,6 +10,7 @@ let openTokenDepth, nextBraceIsClass, starExportMap, lastStarExportSpecifier, + lastExportsAssignSpecifier, _exports, reexports; @@ -25,11 +26,17 @@ function resetState () { nextBraceIsClass = false; starExportMap = Object.create(null); lastStarExportSpecifier = null; + lastExportsAssignSpecifier = null; _exports = new Set(); reexports = new Set(); } +// RequireType +const Import = 0; +const ExportAssign = 1; +const ExportStar = 2; + const strictReserved = new Set(['implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'enum']); module.exports = function parseCJS (source, name = '@') { @@ -42,6 +49,8 @@ module.exports = function parseCJS (source, name = '@') { e.loc = pos; throw e; } + if (lastExportsAssignSpecifier) + reexports.add(lastExportsAssignSpecifier); const result = { exports: [..._exports], reexports: [...reexports] }; resetState(); return result; @@ -79,25 +88,25 @@ function parseSource (cjsSource) { if (openTokenDepth === 0) { switch (ch) { case 105/*i*/: - if (source.slice(pos + 1, pos + 6) === 'mport' && keywordStart(pos)) + if (source.startsWith('mport', pos + 1) && keywordStart(pos)) throwIfImportStatement(); lastTokenPos = pos; continue; case 114/*r*/: const startPos = pos; - if (tryParseRequire(false) && keywordStart(startPos)) + if (tryParseRequire(Import) && keywordStart(startPos)) tryBacktrackAddStarExportBinding(startPos - 1); lastTokenPos = pos; continue; case 95/*_*/: - if (source.slice(pos + 1, pos + 8) === '_export' && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { + if (source.startsWith('_export', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { pos += 8; - if (source.slice(pos, pos + 4) === 'Star') + if (source.startsWith('Star', pos)) pos += 4; if (source.charCodeAt(pos) === 40/*(*/) { openTokenPosStack[openTokenDepth++] = lastTokenPos; if (source.charCodeAt(++pos) === 114/*r*/) - tryParseRequire(true); + tryParseRequire(ExportStar); } } lastTokenPos = pos; @@ -107,7 +116,7 @@ function parseSource (cjsSource) { switch (ch) { case 101/*e*/: - if (source.slice(pos + 1, pos + 6) === 'xport' && keywordStart(pos)) { + if (source.startsWith('xport', pos + 1) && keywordStart(pos)) { if (source.charCodeAt(pos + 6) === 115/*s*/) tryParseExportsDotAssign(false); else if (openTokenDepth === 0) @@ -115,15 +124,15 @@ function parseSource (cjsSource) { } break; case 99/*c*/: - if (keywordStart(pos) && source.slice(pos + 1, pos + 5) === 'lass' && isBrOrWs(source.charCodeAt(pos + 5))) + if (keywordStart(pos) && source.startsWith('lass', pos + 1) && isBrOrWs(source.charCodeAt(pos + 5))) nextBraceIsClass = true; break; case 109/*m*/: - if (source.slice(pos + 1, pos + 6) === 'odule' && keywordStart(pos)) + if (source.startsWith('odule', pos + 1) && keywordStart(pos)) tryParseModuleExportsDotAssign(); break; case 79/*O*/: - if (source.slice(pos + 1, pos + 6) === 'bject' && keywordStart(pos)) + if (source.startsWith('bject', pos + 1) && keywordStart(pos)) tryParseObjectDefineOrKeys(openTokenDepth === 0); break; case 40/*(*/: @@ -233,11 +242,11 @@ function tryBacktrackAddStarExportBinding (bPos) { bPos--; switch (source.charCodeAt(bPos)) { case 114/*r*/: - if (source.slice(bPos - 2, bPos) !== 'va') + if (!source.startsWith('va', bPos - 2)) return; break; case 116/*t*/: - if (source.slice(bPos - 2, bPos) !== 'le' && source.slice(bPos - 4, bPos) !== 'cons') + if (!source.startsWith('le', bPos - 2) && !source.startsWith('cons', bPos - 4)) return; break; default: return; @@ -254,7 +263,7 @@ function tryParseObjectDefineOrKeys (keys) { if (ch === 46/*.*/) { pos++; ch = commentWhitespace(); - if (ch === 100/*d*/ && source.slice(pos + 1, pos + 14) === 'efineProperty') { + if (ch === 100/*d*/ && source.startsWith('efineProperty', pos + 1)) { pos += 14; revertPos = pos - 1; ch = commentWhitespace(); @@ -279,7 +288,7 @@ function tryParseObjectDefineOrKeys (keys) { } } } - else if (keys && ch === 107/*k*/ && source.slice(pos + 1, pos + 4) === 'eys') { + else if (keys && ch === 107/*k*/ && source.startsWith('eys', pos + 1)) { while (true) { pos += 4; revertPos = pos - 1; @@ -298,14 +307,14 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 46/*.*/) break; pos++; ch = commentWhitespace(); - if (ch !== 102/*f*/ || source.slice(pos + 1, pos + 7) !== 'orEach') break; + if (ch !== 102/*f*/ || !source.startsWith('orEach', pos + 1)) break; pos += 7; ch = commentWhitespace(); revertPos = pos - 1; if (ch !== 40/*(*/) break; pos++; ch = commentWhitespace(); - if (ch !== 102/*f*/ || source.slice(pos + 1, pos + 8) !== 'unction') break; + if (ch !== 102/*f*/ || !source.startsWith('unction', pos + 1)) break; pos += 8; ch = commentWhitespace(); if (ch !== 40/*(*/) break; @@ -321,23 +330,23 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 123/*{*/) break; pos++; ch = commentWhitespace(); - if (ch !== 105/*i*/ || source.slice(pos + 1, pos + 3) !== 'f ') break; + if (ch !== 105/*i*/ || !source.startsWith('f ', pos + 1)) break; pos += 3; ch = commentWhitespace(); if (ch !== 40/*(*/) break; pos++; ch = commentWhitespace(); - if (it_id !== source.slice(pos, pos + it_id.length)) break; + if (!source.startsWith(it_id, pos)) break; pos += it_id.length; ch = commentWhitespace(); // `if (` IDENTIFIER$2 `===` ( `'default'` | `"default"` ) `||` IDENTIFIER$2 `===` ( '__esModule' | `"__esModule"` ) `) return` `;`? | if (ch === 61/*=*/) { - if (source.slice(pos + 1, pos + 3) !== '==') break; + if (!source.startsWith('==', pos + 1)) break; pos += 3; ch = commentWhitespace(); if (ch !== 34/*"*/ && ch !== 39/*'*/) break; let quot = ch; - if (source.slice(pos + 1, pos + 8) !== 'default') break; + if (!source.startsWith('default', pos + 1)) break; pos += 8; ch = commentWhitespace(); if (ch !== quot) break; @@ -354,7 +363,7 @@ function tryParseObjectDefineOrKeys (keys) { ch = commentWhitespace(); if (ch !== 34/*"*/ && ch !== 39/*'*/) break; quot = ch; - if (source.slice(pos + 1, pos + 11) !== '__esModule') break; + if (!source.startsWith('__esModule', pos + 1)) break; pos += 11; ch = commentWhitespace(); if (ch !== quot) break; @@ -363,7 +372,7 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 41/*)*/) break; pos += 1; ch = commentWhitespace(); - if (ch !== 114/*r*/ || source.slice(pos + 1, pos + 6) !== 'eturn') break; + if (ch !== 114/*r*/ || !source.startsWith('eturn', pos + 1)) break; pos += 6; ch = commentWhitespace(); if (ch === 59/*;*/) @@ -372,12 +381,12 @@ function tryParseObjectDefineOrKeys (keys) { } // `if (` IDENTIFIER$2 `!==` ( `'default'` | `"default"` ) `)` else if (ch === 33/*!*/) { - if (source.slice(pos + 1, pos + 3) !== '==') break; + if (!source.startsWith('==', pos + 1)) break; pos += 3; ch = commentWhitespace(); if (ch !== 34/*"*/ && ch !== 39/*'*/) break; const quot = ch; - if (source.slice(pos + 1, pos + 8) !== 'default') break; + if (!source.startsWith('default', pos + 1)) break; pos += 8; ch = commentWhitespace(); if (ch !== quot) break; @@ -429,7 +438,7 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 46/*.*/) break; pos++; ch = commentWhitespace(); - if (ch !== 100/*d*/ || source.slice(pos + 1, pos + 14) !== 'efineProperty') break; + if (ch !== 100/*d*/ || !source.startsWith('efineProperty', pos + 1)) break; pos += 14; ch = commentWhitespace(); if (ch !== 40/*(*/) break; @@ -440,7 +449,7 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 44/*,*/) break; pos++; ch = commentWhitespace(); - if (source.slice(pos, pos + it_id.length) !== it_id) break; + if (!source.startsWith(it_id, pos)) break; pos += it_id.length; ch = commentWhitespace(); if (ch !== 44/*,*/) break; @@ -449,25 +458,25 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 123/*{*/) break; pos++; ch = commentWhitespace(); - if (ch !== 101/*e*/ || source.slice(pos + 1, pos + 10) !== 'numerable') break; + if (ch !== 101/*e*/ || !source.startsWith('numerable', pos + 1)) break; pos += 10; ch = commentWhitespace(); if (ch !== 58/*:*/) break; pos++; ch = commentWhitespace(); - if (ch !== 116/*t*/ && source.slice(pos + 1, pos + 4) !== 'rue') break; + if (ch !== 116/*t*/ && !source.startsWith('rue', pos + 1)) break; pos += 4; ch = commentWhitespace(); if (ch !== 44/*,*/) break; pos++; ch = commentWhitespace(); - if (ch !== 103/*g*/ || source.slice(pos + 1, pos + 3) !== 'et') break; + if (ch !== 103/*g*/ || !source.startsWith('et', pos + 1)) break; pos += 3; ch = commentWhitespace(); if (ch !== 58/*:*/) break; pos++; ch = commentWhitespace(); - if (ch !== 102/*f*/ || source.slice(pos + 1, pos + 8) !== 'unction') break; + if (ch !== 102/*f*/ || !source.startsWith('unction', pos + 1)) break; pos += 8; ch = commentWhitespace(); if (ch !== 40/*(*/) break; @@ -479,16 +488,16 @@ function tryParseObjectDefineOrKeys (keys) { if (ch !== 123/*{*/) break; pos++; ch = commentWhitespace(); - if (ch !== 114/*r*/ || source.slice(pos + 1, pos + 6) !== 'eturn') break; + if (ch !== 114/*r*/ || !source.startsWith('eturn', pos + 1)) break; pos += 6; ch = commentWhitespace(); - if (source.slice(pos, pos + id.length) !== id) break; + if (!source.startsWith(id, pos)) break; pos += id.length; ch = commentWhitespace(); if (ch !== 91/*[*/) break; pos++; ch = commentWhitespace(); - if (source.slice(pos, pos + it_id.length) !== it_id) break; + if (!source.startsWith(it_id, pos)) break; pos += it_id.length; ch = commentWhitespace(); if (ch !== 93/*]*/) break; @@ -534,7 +543,7 @@ function tryParseObjectDefineOrKeys (keys) { function readExportsOrModuleDotExports (ch) { const revertPos = pos; - if (ch === 109/*m*/ && source.slice(pos + 1, pos + 6) === 'odule') { + if (ch === 109/*m*/ && source.startsWith('odule', pos + 1)) { pos += 6; ch = commentWhitespace(); if (ch !== 46/*.*/) { @@ -544,7 +553,7 @@ function readExportsOrModuleDotExports (ch) { pos++; ch = commentWhitespace(); } - if (ch === 101/*e*/ && source.slice(pos + 1, pos + 7) === 'xports') { + if (ch === 101/*e*/ && source.startsWith('xports', pos + 1)) { pos += 7; return true; } @@ -561,7 +570,7 @@ function tryParseModuleExportsDotAssign () { if (ch === 46/*.*/) { pos++; ch = commentWhitespace(); - if (ch === 101/*e*/ && source.slice(pos + 1, pos + 7) === 'xports') { + if (ch === 101/*e*/ && source.startsWith('xports', pos + 1)) { tryParseExportsDotAssign(true); return; } @@ -623,16 +632,16 @@ function tryParseExportsDotAssign (assign) { // require('...') if (ch === 114/*r*/) - tryParseRequire(true); + tryParseRequire(ExportAssign); } } } pos = revertPos; } -function tryParseRequire (directStarExport) { +function tryParseRequire (requireType) { // require('...') - if (source.slice(pos + 1, pos + 7) === 'equire') { + if (source.startsWith('equire', pos + 1)) { pos += 7; const revertPos = pos - 1; let ch = commentWhitespace(); @@ -645,13 +654,17 @@ function tryParseRequire (directStarExport) { const reexportEnd = pos++; ch = commentWhitespace(); if (ch === 41/*)*/) { - if (directStarExport) { - reexports.add(source.slice(reexportStart, reexportEnd)); - } - else { - lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); + switch (requireType) { + case ExportAssign: + lastExportsAssignSpecifier = source.slice(reexportStart, reexportEnd); + return true; + case ExportStar: + reexports.add(source.slice(reexportStart, reexportEnd)); + return true; + default: + lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); + return true; } - return true; } } else if (ch === 34/*"*/) { @@ -659,13 +672,17 @@ function tryParseRequire (directStarExport) { const reexportEnd = pos++; ch = commentWhitespace(); if (ch === 41/*)*/) { - if (directStarExport) { - reexports.add(source.slice(reexportStart, reexportEnd)); - } - else { - lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); + switch (requireType) { + case ExportAssign: + lastExportsAssignSpecifier = source.slice(reexportStart, reexportEnd); + return true; + case ExportStar: + reexports.add(source.slice(reexportStart, reexportEnd)); + return true; + default: + lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); + return true; } - return true; } } } @@ -1029,7 +1046,7 @@ function keywordStart (pos) { function readPrecedingKeyword (pos, match) { if (pos < match.length - 1) return false; - return source.slice(pos - match.length + 1, pos + 1) === match && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - match.length))); + return source.startsWith(match, pos - match.length + 1) && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - match.length))); } function readPrecedingKeyword1 (pos, ch) { @@ -1111,8 +1128,8 @@ function isExpressionKeyword (pos) { } function isParenKeyword (curPos) { - return source.charCodeAt(curPos) === 101/*e*/ && source.slice(curPos - 4, curPos) === 'whil' || - source.charCodeAt(curPos) === 114/*r*/ && source.slice(curPos - 2, curPos) === 'fo' || + return source.charCodeAt(curPos) === 101/*e*/ && source.startsWith('whil', curPos - 4) || + source.charCodeAt(curPos) === 114/*r*/ && source.startsWith('fo', curPos - 2) || source.charCodeAt(curPos - 1) === 105/*i*/ && source.charCodeAt(curPos) === 102/*f*/; } @@ -1142,11 +1159,11 @@ function isExpressionTerminator (curPos) { case 41/*)*/: return true; case 104/*h*/: - return source.slice(curPos - 4, curPos) === 'catc'; + return source.startsWith('catc', curPos - 4); case 121/*y*/: - return source.slice(curPos - 6, curPos) === 'finall'; + return source.startsWith('finall', curPos - 6); case 101/*e*/: - return source.slice(curPos - 3, curPos) === 'els'; + return source.startsWith('els', curPos - 3); } return false; } diff --git a/deps/cjs-module-lexer/package.json b/deps/cjs-module-lexer/package.json index 3f411a29dd3799..9859ccaaaaca46 100755 --- a/deps/cjs-module-lexer/package.json +++ b/deps/cjs-module-lexer/package.json @@ -1,6 +1,6 @@ { "name": "cjs-module-lexer", - "version": "0.3.3", + "version": "0.4.0", "description": "Lexes CommonJS modules, returning their named exports metadata", "main": "lexer.js", "exports": { diff --git a/doc/api/esm.md b/doc/api/esm.md index 456d270852ad8c..4680fb6b763462 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1998,7 +1998,7 @@ success! [TypedArray]: https://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects [Uint8Array]: https://www.ecma-international.org/ecma-262/6.0/#sec-uint8array [`util.TextDecoder`]: util.html#util_class_util_textdecoder -[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.3.1 +[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.4.0 [dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook [special scheme]: https://url.spec.whatwg.org/#special-scheme [the full specifier path]: #esm_mandatory_file_extensions From 7510667d87b426af4d0df1063df7b3fb09cc8777 Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 10:40:45 +0200 Subject: [PATCH 020/117] 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 Backport-PR-URL: https://github.com/nodejs/node/pull/35757 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 | 4 ++-- doc/api/modules.md | 2 +- doc/api/vm.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 4680fb6b763462..fc154e8f05b512 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 a6d54e1601c152..eac42930c81ca0 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,7 +34,8 @@ * [HTTPS](https.html) * [Inspector](inspector.html) * [Internationalization](intl.html) -* [Modules](modules.html) +* [Modules: CommonJS modules](modules.html) +* [Modules: ECMAScript modules](esm.html) * [Net](net.html) * [OS](os.html) * [Path](path.html) diff --git a/doc/api/modules.md b/doc/api/modules.md index b4f1abc5a24e10..39b294556c8074 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 6703921c712e6a..61aee4042b4eff 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1177,7 +1177,7 @@ queues. [`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 7c1700e143f862888662221930453c931e89208c Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 13:04:13 +0200 Subject: [PATCH 021/117] doc: move package config docs to separate page This part of the docs aims to contain documentation regarding package configuration that covers both ESM and CJS realms. * Move Enabling section * Update Enabling section * Remove -u flag * Package scopes do not carry through `node_modules` folders Refs: https://github.com/nodejs/modules/issues/539 Co-authored-by: Geoffrey Booth > Co-authored-by: Guy Bedford Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/34748 Reviewed-By: Derek Lewis Reviewed-By: Geoffrey Booth Reviewed-By: Guy Bedford Reviewed-By: Trivikram Kamat Reviewed-By: Ruy Adorno --- .eslintrc.js | 1 + doc/api/errors.md | 8 +- doc/api/esm.md | 846 ++------------------------------------------ doc/api/index.md | 1 + doc/api/packages.md | 828 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 865 insertions(+), 819 deletions(-) create mode 100644 doc/api/packages.md diff --git a/.eslintrc.js b/.eslintrc.js index 8279dfc9c4ab41..fe936370a37557 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,6 +44,7 @@ module.exports = { files: [ 'doc/api/esm.md', 'doc/api/modules.md', + 'doc/api/packages.md', 'test/es-module/test-esm-type-flag.js', 'test/es-module/test-esm-type-flag-alias.js', '*.mjs', diff --git a/doc/api/errors.md b/doc/api/errors.md index 4e608d87558db1..8f5ec9a88904d3 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2529,7 +2529,7 @@ closed. [crypto digest algorithm]: crypto.html#crypto_crypto_gethashes [domains]: domain.html [event emitter-based]: events.html#events_class_eventemitter -[exports]: esm.html#esm_package_entry_points +[exports]: packages.html#packages_package_entry_points [file descriptors]: https://en.wikipedia.org/wiki/File_descriptor [policy]: policy.html [stream-based]: stream.html @@ -2537,6 +2537,6 @@ closed. [Subresource Integrity specification]: https://www.w3.org/TR/SRI/#the-integrity-attribute [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch [vm]: vm.html -[self-reference a package using its name]: esm.html#esm_self_referencing_a_package_using_its_name -[define a custom subpath]: esm.html#esm_subpath_exports -["imports" field]: esm.html#esm_internal_package_imports +[self-reference a package using its name]: packages.html#packages_self_referencing_a_package_using_its_name +[define a custom subpath]: packages.html#packages_subpath_exports +["imports" field]: packages.html#packages_internal_package_imports diff --git a/doc/api/esm.md b/doc/api/esm.md index fc154e8f05b512..dee86968084812 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -44,822 +44,41 @@ Node.js contains support for ES Modules based upon the Expect major changes in the implementation including interoperability support, specifier resolution, and default behavior. + + + + + ## Enabling -Experimental support for ECMAScript modules is enabled by default. -Node.js will treat the following as ES modules when passed to `node` as the -initial input, or when referenced by `import` statements within ES module code: - -* Files ending in `.mjs`. - -* Files ending in `.js` when the nearest parent `package.json` file contains a - top-level field `"type"` with a value of `"module"`. - -* Strings passed in as an argument to `--eval` or `--print`, or piped to - `node` via `STDIN`, with the flag `--input-type=module`. - -Node.js will treat as CommonJS all other forms of input, such as `.js` files -where the nearest parent `package.json` file contains no top-level `"type"` -field, or string input without the flag `--input-type`. This behavior is to -preserve backward compatibility. However, now that Node.js supports both -CommonJS and ES modules, it is best to be explicit whenever possible. Node.js -will treat the following as CommonJS when passed to `node` as the initial input, -or when referenced by `import` statements within ES module code: - -* Files ending in `.cjs`. - -* Files ending in `.js` when the nearest parent `package.json` file contains a - top-level field `"type"` with a value of `"commonjs"`. - -* Strings passed in as an argument to `--eval` or `--print`, or piped to - `node` via `STDIN`, with the flag `--input-type=commonjs`. - -### `package.json` `"type"` field - -Files ending with `.js` will be loaded as ES modules when the nearest parent -`package.json` file contains a top-level field `"type"` with a value of -`"module"`. - -The nearest parent `package.json` is defined as the first `package.json` found -when searching in the current folder, that folder’s parent, and so on up -until the root of the volume is reached. - - -```js -// package.json -{ - "type": "module" -} -``` - -```bash -# In same folder as preceding package.json -node my-app.js # Runs as ES module -``` - -If the nearest parent `package.json` lacks a `"type"` field, or contains -`"type": "commonjs"`, `.js` files are treated as CommonJS. If the volume root is -reached and no `package.json` is found, Node.js defers to the default, a -`package.json` with no `"type"` field. - -`import` statements of `.js` files are treated as ES modules if the nearest -parent `package.json` contains `"type": "module"`. - -```js -// my-app.js, part of the same example as above -import './startup.js'; // Loaded as ES module because of package.json -``` - -Package authors should include the `"type"` field, even in packages where all -sources are CommonJS. Being explicit about the `type` of the package will -future-proof the package in case the default type of Node.js ever changes, and -it will also make things easier for build tools and loaders to determine how the -files in the package should be interpreted. - -Regardless of the value of the `"type"` field, `.mjs` files are always treated -as ES modules and `.cjs` files are always treated as CommonJS. - -### Package scope and file extensions - -A folder containing a `package.json` file, and all subfolders below that folder -until the next folder containing another `package.json`, are a -_package scope_. The `"type"` field defines how to treat `.js` files -within the package scope. Every package in a -project’s `node_modules` folder contains its own `package.json` file, so each -project’s dependencies have their own package scopes. If a `package.json` file -does not have a `"type"` field, the default `"type"` is `"commonjs"`. - -The package scope applies not only to initial entry points (`node my-app.js`) -but also to files referenced by `import` statements and `import()` expressions. - -```js -// my-app.js, in an ES module package scope because there is a package.json -// file in the same folder with "type": "module". - -import './startup/init.js'; -// Loaded as ES module since ./startup contains no package.json file, -// and therefore inherits the ES module package scope from one level up. - -import 'commonjs-package'; -// Loaded as CommonJS since ./node_modules/commonjs-package/package.json -// lacks a "type" field or contains "type": "commonjs". - -import './node_modules/commonjs-package/index.js'; -// Loaded as CommonJS since ./node_modules/commonjs-package/package.json -// lacks a "type" field or contains "type": "commonjs". -``` - -Files ending with `.mjs` are always loaded as ES modules regardless of package -scope. - -Files ending with `.cjs` are always loaded as CommonJS regardless of package -scope. - -```js -import './legacy-file.cjs'; -// Loaded as CommonJS since .cjs is always loaded as CommonJS. - -import 'commonjs-package/src/index.mjs'; -// Loaded as ES module since .mjs is always loaded as ES module. -``` - -The `.mjs` and `.cjs` extensions may be used to mix types within the same -package scope: - -* Within a `"type": "module"` package scope, Node.js can be instructed to - interpret a particular file as CommonJS by naming it with a `.cjs` extension - (since both `.js` and `.mjs` files are treated as ES modules within a - `"module"` package scope). - -* Within a `"type": "commonjs"` package scope, Node.js can be instructed to - interpret a particular file as an ES module by naming it with an `.mjs` - extension (since both `.js` and `.cjs` files are treated as CommonJS within a - `"commonjs"` package scope). - -### `--input-type` flag - -Strings passed in as an argument to `--eval` or `--print` (or `-e` or `-p`), or -piped to `node` via `STDIN`, will be treated as ES modules when the -`--input-type=module` flag is set. - -```bash -node --input-type=module --eval "import { sep } from 'path'; console.log(sep);" - -echo "import { sep } from 'path'; console.log(sep);" | node --input-type=module -``` - -For completeness there is also `--input-type=commonjs`, for explicitly running -string input as CommonJS. This is the default behavior if `--input-type` is -unspecified. +Node.js treats JavaScript code as CommonJS modules by default. +Authors can tell Node.js to treat JavaScript code as ECMAScript modules +via the `.mjs` file extension, the `package.json` `"type"` field, or the +`--input-type` flag. See +[Modules: Packages](packages.html#packages_determining_module_system) for more +details. + + + + + + + + + + + + + + + + ## Packages -### Package entry points - -In a package’s `package.json` file, two fields can define entry points for a -package: `"main"` and `"exports"`. The `"main"` field is supported in all -versions of Node.js, but its capabilities are limited: it only defines the main -entry point of the package. - -The `"exports"` field provides an alternative to `"main"` where the package -main entry point can be defined while also encapsulating the package, -**preventing any other entry points besides those defined in `"exports"`**. -This encapsulation allows module authors to define a public interface for -their package. - -If both `"exports"` and `"main"` are defined, the `"exports"` field takes -precedence over `"main"`. `"exports"` are not specific to ES modules or -CommonJS; `"main"` will be overridden by `"exports"` if it exists. As such -`"main"` cannot be used as a fallback for CommonJS but it can be used as a -fallback for legacy versions of Node.js that do not support the `"exports"` -field. - -[Conditional exports][] can be used within `"exports"` to define different -package entry points per environment, including whether the package is -referenced via `require` or via `import`. For more information about supporting -both CommonJS and ES Modules in a single package please consult -[the dual CommonJS/ES module packages section][]. - -**Warning**: Introducing the `"exports"` field prevents consumers of a package -from using any entry points that are not defined, including the `package.json` -(e.g. `require('your-package/package.json')`. **This will likely be a breaking -change.** - -To make the introduction of `"exports"` non-breaking, ensure that every -previously supported entry point is exported. It is best to explicitly specify -entry points so that the package’s public API is well-defined. For example, -a project that previous exported `main`, `lib`, -`feature`, and the `package.json` could use the following `package.exports`: - -```json -{ - "name": "my-mod", - "exports": { - ".": "./lib/index.js", - "./lib": "./lib/index.js", - "./lib/index": "./lib/index.js", - "./lib/index.js": "./lib/index.js", - "./feature": "./feature/index.js", - "./feature/index.js": "./feature/index.js", - "./package.json": "./package.json" - } -} -``` - -Alternatively a project could choose to export entire folders: - -```json -{ - "name": "my-mod", - "exports": { - ".": "./lib/index.js", - "./lib": "./lib/index.js", - "./lib/": "./lib/", - "./feature": "./feature/index.js", - "./feature/": "./feature/", - "./package.json": "./package.json" - } -} -``` - -As a last resort, package encapsulation can be disabled entirely by creating an -export for the root of the package `"./": "./"`. This will expose every file in -the package at the cost of disabling the encapsulation and potential tooling -benefits this provides. As the ES Module loader in Node.js enforces the use of -[the full specifier path][], exporting the root rather than being explicit -about entry is less expressive than either of the prior examples. Not only -will encapsulation be lost but module consumers will be unable to -`import feature from 'my-mod/feature'` as they will need to provide the full -path `import feature from 'my-mod/feature/index.js`. - -#### Main entry point export - -To set the main entry point for a package, it is advisable to define both -`"exports"` and `"main"` in the package’s `package.json` file: - - -```js -{ - "main": "./main.js", - "exports": "./main.js" -} -``` - -The benefit of doing this is that when using the `"exports"` field all -subpaths of the package will no longer be available to importers under -`require('pkg/subpath.js')`, and instead they will get a new error, -`ERR_PACKAGE_PATH_NOT_EXPORTED`. - -This encapsulation of exports provides more reliable guarantees -about package interfaces for tools and when handling semver upgrades for a -package. It is not a strong encapsulation since a direct require of any -absolute subpath of the package such as -`require('/path/to/node_modules/pkg/subpath.js')` will still load `subpath.js`. - -#### Subpath exports - -When using the `"exports"` field, custom subpaths can be defined along -with the main entry point by treating the main entry point as the -`"."` subpath: - - -```js -{ - "main": "./main.js", - "exports": { - ".": "./main.js", - "./submodule": "./src/submodule.js" - } -} -``` - -Now only the defined subpath in `"exports"` can be imported by a -consumer: - -```js -import submodule from 'es-module-package/submodule'; -// Loads ./node_modules/es-module-package/src/submodule.js -``` - -While other subpaths will error: - -```js -import submodule from 'es-module-package/private-module.js'; -// Throws ERR_PACKAGE_PATH_NOT_EXPORTED -``` - -Entire folders can also be mapped with package exports: - - -```js -// ./node_modules/es-module-package/package.json -{ - "exports": { - "./features/": "./src/features/" - } -} -``` - -With the above, all modules within the `./src/features/` folder -are exposed deeply to `import` and `require`: - -```js -import feature from 'es-module-package/features/x.js'; -// Loads ./node_modules/es-module-package/src/features/x.js -``` - -When using folder mappings, ensure that you do want to expose every -module inside the subfolder. Any modules which are not public -should be moved to another folder to retain the encapsulation -benefits of exports. - -#### Package exports fallbacks - -For possible new specifier support in future, array fallbacks are -supported for all invalid specifiers: - - -```js -{ - "exports": { - "./submodule": ["not:valid", "./submodule.js"] - } -} -``` - -Since `"not:valid"` is not a valid specifier, `"./submodule.js"` is used -instead as the fallback, as if it were the only target. - -#### Exports sugar - -If the `"."` export is the only export, the `"exports"` field provides sugar -for this case being the direct `"exports"` field value. - -If the `"."` export has a fallback array or string value, then the `"exports"` -field can be set to this value directly. - - -```js -{ - "exports": { - ".": "./main.js" - } -} -``` - -can be written: - - -```js -{ - "exports": "./main.js" -} -``` - -#### Conditional exports - -Conditional exports provide a way to map to different paths depending on -certain conditions. They are supported for both CommonJS and ES module imports. - -For example, a package that wants to provide different ES module exports for -`require()` and `import` can be written: - - -```js -// package.json -{ - "main": "./main-require.cjs", - "exports": { - "import": "./main-module.js", - "require": "./main-require.cjs" - }, - "type": "module" -} -``` - -Node.js supports the following conditions out of the box: - -* `"import"` - matched when the package is loaded via `import` or - `import()`. Can reference either an ES module or CommonJS file, as both - `import` and `import()` can load either ES module or CommonJS sources. - _Always matched when the `"require"` condition is not matched._ -* `"require"` - matched when the package is loaded via `require()`. - As `require()` only supports CommonJS, the referenced file must be CommonJS. - _Always matched when the `"import"` condition is not matched._ -* `"node"` - matched for any Node.js environment. Can be a CommonJS or ES - module file. _This condition should always come after `"import"` or - `"require"`._ -* `"default"` - the generic fallback that will always match. Can be a CommonJS - or ES module file. _This condition should always come last._ - -Within the `"exports"` object, key order is significant. During condition -matching, earlier entries have higher priority and take precedence over later -entries. _The general rule is that conditions should be from most specific to -least specific in object order_. - -Other conditions such as `"browser"`, `"electron"`, `"deno"`, `"react-native"`, -etc. are unknown to, and thus ignored by Node.js. Runtimes or tools other than -Node.js may use them at their discretion. Further restrictions, definitions, or -guidance on condition names may occur in the future. - -Using the `"import"` and `"require"` conditions can lead to some hazards, -which are further explained in [the dual CommonJS/ES module packages section][]. - -Conditional exports can also be extended to exports subpaths, for example: - - -```js -{ - "main": "./main.js", - "exports": { - ".": "./main.js", - "./feature": { - "node": "./feature-node.js", - "default": "./feature.js" - } - } -} -``` - -Defines a package where `require('pkg/feature')` and `import 'pkg/feature'` -could provide different implementations between Node.js and other JS -environments. - -When using environment branches, always include a `"default"` condition where -possible. Providing a `"default"` condition ensures that any unknown JS -environments are able to use this universal implementation, which helps avoid -these JS environments from having to pretend to be existing environments in -order to support packages with conditional exports. For this reason, using -`"node"` and `"default"` condition branches is usually preferable to using -`"node"` and `"browser"` condition branches. - -#### Nested conditions - -In addition to direct mappings, Node.js also supports nested condition objects. - -For example, to define a package that only has dual mode entry points for -use in Node.js but not the browser: - - -```js -{ - "main": "./main.js", - "exports": { - "node": { - "import": "./feature-node.mjs", - "require": "./feature-node.cjs" - }, - "default": "./feature.mjs", - } -} -``` - -Conditions continue to be matched in order as with flat conditions. If -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 -`package.json` `"exports"` field can be referenced via the package’s name. -For example, assuming the `package.json` is: - -```json -// package.json -{ - "name": "a-package", - "exports": { - ".": "./main.mjs", - "./foo": "./foo.js" - } -} -``` - -Then any module _in that package_ can reference an export in the package itself: - -```js -// ./a-module.mjs -import { something } from 'a-package'; // Imports "something" from ./main.mjs. -``` - -Self-referencing is available only if `package.json` has `exports`, and will -allow importing only what that `exports` (in the `package.json`) allows. -So the code below, given the previous package, will generate a runtime error: - -```js -// ./another-module.mjs - -// Imports "another" from ./m.mjs. Fails because -// the "package.json" "exports" field -// does not provide an export named "./m.mjs". -import { another } from 'a-package/m.mjs'; -``` - -Self-referencing is also available when using `require`, both in an ES module, -and in a CommonJS one. For example, this code will also work: - -```js -// ./a-module.js -const { something } = require('a-package/foo'); // Loads from ./foo.js. -``` - -### Internal package imports - -In addition to the `"exports"` field it is possible to define internal package -import maps that only apply to import specifiers from within the package itself. - -Entries in the imports field must always start with `#` to ensure they are -clearly disambiguated from package specifiers. - -For example, the imports field can be used to gain the benefits of conditional -exports for internal modules: - -```json -// package.json -{ - "imports": { - "#dep": { - "node": "dep-node-native", - "default": "./dep-polyfill.js" - } - }, - "dependencies": { - "dep-node-native": "^1.0.0" - } -} -``` - -where `import '#dep'` would now get the resolution of the external package -`dep-node-native` (including its exports in turn), and instead get the local -file `./dep-polyfill.js` relative to the package in other environments. - -Unlike the exports field, import maps permit mapping to external packages -because this provides an important use case for conditional loading and also can -be done without the risk of cycles, unlike for exports. - -Apart from the above, the resolution rules for the imports field are otherwise -analogous to the exports field. - -### Dual CommonJS/ES module packages - -Prior to the introduction of support for ES modules in Node.js, it was a common -pattern for package authors to include both CommonJS and ES module JavaScript -sources in their package, with `package.json` `"main"` specifying the CommonJS -entry point and `package.json` `"module"` specifying the ES module entry point. -This enabled Node.js to run the CommonJS entry point while build tools such as -bundlers used the ES module entry point, since Node.js ignored (and still -ignores) the top-level `"module"` field. - -Node.js can now run ES module entry points, and a package can contain both -CommonJS and ES module entry points (either via separate specifiers such as -`'pkg'` and `'pkg/es-module'`, or both at the same specifier via [Conditional -exports][]). Unlike in the scenario where `"module"` is only used by bundlers, -or ES module files are transpiled into CommonJS on the fly before evaluation by -Node.js, the files referenced by the ES module entry point are evaluated as ES -modules. - -#### Dual package hazard - -When an application is using a package that provides both CommonJS and ES module -sources, there is a risk of certain bugs if both versions of the package get -loaded. This potential comes from the fact that the `pkgInstance` created by -`const pkgInstance = require('pkg')` is not the same as the `pkgInstance` -created by `import pkgInstance from 'pkg'` (or an alternative main path like -`'pkg/module'`). This is the “dual package hazard,” where two versions of the -same package can be loaded within the same runtime environment. While it is -unlikely that an application or package would intentionally load both versions -directly, it is common for an application to load one version while a dependency -of the application loads the other version. This hazard can happen because -Node.js supports intermixing CommonJS and ES modules, and can lead to unexpected -behavior. - -If the package main export is a constructor, an `instanceof` comparison of -instances created by the two versions returns `false`, and if the export is an -object, properties added to one (like `pkgInstance.foo = 3`) are not present on -the other. This differs from how `import` and `require` statements work in -all-CommonJS or all-ES module environments, respectively, and therefore is -surprising to users. It also differs from the behavior users are familiar with -when using transpilation via tools like [Babel][] or [`esm`][]. - -#### Writing dual packages while avoiding or minimizing hazards - -First, the hazard described in the previous section occurs when a package -contains both CommonJS and ES module sources and both sources are provided for -use in Node.js, either via separate main entry points or exported paths. A -package could instead be written where any version of Node.js receives only -CommonJS sources, and any separate ES module sources the package may contain -could be intended only for other environments such as browsers. Such a package -would be usable by any version of Node.js, since `import` can refer to CommonJS -files; but it would not provide any of the advantages of using ES module syntax. - -A package could also switch from CommonJS to ES module syntax in a breaking -change version bump. This has the disadvantage that the newest version -of the package would only be usable in ES module-supporting versions of Node.js. - -Every pattern has tradeoffs, but there are two broad approaches that satisfy the -following conditions: - -1. The package is usable via both `require` and `import`. -1. The package is usable in both current Node.js and older versions of Node.js - that lack support for ES modules. -1. The package main entry point, e.g. `'pkg'` can be used by both `require` to - resolve to a CommonJS file and by `import` to resolve to an ES module file. - (And likewise for exported paths, e.g. `'pkg/feature'`.) -1. The package provides named exports, e.g. `import { name } from 'pkg'` rather - than `import pkg from 'pkg'; pkg.name`. -1. The package is potentially usable in other ES module environments such as - browsers. -1. The hazards described in the previous section are avoided or minimized. - -##### Approach #1: Use an ES module wrapper - -Write the package in CommonJS or transpile ES module sources into CommonJS, and -create an ES module wrapper file that defines the named exports. Using -[Conditional exports][], the ES module wrapper is used for `import` and the -CommonJS entry point for `require`. - - -```js -// ./node_modules/pkg/package.json -{ - "type": "module", - "main": "./index.cjs", - "exports": { - "import": "./wrapper.mjs", - "require": "./index.cjs" - } -} -``` - -The preceding 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'; -``` - -```js -// ./node_modules/pkg/wrapper.mjs -import cjsModule from './index.cjs'; -export const name = cjsModule.name; -``` - -In this example, the `name` from `import { name } from 'pkg'` is the same -singleton as the `name` from `const { name } = require('pkg')`. Therefore `===` -returns `true` when comparing the two `name`s and the divergent specifier hazard -is avoided. - -If the module is not simply a list of named exports, but rather contains a -unique function or object export like `module.exports = function () { ... }`, -or if support in the wrapper for the `import pkg from 'pkg'` pattern is desired, -then the wrapper would instead be written to export the default optionally -along with any named exports as well: - -```js -import cjsModule from './index.cjs'; -export const name = cjsModule.name; -export default cjsModule; -``` - -This approach is appropriate for any of the following use cases: -* The package is currently written in CommonJS and the author would prefer not - to refactor it into ES module syntax, but wishes to provide named exports for - ES module consumers. -* The package has other packages that depend on it, and the end user might - install both this package and those other packages. For example a `utilities` - package is used directly in an application, and a `utilities-plus` package - adds a few more functions to `utilities`. Because the wrapper exports - underlying CommonJS files, it doesn’t matter if `utilities-plus` is written in - CommonJS or ES module syntax; it will work either way. -* The package stores internal state, and the package author would prefer not to - refactor the package to isolate its state management. See the next section. - -A variant of this approach not requiring conditional exports for consumers could -be to add an export, e.g. `"./module"`, to point to an all-ES module-syntax -version of the package. This could be used via `import 'pkg/module'` by users -who are certain that the CommonJS version will not be loaded anywhere in the -application, such as by dependencies; or if the CommonJS version can be loaded -but doesn’t affect the ES module version (for example, because the package is -stateless): - - -```js -// ./node_modules/pkg/package.json -{ - "type": "module", - "main": "./index.cjs", - "exports": { - ".": "./index.cjs", - "./module": "./wrapper.mjs" - } -} -``` - -##### Approach #2: Isolate state - -A `package.json` file can define the separate CommonJS and ES module entry -points directly: - - -```js -// ./node_modules/pkg/package.json -{ - "type": "module", - "main": "./index.cjs", - "exports": { - "import": "./index.mjs", - "require": "./index.cjs" - } -} -``` - -This can be done if both the CommonJS and ES module versions of the package are -equivalent, for example because one is the transpiled output of the other; and -the package’s management of state is carefully isolated (or the package is -stateless). - -The reason that state is an issue is because both the CommonJS and ES module -versions of the package may get used within an application; for example, the -user’s application code could `import` the ES module version while a dependency -`require`s the CommonJS version. If that were to occur, two copies of the -package would be loaded in memory and therefore two separate states would be -present. This would likely cause hard-to-troubleshoot bugs. - -Aside from writing a stateless package (if JavaScript’s `Math` were a package, -for example, it would be stateless as all of its methods are static), there are -some ways to isolate state so that it’s shared between the potentially loaded -CommonJS and ES module instances of the package: - -1. If possible, contain all state within an instantiated object. JavaScript’s - `Date`, for example, needs to be instantiated to contain state; if it were a - package, it would be used like this: - - ```js - import Date from 'date'; - const someDate = new Date(); - // someDate contains state; Date does not - ``` - - The `new` keyword isn’t required; a package’s function can return a new - object, or modify a passed-in object, to keep the state external to the - package. - -1. Isolate the state in one or more CommonJS files that are shared between the - CommonJS and ES module versions of the package. For example, if the CommonJS - and ES module entry points are `index.cjs` and `index.mjs`, respectively: - - ```js - // ./node_modules/pkg/index.cjs - const state = require('./state.cjs'); - module.exports.state = state; - ``` - - ```js - // ./node_modules/pkg/index.mjs - import state from './state.cjs'; - export { - state - }; - ``` - - Even if `pkg` is used via both `require` and `import` in an application (for - example, via `import` in application code and via `require` by a dependency) - each reference of `pkg` will contain the same state; and modifying that - state from either module system will apply to both. - -Any plugins that attach to the package’s singleton would need to separately -attach to both the CommonJS and ES module singletons. - -This approach is appropriate for any of the following use cases: -* The package is currently written in ES module syntax and the package author - wants that version to be used wherever such syntax is supported. -* The package is stateless or its state can be isolated without too much - difficulty. -* The package is unlikely to have other public packages that depend on it, or if - it does, the package is stateless or has state that need not be shared between - dependencies or with the overall application. - -Even with isolated state, there is still the cost of possible extra code -execution between the CommonJS and ES module versions of a package. - -As with the previous approach, a variant of this approach not requiring -conditional exports for consumers could be to add an export, e.g. -`"./module"`, to point to an all-ES module-syntax version of the package: - - -```js -// ./node_modules/pkg/package.json -{ - "type": "module", - "main": "./index.cjs", - "exports": { - ".": "./index.cjs", - "./module": "./index.mjs" - } -} -``` +This section was moved to [Modules: Packages](packages.html). ## `import` Specifiers @@ -1139,7 +358,7 @@ semantics implemented. ## Builtin modules -Builtin modules will provide named exports of their public API. A +[Core modules][] will provide named exports of their public API. A default export is also provided which is the value of the CommonJS exports. The default export can be used for, among other things, modifying the named exports. Named exports of builtin modules are updated only by calling @@ -1973,9 +1192,8 @@ success! ``` -[Babel]: https://babeljs.io/ [CommonJS]: modules.html -[Conditional exports]: #esm_conditional_exports +[Conditional exports]: packages.html#packages_conditional_exports [Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports [ECMAScript-modules implementation]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md [ES Module Integration Proposal for Web Assembly]: https://github.com/webassembly/esm-integration @@ -1983,7 +1201,6 @@ success! [Terminology]: #esm_terminology [WHATWG JSON modules specification]: https://html.spec.whatwg.org/#creating-a-json-module-script [`data:` URLs]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs -[`esm`]: https://github.com/standard-things/esm#readme [`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export [`getFormat` hook]: #esm_code_getformat_code_hook [`import()`]: #esm_import_expressions @@ -2001,9 +1218,8 @@ success! [cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.4.0 [dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook [special scheme]: https://url.spec.whatwg.org/#special-scheme -[the full specifier path]: #esm_mandatory_file_extensions [the official standard format]: https://tc39.github.io/ecma262/#sec-modules -[the dual CommonJS/ES module packages section]: #esm_dual_commonjs_es_module_packages [transpiler loader example]: #esm_transpiler_loader [6.1.7 Array Index]: https://tc39.es/ecma262/#integer-index [Top-Level Await]: https://github.com/tc39/proposal-top-level-await +[Core modules]: modules.html#modules_core_modules diff --git a/doc/api/index.md b/doc/api/index.md index eac42930c81ca0..ce1af23c6b3bb9 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -36,6 +36,7 @@ * [Internationalization](intl.html) * [Modules: CommonJS modules](modules.html) * [Modules: ECMAScript modules](esm.html) +* [Modules: Packages](packages.html) * [Net](net.html) * [OS](os.html) * [Path](path.html) diff --git a/doc/api/packages.md b/doc/api/packages.md new file mode 100644 index 00000000000000..c8fbf6c213bb83 --- /dev/null +++ b/doc/api/packages.md @@ -0,0 +1,828 @@ +# Modules: Packages + + + +## Introduction + +A package is a folder described by a `package.json` file. + +A folder containing a `package.json` file, and all subfolders below that folder +until the next folder containing another `package.json` file, are a _package +scope_. + +## Determining module system + +Node.js will treat the following as [ES modules][] when passed to `node` as the +initial input, or when referenced by `import` statements within ES module code: + +* Files ending in `.mjs`. + +* Files ending in `.js` when the nearest parent `package.json` file contains a + top-level field `"type"` with a value of `"module"`. + +* Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`, + with the flag `--input-type=module`. + +Node.js will treat as [CommonJS][] all other forms of input, such as `.js` files +where the nearest parent `package.json` file contains no top-level `"type"` +field, or string input without the flag `--input-type`. This behavior is to +preserve backward compatibility. However, now that Node.js supports both +CommonJS and ES modules, it is best to be explicit whenever possible. Node.js +will treat the following as CommonJS when passed to `node` as the initial input, +or when referenced by `import` statements within ES module code: + +* Files ending in `.cjs`. + +* Files ending in `.js` when the nearest parent `package.json` file contains a + top-level field `"type"` with a value of `"commonjs"`. + +* Strings passed in as an argument to `--eval` or `--print`, or piped to `node` + via `STDIN`, with the flag `--input-type=commonjs`. + +### `package.json` `"type"` field + +Files ending with `.js` will be loaded as [ES modules][] when the nearest parent +`package.json` file contains a top-level field `"type"` with a value of +`"module"`. + +The nearest parent `package.json` is defined as the first `package.json` found +when searching in the current folder, that folder’s parent, and so on up +until the root of the volume is reached. + + +```js +// package.json +{ + "type": "module" +} +``` + +```bash +# In same folder as preceding package.json +node my-app.js # Runs as ES module +``` + +If the nearest parent `package.json` lacks a `"type"` field, or contains +`"type": "commonjs"`, `.js` files are treated as [CommonJS][]. If the volume +root is reached and no `package.json` is found, Node.js defers to the default, a +`package.json` with no `"type"` field. + +`import` statements of `.js` files are treated as ES modules if the nearest +parent `package.json` contains `"type": "module"`. + +```js +// my-app.js, part of the same example as above +import './startup.js'; // Loaded as ES module because of package.json +``` + +Package authors should include the `"type"` field, even in packages where all +sources are [CommonJS][]. Being explicit about the `type` of the package will +future-proof the package in case the default type of Node.js ever changes, and +it will also make things easier for build tools and loaders to determine how the +files in the package should be interpreted. + +Regardless of the value of the `"type"` field, `.mjs` files are always treated +as ES modules and `.cjs` files are always treated as [CommonJS][]. + +### Package scope and file extensions + +A folder containing a `package.json` file, and all subfolders below that folder +until the next folder containing another `package.json`, are a +_package scope_. Package scopes do not carry through `node_modules` folders. The +`"type"` field defines how to treat `.js` files within the package scope. If a +`package.json` file does not have a `"type"` field, the default is `"commonjs"`. + +The package scope applies not only to initial entry points (`node my-app.js`) +but also to files referenced by `import` statements and `import()` expressions. + +```js +// my-app.js, in an ES module package scope because there is a package.json +// file in the same folder with "type": "module". + +import './startup/init.js'; +// Loaded as ES module since ./startup contains no package.json file, +// and therefore inherits the ES module package scope from one level up. + +import 'commonjs-package'; +// Loaded as CommonJS since ./node_modules/commonjs-package/package.json +// lacks a "type" field or contains "type": "commonjs". + +import './node_modules/commonjs-package/index.js'; +// Loaded as CommonJS since ./node_modules/commonjs-package/package.json +// lacks a "type" field or contains "type": "commonjs". +``` + +Files ending with `.mjs` are always loaded as [ES modules][] regardless of +package scope. + +Files ending with `.cjs` are always loaded as [CommonJS][] regardless of package +scope. + +```js +import './legacy-file.cjs'; +// Loaded as CommonJS since .cjs is always loaded as CommonJS. + +import 'commonjs-package/src/index.mjs'; +// Loaded as ES module since .mjs is always loaded as ES module. +``` + +The `.mjs` and `.cjs` extensions may be used to mix types within the same +package scope: + +* Within a `"type": "module"` package scope, Node.js can be instructed to + interpret a particular file as [CommonJS][] by naming it with a `.cjs` + extension (since both `.js` and `.mjs` files are treated as ES modules within + a `"module"` package scope). + +* Within a `"type": "commonjs"` package scope, Node.js can be instructed to + interpret a particular file as an ES module by naming it with an `.mjs` + extension (since both `.js` and `.cjs` files are treated as CommonJS within a + `"commonjs"` package scope). + +### `--input-type` flag + +Strings passed in as an argument to `--eval` (or `-e`), or piped to `node` via +`STDIN`, will be treated as [ES modules][] when the `--input-type=module` flag +is set. + +```bash +node --input-type=module --eval "import { sep } from 'path'; console.log(sep);" + +echo "import { sep } from 'path'; console.log(sep);" | node --input-type=module +``` + +For completeness there is also `--input-type=commonjs`, for explicitly running +string input as CommonJS. This is the default behavior if `--input-type` is +unspecified. + +## Package entry points + +In a package’s `package.json` file, two fields can define entry points for a +package: `"main"` and `"exports"`. The `"main"` field is supported in all +versions of Node.js, but its capabilities are limited: it only defines the main +entry point of the package. + +The `"exports"` field provides an alternative to `"main"` where the package +main entry point can be defined while also encapsulating the package, +**preventing any other entry points besides those defined in `"exports"`**. +This encapsulation allows module authors to define a public interface for +their package. + +If both `"exports"` and `"main"` are defined, the `"exports"` field takes +precedence over `"main"`. `"exports"` are not specific to ES modules or +CommonJS; `"main"` will be overridden by `"exports"` if it exists. As such +`"main"` cannot be used as a fallback for CommonJS but it can be used as a +fallback for legacy versions of Node.js that do not support the `"exports"` +field. + +[Conditional exports][] can be used within `"exports"` to define different +package entry points per environment, including whether the package is +referenced via `require` or via `import`. For more information about supporting +both CommonJS and ES Modules in a single package please consult +[the dual CommonJS/ES module packages section][]. + +**Warning**: Introducing the `"exports"` field prevents consumers of a package +from using any entry points that are not defined, including the `package.json` +(e.g. `require('your-package/package.json')`. **This will likely be a breaking +change.** + +To make the introduction of `"exports"` non-breaking, ensure that every +previously supported entry point is exported. It is best to explicitly specify +entry points so that the package’s public API is well-defined. For example, +a project that previous exported `main`, `lib`, +`feature`, and the `package.json` could use the following `package.exports`: + +```json +{ + "name": "my-mod", + "exports": { + ".": "./lib/index.js", + "./lib": "./lib/index.js", + "./lib/index": "./lib/index.js", + "./lib/index.js": "./lib/index.js", + "./feature": "./feature/index.js", + "./feature/index.js": "./feature/index.js", + "./package.json": "./package.json" + } +} +``` + +Alternatively a project could choose to export entire folders: + +```json +{ + "name": "my-mod", + "exports": { + ".": "./lib/index.js", + "./lib": "./lib/index.js", + "./lib/": "./lib/", + "./feature": "./feature/index.js", + "./feature/": "./feature/", + "./package.json": "./package.json" + } +} +``` + +As a last resort, package encapsulation can be disabled entirely by creating an +export for the root of the package `"./": "./"`. This will expose every file in +the package at the cost of disabling the encapsulation and potential tooling +benefits this provides. As the ES Module loader in Node.js enforces the use of +[the full specifier path][], exporting the root rather than being explicit +about entry is less expressive than either of the prior examples. Not only +will encapsulation be lost but module consumers will be unable to +`import feature from 'my-mod/feature'` as they will need to provide the full +path `import feature from 'my-mod/feature/index.js`. + +### Main entry point export + +To set the main entry point for a package, it is advisable to define both +`"exports"` and `"main"` in the package’s `package.json` file: + +```json +{ + "main": "./main.js", + "exports": "./main.js" +} +``` + +The benefit of doing this is that when using the `"exports"` field all +subpaths of the package will no longer be available to importers under +`require('pkg/subpath.js')`, and instead they will get a new error, +`ERR_PACKAGE_PATH_NOT_EXPORTED`. + +This encapsulation of exports provides more reliable guarantees +about package interfaces for tools and when handling semver upgrades for a +package. It is not a strong encapsulation since a direct require of any +absolute subpath of the package such as +`require('/path/to/node_modules/pkg/subpath.js')` will still load `subpath.js`. + +### Subpath exports + +> Stability: 1 - Experimental + +When using the `"exports"` field, custom subpaths can be defined along +with the main entry point by treating the main entry point as the +`"."` subpath: + +```json +{ + "main": "./main.js", + "exports": { + ".": "./main.js", + "./submodule": "./src/submodule.js" + } +} +``` + +Now only the defined subpath in `"exports"` can be imported by a +consumer: + +```js +import submodule from 'es-module-package/submodule'; +// Loads ./node_modules/es-module-package/src/submodule.js +``` + +While other subpaths will error: + +```js +import submodule from 'es-module-package/private-module.js'; +// Throws ERR_PACKAGE_PATH_NOT_EXPORTED +``` + +Entire folders can also be mapped with package exports: + +```json +// ./node_modules/es-module-package/package.json +{ + "exports": { + "./features/": "./src/features/" + } +} +``` + +With the preceding, all modules within the `./src/features/` folder +are exposed deeply to `import` and `require`: + +```js +import feature from 'es-module-package/features/x.js'; +// Loads ./node_modules/es-module-package/src/features/x.js +``` + +When using folder mappings, ensure that you do want to expose every +module inside the subfolder. Any modules which are not public +should be moved to another folder to retain the encapsulation +benefits of exports. + +### Package exports fallbacks + +> Stability: 1 - Experimental + +For possible new specifier support in future, array fallbacks are +supported for all invalid specifiers: + +```json +{ + "exports": { + "./submodule": ["not:valid", "./submodule.js"] + } +} +``` + +Since `"not:valid"` is not a valid specifier, `"./submodule.js"` is used +instead as the fallback, as if it were the only target. + +### Exports sugar + +> Stability: 1 - Experimental + +If the `"."` export is the only export, the `"exports"` field provides sugar +for this case being the direct `"exports"` field value. + +If the `"."` export has a fallback array or string value, then the `"exports"` +field can be set to this value directly. + +```json +{ + "exports": { + ".": "./main.js" + } +} +``` + +can be written: + +```json +{ + "exports": "./main.js" +} +``` + +### Conditional exports + +> Stability: 1 - Experimental + +Conditional exports provide a way to map to different paths depending on +certain conditions. They are supported for both CommonJS and ES module imports. + +For example, a package that wants to provide different ES module exports for +`require()` and `import` can be written: + +```json +// package.json +{ + "main": "./main-require.cjs", + "exports": { + "import": "./main-module.js", + "require": "./main-require.cjs" + }, + "type": "module" +} +``` + +Node.js supports the following conditions out of the box: + +* `"import"` - matched when the package is loaded via `import` or + `import()`. Can reference either an ES module or CommonJS file, as both + `import` and `import()` can load either ES module or CommonJS sources. + _Always matched when the `"require"` condition is not matched._ +* `"require"` - matched when the package is loaded via `require()`. + As `require()` only supports CommonJS, the referenced file must be CommonJS. + _Always matched when the `"import"` condition is not matched._ +* `"node"` - matched for any Node.js environment. Can be a CommonJS or ES + module file. _This condition should always come after `"import"` or + `"require"`._ +* `"default"` - the generic fallback that will always match. Can be a CommonJS + or ES module file. _This condition should always come last._ + +Within the `"exports"` object, key order is significant. During condition +matching, earlier entries have higher priority and take precedence over later +entries. _The general rule is that conditions should be from most specific to +least specific in object order_. + +Other conditions such as `"browser"`, `"electron"`, `"deno"`, `"react-native"`, +etc. are unknown to, and thus ignored by Node.js. Runtimes or tools other than +Node.js may use them at their discretion. Further restrictions, definitions, or +guidance on condition names may occur in the future. + +Using the `"import"` and `"require"` conditions can lead to some hazards, +which are further explained in [the dual CommonJS/ES module packages section][]. + +Conditional exports can also be extended to exports subpaths, for example: + +```json +{ + "main": "./main.js", + "exports": { + ".": "./main.js", + "./feature": { + "node": "./feature-node.js", + "default": "./feature.js" + } + } +} +``` + +Defines a package where `require('pkg/feature')` and `import 'pkg/feature'` +could provide different implementations between Node.js and other JS +environments. + +When using environment branches, always include a `"default"` condition where +possible. Providing a `"default"` condition ensures that any unknown JS +environments are able to use this universal implementation, which helps avoid +these JS environments from having to pretend to be existing environments in +order to support packages with conditional exports. For this reason, using +`"node"` and `"default"` condition branches is usually preferable to using +`"node"` and `"browser"` condition branches. + +### Nested conditions + +> Stability: 1 - Experimental + +In addition to direct mappings, Node.js also supports nested condition objects. + +For example, to define a package that only has dual mode entry points for +use in Node.js but not the browser: + +```json +{ + "main": "./main.js", + "exports": { + "node": { + "import": "./feature-node.mjs", + "require": "./feature-node.cjs" + }, + "default": "./feature.mjs", + } +} +``` + +Conditions continue to be matched in order as with flat conditions. If +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` 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 +`package.json` `"exports"` field can be referenced via the package’s name. +For example, assuming the `package.json` is: + +```json +// package.json +{ + "name": "a-package", + "exports": { + ".": "./main.mjs", + "./foo": "./foo.js" + } +} +``` + +Then any module _in that package_ can reference an export in the package itself: + +```js +// ./a-module.mjs +import { something } from 'a-package'; // Imports "something" from ./main.mjs. +``` + +Self-referencing is available only if `package.json` has `exports`, and will +allow importing only what that `exports` (in the `package.json`) allows. +So the code below, given the previous package, will generate a runtime error: + +```js +// ./another-module.mjs + +// Imports "another" from ./m.mjs. Fails because +// the "package.json" "exports" field +// does not provide an export named "./m.mjs". +import { another } from 'a-package/m.mjs'; +``` + +Self-referencing is also available when using `require`, both in an ES module, +and in a CommonJS one. For example, this code will also work: + +```js +// ./a-module.js +const { something } = require('a-package/foo'); // Loads from ./foo.js. +``` + +## Internal package imports + +> Stability: 1 - Experimental + +In addition to the `"exports"` field it is possible to define internal package +import maps that only apply to import specifiers from within the package itself. + +Entries in the imports field must always start with `#` to ensure they are +clearly disambiguated from package specifiers. + +For example, the imports field can be used to gain the benefits of conditional +exports for internal modules: + +```json +// package.json +{ + "imports": { + "#dep": { + "node": "dep-node-native", + "default": "./dep-polyfill.js" + } + }, + "dependencies": { + "dep-node-native": "^1.0.0" + } +} +``` + +where `import '#dep'` would now get the resolution of the external package +`dep-node-native` (including its exports in turn), and instead get the local +file `./dep-polyfill.js` relative to the package in other environments. + +Unlike the exports field, import maps permit mapping to external packages +because this provides an important use case for conditional loading and also can +be done without the risk of cycles, unlike for exports. + +Apart from the above, the resolution rules for the imports field are otherwise +analogous to the exports field. + +## Dual CommonJS/ES module packages + +Prior to the introduction of support for ES modules in Node.js, it was a common +pattern for package authors to include both CommonJS and ES module JavaScript +sources in their package, with `package.json` `"main"` specifying the CommonJS +entry point and `package.json` `"module"` specifying the ES module entry point. +This enabled Node.js to run the CommonJS entry point while build tools such as +bundlers used the ES module entry point, since Node.js ignored (and still +ignores) the top-level `"module"` field. + +Node.js can now run ES module entry points, and a package can contain both +CommonJS and ES module entry points (either via separate specifiers such as +`'pkg'` and `'pkg/es-module'`, or both at the same specifier via [Conditional +exports][]). Unlike in the scenario where `"module"` is only used by bundlers, +or ES module files are transpiled into CommonJS on the fly before evaluation by +Node.js, the files referenced by the ES module entry point are evaluated as ES +modules. + +### Dual package hazard + +When an application is using a package that provides both CommonJS and ES module +sources, there is a risk of certain bugs if both versions of the package get +loaded. This potential comes from the fact that the `pkgInstance` created by +`const pkgInstance = require('pkg')` is not the same as the `pkgInstance` +created by `import pkgInstance from 'pkg'` (or an alternative main path like +`'pkg/module'`). This is the “dual package hazard,” where two versions of the +same package can be loaded within the same runtime environment. While it is +unlikely that an application or package would intentionally load both versions +directly, it is common for an application to load one version while a dependency +of the application loads the other version. This hazard can happen because +Node.js supports intermixing CommonJS and ES modules, and can lead to unexpected +behavior. + +If the package main export is a constructor, an `instanceof` comparison of +instances created by the two versions returns `false`, and if the export is an +object, properties added to one (like `pkgInstance.foo = 3`) are not present on +the other. This differs from how `import` and `require` statements work in +all-CommonJS or all-ES module environments, respectively, and therefore is +surprising to users. It also differs from the behavior users are familiar with +when using transpilation via tools like [Babel][] or [`esm`][]. + +### Writing dual packages while avoiding or minimizing hazards + +First, the hazard described in the previous section occurs when a package +contains both CommonJS and ES module sources and both sources are provided for +use in Node.js, either via separate main entry points or exported paths. A +package could instead be written where any version of Node.js receives only +CommonJS sources, and any separate ES module sources the package may contain +could be intended only for other environments such as browsers. Such a package +would be usable by any version of Node.js, since `import` can refer to CommonJS +files; but it would not provide any of the advantages of using ES module syntax. + +A package could also switch from CommonJS to ES module syntax in a breaking +change version bump. This has the disadvantage that the newest version +of the package would only be usable in ES module-supporting versions of Node.js. + +Every pattern has tradeoffs, but there are two broad approaches that satisfy the +following conditions: + +1. The package is usable via both `require` and `import`. +1. The package is usable in both current Node.js and older versions of Node.js + that lack support for ES modules. +1. The package main entry point, e.g. `'pkg'` can be used by both `require` to + resolve to a CommonJS file and by `import` to resolve to an ES module file. + (And likewise for exported paths, e.g. `'pkg/feature'`.) +1. The package provides named exports, e.g. `import { name } from 'pkg'` rather + than `import pkg from 'pkg'; pkg.name`. +1. The package is potentially usable in other ES module environments such as + browsers. +1. The hazards described in the previous section are avoided or minimized. + +#### Approach #1: Use an ES module wrapper + +Write the package in CommonJS or transpile ES module sources into CommonJS, and +create an ES module wrapper file that defines the named exports. Using +[Conditional exports][], the ES module wrapper is used for `import` and the +CommonJS entry point for `require`. + +```json +// ./node_modules/pkg/package.json +{ + "type": "module", + "main": "./index.cjs", + "exports": { + "import": "./wrapper.mjs", + "require": "./index.cjs" + } +} +``` + +The preceding 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'; +``` + +```js +// ./node_modules/pkg/wrapper.mjs +import cjsModule from './index.cjs'; +export const name = cjsModule.name; +``` + +In this example, the `name` from `import { name } from 'pkg'` is the same +singleton as the `name` from `const { name } = require('pkg')`. Therefore `===` +returns `true` when comparing the two `name`s and the divergent specifier hazard +is avoided. + +If the module is not simply a list of named exports, but rather contains a +unique function or object export like `module.exports = function () { ... }`, +or if support in the wrapper for the `import pkg from 'pkg'` pattern is desired, +then the wrapper would instead be written to export the default optionally +along with any named exports as well: + +```js +import cjsModule from './index.cjs'; +export const name = cjsModule.name; +export default cjsModule; +``` + +This approach is appropriate for any of the following use cases: +* The package is currently written in CommonJS and the author would prefer not + to refactor it into ES module syntax, but wishes to provide named exports for + ES module consumers. +* The package has other packages that depend on it, and the end user might + install both this package and those other packages. For example a `utilities` + package is used directly in an application, and a `utilities-plus` package + adds a few more functions to `utilities`. Because the wrapper exports + underlying CommonJS files, it doesn’t matter if `utilities-plus` is written in + CommonJS or ES module syntax; it will work either way. +* The package stores internal state, and the package author would prefer not to + refactor the package to isolate its state management. See the next section. + +A variant of this approach not requiring conditional exports for consumers could +be to add an export, e.g. `"./module"`, to point to an all-ES module-syntax +version of the package. This could be used via `import 'pkg/module'` by users +who are certain that the CommonJS version will not be loaded anywhere in the +application, such as by dependencies; or if the CommonJS version can be loaded +but doesn’t affect the ES module version (for example, because the package is +stateless): + +```json +// ./node_modules/pkg/package.json +{ + "type": "module", + "main": "./index.cjs", + "exports": { + ".": "./index.cjs", + "./module": "./wrapper.mjs" + } +} +``` + +#### Approach #2: Isolate state + +A `package.json` file can define the separate CommonJS and ES module entry +points directly: + +```json +// ./node_modules/pkg/package.json +{ + "type": "module", + "main": "./index.cjs", + "exports": { + "import": "./index.mjs", + "require": "./index.cjs" + } +} +``` + +This can be done if both the CommonJS and ES module versions of the package are +equivalent, for example because one is the transpiled output of the other; and +the package’s management of state is carefully isolated (or the package is +stateless). + +The reason that state is an issue is because both the CommonJS and ES module +versions of the package may get used within an application; for example, the +user’s application code could `import` the ES module version while a dependency +`require`s the CommonJS version. If that were to occur, two copies of the +package would be loaded in memory and therefore two separate states would be +present. This would likely cause hard-to-troubleshoot bugs. + +Aside from writing a stateless package (if JavaScript’s `Math` were a package, +for example, it would be stateless as all of its methods are static), there are +some ways to isolate state so that it’s shared between the potentially loaded +CommonJS and ES module instances of the package: + +1. If possible, contain all state within an instantiated object. JavaScript’s + `Date`, for example, needs to be instantiated to contain state; if it were a + package, it would be used like this: + + ```js + import Date from 'date'; + const someDate = new Date(); + // someDate contains state; Date does not + ``` + + The `new` keyword isn’t required; a package’s function can return a new + object, or modify a passed-in object, to keep the state external to the + package. + +1. Isolate the state in one or more CommonJS files that are shared between the + CommonJS and ES module versions of the package. For example, if the CommonJS + and ES module entry points are `index.cjs` and `index.mjs`, respectively: + + ```js + // ./node_modules/pkg/index.cjs + const state = require('./state.cjs'); + module.exports.state = state; + ``` + + ```js + // ./node_modules/pkg/index.mjs + import state from './state.cjs'; + export { + state + }; + ``` + + Even if `pkg` is used via both `require` and `import` in an application (for + example, via `import` in application code and via `require` by a dependency) + each reference of `pkg` will contain the same state; and modifying that + state from either module system will apply to both. + +Any plugins that attach to the package’s singleton would need to separately +attach to both the CommonJS and ES module singletons. + +This approach is appropriate for any of the following use cases: +* The package is currently written in ES module syntax and the package author + wants that version to be used wherever such syntax is supported. +* The package is stateless or its state can be isolated without too much + difficulty. +* The package is unlikely to have other public packages that depend on it, or if + it does, the package is stateless or has state that need not be shared between + dependencies or with the overall application. + +Even with isolated state, there is still the cost of possible extra code +execution between the CommonJS and ES module versions of a package. + +As with the previous approach, a variant of this approach not requiring +conditional exports for consumers could be to add an export, e.g. +`"./module"`, to point to an all-ES module-syntax version of the package: + +```json +// ./node_modules/pkg/package.json +{ + "type": "module", + "main": "./index.cjs", + "exports": { + ".": "./index.cjs", + "./module": "./index.mjs" + } +} +``` + +[Conditional exports]: #packages_conditional_exports +[Babel]: https://babeljs.io/ +[`esm`]: https://github.com/standard-things/esm#readme +[the full specifier path]: modules_esm.html#modules_esm_mandatory_file_extensions +[the dual CommonJS/ES module packages section]: #packages_dual_commonjs_es_module_packages +[ES modules]: esm.html +[CommonJS]: modules.html From d6a13a947ea51f37971c5d89cf88e740b496328b Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 13:12:25 +0200 Subject: [PATCH 022/117] doc: document support for package.json fields Fixes: https://github.com/nodejs/node/issues/33143 Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/34970 Reviewed-By: Guy Bedford Reviewed-By: Geoffrey Booth Reviewed-By: Trivikram Kamat --- doc/api/errors.md | 17 +- doc/api/esm.md | 11 +- doc/api/modules.md | 12 +- doc/api/packages.md | 378 +++++++++++++++++++++++++++++--------------- 4 files changed, 276 insertions(+), 142 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 8f5ec9a88904d3..b4d640446c8ca4 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1357,13 +1357,13 @@ An invalid or unknown file encoding was passed. ### `ERR_INVALID_PACKAGE_CONFIG` -An invalid `package.json` file was found which failed parsing. +An invalid [`package.json`][] file was found which failed parsing. ### `ERR_INVALID_PACKAGE_TARGET` -The `package.json` [exports][] field contains an invalid target mapping value -for the attempted module resolution. +The `package.json` [`"exports"`][] field contains an invalid target mapping +value for the attempted module resolution. ### `ERR_INVALID_PERFORMANCE_MARK` @@ -1686,13 +1686,13 @@ A given value is out of the accepted range. ### `ERR_PACKAGE_IMPORT_NOT_DEFINED` -The `package.json` ["imports" field][] does not define the given internal +The `package.json` [`"imports"`][] field does not define the given internal package specifier mapping. ### `ERR_PACKAGE_PATH_NOT_EXPORTED` -The `package.json` [exports][] field does not export the requested subpath. +The `package.json` [`"exports"`][] field does not export the requested subpath. Because exports are encapsulated, private internal modules that are not exported cannot be imported through the package resolution, unless using an absolute URL. @@ -2057,7 +2057,7 @@ signal (such as [`subprocess.kill()`][]). `import` a directory URL is unsupported. Instead, [self-reference a package using its name][] and [define a custom subpath][] in -the `"exports"` field of the `package.json` file. +the [`"exports"`][] field of the [`package.json`][] file. ```js @@ -2529,7 +2529,8 @@ closed. [crypto digest algorithm]: crypto.html#crypto_crypto_gethashes [domains]: domain.html [event emitter-based]: events.html#events_class_eventemitter -[exports]: packages.html#packages_package_entry_points +[`package.json`]: packages.html#packages_node_js_package_json_field_definitions +[`"exports"`]: packages.html#packages_exports [file descriptors]: https://en.wikipedia.org/wiki/File_descriptor [policy]: policy.html [stream-based]: stream.html @@ -2539,4 +2540,4 @@ closed. [vm]: vm.html [self-reference a package using its name]: packages.html#packages_self_referencing_a_package_using_its_name [define a custom subpath]: packages.html#packages_subpath_exports -["imports" field]: packages.html#packages_internal_package_imports +[`"imports"`]: packages.html#packages_imports diff --git a/doc/api/esm.md b/doc/api/esm.md index dee86968084812..219c45d06ecafd 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -55,7 +55,7 @@ specifier resolution, and default behavior. Node.js treats JavaScript code as CommonJS modules by default. Authors can tell Node.js to treat JavaScript code as ECMAScript modules -via the `.mjs` file extension, the `package.json` `"type"` field, or the +via the `.mjs` file extension, the `package.json` [`"type"`][] field, or the `--input-type` flag. See [Modules: Packages](packages.html#packages_determining_module_system) for more details. @@ -260,9 +260,9 @@ can either be an URL-style relative path like `'./file.mjs'` or a package name like `'fs'`. Like in CommonJS, files within packages can be accessed by appending a path to -the package name; unless the package’s `package.json` contains an `"exports"` -field, in which case files within packages need to be accessed via the path -defined in `"exports"`. +the package name; unless the package’s [`package.json`][] contains an +[`"exports"`][] field, in which case files within packages need to be accessed +via the path defined in [`"exports"`][]. ```js import { sin, cos } from 'geometry/trigonometry-functions.mjs'; @@ -1223,3 +1223,6 @@ success! [6.1.7 Array Index]: https://tc39.es/ecma262/#integer-index [Top-Level Await]: https://github.com/tc39/proposal-top-level-await [Core modules]: modules.html#modules_core_modules +[`package.json`]: packages.html#packages_node_js_package_json_field_definitions +[`"exports"`]: packages.html#packages_exports +[`"type"`]: packages.html#packages_type diff --git a/doc/api/modules.md b/doc/api/modules.md index 39b294556c8074..477a2e533c7b03 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -391,8 +391,8 @@ directories, and then provide a single entry point to those directories. There are three ways in which a folder may be passed to `require()` as an argument. -The first is to create a `package.json` file in the root of the folder, -which specifies a `main` module. An example `package.json` file might +The first is to create a [`package.json`][] file in the root of the folder, +which specifies a `main` module. An example [`package.json`][] file might look like this: ```json @@ -406,10 +406,10 @@ If this was in a folder at `./some-library`, then This is the extent of the awareness of `package.json` files within Node.js. -If there is no `package.json` file present in the directory, or if the -`'main'` entry is missing or cannot be resolved, then Node.js +If there is no [`package.json`][] file present in the directory, or if the +[`"main"`][] entry is missing or cannot be resolved, then Node.js will attempt to load an `index.js` or `index.node` file out of that -directory. For example, if there was no `package.json` file in the above +directory. For example, if there was no [`package.json`][] file in the previous example, then `require('./some-library')` would attempt to load: * `./some-library/index.js` @@ -1154,3 +1154,5 @@ consists of the following keys: [`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 +[`package.json`]: packages.html#packages_node_js_package_json_field_definitions +[`"main"`]: packages.html#packages_main diff --git a/doc/api/packages.md b/doc/api/packages.md index c8fbf6c213bb83..84da766d956340 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -18,7 +18,7 @@ initial input, or when referenced by `import` statements within ES module code: * Files ending in `.mjs`. * Files ending in `.js` when the nearest parent `package.json` file contains a - top-level field `"type"` with a value of `"module"`. + top-level field [`"type"`][] with a value of `"module"`. * Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`, with the flag `--input-type=module`. @@ -34,63 +34,29 @@ or when referenced by `import` statements within ES module code: * Files ending in `.cjs`. * Files ending in `.js` when the nearest parent `package.json` file contains a - top-level field `"type"` with a value of `"commonjs"`. + top-level field [`"type"`][] with a value of `"commonjs"`. * Strings passed in as an argument to `--eval` or `--print`, or piped to `node` via `STDIN`, with the flag `--input-type=commonjs`. -### `package.json` `"type"` field - -Files ending with `.js` will be loaded as [ES modules][] when the nearest parent -`package.json` file contains a top-level field `"type"` with a value of -`"module"`. - -The nearest parent `package.json` is defined as the first `package.json` found -when searching in the current folder, that folder’s parent, and so on up -until the root of the volume is reached. - - -```js -// package.json -{ - "type": "module" -} -``` - -```bash -# In same folder as preceding package.json -node my-app.js # Runs as ES module -``` - -If the nearest parent `package.json` lacks a `"type"` field, or contains -`"type": "commonjs"`, `.js` files are treated as [CommonJS][]. If the volume -root is reached and no `package.json` is found, Node.js defers to the default, a -`package.json` with no `"type"` field. - -`import` statements of `.js` files are treated as ES modules if the nearest -parent `package.json` contains `"type": "module"`. - -```js -// my-app.js, part of the same example as above -import './startup.js'; // Loaded as ES module because of package.json -``` - -Package authors should include the `"type"` field, even in packages where all -sources are [CommonJS][]. Being explicit about the `type` of the package will +Package authors should include the [`"type"`][] field, even in packages where +all sources are CommonJS. Being explicit about the `type` of the package will future-proof the package in case the default type of Node.js ever changes, and it will also make things easier for build tools and loaders to determine how the files in the package should be interpreted. -Regardless of the value of the `"type"` field, `.mjs` files are always treated -as ES modules and `.cjs` files are always treated as [CommonJS][]. - ### Package scope and file extensions A folder containing a `package.json` file, and all subfolders below that folder -until the next folder containing another `package.json`, are a -_package scope_. Package scopes do not carry through `node_modules` folders. The -`"type"` field defines how to treat `.js` files within the package scope. If a -`package.json` file does not have a `"type"` field, the default is `"commonjs"`. +until the next folder containing another [`package.json`][], are a +_package scope_. Package scopes do not carry through `node_modules` folders. + +Within a package scope, the [`package.json`][] [`"type"`][] field defines how +Node.js should interpret `.js` files. If a `package.json` file does not have a +`"type"` field, `.js` files are treated as [CommonJS][]. + +A `package.json` `"type"` value of `"module"` tells Node.js to interpret `.js` +files within that package scope as using [ES module][] syntax. The package scope applies not only to initial entry points (`node my-app.js`) but also to files referenced by `import` statements and `import()` expressions. @@ -135,7 +101,7 @@ package scope: a `"module"` package scope). * Within a `"type": "commonjs"` package scope, Node.js can be instructed to - interpret a particular file as an ES module by naming it with an `.mjs` + interpret a particular file as an [ES module][] by naming it with an `.mjs` extension (since both `.js` and `.cjs` files are treated as CommonJS within a `"commonjs"` package scope). @@ -158,35 +124,35 @@ unspecified. ## Package entry points In a package’s `package.json` file, two fields can define entry points for a -package: `"main"` and `"exports"`. The `"main"` field is supported in all -versions of Node.js, but its capabilities are limited: it only defines the main -entry point of the package. +package: [`"main"`][] and [`"exports"`][]. The [`"main"`][] field is supported +in all versions of Node.js, but its capabilities are limited: it only defines +the main entry point of the package. -The `"exports"` field provides an alternative to `"main"` where the package -main entry point can be defined while also encapsulating the package, -**preventing any other entry points besides those defined in `"exports"`**. +The [`"exports"`][] field provides an alternative to [`"main"`][] where the +package main entry point can be defined while also encapsulating the package, +**preventing any other entry points besides those defined in [`"exports"`][]**. This encapsulation allows module authors to define a public interface for their package. -If both `"exports"` and `"main"` are defined, the `"exports"` field takes -precedence over `"main"`. `"exports"` are not specific to ES modules or -CommonJS; `"main"` will be overridden by `"exports"` if it exists. As such -`"main"` cannot be used as a fallback for CommonJS but it can be used as a -fallback for legacy versions of Node.js that do not support the `"exports"` -field. +If both [`"exports"`][] and [`"main"`][] are defined, the [`"exports"`][] field +takes precedence over [`"main"`][]. [`"exports"`][] are not specific to ES +modules or CommonJS; [`"main"`][] will be overridden by [`"exports"`][] if it +exists. As such [`"main"`][] cannot be used as a fallback for CommonJS but it +can be used as a fallback for legacy versions of Node.js that do not support the +[`"exports"`][] field. -[Conditional exports][] can be used within `"exports"` to define different +[Conditional exports][] can be used within [`"exports"`][] to define different package entry points per environment, including whether the package is referenced via `require` or via `import`. For more information about supporting both CommonJS and ES Modules in a single package please consult [the dual CommonJS/ES module packages section][]. -**Warning**: Introducing the `"exports"` field prevents consumers of a package -from using any entry points that are not defined, including the `package.json` -(e.g. `require('your-package/package.json')`. **This will likely be a breaking -change.** +**Warning**: Introducing the [`"exports"`][] field prevents consumers of a +package from using any entry points that are not defined, including the +[`package.json`][] (e.g. `require('your-package/package.json')`. **This will +likely be a breaking change.** -To make the introduction of `"exports"` non-breaking, ensure that every +To make the introduction of [`"exports"`][] non-breaking, ensure that every previously supported entry point is exported. It is best to explicitly specify entry points so that the package’s public API is well-defined. For example, a project that previous exported `main`, `lib`, @@ -236,7 +202,7 @@ path `import feature from 'my-mod/feature/index.js`. ### Main entry point export To set the main entry point for a package, it is advisable to define both -`"exports"` and `"main"` in the package’s `package.json` file: +[`"exports"`][] and [`"main"`][] in the package’s [`package.json`][] file: ```json { @@ -245,7 +211,7 @@ To set the main entry point for a package, it is advisable to define both } ``` -The benefit of doing this is that when using the `"exports"` field all +The benefit of doing this is that when using the [`"exports"`][] field all subpaths of the package will no longer be available to importers under `require('pkg/subpath.js')`, and instead they will get a new error, `ERR_PACKAGE_PATH_NOT_EXPORTED`. @@ -260,7 +226,7 @@ absolute subpath of the package such as > Stability: 1 - Experimental -When using the `"exports"` field, custom subpaths can be defined along +When using the [`"exports"`][] field, custom subpaths can be defined along with the main entry point by treating the main entry point as the `"."` subpath: @@ -274,8 +240,7 @@ with the main entry point by treating the main entry point as the } ``` -Now only the defined subpath in `"exports"` can be imported by a -consumer: +Now only the defined subpath in [`"exports"`][] can be imported by a consumer: ```js import submodule from 'es-module-package/submodule'; @@ -335,11 +300,11 @@ instead as the fallback, as if it were the only target. > Stability: 1 - Experimental -If the `"."` export is the only export, the `"exports"` field provides sugar -for this case being the direct `"exports"` field value. +If the `"."` export is the only export, the [`"exports"`][] field provides sugar +for this case being the direct [`"exports"`][] field value. -If the `"."` export has a fallback array or string value, then the `"exports"` -field can be set to this value directly. +If the `"."` export has a fallback array or string value, then the +[`"exports"`][] field can be set to this value directly. ```json { @@ -394,7 +359,7 @@ Node.js supports the following conditions out of the box: * `"default"` - the generic fallback that will always match. Can be a CommonJS or ES module file. _This condition should always come last._ -Within the `"exports"` object, key order is significant. During condition +Within the [`"exports"`][] object, key order is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. _The general rule is that conditions should be from most specific to least specific in object order_. @@ -479,7 +444,7 @@ 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 -`package.json` `"exports"` field can be referenced via the package’s name. +`package.json` [`"exports"`][] field can be referenced via the package’s name. For example, assuming the `package.json` is: ```json @@ -500,9 +465,10 @@ Then any module _in that package_ can reference an export in the package itself: import { something } from 'a-package'; // Imports "something" from ./main.mjs. ``` -Self-referencing is available only if `package.json` has `exports`, and will -allow importing only what that `exports` (in the `package.json`) allows. -So the code below, given the previous package, will generate a runtime error: +Self-referencing is available only if `package.json` has [`"exports"`][], and +will allow importing only what that [`"exports"`][] (in the `package.json`) +allows. So the code below, given the previous package, will generate a runtime +error: ```js // ./another-module.mjs @@ -521,51 +487,13 @@ and in a CommonJS one. For example, this code will also work: const { something } = require('a-package/foo'); // Loads from ./foo.js. ``` -## Internal package imports - -> Stability: 1 - Experimental - -In addition to the `"exports"` field it is possible to define internal package -import maps that only apply to import specifiers from within the package itself. - -Entries in the imports field must always start with `#` to ensure they are -clearly disambiguated from package specifiers. - -For example, the imports field can be used to gain the benefits of conditional -exports for internal modules: - -```json -// package.json -{ - "imports": { - "#dep": { - "node": "dep-node-native", - "default": "./dep-polyfill.js" - } - }, - "dependencies": { - "dep-node-native": "^1.0.0" - } -} -``` - -where `import '#dep'` would now get the resolution of the external package -`dep-node-native` (including its exports in turn), and instead get the local -file `./dep-polyfill.js` relative to the package in other environments. - -Unlike the exports field, import maps permit mapping to external packages -because this provides an important use case for conditional loading and also can -be done without the risk of cycles, unlike for exports. - -Apart from the above, the resolution rules for the imports field are otherwise -analogous to the exports field. - ## Dual CommonJS/ES module packages Prior to the introduction of support for ES modules in Node.js, it was a common pattern for package authors to include both CommonJS and ES module JavaScript -sources in their package, with `package.json` `"main"` specifying the CommonJS -entry point and `package.json` `"module"` specifying the ES module entry point. +sources in their package, with `package.json` [`"main"`][] specifying the +CommonJS entry point and `package.json` `"module"` specifying the ES module +entry point. This enabled Node.js to run the CommonJS entry point while build tools such as bundlers used the ES module entry point, since Node.js ignored (and still ignores) the top-level `"module"` field. @@ -719,7 +647,7 @@ stateless): #### Approach #2: Isolate state -A `package.json` file can define the separate CommonJS and ES module entry +A [`package.json`][] file can define the separate CommonJS and ES module entry points directly: ```json @@ -819,10 +747,210 @@ conditional exports for consumers could be to add an export, e.g. } ``` -[Conditional exports]: #packages_conditional_exports +## Node.js `package.json` field definitions + +This section describes the fields used by the Node.js runtime. Other tools (such +as [npm](https://docs.npmjs.com/creating-a-package-json-file)) may use +additional fields which are ignored by Node.js and not documented here. + +### `"name"` + + +* Type: {string} + +```json +{ + "name": "package-name" +} +``` + +The `"name"` field defines your package’s name. Publishing to the +_npm_ registry may require a name that satisfies +[certain requirements](https://docs.npmjs.com/files/package.json#name). + +The `"name"` field can be used in addition to the [`"exports"`][] field to +[self-reference][] a package using its name. + +### `"type"` + + +* Type: {string} + +The `"type"` field defines the module format that Node.js will use for all +`.js` files within a particular `package.json` file’s [package scope][]. + +Files ending with `.js` will be loaded as ES modules when the nearest parent +`package.json` file contains a top-level field `"type"` with a value of +`"module"`. + +The nearest parent `package.json` is defined as the first `package.json` found +when searching in the current folder, that folder’s parent, and so on up +until a node_modules folder or the volume root is reached. + +```json +// package.json +{ + "type": "module" +} +``` + +```bash +# In same folder as preceding package.json +node my-app.js # Runs as ES module +``` + +If the nearest parent `package.json` lacks a `"type"` field, or contains +`"type": "commonjs"`, `.js` files are treated as [CommonJS][]. If the volume +root is reached and no `package.json` is found, Node.js defers to the default +treatment as [CommonJS][]. + +`import` statements of `.js` files are treated as ES modules if the nearest +parent `package.json` contains `"type": "module"`. + +```js +// my-app.js, part of the same example as above +import './startup.js'; // Loaded as ES module because of package.json +``` + +Regardless of the value of the `"type"` field, `.mjs` files are always treated +as ES modules and `.cjs` files are always treated as CommonJS. + +### `"exports"` + + +* Type: {Object} | {string} | {string[]} + +```json +{ + "exports": "./index.js" +} +``` + +The `"exports"` field allows defining the [entry points][] of a package when +imported by name loaded either via a `node_modules` lookup or a +[self-reference][] to its own name. It is supported in Node.js 12+ as an +alternative to the [`"main"`][] that can support defining [subpath exports][] +and [conditional exports][] while encapsulating internal unexported modules. + +[Conditional Exports][] can also be used within `"exports"` to define different +package entry points per environment, including whether the package is +referenced via `require` or via `import`. + +All paths defined in the `"exports"` must be relative file URLs starting with +`./`. + +### `"main"` + + +* Type: {string} + +```json +{ + "main": "./main.js" +} +``` + +The `"main"` field defines the script that is used when the [package directory +is loaded via `require()`](modules.html#modules_folders_as_modules). Its value +is interpreted as a path. + +```js +require('./path/to/directory'); // This resolves to ./path/to/directory/main.js. +``` + +When a package has an [`"exports"`][] field, this will take precedence over the +`"main"` field when importing the package by name. + +### `"imports"` + + +> Stability: 1 - Experimental + +* Type: {Object} + +In addition to the [`"exports"`][] field it is possible to define internal +package import maps that only apply to import specifiers from within the package +itself. + +Entries in the imports field must always start with `#` to ensure they are +clearly disambiguated from package specifiers. + +For example, the imports field can be used to gain the benefits of conditional +exports for internal modules: + +```json +// package.json +{ + "imports": { + "#dep": { + "node": "dep-node-native", + "default": "./dep-polyfill.js" + } + }, + "dependencies": { + "dep-node-native": "^1.0.0" + } +} +``` + +where `import '#dep'` would now get the resolution of the external package +`dep-node-native` (including its exports in turn), and instead get the local +file `./dep-polyfill.js` relative to the package in other environments. + +Unlike the exports field, import maps permit mapping to external packages +because this provides an important use case for conditional loading and also can +be done without the risk of cycles, unlike for exports. + +Apart from the above, the resolution rules for the imports field are otherwise +analogous to the exports field. + [Babel]: https://babeljs.io/ +[Conditional exports]: #packages_conditional_exports +[CommonJS]: modules.html +[entry points]: #packages_package_entry_points [`esm`]: https://github.com/standard-things/esm#readme +[ES modules]: esm.html +[ES module]: esm.html +[`"exports"`]: #packages_exports +[`"main"`]: #packages_main +[`package.json`]: #packages_node_js_package_json_field_definitions +[package scope]: #packages_package_scope_and_file_extensions +[self-reference]: #packages_self_referencing_a_package_using_its_name +[subpath exports]: #packages_subpath_exports [the full specifier path]: modules_esm.html#modules_esm_mandatory_file_extensions [the dual CommonJS/ES module packages section]: #packages_dual_commonjs_es_module_packages -[ES modules]: esm.html -[CommonJS]: modules.html +[`"type"`]: #packages_type From 41af927efbbf88bd208c52bb15740bf4f48faf74 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Tue, 11 Aug 2020 18:40:05 -0700 Subject: [PATCH 023/117] module: exports pattern support Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/34718 Reviewed-By: Jan Krems Reviewed-By: Matteo Collina --- doc/api/esm.md | 49 ++++++++++---- doc/api/packages.md | 43 +++++++++---- lib/internal/modules/esm/resolve.js | 64 +++++++++++++------ test/es-module/test-esm-exports.mjs | 3 + .../es-modules/pkgimports/package.json | 4 +- .../node_modules/pkgexports/package.json | 4 +- 6 files changed, 118 insertions(+), 49 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 219c45d06ecafd..4b5679b3c3363d 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1038,7 +1038,8 @@ The resolver can throw the following errors: > 1. Set _mainExport_ to _exports_\[_"."_\]. > 1. If _mainExport_ is not **undefined**, then > 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( -> _packageURL_, _mainExport_, _""_, **false**, _conditions_). +> _packageURL_, _mainExport_, _""_, **false**, **false**, +> _conditions_). > 1. If _resolved_ is not **null** or **undefined**, then > 1. Return _resolved_. > 1. Otherwise, if _exports_ is an Object and all keys of _exports_ start with @@ -1072,29 +1073,43 @@ _isImports_, _conditions_) > 1. If _matchKey_ is a key of _matchObj_, and does not end in _"*"_, then > 1. Let _target_ be the value of _matchObj_\[_matchKey_\]. > 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( -> _packageURL_, _target_, _""_, _isImports_, _conditions_). +> _packageURL_, _target_, _""_, **false**, _isImports_, _conditions_). > 1. Return the object _{ resolved, exact: **true** }_. -> 1. Let _expansionKeys_ be the list of keys of _matchObj_ ending in _"/"_, -> sorted by length descending. +> 1. Let _expansionKeys_ be the list of keys of _matchObj_ ending in _"/"_ +> or _"*"_, sorted by length descending. > 1. For each key _expansionKey_ in _expansionKeys_, do +> 1. If _expansionKey_ ends in _"*"_ and _matchKey_ starts with but is +> not equal to the substring of _expansionKey_ excluding the last _"*"_ +> character, then +> 1. Let _target_ be the value of _matchObj_\[_expansionKey_\]. +> 1. Let _subpath_ be the substring of _matchKey_ starting at the +> index of the length of _expansionKey_ minus one. +> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( +> _packageURL_, _target_, _subpath_, **true**, _isImports_, +> _conditions_). +> 1. Return the object _{ resolved, exact: **true** }_. > 1. If _matchKey_ starts with _expansionKey_, then > 1. Let _target_ be the value of _matchObj_\[_expansionKey_\]. > 1. Let _subpath_ be the substring of _matchKey_ starting at the > index of the length of _expansionKey_. > 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( -> _packageURL_, _target_, _subpath_, _isImports_, _conditions_). +> _packageURL_, _target_, _subpath_, **false**, _isImports_, +> _conditions_). > 1. Return the object _{ resolved, exact: **false** }_. > 1. Return the object _{ resolved: **null**, exact: **true** }_. -**PACKAGE_TARGET_RESOLVE**(_packageURL_, _target_, _subpath_, _internal_, -_conditions_) +**PACKAGE_TARGET_RESOLVE**(_packageURL_, _target_, _subpath_, _pattern_, +_internal_, _conditions_) > 1. If _target_ is a String, then -> 1. If _subpath_ has non-zero length and _target_ does not end with _"/"_, -> throw an _Invalid Module Specifier_ error. +> 1. If _pattern_ is **false**, _subpath_ has non-zero length and _target_ +> does not end with _"/"_, throw an _Invalid Module Specifier_ error. > 1. If _target_ does not start with _"./"_, then > 1. If _internal_ is **true** and _target_ does not start with _"../"_ or > _"/"_ and is not a valid URL, then +> 1. If _pattern_ is **true**, then +> 1. Return **PACKAGE_RESOLVE**(_target_ with every instance of +> _"*"_ replaced by _subpath_, _packageURL_ + _"/"_)_. > 1. Return **PACKAGE_RESOLVE**(_target_ + _subpath_, > _packageURL_ + _"/"_)_. > 1. Otherwise, throw an _Invalid Package Target_ error. @@ -1106,8 +1121,12 @@ _conditions_) > 1. Assert: _resolvedTarget_ is contained in _packageURL_. > 1. If _subpath_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or > _"node_modules"_ segments, throw an _Invalid Module Specifier_ error. -> 1. Return the URL resolution of the concatenation of _subpath_ and -> _resolvedTarget_. +> 1. If _pattern_ is **true**, then +> 1. Return the URL resolution of _resolvedTarget_ with every instance of +> _"*"_ replaced with _subpath_. +> 1. Otherwise, +> 1. Return the URL resolution of the concatenation of _subpath_ and +> _resolvedTarget_. > 1. Otherwise, if _target_ is a non-null Object, then > 1. If _exports_ contains any index property keys, as defined in ECMA-262 > [6.1.7 Array Index][], throw an _Invalid Package Configuration_ error. @@ -1116,7 +1135,8 @@ _conditions_) > then > 1. Let _targetValue_ be the value of the _p_ property in _target_. > 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( -> _packageURL_, _targetValue_, _subpath_, _internal_, _conditions_). +> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_, +> _conditions_). > 1. If _resolved_ is equal to **undefined**, continue the loop. > 1. Return _resolved_. > 1. Return **undefined**. @@ -1124,8 +1144,9 @@ _conditions_) > 1. If _target.length is zero, return **null**. > 1. For each item _targetValue_ in _target_, do > 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**( -> _packageURL_, _targetValue_, _subpath_, _internal_, _conditions_), -> continuing the loop on any _Invalid Package Target_ error. +> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_, +> _conditions_), continuing the loop on any _Invalid Package Target_ +> error. > 1. If _resolved_ is **undefined**, continue the loop. > 1. Return _resolved_. > 1. Return or throw the last fallback resolution **null** return or error. diff --git a/doc/api/packages.md b/doc/api/packages.md index 84da766d956340..a67343585a55c1 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -181,17 +181,17 @@ Alternatively a project could choose to export entire folders: "exports": { ".": "./lib/index.js", "./lib": "./lib/index.js", - "./lib/": "./lib/", + "./lib/*": "./lib/*.js", "./feature": "./feature/index.js", - "./feature/": "./feature/", + "./feature/*": "./feature/*.js", "./package.json": "./package.json" } } ``` As a last resort, package encapsulation can be disabled entirely by creating an -export for the root of the package `"./": "./"`. This will expose every file in -the package at the cost of disabling the encapsulation and potential tooling +export for the root of the package `"./*": "./*"`. This will expose every file +in the package at the cost of disabling the encapsulation and potential tooling benefits this provides. As the ES Module loader in Node.js enforces the use of [the full specifier path][], exporting the root rather than being explicit about entry is less expressive than either of the prior examples. Not only @@ -254,29 +254,46 @@ import submodule from 'es-module-package/private-module.js'; // Throws ERR_PACKAGE_PATH_NOT_EXPORTED ``` -Entire folders can also be mapped with package exports: +### Subpath export patterns + +> Stability: 1 - Experimental + +Explicitly listing each exports subpath entry is recommended for packages with +a small number of exports. But for packages that have very large numbers of +subpaths this can start to cause package.json bloat and maintenance issues. + +For these use cases, subpath export patterns can be used instead: ```json // ./node_modules/es-module-package/package.json { "exports": { - "./features/": "./src/features/" + "./features/*": "./src/features/*.js" } } ``` -With the preceding, all modules within the `./src/features/` folder -are exposed deeply to `import` and `require`: +The left hand matching pattern must always end in `*`. All instances of `*` on +the right hand side will then be replaced with this value, including if it +contains any `/` separators. ```js -import feature from 'es-module-package/features/x.js'; +import featureX from 'es-module-package/features/x'; // Loads ./node_modules/es-module-package/src/features/x.js + +import featureY from 'es-module-package/features/y/y'; +// Loads ./node_modules/es-module-package/src/features/y/y.js ``` -When using folder mappings, ensure that you do want to expose every -module inside the subfolder. Any modules which are not public -should be moved to another folder to retain the encapsulation -benefits of exports. +This is a direct static replacement without any special handling for file +extensions. In the previous example, `pkg/features/x.json` would be resolved to +`./src/features/x.json.js` in the mapping. + +The property of exports being statically enumerable is maintained with exports +patterns since the individual exports for a package can be determined by +treating the right hand side target pattern as a `**` glob against the list of +files within the package. Because `node_modules` paths are forbidden in exports +targets, this expansion is dependent on only the files of the package itself. ### Package exports fallbacks diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index dd24019351a72e..92760d201beb4c 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -307,10 +307,11 @@ function throwInvalidPackageTarget( } const invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; +const patternRegEx = /\*/g; function resolvePackageTargetString( - target, subpath, match, packageJSONUrl, base, internal, conditions) { - if (subpath !== '' && target[target.length - 1] !== '/') + target, subpath, match, packageJSONUrl, base, pattern, internal, conditions) { + if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (!StringPrototypeStartsWith(target, './')) { @@ -321,8 +322,12 @@ function resolvePackageTargetString( new URL(target); isURL = true; } catch {} - if (!isURL) - return packageResolve(target + subpath, packageJSONUrl, conditions); + if (!isURL) { + const exportTarget = pattern ? + StringPrototypeReplace(target, patternRegEx, subpath) : + target + subpath; + return packageResolve(exportTarget, packageJSONUrl, conditions); + } } throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); } @@ -342,6 +347,9 @@ function resolvePackageTargetString( if (RegExpPrototypeTest(invalidSegmentRegEx, subpath)) throwInvalidSubpath(match + subpath, packageJSONUrl, internal, base); + if (pattern) + return new URL(StringPrototypeReplace(resolved.href, patternRegEx, + subpath)); return new URL(subpath, resolved); } @@ -356,10 +364,10 @@ function isArrayIndex(key) { } function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, - base, internal, conditions) { + base, pattern, internal, conditions) { if (typeof target === 'string') { return resolvePackageTargetString( - target, subpath, packageSubpath, packageJSONUrl, base, internal, + target, subpath, packageSubpath, packageJSONUrl, base, pattern, internal, conditions); } else if (ArrayIsArray(target)) { if (target.length === 0) @@ -371,8 +379,8 @@ function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, let resolved; try { resolved = resolvePackageTarget( - packageJSONUrl, targetItem, subpath, packageSubpath, base, internal, - conditions); + packageJSONUrl, targetItem, subpath, packageSubpath, base, pattern, + internal, conditions); } catch (e) { lastException = e; if (e.code === 'ERR_INVALID_PACKAGE_TARGET') @@ -406,7 +414,7 @@ function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, const conditionalTarget = target[key]; const resolved = resolvePackageTarget( packageJSONUrl, conditionalTarget, subpath, packageSubpath, base, - internal, conditions); + pattern, internal, conditions); if (resolved === undefined) continue; return resolved; @@ -460,7 +468,7 @@ function packageExportsResolve( if (ObjectPrototypeHasOwnProperty(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolvePackageTarget( - packageJSONUrl, target, '', packageSubpath, base, false, conditions + packageJSONUrl, target, '', packageSubpath, base, false, false, conditions ); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); @@ -471,7 +479,13 @@ function packageExportsResolve( const keys = ObjectGetOwnPropertyNames(exports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - if (key[key.length - 1] === '/' && + if (key[key.length - 1] === '*' && + StringPrototypeStartsWith(packageSubpath, + StringPrototypeSlice(key, 0, -1)) && + packageSubpath.length >= key.length && + key.length > bestMatch.length) { + bestMatch = key; + } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(packageSubpath, key) && key.length > bestMatch.length) { bestMatch = key; @@ -480,12 +494,15 @@ function packageExportsResolve( if (bestMatch) { const target = exports[bestMatch]; - const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length); + const pattern = bestMatch[bestMatch.length - 1] === '*'; + const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length - + (pattern ? 1 : 0)); const resolved = resolvePackageTarget(packageJSONUrl, target, subpath, - bestMatch, base, false, conditions); + bestMatch, base, pattern, false, + conditions); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); - return { resolved, exact: false }; + return { resolved, exact: pattern }; } throwExportsNotFound(packageSubpath, packageJSONUrl, base); @@ -504,7 +521,7 @@ function packageImportsResolve(name, base, conditions) { if (imports) { if (ObjectPrototypeHasOwnProperty(imports, name)) { const resolved = resolvePackageTarget( - packageJSONUrl, imports[name], '', name, base, true, conditions + packageJSONUrl, imports[name], '', name, base, false, true, conditions ); if (resolved !== null) return { resolved, exact: true }; @@ -513,7 +530,13 @@ function packageImportsResolve(name, base, conditions) { const keys = ObjectGetOwnPropertyNames(imports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - if (key[key.length - 1] === '/' && + if (key[key.length - 1] === '*' && + StringPrototypeStartsWith(name, + StringPrototypeSlice(key, 0, -1)) && + name.length >= key.length && + key.length > bestMatch.length) { + bestMatch = key; + } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(name, key) && key.length > bestMatch.length) { bestMatch = key; @@ -522,11 +545,14 @@ function packageImportsResolve(name, base, conditions) { if (bestMatch) { const target = imports[bestMatch]; - const subpath = StringPrototypeSubstr(name, bestMatch.length); + const pattern = bestMatch[bestMatch.length - 1] === '*'; + const subpath = StringPrototypeSubstr(name, bestMatch.length - + (pattern ? 1 : 0)); const resolved = resolvePackageTarget( - packageJSONUrl, target, subpath, bestMatch, base, true, conditions); + packageJSONUrl, target, subpath, bestMatch, base, pattern, true, + conditions); if (resolved !== null) - return { resolved, exact: false }; + return { resolved, exact: pattern }; } } } diff --git a/test/es-module/test-esm-exports.mjs b/test/es-module/test-esm-exports.mjs index a4cced41f897b0..d234099732e3aa 100644 --- a/test/es-module/test-esm-exports.mjs +++ b/test/es-module/test-esm-exports.mjs @@ -33,6 +33,9 @@ import fromInside from '../fixtures/node_modules/pkgexports/lib/hole.js'; { default: 'self-cjs' } : { default: 'self-mjs' }], // Resolve self sugar ['pkgexports-sugar', { default: 'main' }], + // Path patterns + ['pkgexports/subpath/sub-dir1', { default: 'main' }], + ['pkgexports/features/dir1', { default: 'main' }] ]); if (isRequire) { diff --git a/test/fixtures/es-modules/pkgimports/package.json b/test/fixtures/es-modules/pkgimports/package.json index 7cd179631fa618..a2224b39ddd2ac 100644 --- a/test/fixtures/es-modules/pkgimports/package.json +++ b/test/fixtures/es-modules/pkgimports/package.json @@ -5,9 +5,9 @@ "import": "./importbranch.js", "require": "./requirebranch.js" }, - "#subpath/": "./sub/", + "#subpath/*": "./sub/*", "#external": "pkgexports/valid-cjs", - "#external/subpath/": "pkgexports/sub/", + "#external/subpath/*": "pkgexports/sub/*", "#external/invalidsubpath/": "pkgexports/sub", "#belowbase": "../belowbase", "#url": "some:url", diff --git a/test/fixtures/node_modules/pkgexports/package.json b/test/fixtures/node_modules/pkgexports/package.json index 71406a407c453d..240122d4aaec95 100644 --- a/test/fixtures/node_modules/pkgexports/package.json +++ b/test/fixtures/node_modules/pkgexports/package.json @@ -47,6 +47,8 @@ "require": "./resolve-self-invalid.js", "import": "./resolve-self-invalid.mjs" }, - "./subpath/": "./subpath/" + "./subpath/": "./subpath/", + "./subpath/sub-*": "./subpath/dir1/*.js", + "./features/*": "./subpath/*/*.js" } } From 5f0b1571a7da0fefa8140368333b25932a2c2422 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 18 Sep 2020 02:48:37 -0700 Subject: [PATCH 024/117] doc: edit subpath export patterns introduction * Use parallel construction in the two sentences * Backticks around _package.json_ to match rest of file * Add comma for readability * Own the recommendation ("we recommend") Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35254 Reviewed-By: Jan Krems Reviewed-By: Michael Dawson Reviewed-By: Guy Bedford --- doc/api/packages.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/packages.md b/doc/api/packages.md index a67343585a55c1..c4d708bf8dfd1e 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -258,9 +258,9 @@ import submodule from 'es-module-package/private-module.js'; > Stability: 1 - Experimental -Explicitly listing each exports subpath entry is recommended for packages with -a small number of exports. But for packages that have very large numbers of -subpaths this can start to cause package.json bloat and maintenance issues. +For packages with a small number of exports, we recommend explicitly listing +each exports subpath entry. But for packages that have large numbers of +subpaths, this might cause `package.json` bloat and maintenance issues. For these use cases, subpath export patterns can be used instead: From 5330930128e28e2561ab5d8628132c8581a509dc Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Tue, 22 Sep 2020 20:35:47 -0700 Subject: [PATCH 025/117] doc: refine require/import conditions constraints Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35311 Reviewed-By: Jan Krems --- doc/api/packages.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/api/packages.md b/doc/api/packages.md index c4d708bf8dfd1e..d9c3696b813aeb 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -364,12 +364,15 @@ For example, a package that wants to provide different ES module exports for Node.js supports the following conditions out of the box: * `"import"` - matched when the package is loaded via `import` or - `import()`. Can reference either an ES module or CommonJS file, as both - `import` and `import()` can load either ES module or CommonJS sources. - _Always matched when the `"require"` condition is not matched._ -* `"require"` - matched when the package is loaded via `require()`. - As `require()` only supports CommonJS, the referenced file must be CommonJS. - _Always matched when the `"import"` condition is not matched._ + `import()`, or via any top-level import or resolve operation by the + ECMAScript module loader. Applies regardless of the module format of the + target file. _Always mutually exclusive with `"require"`._ +* `"require"` - matched when the package is loaded via `require()`. The + referenced file should be loadable with `require()` although the condition + will be matched regardless of the module format of the target file. Expected + formats include CommonJS, JSON, and native addons but not ES modules as + `require()` doesn't support them. _Always mutually exclusive with + `"import"`._ * `"node"` - matched for any Node.js environment. Can be a CommonJS or ES module file. _This condition should always come after `"import"` or `"require"`._ From f507ca9e21c8e35dca7966b46754a142d67cd3ab Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sat, 26 Sep 2020 22:13:02 -0700 Subject: [PATCH 026/117] doc: packages docs feedback Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35370 Reviewed-By: Derek Lewis Reviewed-By: Geoffrey Booth Reviewed-By: Rich Trott --- doc/api/packages.md | 111 +++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 58 deletions(-) diff --git a/doc/api/packages.md b/doc/api/packages.md index d9c3696b813aeb..2e420ef5fec47e 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -4,11 +4,13 @@ ## Introduction -A package is a folder described by a `package.json` file. +A package is a folder tree described by a `package.json` file. The package +consists of the folder containing the `package.json` file and all subfolders +until the next folder containing another `package.json` file, or a folder +named `node_modules`. -A folder containing a `package.json` file, and all subfolders below that folder -until the next folder containing another `package.json` file, are a _package -scope_. +This page provides guidance for package authors writing `package.json` files +along with a reference for the [`package.json`][] fields defined by Node.js. ## Determining module system @@ -18,7 +20,7 @@ initial input, or when referenced by `import` statements within ES module code: * Files ending in `.mjs`. * Files ending in `.js` when the nearest parent `package.json` file contains a - top-level field [`"type"`][] with a value of `"module"`. + top-level [`"type"`][] field with a value of `"module"`. * Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`, with the flag `--input-type=module`. @@ -45,29 +47,25 @@ future-proof the package in case the default type of Node.js ever changes, and it will also make things easier for build tools and loaders to determine how the files in the package should be interpreted. -### Package scope and file extensions +### `package.json` and file extensions -A folder containing a `package.json` file, and all subfolders below that folder -until the next folder containing another [`package.json`][], are a -_package scope_. Package scopes do not carry through `node_modules` folders. - -Within a package scope, the [`package.json`][] [`"type"`][] field defines how +Within a package, the [`package.json`][] [`"type"`][] field defines how Node.js should interpret `.js` files. If a `package.json` file does not have a `"type"` field, `.js` files are treated as [CommonJS][]. A `package.json` `"type"` value of `"module"` tells Node.js to interpret `.js` -files within that package scope as using [ES module][] syntax. +files within that package as using [ES module][] syntax. -The package scope applies not only to initial entry points (`node my-app.js`) +The `"type"` field applies not only to initial entry points (`node my-app.js`) but also to files referenced by `import` statements and `import()` expressions. ```js -// my-app.js, in an ES module package scope because there is a package.json +// my-app.js, treated as an ES module because there is a package.json // file in the same folder with "type": "module". import './startup/init.js'; // Loaded as ES module since ./startup contains no package.json file, -// and therefore inherits the ES module package scope from one level up. +// and therefore inherits the "type" value from one level up. import 'commonjs-package'; // Loaded as CommonJS since ./node_modules/commonjs-package/package.json @@ -79,10 +77,10 @@ import './node_modules/commonjs-package/index.js'; ``` Files ending with `.mjs` are always loaded as [ES modules][] regardless of -package scope. +the nearest parent `package.json`. -Files ending with `.cjs` are always loaded as [CommonJS][] regardless of package -scope. +Files ending with `.cjs` are always loaded as [CommonJS][] regardless of the +nearest parent `package.json`. ```js import './legacy-file.cjs'; @@ -93,17 +91,17 @@ import 'commonjs-package/src/index.mjs'; ``` The `.mjs` and `.cjs` extensions may be used to mix types within the same -package scope: +package: -* Within a `"type": "module"` package scope, Node.js can be instructed to +* Within a `"type": "module"` package, Node.js can be instructed to interpret a particular file as [CommonJS][] by naming it with a `.cjs` extension (since both `.js` and `.mjs` files are treated as ES modules within - a `"module"` package scope). + a `"module"` package). -* Within a `"type": "commonjs"` package scope, Node.js can be instructed to +* Within a `"type": "commonjs"` package, Node.js can be instructed to interpret a particular file as an [ES module][] by naming it with an `.mjs` extension (since both `.js` and `.cjs` files are treated as CommonJS within a - `"commonjs"` package scope). + `"commonjs"` package). ### `--input-type` flag @@ -211,10 +209,10 @@ To set the main entry point for a package, it is advisable to define both } ``` -The benefit of doing this is that when using the [`"exports"`][] field all -subpaths of the package will no longer be available to importers under -`require('pkg/subpath.js')`, and instead they will get a new error, -`ERR_PACKAGE_PATH_NOT_EXPORTED`. +When defining the [`"exports"`][] field, all subpaths of the package will be +encapsulated and no longer available to importers. For example, +`require('pkg/subpath.js')` would throw an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][] +error. This encapsulation of exports provides more reliable guarantees about package interfaces for tools and when handling semver upgrades for a @@ -295,24 +293,6 @@ treating the right hand side target pattern as a `**` glob against the list of files within the package. Because `node_modules` paths are forbidden in exports targets, this expansion is dependent on only the files of the package itself. -### Package exports fallbacks - -> Stability: 1 - Experimental - -For possible new specifier support in future, array fallbacks are -supported for all invalid specifiers: - -```json -{ - "exports": { - "./submodule": ["not:valid", "./submodule.js"] - } -} -``` - -Since `"not:valid"` is not a valid specifier, `"./submodule.js"` is used -instead as the fallback, as if it were the only target. - ### Exports sugar > Stability: 1 - Experimental @@ -560,9 +540,10 @@ could be intended only for other environments such as browsers. Such a package would be usable by any version of Node.js, since `import` can refer to CommonJS files; but it would not provide any of the advantages of using ES module syntax. -A package could also switch from CommonJS to ES module syntax in a breaking -change version bump. This has the disadvantage that the newest version -of the package would only be usable in ES module-supporting versions of Node.js. +A package could also switch from CommonJS to ES module syntax in a [breaking +change](https://semver.org/) version bump. This has the disadvantage that the +newest version of the package would only be usable in ES module-supporting +versions of Node.js. Every pattern has tradeoffs, but there are two broad approaches that satisfy the following conditions: @@ -773,6 +754,19 @@ This section describes the fields used by the Node.js runtime. Other tools (such as [npm](https://docs.npmjs.com/creating-a-package-json-file)) may use additional fields which are ignored by Node.js and not documented here. +The following fields in `package.json` files are used in Node.js: + +* [`"name"`][] - Relevant when using named imports within a package. Also used + by package managers as the name of the package. +* [`"type"`][] - The package type determining whether to load `.js` files as + CommonJS or ES modules. +* [`"exports"`][] - Package exports and conditional exports. When present, + limits which submodules may be loaded from within the package. +* [`"main"`][] - The default module when loading the package, if exports is not + specified, and in versions of Node.js prior to the introduction of exports. +* [`"imports"`][] - Package imports, for use by modules within the package + itself. + ### `"name"` * Type: {Object} | {string} | {string[]} From 985b96a7d557e80e182acd95b3482b30c214a61b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 28 Sep 2020 13:23:53 +0200 Subject: [PATCH 030/117] doc,esm: add history support info Documents which versions of Node.js support which ESM-feature. Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35395 Reviewed-By: Geoffrey Booth Reviewed-By: Guy Bedford Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/esm.md | 17 +++++++++++++++++ doc/api/packages.md | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/doc/api/esm.md b/doc/api/esm.md index 4b5679b3c3363d..feca5527937a88 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -2,6 +2,23 @@ + > Stability: 1 - Experimental diff --git a/doc/api/packages.md b/doc/api/packages.md index 4da77aedefea19..df7383d2532abf 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -1,6 +1,33 @@ # Modules: Packages + ## Introduction From 1ff956f49e05bbfd86c0d3746b043060f166423c Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 26 Feb 2020 22:32:08 +0200 Subject: [PATCH 031/117] module: remove experimental modules warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/31974 Reviewed-By: Myles Borins Reviewed-By: Jan Krems Reviewed-By: Geoffrey Booth Reviewed-By: Michaël Zasso --- lib/internal/process/esm_loader.js | 22 +++---------------- test/es-module/test-esm-dynamic-import.js | 3 --- test/es-module/test-esm-nowarn-exports.mjs | 2 +- test/message/async_error_sync_esm.out | 1 - test/message/esm_display_syntax_error.out | 1 - .../esm_display_syntax_error_import.out | 1 - ...esm_display_syntax_error_import_module.out | 1 - .../esm_display_syntax_error_module.out | 1 - test/message/esm_loader_not_found.out | 1 - .../esm_loader_not_found_cjs_hint_bare.out | 1 - ...esm_loader_not_found_cjs_hint_relative.out | 1 - test/message/esm_loader_syntax_error.out | 1 - 12 files changed, 4 insertions(+), 32 deletions(-) diff --git a/lib/internal/process/esm_loader.js b/lib/internal/process/esm_loader.js index 7788e7db7d0f91..15e3a2cafda9b6 100644 --- a/lib/internal/process/esm_loader.js +++ b/lib/internal/process/esm_loader.js @@ -3,7 +3,6 @@ const { ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, } = require('internal/errors').codes; -const assert = require('internal/assert'); const { Loader } = require('internal/modules/esm/loader'); const { hasUncaughtExceptionCaptureCallback, @@ -26,13 +25,6 @@ exports.initializeImportMetaObject = function(wrap, meta) { }; exports.importModuleDynamicallyCallback = async function(wrap, specifier) { - assert(calledInitialize === true || !userLoader); - if (!calledInitialize) { - process.emitWarning( - 'The ESM module loader is experimental.', - 'ExperimentalWarning', undefined); - calledInitialize = true; - } const { callbackMap } = internalBinding('module_wrap'); if (callbackMap.has(wrap)) { const { importModuleDynamically } = callbackMap.get(wrap); @@ -47,15 +39,7 @@ exports.importModuleDynamicallyCallback = async function(wrap, specifier) { let ESMLoader = new Loader(); exports.ESMLoader = ESMLoader; -let calledInitialize = false; -async function initializeLoader(emitWarning) { - assert(calledInitialize === false); - if (emitWarning) { - process.emitWarning( - 'The ESM module loader is experimental.', - 'ExperimentalWarning', undefined); - } - calledInitialize = true; +async function initializeLoader() { if (!userLoader) return; let cwd; @@ -78,9 +62,9 @@ async function initializeLoader(emitWarning) { })(); } -exports.loadESM = async function loadESM(callback, emitWarning = true) { +exports.loadESM = async function loadESM(callback) { try { - await initializeLoader(emitWarning); + await initializeLoader(); await callback(ESMLoader); } catch (err) { if (hasUncaughtExceptionCaptureCallback()) { diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 4e87866b2bad3b..0cb56dff2c04c5 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -38,9 +38,6 @@ function expectFsNamespace(result) { // For direct use of import expressions inside of CJS or ES modules, including // via eval, all kinds of specifiers should work without issue. (function testScriptOrModuleImport() { - common.expectWarning('ExperimentalWarning', - 'The ESM module loader is experimental.'); - // Importing another file, both direct & via eval // expectOkNamespace(import(relativePath)); expectOkNamespace(eval(`import("${relativePath}")`)); diff --git a/test/es-module/test-esm-nowarn-exports.mjs b/test/es-module/test-esm-nowarn-exports.mjs index 13bfaf9b4f3527..5e0927f4674f84 100644 --- a/test/es-module/test-esm-nowarn-exports.mjs +++ b/test/es-module/test-esm-nowarn-exports.mjs @@ -16,7 +16,7 @@ child.stderr.on('data', (data) => { child.on('close', (code, signal) => { strictEqual(code, 0); strictEqual(signal, null); - ok(stderr.toString().includes( + ok(!stderr.toString().includes( 'ExperimentalWarning: The ESM module loader is experimental' )); ok(!stderr.toString().includes( diff --git a/test/message/async_error_sync_esm.out b/test/message/async_error_sync_esm.out index 6577fff6944723..6054fc7cc22de0 100644 --- a/test/message/async_error_sync_esm.out +++ b/test/message/async_error_sync_esm.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. Error: test at one (*fixtures*async-error.js:4:9) at two (*fixtures*async-error.js:17:9) diff --git a/test/message/esm_display_syntax_error.out b/test/message/esm_display_syntax_error.out index 778d901129fa95..b7d2008540adf3 100644 --- a/test/message/esm_display_syntax_error.out +++ b/test/message/esm_display_syntax_error.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. file:///*/test/message/esm_display_syntax_error.mjs:2 await async () => 0; ^^^^^ diff --git a/test/message/esm_display_syntax_error_import.out b/test/message/esm_display_syntax_error_import.out index 8ca1165766bf77..fe174d54a5c49f 100644 --- a/test/message/esm_display_syntax_error_import.out +++ b/test/message/esm_display_syntax_error_import.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. file:///*/test/message/esm_display_syntax_error_import.mjs:5 notfound ^^^^^^^^ diff --git a/test/message/esm_display_syntax_error_import_module.out b/test/message/esm_display_syntax_error_import_module.out index 56035bc0340cc8..d220627bd02654 100644 --- a/test/message/esm_display_syntax_error_import_module.out +++ b/test/message/esm_display_syntax_error_import_module.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1 import { foo, notfound } from './module-named-exports.mjs'; ^^^^^^^^ diff --git a/test/message/esm_display_syntax_error_module.out b/test/message/esm_display_syntax_error_module.out index a1498f72c94d57..708257fcaf5792 100644 --- a/test/message/esm_display_syntax_error_module.out +++ b/test/message/esm_display_syntax_error_module.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2 await async () => 0; ^^^^^ diff --git a/test/message/esm_loader_not_found.out b/test/message/esm_loader_not_found.out index 4fe916b315f9d8..97400699e644b7 100644 --- a/test/message/esm_loader_not_found.out +++ b/test/message/esm_loader_not_found.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. (node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time internal/process/esm_loader.js:* internalBinding('errors').triggerUncaughtException( diff --git a/test/message/esm_loader_not_found_cjs_hint_bare.out b/test/message/esm_loader_not_found_cjs_hint_bare.out index edf71b42719979..c3f758577eb4d6 100644 --- a/test/message/esm_loader_not_found_cjs_hint_bare.out +++ b/test/message/esm_loader_not_found_cjs_hint_bare.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. internal/process/esm_loader.js:* internalBinding('errors').triggerUncaughtException( ^ diff --git a/test/message/esm_loader_not_found_cjs_hint_relative.out b/test/message/esm_loader_not_found_cjs_hint_relative.out index 63a3a4aff92def..eeb4480ee19144 100644 --- a/test/message/esm_loader_not_found_cjs_hint_relative.out +++ b/test/message/esm_loader_not_found_cjs_hint_relative.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. (node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time internal/process/esm_loader.js:* internalBinding('errors').triggerUncaughtException( diff --git a/test/message/esm_loader_syntax_error.out b/test/message/esm_loader_syntax_error.out index 9767a9c86c6bc2..7dd1c01fbcc1bf 100644 --- a/test/message/esm_loader_syntax_error.out +++ b/test/message/esm_loader_syntax_error.out @@ -1,4 +1,3 @@ -(node:*) ExperimentalWarning: The ESM module loader is experimental. (node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time file://*/test/fixtures/es-module-loaders/syntax-error.mjs:2 await async () => 0; From 1f34230373e97e5d4c409e4d2fe1a669b6f785cc Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 22 Oct 2020 12:16:39 +0200 Subject: [PATCH 032/117] doc,esm: document experimental warning removal Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35750 Reviewed-By: Rich Trott Reviewed-By: Guy Bedford --- doc/api/esm.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/esm.md b/doc/api/esm.md index feca5527937a88..25a1431728f4b0 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -9,6 +9,9 @@ changes: - REPLACEME pr-url: https://github.com/nodejs/node/pull/35249 description: Support for detection of CommonJS named exports. + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/31974 + description: Remove experimental modules warning. - version: - v12.17.0 pr-url: https://github.com/nodejs/node/pull/29866 From 0f757bc2df09bfb0935b92e47b070078ce5a3da5 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 27 Sep 2020 21:24:44 -0700 Subject: [PATCH 033/117] esm: use "node:" namespace for builtins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-PR-URL: https://github.com/nodejs/node/pull/35757 PR-URL: https://github.com/nodejs/node/pull/35387 Reviewed-By: Michaël Zasso Reviewed-By: Bradley Farias Reviewed-By: Jan Krems Reviewed-By: Matteo Collina --- doc/api/esm.md | 2 +- lib/internal/modules/esm/get_format.js | 2 +- lib/internal/modules/esm/resolve.js | 4 ++-- lib/internal/modules/esm/translators.js | 8 ++++---- test/es-module/test-esm-dynamic-import.js | 4 ++-- test/fixtures/es-module-loaders/example-loader.mjs | 4 ++-- .../es-module-loaders/loader-unknown-builtin-module.mjs | 4 ++-- .../es-module-loaders/not-found-assert-loader.mjs | 2 +- test/parallel/test-loaders-unknown-builtin-module.mjs | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 25a1431728f4b0..d9f4007c494825 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1007,7 +1007,7 @@ The resolver can throw the following errors: > 1. If _selfUrl_ is not **undefined**, return _selfUrl_. > 1. If _packageSubpath_ is _"."_ and _packageName_ is a Node.js builtin > module, then -> 1. Return the string _"nodejs:"_ concatenated with _packageSpecifier_. +> 1. Return the string _"node:"_ concatenated with _packageSpecifier_. > 1. While _parentURL_ is not the file system root, > 1. Let _packageURL_ be the URL resolution of _"node_modules/"_ > concatenated with _packageSpecifier_, relative to _parentURL_. diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js index 616b2cf52309ea..16e2ad5e2d5c3e 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -34,7 +34,7 @@ if (experimentalJsonModules) extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; function defaultGetFormat(url, context, defaultGetFormatUnused) { - if (StringPrototypeStartsWith(url, 'nodejs:')) { + if (StringPrototypeStartsWith(url, 'node:')) { return { format: 'builtin' }; } const parsed = new URL(url); diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 92760d201beb4c..4576cfebf4d124 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -750,13 +750,13 @@ function defaultResolve(specifier, context = {}, defaultResolveUnused) { }; } } catch {} - if (parsed && parsed.protocol === 'nodejs:') + if (parsed && parsed.protocol === 'node:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); if (NativeModule.canBeRequiredByUsers(specifier)) { return { - url: 'nodejs:' + specifier + url: 'node:' + specifier }; } if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index acbf1ab1480dea..bb58859e05c2b0 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -261,11 +261,11 @@ function cjsPreparseModuleExports(filename) { // through normal resolution translators.set('builtin', async function builtinStrategy(url) { debug(`Translating BuiltinModule ${url}`); - // Slice 'nodejs:' scheme - const id = url.slice(7); + // Slice 'node:' scheme + const id = url.slice(5); const module = loadNativeModule(id, url, true); - if (!url.startsWith('nodejs:') || !module) { - throw new ERR_UNKNOWN_BUILTIN_MODULE(id); + if (!url.startsWith('node:') || !module) { + throw new ERR_UNKNOWN_BUILTIN_MODULE(url); } debug(`Loading BuiltinModule ${url}`); return module.getESMFacade(); diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 0cb56dff2c04c5..6f8757da1b914e 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -48,9 +48,9 @@ function expectFsNamespace(result) { expectFsNamespace(import('fs')); expectFsNamespace(eval('import("fs")')); expectFsNamespace(eval('import("fs")')); - expectFsNamespace(import('nodejs:fs')); + expectFsNamespace(import('node:fs')); - expectModuleError(import('nodejs:unknown'), + expectModuleError(import('node:unknown'), 'ERR_UNKNOWN_BUILTIN_MODULE'); expectModuleError(import('./not-an-existing-module.mjs'), 'ERR_MODULE_NOT_FOUND'); diff --git a/test/fixtures/es-module-loaders/example-loader.mjs b/test/fixtures/es-module-loaders/example-loader.mjs index 1ed18bda51070d..be4808738035f9 100644 --- a/test/fixtures/es-module-loaders/example-loader.mjs +++ b/test/fixtures/es-module-loaders/example-loader.mjs @@ -11,7 +11,7 @@ baseURL.pathname = process.cwd() + '/'; export function resolve(specifier, { parentURL = baseURL }, defaultResolve) { if (builtinModules.includes(specifier)) { return { - url: 'nodejs:' + specifier + url: 'node:' + specifier }; } if (/^\.{1,2}[/]/.test(specifier) !== true && !specifier.startsWith('file:')) { @@ -27,7 +27,7 @@ export function resolve(specifier, { parentURL = baseURL }, defaultResolve) { } export function getFormat(url, context, defaultGetFormat) { - if (url.startsWith('nodejs:') && builtinModules.includes(url.slice(7))) { + if (url.startsWith('node:') && builtinModules.includes(url.slice(5))) { return { format: 'builtin' }; diff --git a/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs b/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs index e976343e47e9bc..4ef089fd6eb3fd 100644 --- a/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs +++ b/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs @@ -1,14 +1,14 @@ export async function resolve(specifier, { parentURL }, defaultResolve) { if (specifier === 'unknown-builtin-module') { return { - url: 'nodejs:unknown-builtin-module' + url: 'node:unknown-builtin-module' }; } return defaultResolve(specifier, {parentURL}, defaultResolve); } export async function getFormat(url, context, defaultGetFormat) { - if (url === 'nodejs:unknown-builtin-module') { + if (url === 'node:unknown-builtin-module') { return { format: 'builtin' }; diff --git a/test/fixtures/es-module-loaders/not-found-assert-loader.mjs b/test/fixtures/es-module-loaders/not-found-assert-loader.mjs index 2130bad5f52698..9a2cd735a2fd66 100644 --- a/test/fixtures/es-module-loaders/not-found-assert-loader.mjs +++ b/test/fixtures/es-module-loaders/not-found-assert-loader.mjs @@ -14,7 +14,7 @@ export async function resolve(specifier, { parentURL }, defaultResolve) { catch (e) { assert.strictEqual(e.code, 'ERR_MODULE_NOT_FOUND'); return { - url: 'nodejs:fs' + url: 'node:fs' }; } assert.fail(`Module resolution for ${specifier} should be throw ERR_MODULE_NOT_FOUND`); diff --git a/test/parallel/test-loaders-unknown-builtin-module.mjs b/test/parallel/test-loaders-unknown-builtin-module.mjs index 464dbeb22a9b31..85181a2b73b54c 100644 --- a/test/parallel/test-loaders-unknown-builtin-module.mjs +++ b/test/parallel/test-loaders-unknown-builtin-module.mjs @@ -2,7 +2,7 @@ import { expectsError, mustCall } from '../common/index.mjs'; import assert from 'assert'; -const unknownBuiltinModule = 'unknown-builtin-module'; +const unknownBuiltinModule = 'node:unknown-builtin-module'; import(unknownBuiltinModule) .then(assert.fail, expectsError({ From 68c5ee45a2e6b35211a166a50eecb54bbd4cb683 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 22 Oct 2020 12:52:39 -0400 Subject: [PATCH 034/117] doc: update fs promise-based examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/nodejs/node/pull/34843 was cherry-picked onto `v12.x-staging` in 961844d25b but the `fs/promises` API, as used in the examples, is only available from Node.js 14. Change the added examples to use `require(fs).promises` instead. PR-URL: https://github.com/nodejs/node/pull/35760 Fixes: https://github.com/nodejs/node/issues/35740 Refs: https://github.com/nodejs/node/pull/34843 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Michaël Zasso Reviewed-By: Anto Aravinth --- doc/api/fs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index f48f2e3b2ddf6a..c3d0b38ff18571 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -60,7 +60,7 @@ Promise-based operations return a `Promise` that is resolved when the asynchronous operation is complete. ```js -const fs = require('fs/promises'); +const fs = require('fs').promises; (async function(path) { try { @@ -106,7 +106,7 @@ fs.rename('/tmp/hello', '/tmp/world', (err) => { Or, use the promise-based API: ```js -const fs = require('fs/promises'); +const fs = require('fs').promises; (async function(from, to) { try { From a9a606f06b2228d0c7d936f32e57ab346a5515f5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 8 Aug 2020 16:39:05 -0700 Subject: [PATCH 035/117] lib: use full URL to GitHub issues in comments Don't assume the reader of the code will know where to find the issue tracker. Provide the full URL. This is especially important if the issue tracker should move again. PR-URL: https://github.com/nodejs/node/pull/34686 Reviewed-By: Anna Henningsen Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Mary Marchini Reviewed-By: Denys Otrishko Reviewed-By: James M Snell --- lib/internal/stream_base_commons.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index 233741285d2c72..4f48c2be794626 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -204,7 +204,8 @@ function onStreamRead(arrayBuffer) { } if (nread !== UV_EOF) { - // #34375 CallJSOnreadMethod expects the return value to be a buffer. + // CallJSOnreadMethod expects the return value to be a buffer. + // Ref: https://github.com/nodejs/node/pull/34375 stream.destroy(errnoException(nread, 'read')); return; } @@ -224,7 +225,8 @@ function onStreamRead(arrayBuffer) { if (handle.readStop) { const err = handle.readStop(); if (err) { - // #34375 CallJSOnreadMethod expects the return value to be a buffer. + // CallJSOnreadMethod expects the return value to be a buffer. + // Ref: https://github.com/nodejs/node/pull/34375 stream.destroy(errnoException(err, 'read')); return; } From f22672de18043524e331904273e274ac5e886874 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Fri, 7 Aug 2020 20:31:20 +0300 Subject: [PATCH 036/117] errors: improve ERR_INVALID_OPT_VALUE error * use util.inspect for value presentation * allow to optionally specify error reason PR-URL: https://github.com/nodejs/node/pull/34671 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Mary Marchini --- lib/internal/child_process.js | 4 +- lib/internal/errors.js | 11 ++++-- lib/net.js | 3 +- test/parallel/test-crypto-keygen.js | 37 ++++++++++++------- ...est-http2-client-request-options-errors.js | 3 +- .../test-http2-respond-file-errors.js | 3 +- .../test-http2-respond-file-fd-errors.js | 3 +- test/parallel/test-performanceobserver.js | 2 +- test/parallel/test-streams-highwatermark.js | 5 ++- 9 files changed, 45 insertions(+), 26 deletions(-) diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 7f887a6af8916c..6570b599e35f1a 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -908,7 +908,7 @@ function getValidStdio(stdio, sync) { if (typeof stdio === 'string') { stdio = stdioStringToArray(stdio); } else if (!ArrayIsArray(stdio)) { - throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); + throw new ERR_INVALID_OPT_VALUE('stdio', stdio); } // At least 3 stdio will be created @@ -993,7 +993,7 @@ function getValidStdio(stdio, sync) { } else { // Cleanup cleanup(); - throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); + throw new ERR_INVALID_OPT_VALUE('stdio', stdio); } return acc; diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 0d15a0d069fd9c..4c2330cc4ca225 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1100,10 +1100,13 @@ E('ERR_INVALID_MODULE_SPECIFIER', (request, reason, base = undefined) => { return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ''}`; }, TypeError); -E('ERR_INVALID_OPT_VALUE', (name, value) => - `The value "${String(value)}" is invalid for option "${name}"`, - TypeError, - RangeError); +E('ERR_INVALID_OPT_VALUE', (name, value, reason = '') => { + let inspected = typeof value === 'string' ? + value : lazyInternalUtilInspect().inspect(value); + if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`; + if (reason) reason = '. ' + reason; + return `The value "${inspected}" is invalid for option "${name}"` + reason; +}, TypeError, RangeError); E('ERR_INVALID_OPT_VALUE_ENCODING', 'The value "%s" is invalid for option "encoding"', TypeError); E('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { diff --git a/lib/net.js b/lib/net.js index 06e08361515745..3f5767fa6c547c 100644 --- a/lib/net.js +++ b/lib/net.js @@ -34,7 +34,6 @@ const { const EventEmitter = require('events'); const stream = require('stream'); -const { inspect } = require('internal/util/inspect'); let debug = require('internal/util/debuglog').debuglog('net', (fn) => { debug = fn; }); @@ -1489,7 +1488,7 @@ Server.prototype.listen = function(...args) { 'must have the property "port" or "path"'); } - throw new ERR_INVALID_OPT_VALUE('options', inspect(options)); + throw new ERR_INVALID_OPT_VALUE('options', options); }; function lookupAndListen(self, port, address, backlog, exclusive, flags) { diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 1f059c469419fc..384f4fa68a2d02 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -16,7 +16,7 @@ const { sign, verify } = require('crypto'); -const { promisify } = require('util'); +const { inspect, promisify } = require('util'); // Asserts that the size of the given key (in chars or bytes) is within 10% of // the expected size. @@ -705,13 +705,14 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${type}" is invalid for option ` + + message: `The value "${inspect(type)}" is invalid for option ` + '"publicKeyEncoding.type"' }); } // Missing / invalid publicKeyEncoding.format. for (const format of [undefined, null, 0, false, 'a', {}]) { + const expected = typeof format === 'string' ? format : inspect(format); assert.throws(() => generateKeyPairSync('rsa', { modulusLength: 4096, publicKeyEncoding: { @@ -725,7 +726,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${format}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"publicKeyEncoding.format"' }); } @@ -761,13 +762,14 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${type}" is invalid for option ` + + message: `The value "${inspect(type)}" is invalid for option ` + '"privateKeyEncoding.type"' }); } // Missing / invalid privateKeyEncoding.format. for (const format of [undefined, null, 0, false, 'a', {}]) { + const expected = typeof format === 'string' ? format : inspect(format); assert.throws(() => generateKeyPairSync('rsa', { modulusLength: 4096, publicKeyEncoding: { @@ -781,7 +783,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${format}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"privateKeyEncoding.format"' }); } @@ -802,7 +804,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${cipher}" is invalid for option ` + + message: `The value "${inspect(cipher)}" is invalid for option ` + '"privateKeyEncoding.cipher"' }); } @@ -865,25 +867,29 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); { // Test invalid modulus lengths. for (const modulusLength of [undefined, null, 'a', true, {}, [], 512.1, -1]) { + const expected = typeof modulusLength === 'string' ? + modulusLength : inspect(modulusLength); assert.throws(() => generateKeyPair('rsa', { modulusLength }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${modulusLength}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"modulusLength"' }); } // Test invalid exponents. for (const publicExponent of ['a', true, {}, [], 3.5, -1]) { + const expected = typeof publicExponent === 'string' ? + publicExponent : inspect(publicExponent); assert.throws(() => generateKeyPair('rsa', { modulusLength: 4096, publicExponent }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${publicExponent}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"publicExponent"' }); } @@ -893,25 +899,29 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); { // Test invalid modulus lengths. for (const modulusLength of [undefined, null, 'a', true, {}, [], 4096.1]) { + const expected = typeof modulusLength === 'string' ? + modulusLength : inspect(modulusLength); assert.throws(() => generateKeyPair('dsa', { modulusLength }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${modulusLength}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"modulusLength"' }); } // Test invalid divisor lengths. for (const divisorLength of ['a', true, {}, [], 4096.1]) { + const expected = typeof divisorLength === 'string' ? + divisorLength : inspect(divisorLength); assert.throws(() => generateKeyPair('dsa', { modulusLength: 2048, divisorLength }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${divisorLength}" is invalid for option ` + + message: `The value "${expected}" is invalid for option ` + '"divisorLength"' }); } @@ -942,7 +952,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${namedCurve}" is invalid for option ` + + message: `The value "${inspect(namedCurve)}" is invalid for option ` + '"namedCurve"' }); } @@ -1079,7 +1089,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${hashValue}" is invalid for option "hash"` + message: `The value "${inspect(hashValue)}" is invalid for option "hash"` }); } @@ -1182,6 +1192,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); ); for (const mgf1Hash of [null, 0, false, {}, []]) { + const expected = inspect(mgf1Hash); assert.throws( () => { generateKeyPair('rsa-pss', { @@ -1194,7 +1205,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${mgf1Hash}" is invalid for option "mgf1Hash"` + message: `The value "${expected}" is invalid for option "mgf1Hash"` } ); } diff --git a/test/parallel/test-http2-client-request-options-errors.js b/test/parallel/test-http2-client-request-options-errors.js index 365381cc5ab9d0..557b585d2e7200 100644 --- a/test/parallel/test-http2-client-request-options-errors.js +++ b/test/parallel/test-http2-client-request-options-errors.js @@ -5,6 +5,7 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const http2 = require('http2'); +const { inspect } = require('util'); // Check if correct errors are emitted when wrong type of data is passed // to certain options of ClientHttp2Session request method @@ -48,7 +49,7 @@ server.listen(0, common.mustCall(() => { }), { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${String(types[type])}" is invalid ` + + message: `The value "${inspect(types[type])}" is invalid ` + `for option "${option}"` }); }); diff --git a/test/parallel/test-http2-respond-file-errors.js b/test/parallel/test-http2-respond-file-errors.js index 1f2b227f1f501d..1b0a538554c1d0 100644 --- a/test/parallel/test-http2-respond-file-errors.js +++ b/test/parallel/test-http2-respond-file-errors.js @@ -6,6 +6,7 @@ if (!common.hasCrypto) const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); +const { inspect } = require('util'); const optionsWithTypeError = { offset: 'number', @@ -45,7 +46,7 @@ server.on('stream', common.mustCall((stream) => { { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${String(types[type])}" is invalid ` + + message: `The value "${inspect(types[type])}" is invalid ` + `for option "${option}"` } ); diff --git a/test/parallel/test-http2-respond-file-fd-errors.js b/test/parallel/test-http2-respond-file-fd-errors.js index 750f762a53eb37..f06253aefe6307 100644 --- a/test/parallel/test-http2-respond-file-fd-errors.js +++ b/test/parallel/test-http2-respond-file-fd-errors.js @@ -7,6 +7,7 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); const fs = require('fs'); +const { inspect } = require('util'); const optionsWithTypeError = { offset: 'number', @@ -65,7 +66,7 @@ server.on('stream', common.mustCall((stream) => { { name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', - message: `The value "${String(types[type])}" is invalid ` + + message: `The value "${inspect(types[type])}" is invalid ` + `for option "${option}"` } ); diff --git a/test/parallel/test-performanceobserver.js b/test/parallel/test-performanceobserver.js index 3b2f94411f3df3..f1c6fce970a84f 100644 --- a/test/parallel/test-performanceobserver.js +++ b/test/parallel/test-performanceobserver.js @@ -58,7 +58,7 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); { code: 'ERR_INVALID_OPT_VALUE', name: 'TypeError', - message: `The value "${i}" is invalid ` + + message: `The value "${inspect(i)}" is invalid ` + 'for option "entryTypes"' }); }); diff --git a/test/parallel/test-streams-highwatermark.js b/test/parallel/test-streams-highwatermark.js index cd13f2af695cfd..2228c12f1421f5 100644 --- a/test/parallel/test-streams-highwatermark.js +++ b/test/parallel/test-streams-highwatermark.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const stream = require('stream'); +const { inspect } = require('util'); { // This test ensures that the stream implementation correctly handles values @@ -20,6 +21,8 @@ const stream = require('stream'); assert.strictEqual(writable._writableState.highWaterMark, ovfl); for (const invalidHwm of [true, false, '5', {}, -5, NaN]) { + const expected = typeof invalidHwm === 'string' ? + invalidHwm : inspect(invalidHwm); for (const type of [stream.Readable, stream.Writable]) { assert.throws(() => { type({ highWaterMark: invalidHwm }); @@ -27,7 +30,7 @@ const stream = require('stream'); name: 'TypeError', code: 'ERR_INVALID_OPT_VALUE', message: - `The value "${invalidHwm}" is invalid for option "highWaterMark"` + `The value "${expected}" is invalid for option "highWaterMark"` }); } } From 44c739cc497e19bf0857beb95ac5c711882fa3d7 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Fri, 4 Sep 2020 10:01:56 -0700 Subject: [PATCH 037/117] deps: V8: cherry-pick 6be2f6e26e8d Original commit message: [coverage] IncBlockCounter should not be side-effect Incrementing coverage counter was triggering EvalError for evaluateOnCallFrame when throwOnSideEffect is true. R=jgruber@chromium.org, sigurds@chromium.org, yangguo@chromium.org Bug: v8:10856 Change-Id: I0552e19a3a14ff61a9cb626494fb4a21979d535e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2384011 Commit-Queue: Benjamin Coe Reviewed-by: Jakob Gruber Reviewed-by: Yang Guo Reviewed-by: Sigurd Schneider Cr-Commit-Position: refs/heads/master@{#69628} Refs: https://github.com/v8/v8/commit/6be2f6e26e8ddfbc1a48c510672b319809674a34 PR-URL: https://github.com/nodejs/node/pull/35055 Reviewed-By: Richard Lau Reviewed-By: Shelley Vohr Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen --- common.gypi | 2 +- deps/v8/src/debug/debug-evaluate.cc | 1 + ...-effect-free-coverage-enabled-expected.txt | 3 ++ .../side-effect-free-coverage-enabled.js | 43 +++++++++++++++++++ deps/v8/test/inspector/inspector.status | 1 + 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt create mode 100644 deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js diff --git a/common.gypi b/common.gypi index b0ff365b7fdb5b..102f0907745507 100644 --- a/common.gypi +++ b/common.gypi @@ -34,7 +34,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.44', + 'v8_embedder_string': '-node.45', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/debug/debug-evaluate.cc b/deps/v8/src/debug/debug-evaluate.cc index 203885143fa1c8..e18702359e1335 100644 --- a/deps/v8/src/debug/debug-evaluate.cc +++ b/deps/v8/src/debug/debug-evaluate.cc @@ -457,6 +457,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) { case Bytecode::kToNumeric: case Bytecode::kToString: // Misc. + case Bytecode::kIncBlockCounter: // Coverage counters. case Bytecode::kForInEnumerate: case Bytecode::kForInPrepare: case Bytecode::kForInContinue: diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt new file mode 100644 index 00000000000000..454d31963932d9 --- /dev/null +++ b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt @@ -0,0 +1,3 @@ +Tests side-effect-free evaluation with coverage enabled +Paused on 'debugger;' +f() returns 1 diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js new file mode 100644 index 00000000000000..ffa86452287330 --- /dev/null +++ b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js @@ -0,0 +1,43 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation with coverage enabled'); + +contextGroup.addScript(` +function testFunction() +{ + var o = 0; + function f() { return 1; } + function g() { o = 2; return o; } + f,g; + debugger; +} +//# sourceURL=foo.js`); + +// Side effect free call should not result in EvalError when coverage +// is enabled: +Protocol.Profiler.enable() +Protocol.Profiler.startPreciseCoverage({callCount: true, detailed: true}) + +Protocol.Debugger.enable(); + +Protocol.Debugger.oncePaused().then(debuggerPaused); + +Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); + +var topFrameId; + +function debuggerPaused(messageObject) +{ + InspectorTest.log("Paused on 'debugger;'"); + + topFrameId = messageObject.params.callFrames[0].callFrameId; + Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()", throwOnSideEffect: true}).then(evaluatedFirst); +} + +function evaluatedFirst(response) +{ + InspectorTest.log("f() returns " + response.result.result.value); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status index 621fc163e5729c..fcfde07399dc6c 100644 --- a/deps/v8/test/inspector/inspector.status +++ b/deps/v8/test/inspector/inspector.status @@ -31,6 +31,7 @@ 'debugger/eval-scopes': [PASS, FAIL], 'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL], 'debugger/update-call-frame-scopes': [PASS, FAIL], + 'debugger/side-effect-free-coverage-enabled': [PASS, FAIL], 'debugger/side-effect-free-debug-evaluate': [PASS, FAIL], 'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL], }], # variant != default From 607f3c5d84dd0fa6d6591bff3d5241540a6df073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 6 Sep 2020 21:50:00 +0200 Subject: [PATCH 038/117] test: fix comment about DNS lookup test PR-URL: https://github.com/nodejs/node/pull/35080 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- test/parallel/test-c-ares.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 110d28ecf82261..383edd6f887a01 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -42,8 +42,7 @@ const dnsPromises = dns.promises; assert.strictEqual(res.family, 6); })(); -// Try resolution without callback - +// Try resolution without hostname. dns.lookup(null, common.mustCall((error, result, addressType) => { assert.ifError(error); assert.strictEqual(result, null); From 85c47d753c932cc7d37f2b6c9b7b1b639c7d3060 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Sep 2020 11:29:29 -0700 Subject: [PATCH 039/117] doc: avoid double-while sentence in perf_hooks.md This improves readability, as well as awkward reptition of the word _while_ with two different meanings in a single sentence. Refs: https://docs.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/w/while PR-URL: https://github.com/nodejs/node/pull/35078 Reviewed-By: Denys Otrishko Reviewed-By: Derek Lewis --- doc/api/perf_hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 09340803e5da6e..eb919f109051bb 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -211,7 +211,7 @@ setImmediate(() => { }); ``` -While the CPU is mostly idle while running this script the value of +Although the CPU is mostly idle while running this script, the value of `utilization` is 1. This is because the call to [`child_process.spawnSync()`][] blocks the event loop from proceeding. From 992af4e112be918f00cdafcf22a8faca89ecfeba Mon Sep 17 00:00:00 2001 From: himself65 Date: Tue, 8 Sep 2020 15:45:58 +0800 Subject: [PATCH 040/117] module: fix specifier resolution option value Fixes: https://github.com/nodejs/node/issues/35095 PR-URL: https://github.com/nodejs/node/pull/35098 Reviewed-By: Geoffrey Booth Reviewed-By: Anna Henningsen Reviewed-By: Myles Borins Reviewed-By: Rich Trott --- src/node_options.cc | 21 +++---------------- src/node_options.h | 1 - .../test-esm-specifiers-both-flags.mjs | 14 ------------- test/es-module/test-esm-specifiers.mjs | 13 ++++++++---- 4 files changed, 12 insertions(+), 37 deletions(-) delete mode 100644 test/es-module/test-esm-specifiers-both-flags.mjs diff --git a/src/node_options.cc b/src/node_options.cc index 824004631f5301..0240b2ef58ae7a 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -92,20 +92,7 @@ void EnvironmentOptions::CheckOptions(std::vector* errors) { } } - if (!es_module_specifier_resolution.empty()) { - if (!experimental_specifier_resolution.empty()) { - errors->push_back( - "bad option: cannot use --es-module-specifier-resolution" - " and --experimental-specifier-resolution at the same time"); - } else { - experimental_specifier_resolution = es_module_specifier_resolution; - if (experimental_specifier_resolution != "node" && - experimental_specifier_resolution != "explicit") { - errors->push_back( - "invalid value for --es-module-specifier-resolution"); - } - } - } else if (!experimental_specifier_resolution.empty()) { + if (!experimental_specifier_resolution.empty()) { if (experimental_specifier_resolution != "node" && experimental_specifier_resolution != "explicit") { errors->push_back( @@ -377,10 +364,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "either 'explicit' (default) or 'node'", &EnvironmentOptions::experimental_specifier_resolution, kAllowedInEnvironment); - AddOption("--es-module-specifier-resolution", - "", - &EnvironmentOptions::es_module_specifier_resolution, - kAllowedInEnvironment); + AddAlias("--es-module-specifier-resolution", + "--experimental-specifier-resolution"); AddOption("--no-deprecation", "silence deprecation warnings", &EnvironmentOptions::no_deprecation, diff --git a/src/node_options.h b/src/node_options.h index 1e7ffadf0dafbc..aa138c6970be45 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -105,7 +105,6 @@ class EnvironmentOptions : public Options { bool experimental_json_modules = false; bool experimental_modules = false; std::string experimental_specifier_resolution; - std::string es_module_specifier_resolution; bool experimental_wasm_modules = false; bool experimental_import_meta_resolve = false; std::string module_type; diff --git a/test/es-module/test-esm-specifiers-both-flags.mjs b/test/es-module/test-esm-specifiers-both-flags.mjs deleted file mode 100644 index a434684589dc07..00000000000000 --- a/test/es-module/test-esm-specifiers-both-flags.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import { mustCall } from '../common/index.mjs'; -import { exec } from 'child_process'; -import assert from 'assert'; - -const expectedError = - 'cannot use --es-module-specifier-resolution ' + - 'and --experimental-specifier-resolution at the same time'; - -const flags = '--es-module-specifier-resolution=node ' + - '--experimental-specifier-resolution=node'; - -exec(`${process.execPath} ${flags}`, mustCall((error) => { - assert(error.message.includes(expectedError)); -})); diff --git a/test/es-module/test-esm-specifiers.mjs b/test/es-module/test-esm-specifiers.mjs index 5e436f21b74cc6..8451a6a703bb65 100644 --- a/test/es-module/test-esm-specifiers.mjs +++ b/test/es-module/test-esm-specifiers.mjs @@ -49,9 +49,14 @@ main().catch(mustNotCall); '../../fixtures/es-module-specifiers', item, ); - spawn(process.execPath, - ['--es-module-specifier-resolution=node', modulePath], - { stdio: 'inherit' }).on('exit', (code) => { - assert.strictEqual(code, 0); + [ + '--experimental-specifier-resolution', + '--es-module-specifier-resolution' + ].forEach((option) => { + spawn(process.execPath, + [`${option}=node`, modulePath], + { stdio: 'inherit' }).on('exit', (code) => { + assert.strictEqual(code, 0); + }); }); }); From 5405e62eafd5fa8e9f6ca2cd38515cdecef9b720 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 8 Sep 2020 12:09:58 -0400 Subject: [PATCH 041/117] deps: update to uvwasi 0.0.11 Notable changes: - Several issues have been addressed in uvwasi_fd_readdir(). A bug in the copying of the directory entry's name has been fixed. The function now returns UVWASI_ENOSYS on Windows and Android. Serdes support has been added for uvwasi_dirent_t's. - The libuv dependency has been updated to v1.39.0. PR-URL: https://github.com/nodejs/node/pull/35104 Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- deps/uvwasi/include/uvwasi.h | 2 +- deps/uvwasi/include/wasi_serdes.h | 3 ++ deps/uvwasi/src/uvwasi.c | 49 ++++++++++++++++++------------- deps/uvwasi/src/wasi_serdes.c | 7 +++++ 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/deps/uvwasi/include/uvwasi.h b/deps/uvwasi/include/uvwasi.h index 9a0f8aa3c61711..d093a412d6d863 100644 --- a/deps/uvwasi/include/uvwasi.h +++ b/deps/uvwasi/include/uvwasi.h @@ -10,7 +10,7 @@ extern "C" { #define UVWASI_VERSION_MAJOR 0 #define UVWASI_VERSION_MINOR 0 -#define UVWASI_VERSION_PATCH 10 +#define UVWASI_VERSION_PATCH 11 #define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \ (UVWASI_VERSION_MINOR << 8) | \ (UVWASI_VERSION_PATCH)) diff --git a/deps/uvwasi/include/wasi_serdes.h b/deps/uvwasi/include/wasi_serdes.h index ed80e4a88e6ee4..038ae74786ad0b 100644 --- a/deps/uvwasi/include/wasi_serdes.h +++ b/deps/uvwasi/include/wasi_serdes.h @@ -103,6 +103,9 @@ IOVS_STRUCT(ciovec_t) #define UVWASI_SERDES_SIZE_iovec_t 8 IOVS_STRUCT(iovec_t) +#define UVWASI_SERDES_SIZE_dirent_t 24 +STRUCT(dirent_t) + #define UVWASI_SERDES_SIZE_fdstat_t 24 STRUCT(fdstat_t) diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c index acc25c3dba2f73..0b4b091f9d5a1f 100644 --- a/deps/uvwasi/src/uvwasi.c +++ b/deps/uvwasi/src/uvwasi.c @@ -13,6 +13,10 @@ #define UVWASI__READDIR_NUM_ENTRIES 1 +#if !defined(_WIN32) && !defined(__ANDROID__) +# define UVWASI_FD_READDIR_SUPPORTED 1 +#endif + #include "uvwasi.h" #include "uvwasi_alloc.h" #include "uv.h" @@ -22,6 +26,7 @@ #include "path_resolver.h" #include "poll_oneoff.h" #include "wasi_rights.h" +#include "wasi_serdes.h" #include "debug.h" /* IBMi PASE does not support posix_fadvise() */ @@ -1268,7 +1273,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, uvwasi_size_t buf_len, uvwasi_dircookie_t cookie, uvwasi_size_t* bufused) { - /* TODO(cjihrig): Support Windows where seekdir() and telldir() are used. */ +#if defined(UVWASI_FD_READDIR_SUPPORTED) /* TODO(cjihrig): Avoid opening and closing the directory on each call. */ struct uvwasi_fd_wrap_t* wrap; uvwasi_dirent_t dirent; @@ -1282,6 +1287,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, long tell; int i; int r; +#endif /* defined(UVWASI_FD_READDIR_SUPPORTED) */ UVWASI_DEBUG("uvwasi_fd_readdir(uvwasi=%p, fd=%d, buf=%p, buf_len=%d, " "cookie=%"PRIu64", bufused=%p)\n", @@ -1295,6 +1301,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, if (uvwasi == NULL || buf == NULL || bufused == NULL) return UVWASI_EINVAL; +#if defined(UVWASI_FD_READDIR_SUPPORTED) err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, @@ -1316,12 +1323,9 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, dir->nentries = UVWASI__READDIR_NUM_ENTRIES; uv_fs_req_cleanup(&req); -#ifndef _WIN32 - /* TODO(cjihrig): Need a Windows equivalent of this logic. */ /* Seek to the proper location in the directory. */ if (cookie != UVWASI_DIRCOOKIE_START) seekdir(dir->dir, cookie); -#endif /* Read the directory entries into the provided buffer. */ err = UVWASI_ESUCCESS; @@ -1333,25 +1337,20 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, goto exit; } + available = 0; + for (i = 0; i < r; i++) { - /* TODO(cjihrig): This should probably be serialized to the buffer - consistently across platforms. In other words, d_next should always - be 8 bytes, d_ino should always be 8 bytes, d_namlen should always be - 4 bytes, and d_type should always be 1 byte. */ -#ifndef _WIN32 tell = telldir(dir->dir); if (tell < 0) { err = uvwasi__translate_uv_error(uv_translate_sys_error(errno)); uv_fs_req_cleanup(&req); goto exit; } -#else - tell = 0; /* TODO(cjihrig): Need to support Windows. */ -#endif /* _WIN32 */ name_len = strlen(dirents[i].name); dirent.d_next = (uvwasi_dircookie_t) tell; - /* TODO(cjihrig): Missing ino libuv (and Windows) support. fstat()? */ + /* TODO(cjihrig): libuv doesn't provide d_ino, and d_type is not + supported on all platforms. Use stat()? */ dirent.d_ino = 0; dirent.d_namlen = name_len; @@ -1381,21 +1380,24 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, break; } - /* Write dirent to the buffer. */ - available = buf_len - *bufused; - size_to_cp = sizeof(dirent) > available ? available : sizeof(dirent); - memcpy((char*)buf + *bufused, &dirent, size_to_cp); - *bufused += size_to_cp; - /* Write the entry name to the buffer. */ + /* Write dirent to the buffer if it will fit. */ + if (UVWASI_SERDES_SIZE_dirent_t + *bufused > buf_len) + break; + + uvwasi_serdes_write_dirent_t(buf, *bufused, &dirent); + *bufused += UVWASI_SERDES_SIZE_dirent_t; available = buf_len - *bufused; + + /* Write as much of the entry name to the buffer as possible. */ size_to_cp = name_len > available ? available : name_len; - memcpy((char*)buf + *bufused, &dirents[i].name, size_to_cp); + memcpy((char*)buf + *bufused, dirents[i].name, size_to_cp); *bufused += size_to_cp; + available = buf_len - *bufused; } uv_fs_req_cleanup(&req); - if (*bufused >= buf_len) + if (available == 0) break; } @@ -1408,6 +1410,10 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, return uvwasi__translate_uv_error(r); return err; +#else + /* TODO(cjihrig): Need a solution for Windows and Android. */ + return UVWASI_ENOSYS; +#endif /* defined(UVWASI_FD_READDIR_SUPPORTED) */ } @@ -2353,6 +2359,7 @@ uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; + timer_userdata = 0; has_timeout = 0; min_timeout = 0; diff --git a/deps/uvwasi/src/wasi_serdes.c b/deps/uvwasi/src/wasi_serdes.c index 96253fc5af0623..ea7b9e1e52fbf3 100644 --- a/deps/uvwasi/src/wasi_serdes.c +++ b/deps/uvwasi/src/wasi_serdes.c @@ -84,6 +84,13 @@ uint8_t uvwasi_serdes_read_uint8_t(const void* ptr, size_t offset) { ALIAS(userdata_t, uint64_t) \ ALIAS(whence_t, uint8_t) \ \ + STRUCT(dirent_t) { \ + FIELD( 0, dircookie_t, d_next); \ + FIELD( 8, inode_t, d_ino); \ + FIELD(16, uint32_t, d_namlen); \ + FIELD(20, filetype_t, d_type); \ + } \ + \ STRUCT(fdstat_t) { \ FIELD( 0, filetype_t, fs_filetype); \ FIELD( 2, fdflags_t, fs_flags); \ From 548137f4ec912d5b361eb7981c55cbe474a99aef Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 9 Sep 2020 08:24:18 -0700 Subject: [PATCH 042/117] errors: simplify ERR_REQUIRE_ESM message generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because of the condition that starts the `if` block, we know that `parentPath` must be truthy. So there is no need to check for that in the template string that generates the error message. PR-URL: https://github.com/nodejs/node/pull/35123 Reviewed-By: Anna Henningsen Reviewed-By: Juan José Arboleda Reviewed-By: Guy Bedford --- lib/internal/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 4c2330cc4ca225..2cf7df436b5e9f 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1296,7 +1296,7 @@ E('ERR_REQUIRE_ESM', filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + - `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + + `${filename} from ${parentPath} ` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + From 884755f1e503804b59fd80c530b419cb690049c1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 9 Sep 2020 10:46:32 -0700 Subject: [PATCH 043/117] doc: simplify circular dependencies text in modules.md PR-URL: https://github.com/nodejs/node/pull/35126 Reviewed-By: Michael Dawson Reviewed-By: Benjamin Gruenbaum Reviewed-By: Trivikram Kamat --- doc/api/modules.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 477a2e533c7b03..4d392dfb9b205e 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -98,10 +98,9 @@ may be necessary to install a specific version of package `bar`. The `bar` package may itself have dependencies, and in some cases, these may even collide or form cyclic dependencies. -Since Node.js looks up the `realpath` of any modules it loads (that is, -resolves symlinks), and then looks for their dependencies in the `node_modules` -folders as described [here](#modules_loading_from_node_modules_folders), this -situation is very simple to resolve with the following architecture: +Because Node.js looks up the `realpath` of any modules it loads (that is, it +resolves symlinks) and then [looks for their dependencies in `node_modules` folders](#modules_loading_from_node_modules_folders), +this situation can be resolved with the following architecture: * `/usr/lib/node/foo/1.2.3/`: Contents of the `foo` package, version 1.2.3. * `/usr/lib/node/bar/4.3.2/`: Contents of the `bar` package that `foo` depends From c3e1bf78c430d3a716ba5c90b422653abe2d1d51 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 31 Aug 2020 23:01:20 -0400 Subject: [PATCH 044/117] test: add wasi readdir() test This commit provides coverage for __wasi_fd_readdir(). PR-URL: https://github.com/nodejs/node/pull/35202 Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen Reviewed-By: Jiawen Geng --- test/wasi/c/readdir.c | 50 ++++++++++++++++++++++++++++++++++++ test/wasi/test-wasi.js | 5 ++++ test/wasi/wasm/readdir.wasm | Bin 0 -> 36298 bytes 3 files changed, 55 insertions(+) create mode 100644 test/wasi/c/readdir.c create mode 100755 test/wasi/wasm/readdir.wasm diff --git a/test/wasi/c/readdir.c b/test/wasi/c/readdir.c new file mode 100644 index 00000000000000..a18ae5de34eb8f --- /dev/null +++ b/test/wasi/c/readdir.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include +#include + +int main() { + DIR* dir; + struct dirent* entry; + char* platform; + int cnt; + int has_d_type; + + platform = getenv("NODE_PLATFORM"); + assert(platform != NULL); + has_d_type = (0 != strcmp(platform, "aix") && 0 != strcmp(platform, "sunos")); + + dir = opendir("/sandbox"); + assert(dir != NULL); + + cnt = 0; + errno = 0; + while (NULL != (entry = readdir(dir))) { + if (strcmp(entry->d_name, "input.txt") == 0 || + strcmp(entry->d_name, "input2.txt") == 0 || + strcmp(entry->d_name, "notadir") == 0) { + if (has_d_type) { + assert(entry->d_type == DT_REG); + } else { + assert(entry->d_type == DT_UNKNOWN); + } + } else if (strcmp(entry->d_name, "subdir") == 0) { + if (has_d_type) { + assert(entry->d_type == DT_DIR); + } else { + assert(entry->d_type == DT_UNKNOWN); + } + } else { + assert("unexpected file"); + } + + cnt++; + } + + assert(errno == 0); + assert(cnt == 4); + closedir(dir); + return 0; +} diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js index 8ebc290d7b8269..b4c404e515cbb2 100644 --- a/test/wasi/test-wasi.js +++ b/test/wasi/test-wasi.js @@ -84,6 +84,11 @@ if (process.argv[2] === 'wasi-child') { runWASI({ test: 'notdir' }); runWASI({ test: 'poll' }); runWASI({ test: 'preopen_populates' }); + + if (!common.isWindows && process.platform !== 'android') { + runWASI({ test: 'readdir' }); + } + runWASI({ test: 'read_file', stdout: `hello from input.txt${EOL}` }); runWASI({ test: 'read_file_twice', diff --git a/test/wasi/wasm/readdir.wasm b/test/wasi/wasm/readdir.wasm new file mode 100755 index 0000000000000000000000000000000000000000..ce6cb4999524db243ef569120258fff2a8c23a9f GIT binary patch literal 36298 zcmeI5Ymgk*b>F*tW_EXWX0W{v0K3>Fak~kE07;NbN&+ZI6wx375PVyrW%&s%u|sla z7yFnUfS^rsR}w8zc5KU*{E)1~l=6_{M=VEjEIYDA$ByFcaZwGi#l5>+R;HrRKADj6St^uH9T%TwH1g(KXtP(B}Ng+GaB-U86;H zy}fq+T=Vi$Cn#T|Ndq8HEpB!eI_I8lc7n<^npM{qI?tS2TW_ugL)U1s3rL{9`B~&Klceqpu8oR1!5YPEr2`Xdd zO1K^l4OL2E5Do1vZH3wEpD)+8g5vO6QX9UlJanOXVXggK6x7b0d#1Ute(uSI&1NYa zJ$G(#p|fzVxw=@2hR(s%b|oBgCPDlUbc{~8pb?DKTo8Xo*Fi1&S38~lQZ4+u z;noc_QQyoZp$lBNoJ1}v7pdu5>h-bLIFSS^Ek%Do3N(MTep|8FE9( zuq!1aZrF{SNvc_xjJm2D-AKUN)fz$elLn@q{gNFUS)A<3e$~#$T-`O?E;kncLqP`H zAc^@q?mq=J zJ&d{RD+c2_H|MU)VO;NKll|`c#JT;>okQS^Uy{=8hU|B({Q&^q=u&s%Msg5( z4<3z1+=2L)42PSzansRgS|dy+huop$u)86-*&TK_pGj_^mK($cTdik6Vg7AJ^>4Thl~y)vr_qzM?4yW9yZqw5=J>yQh zGp*$Q?9Z*~S$DrXn>T&HJ%Az$>PYgSjq;!bRZbrABR%XMJ`#*1k7RFz$)oNO_vl9Q zn0qYwF85IKe)nDO{il-;K-1&y1McyS$*Q~HR!=8u(7x{0-1P{0%IAoL=C zx7>?vYa`hX0ka)~*4GWK4~IFNkA&Hw7~$pICLKg-A6p0_elB#M3%%=gp9#lmqX91br_`+W<#&Yj+*N1sa+$H;*)XtTblZqS3qE7bO-|Lci zs!?LhAe-Sycxjp6{ikO;$q;BN`czBEM;s_;mp6cr5;7l^3jkC(sk-P?V}vN}%Gs2$ zjKJ&4aOJv7S$PA@JReWb(j=Nq0yjj<;0*9xxe=&iwSB5luGeZp;!yNQo=p!o8V=r+ z1-O#|QKZ6^<@QE?vXN~;B-GU}WidCAX;v|ARb0>pg^ENR2@4n_IJyomWyYw!>#+O0 zwSxjk@*v$O`62rDBp*of!(wifz33{>ZXETBR}%(OCw|&Tqp~hrDF-n!)SY@FPhc#D z`$4+_l*o;A33bCzb*fQ?L=k>%dO=9^4t?kJ4r)Ts7_LiA3SAvVvTl^YN8e=dzd5r9 z2OsJx7-OyD#X%&}&9Vzrz6*>?*3Y??hN=daw z##okLDCsbw@pM&oRj$+?)iJo7f{>|ueOC09$ugB16`s(QcST_!6X~)B{ecUvayBi` z!Vfd1Su82Y`PB#o2S?bx9f=p&g-#nn$WDqfyd1}W)O z61FH@R&?~_gES+}Vbfh_mBNQW=+?71n{ss!0sYyQIExo)grb`hyTY+c5_NK0Ppl!$ zQ;|nRP_t=xQm{#ZKm_P9)@F~rd`B_svdr2XxMxWv8PMsK1j>giDY?khPvIyjdGxr~Rljlq2M9o3;W!`` zuZ*Z{u70(v)lY0tn5)mgKQRuG_URn{{%kS?s@#iHoHh>0Ts^`^`>|H9izw49@c;ug z&kp-#DwVEN#{?BOs$$uQt3IrAX(Mwi>Ee*9o|X`DhbtOjsAw2%Ox1Vidf~OB3p0f< zfa>~BEO5Z&hh+taqJL}GJeSwyHumpr-W#4Z=M*EgmT;;N4}n?SkWm&wP#iJ{@mX*j z^dTOe88WAZdDAHHLRNDx_*A;x36 z7qBO{jzzBs7^mCYFOhG(8XSv$!QXLVR&SAsWdHtG{@t%sHjhSzf`|IczKNjz1(U)c z+uklCSsaOJo?-v5z-PEcE(O1qQxXz{i2R}xBH@3imrrE4dd;qIcLY;cewaL|;(`Yo zqWnnU2PkheMtxT=qq1_Kzf`{@ko%LO1?nvuqc`@{(#4RuLc%fb1aR>eATl6b+d55< ztR|6%X(VHlWCzII>;=tShK`{Y_!CH5NhHOE0iw=9DN>M+B05jjCqxLu zA(Ad76g3Lg7$-dgPczU^qG&?AC}n?wazQWLBeqzGOpX(_KZow*h-LB-ypbVFQthS>w(v_j?GAzo*HiQgMIGaVJSVolH zFQpEaX>6&GAN?O_tfSGt_oItXS2;?eUMssx2`u8psO!v7jB2c1_G)I!WC2&<2bPzz zfk}XwRphQ(5*l%pu3H9k%p8ksLB@{A5HSm6;GXx|We03SCX|U8cw@Omg`NNq3Tj#@ z+>8$+yAl%T@%O3sE#&IYBQ(K6vA zK_LiFN^F&fS=6%BP*?aYDO{OJY8IYpjN$7kaSU^Kg9+}ap4K%b6|MwM#eGs5;;QAF z^{uV6XHDL%ENc-dNC|LZ zOuVbv4QS1dqV3bOkwUa`i&=0udPypI4B=FDWkz!>BAeXVnrJnG23aQ!m75Q@4-nKP z=WN*9Nmi=sw@D@U{5jx zCx=o_ttt?SdjV5^%|$3Ts1>T@=l`0U5Y%!$8z-}ApBmXjK$)-^v)2qWam%E0a|cxJ zqNLSWp{sN=US@?P(?yP(Pq-jY6E47xXi8v@k&E<|jz%VY$WhQdoqp<|?j+SBP;-8} zYn_?J(cFh!gR9nz;wQ_7FzuBQiH~_0QQ`^aN*i+p8t%z|%luS@+}U%Kut5r5Wo!^*lyg?B#dDMq zfRzp5wmgTX3`N;6z;mdO*XKEa!F8`}NXe~D8$3suEWcYeEa5p&Lhm`sMcI%l6=g%F zcxD1~u2MLV?u0xkbs0olHZ^*aF%P!s}RtvQ$nP<g}B+*`Tiy4BDW^h$4 zXhzkdTilU;$RPC?m9odaEHLb=7Adjr>bgZ$WGGAYNeV$d4|_#r68jOw7VV&^@K4+; z>K27Y)5_~JLGYUT45S_OnXbe@tS_<{2p}tf!*4VhZ``lRL?o_zn#{CAB~NN1q`Ey# zezO9&)#s%|S1Aq|M;+#I7=dh496Y{M!HiD+N_Xenh&O@$$caUo%NmA6kkpC-W9$?* zRY6Nir4x8Zs{vC?C)AwyZHleA|f1FB?n!6klZXhV6j6JiLD(52S>;L#R|9*bSA=&{1jAI1wshvOdRZ5)_HI z`IW34eTbCRlj8Nas?drp3}hl!ajQ|FHWMG}MojW6_4k|;%7e91jVB852^KL?rkHE| z4y2%=-tQP;TnQ4EA@35M5U@C9Sx3eK#q5qyC;W~mF)7j>CCBerV(cG#s(V?4xt+n< zshVhJTu3RDwe)0PoFTAC%fhIFpX8MWCP!SMH(HFcDC|{)$S0{G@mxi4ApI(0y3wZ$ zpmLQ4_+=bcY2P#(rDN_GdlR-Z4df#UnRfY8)8a8DZa{p~#H|lvffULJAyP&o3wJGL zG}?^Y3RZ7T8H>EFG@xIlzZES6za6v?)CaV%^wzWxU^{D}D7mHTbmLtYB$WEzcIXdz2GcqNvpa<&8S&5=L{m6%!WZDE z8Pmni9s4oD8un|Igd~J`{33O3#YpgjHhLDNyV_=V%bSmlv{+F^8q|U|GAmPOfKOWr zc&l>6R)hBYA}DBwxtdVyw5<{1(GD=t+EUBCLMxnPb1F<%uxf);|uoA=!G zFpjxvO^&OQ8&)`G!@&lzctkFn5+EhMvs`jmW?njC`6FBI zKkc&~`R$@k3CciJt^5jLh{M2vU>-62&?v1hVxYe{Xe1$k`9$3SKH8u*kxNI>md2>R zHyk*XQ4Ao)mNsUokct^DJUbizbD<~oi!CE_p;hz+-21CO+JSW~+I?OxDGIdM!qlfb zg;j#d^h#StDm}K*Hk1YAQv@cXNFF7YPIlv)fO#6FddPA*u|qvYz=~id-mpkeX+6Te z%3jW3g)?%7k^Xe5h+xBtU}l3j77`-zD1RkWk$EOWMU<_-)rj&a##1aYcf?*q(Oc{0 zQ6QlHUgd?~9I04$ifbbXb-Gv{RZ|`{tO({)a-T;TMP%4!v_SNE6u{zC+qy`wAr<>m zC-Nv!B3~jG1FhsyCItWZst9I#N{UGw`!Q_kITuj1Cm-6aGBQb6xKa|JB*5_x~0R+h*!o>am1JAIo(9$W`gC_xhH11VH+ zWeQ~!F`6l0H<1TeoT^lWeM4%DKKMjFU%=P1Jdx+I9EKiWrGR}Ylw?{6WH3jk1l&ud z99ODE;qavixv&ZPUf3K=*wmv6C$EUiW^&grUDG{p8eOT<29JXcUzMYW=zrmOyUmdj zOt9=5j1tIa^Z|#%xQjw(NHc8U8VX3Gok)(Sg>_wj|lXOPZ)I#Ztl5}8@q?de>&Jb|>iX@!^ z0E+38bd3l}SX_~$Bf30EC-ac~2UjNP3KPaOf@^PU5nfb&6X7V0#%*wgh1ik^ny(zB zo1}L^La9&c?O^R?J_f5;PB8?0fXbiG|13phx-as4&XRAv007RQYn3zYL*r^n zOR1Khvst2Vwv;6a z2$BY|d75G2VlDn%^<^23gh7kf5t}nzl#JL`3;2yIIY3@j%SQ2hB;uezsY)oYSWC93 z*%xgba|VwE=}8Ix9LQ&bLFRlGW7_WlI`#=eUG;dNQfU2HiQFZtw%jP_Snla+tb-j7 zq$_NDZm5BUMav@Krxx!W()Du>Pcd7LxtozK3LmY*5OfdIGmN1S_KdJSNLoWHzdv3b z>{XF0sKtyB|Ge78zo6gREljlxP=fN{ed15*wvk$#=Ety>N?JkuVH*Zsf`zou!`>2_ zwHkL~dnGBT{lh4V&@=xwQRbG@(gAvI1H`1y3}k!z^>9On^;R~cf_D`)(!a7_!cx&Be|N}U#gN+^rxg)7&}K@ilw7>3anLJgt)Q2dhxNR7Vj z@@pJKY@D+!7=iQXq*~0ia?x7~tT2aSlAaa-qXaogUGkCj}0$^`ou zFAhaG(~`8`+*y=BKv=s6eUb7RBEsRNS3&TzhOq4;3Qz#{yTEF(1n9B_uWb8JkeAEh z7}M;0UT?ziz!Z|c@{0P|avVeG&adf?WOF3IyJokaCTplC(uT6N1`xfHuv=V3g*uM_&m+!wg~QG={6!tt z@S-;UGI!M!i_7p#(g1^+Yp5e&UETVpjqEl`61>7DMA-&HCz5lm2!zrtV+%WX%f>@6 z>rI+;CYLWX&e(SC2DCL?4W|h7Mk~?V3>?M)PBPeVW3+U;_#xq-Mve_8Y+tFfVK3Pw zzwH_+LqU%2=$*Q{s2ADVpaR~W8Fm9gz!DCYlhG{1nbuTS!4GT43Tpydn$ueu?ASx? z0Otn)URw98@<{oO$81Orvj6-E$q$U+wVc`LSS|iVX-81|K{P4%4TG<*09-pPV_vF2 z8w#aTxT(i~SNB*W)P}GG|C4>Aa6k-!;^$Ts)c!}r>PioM;2&fqSy=Bs_!FWLc!wXg z!J-C_rEDYMKJQ&D8-w6LZiBdwVY*Nmk3W|8P;DGdWlN~J@-W+as6oh#PV_W7(&?98 z0d?hD+WixDG7@;)So|{v2AwB*b~Rp`no#GwLcylQ!d#W%8=wpc9QEeW9fzPMz7$rY z?J*jPC}M_1%oI?o*ytS!YB`8Rd{e^irAvzumU_fp)AF((7{T+Jr-cTwg<%RQ!o4on zquTF;VfkvVi=_zEGy3C3FT;5$80+LJ#P871)fJ(YgeGS?%n|D4oLBNIAYY1k$qxm= z>FL79t=z9!T{KZ0uz2D%CU?=VOB5(^5B0G2Xcr-wpbE;R4FIEl57{BUbRt*AP#rsC zwR`*lCG6G+34#S<;Owp-{`*2P{*r!c9~@BlauEO|N9Alb<+1XrX_SKeUkK0azsiPS z|1S#)J~aNKofHFoI1Ed9;WE2B{yjZQL6Ln{A|%8*;Vs-WqWuKcQZ0)jTGG=xszl`A zYW%ADtDh1!bMsb71A zVWd*Uxn~&>%s>BcpYJ`lbN}3hZEF($V-2W4A|ReQZ%$BjLSz&~1qDr(qA{yAE=Xms zNt5htC%UAzTUOon$cahs^n14BUlEp$mjbh`+OYxMD&@L`)%Zz;B>T_QoKdt|l|PSa zBSH46m{mhvC8|TwU3p@-K|<2=pE*S3Num`3DZf9Y9uC;R#9yPPsGh9TJEvZPr3qm- z8Gv!~uOPyfJ_tj?aazR*RaiKm;{9}8@@`8PH&C+eVo(EWQT%I$ znZ2Du0D#YTF$F1|U^Ul_n`tUVL$W$T3lt$=1-I2jUaypE#}+Wgnm zb2SSxXH|D7l|nHq0hML#nd%eiP;GH1RWOm6teDf2$|~gjm~qA1N%qGQrNZgy**s4? zxrGCjtPYn(l>7A!64u6PEbhYT_@4+)?W5iYeCM|Foq2$+`bQ^Z-QRdcIwu-XNv_|_ z>%iN$=x97_^CEvsu+8hd?XYX#kL)GKL(zL#v)Mw;(3tmn)({o^-f}CFXu3l)Q^{%0 zu^@PdJh^H5Xx^P0Ug>Z#e;rc6Ha+rHD!EtH@Z#T;{1uXMENCgU4F<&ZAdR%V?3hhU zSxxzRF~Hn)g@!aklJ^_5iUT502}oe#SLul_3H#Vo`W%+Ql8Z9xFeeI5qq49ZdTCjS z3=_iMD4MRR8o`o5OMpPcJ87mAC1u3uwKx&_OlzM#PHp=GH_hT%(`gashH77ydy>_y z6n;j`5UDEKRdNDKU3SP`#16gqhcBSjRH`>;tk%Jpw!5MTiJ;Ab z2!InJX#yLjAC~oLPcW{?RSFiVp*Et+>s5?JEMAK5bb*}_{xY0}V=!*D_8UqF!94UP z_20}~BY5>qoh3B(XGbG@1grdiQh@A}c&I=`*=j@frzi$@m8^1(;K7dsL^n01%D$!M zNvN*$NkBtw%Lz<`U>zlLZ30uryt!?5l&Z#mC^fF7SWpJW%vo*v&x%fvg%W%GWi>c6 zTl-~sx;!*~li*W2z=LgtBckm$G|DSzn`n_v;FrnZHXvQ zRS=`s*vh7EZ83tPn;Zg40n$gKLrOhRIo*uKUeJOmxv>lEHStrvQqJ6lq^?yI0PmCn zGOQm}lbSqQ``~ zOt|<+5G7Oe)NBAqQ-bRaFP8J<13b%VkF0d!fyOLCS3tI!4RR5Z&>F=5RJzMvi@34R zW0Y63ZVke8JbSE_?zZ|L&q^&ifP0i3IGs+-GVX4~%*mcCq=doAF16xfYPNN2z=wgP ztXqk_D!7;N$FnEoCH6mvrwLuy;rtW-MmxX*NP(~^M6*{yaeLdzUN@D-KmiHsucJRZv2wFht%^!yd-sEUvm>|LsqFZQ!!5l+;ojmQ&$sYbCQ1yxUa%TT&Wgi( z6d^*rI=V-xl~i$$RMEv!MJ=A}k?yf-aIAEf2~3#J$sw2$$c!IK~#!@AYg5w z_*2$Nt+)!Jp-|65ZVZo9MaZlbk5DalFsEVgJ1y!Y!A_E1U<~~HOAXV9-i*c z{u6mm=&sW$(sjDGk?sW{=&C)~n91sHeEC#khRaSXiF0`KCz9*YuL6Fox%m}O(sewARPB=ZrFpNcM%t?TQXI{)}U%qeI~MP zO70VW6}sjo868dJt4n+9v>QjYY1Gd)d)tq<=A&$}mF^Max{tq+h10?C~v}p6}w6C!%Y~gP8nO-h%*)cOVbC!)BWk*#+1Y1xOn+N z&L-pnC%7aS;~y{xzTzM>EM2kj--{soutXil-7teT;1UK~KL!!`SF+--XdFUT=EBl`QGZqd9=#uDqr+cZY2o?r9B`tU%$i1 z=JfXZyk`gQ>XW7|@oX|_SdrsQ=J8|PRC6}|120P~u}~Zy;F!yjhMOV~%nuNhbJc6z z9 zh$LuS*G78QbFh9R&csu!?1%_+OZ^CNG!-#7Kv*fffQB^x5hGB>z0UEet2}e`9wJr~ z|1|qm$u|29{hBl6lU4Yk?C;y{FWT*R7GFE}B+jf0M*!s2$|%RHnn!xqrZoOLaBUVY z@Sty_dy^~m?hVfD%pRetzZgqgzg{6{Pxf(XV$WYa-f;BGL zZZD=ncqz$rO3q*^o5u?%ibQS9XiAHxvj}OdCFh_f*^%rPP(h1zM@|6%Hq-L1(a)WT zp{AZe@U84TX)iXlec8`l=6)sNiyamwBxBD9s!IQuJ`;O$vS@j9t+(x;PXEjjX=hTD?Y$7$~u zg!A7#+*TM%`Z&$PvfJCZNh~0pyfL?)bh@L9m3(MX! z@MH$jQbD@H80W=@<@DPTK4^?@3-MyKCmzxF8RNC+F|i`bergZ8eZt*5s2AkCIQ6D7 z{J(${>1#h3i01!kKgo=^m&5EYE`E*b94<6}^qw%NUsqgU<8}OIuhVRCVV(58NMp|J zB9+Gh^A5Z%E9m2bT32ylF>%rZHsxtfsABNogL=Mjt+kiT9vGN!M1MFbwc ztyto~SBlCU$RR5n*fcQ2ff~Uu2d29t9GDeVm35TmGntfx1RB*7RGadXdh^Ldm4_`) z3>k!}ci(Cu3kC3)8FKW0^dD2lC85jU@B0b=y^n%O*J<$vSJyWVLePl*M z!Oc%?4iJLK0w3TbQB$zY?NKGJ$|zM(rV0kqQ|dx>OW%kAx`^nVa}S{U~< zXdW_73pc5<4>`uc4Yy~77BNzS>;qP7U_!#BRWxP^)|1lg18!114oI2@6eb57_3++X zOvw_O?9cuSD~$lY(drTh0241~(M5M7nau%_b$`Q_h{SqNg`=OEWL4p%stN@=6=AZ` zB!-Gf$&x7+C{q`U#bjlAWEkY;`FP{Yx<13@e+^EjH*KVc;2C2lIpFNs)+5L_0me24 zkRHye7t(`5F}*o^>4_HK6=yJ@9(D)8BRxnKK_Nyp1z6U~Uj8a;ZZpdad1!e#0X@S^ z2;nA3{#)s|$#So-=L6v`UQG|Xc!jnmuf5{-K}Q7)fNmomJ2z+B@KFMj zYT5i*4cwI0#k?`tO=Wi4%m;&0(=b_&vd-*{PeC&iV5K7{-QL>YL^EKRS8Qn>^UMRr zY6$_%4j>z2@FAJt0kDt>;wBEdn~IOD=oD?Yy!9sOJ#*kq%xfmYxk$4oAK=!HJg||D zQ_X5o`rBejf%APW3X1BM-h}Sr9U=dqxU0dW7kjzDI;ojtqwA*LB&a#ZP;u^~N~rkw zy0EIj{yz1UB55wv#=y`bI^N_c2w`0~2f3i&0U^gn@o^F}^3O$!Nz(ou8>zBR51-ol zZ_3gCrgnOG_JPKAoF2xcY!&flQ{rOu^cILJCdD_iiq|boKX?*jS^&ZF)Poe9*{lkhFw!cp zOiONc`)F%KYFL|>fTW+7)ZDGhX+IH6y2Or2ce5%UvwqIMDMoPBvTys7;xV~QZ-e~Z z?ueG-dRhFDWjqNPpnk3@nvJW9fyaX;%`B}5cC!jBx?!eWfV!%1X2hr*sKVK#70$pq zG&9*tw7uDq*_%yKrMHHWyLlkb>rc*S2cF#4OV0b~QF8u&Ej{iQHVrD&Ou6L2+4S~g zp46oq=I3Q-S}Q~SRlph|@D!P~w0@-hANU8G6$%>*{@w5Jvr zHW83_wv%igX;fQ9ZPe~rUZm->SIpQ?m635z05PEB<(>@Oyxi5iOCD~pt=Aovzv#Bk zzH9}Lu&+5@NOk{tcStW4mmpkUx+zc<@dR%+Hs!{Gc}S%vWo(1w=X6hsZn@-wI%$v= zP3O7C-mkBz*0m2tnyKZ@qQz-uU{dDl{b8Xf@bpeMC3RDc88P&$+xUPy zaz|>dkOz7BphU*AezoC>ApuWlf@J9sa~_@Qmtb^&J#PVDp2u3&aoWb+al*O<9Fpe!RBX=2qY9L z>hOQBvcq2cb5OFb`|P#o&t zY1J2{V>iQ_mBIRg=L80>RVS^8bb}`=!*FY#xJA9N(2v1dPaaGr@PU)^0#lkC@pfR} zst)x&s*kMQgrL+j7~iOm^^^1>=+IQNF4?Oxio8;NHB0&y;jUoGq}<{aEZO_kSVC}9 z?{r*jyn-d;m|tI|x{oD&bt6ene@%gS56&g2mS@Dn!BrY2%cI+AdUEu|7rxkCJJMA8 zm% zdIw2PBguoN+y}2v?t?vj1n-`*CT_57J6mLi1N0~>fSx^~M?Y_go;`05J$sCvJy*~( zh&6KSF@K&_rkQ~n^A%>alV_QJYsh{(&(c?8?lYrn)tD#yVv?3ta;GrBdaOmP?~5u^ zgE7>c!h}T?e3aI&{60a#3+u~ojjX~u?A}4AcH{T*@KSinUR?2Sq-J;Ld(1VL(wcns z`cUhDmUaR+R{OnjAnd-~e-sc&8^dfIH;syhyCwp*dsN69$A;qa@HpF7CrDWbH#E7x z%8yhf_{}BqD~h3hQ-AF@YvG7(%@hY#~f-N=>UoKY# zu$-;){=FXqYE?HZDNoXZK=)efC>Uh-n%4*QQfT*@ikgt&02Tn`<#Bz=NAnwDC4NV? z&jjEYG^WWgf=GL<()hO&c&X5+rb!MtUzHF-MHBze#Ly&Xh@FMU0|AOW8XU+nB42&& z;~kCyM9P_iZqI8rx50u)ukaWbwb!u^px?jm&6l$kI3KS6cda z(DYJ(xTwz=@X7+v*p}~En2u&69h7AHlD#lw+|}nup%Ja&5#L299>M6UXY5tI;CU4e zU)?Jb-+3!ld>_iR87cp&f=5GmN-7ulBEqtLZCS(^7!g*M5s4f$>8+A8EpkQ*oKcn@ zIXr^g;?V#(gS`gG>F+g2&cs#Zn8ug0wVWIz-A@kZ?6Q_R@YQNh80zp=35!KoTwp&y z7>`DKj|K=E>@`4Gf3HEp6etJfB((+WRZo~#)wnQ-+k@ae18Qi5mW~IkO^W35@c^%& zGt^akN;w-k9w1nq4Id9!U)0%%K7V0nd1 zKLCImk@thkZ`qCLV{rpSQCz6~WfbvG48I5@AFCWR1`bbx?PE{=lGnTCU~zPE8+MSB zdLe(zcfPs}?Ij>~ejZ*HhJ z9rQ&TJ1Asc2Dlza>`L`#tuXnqxbkCmYo-G!jz@Cj<)9sXh z{3J3*>%w18hfcbWxuKWjX7rv^h@a#IPrZ+0AG*xXSd-7su&(^f$tEJb3BU(CWijIZ zpNG5+8v#R{uotV%o97t=z?CWJ-D-2@KE(U*o2reV(Aze)A+1et9t`Yaj?V$)(Rq<* zQ&PRUT__m*!(>Gsuu~&cM>xyL2Eq(Cn-=Jy4W0&;hSZ1@H(;V?Z#uPVPeY`1nYbcs zbCM)beHM6wJ_aoj6Xg?u?pt@;f}frg4T_$GJVwjGEZ2TLR1y{>p_r(VV38DFBdTg* zFbujq2#ZlPYFbJV5Afh2Y9A~^LWl->Y%n+f8N;2@Co#rT!XO^^(DIi7s2(K97-SB$ zZK0c^D&r&WA^>qmpIgr<&cJHf;<5fs8NMH*=M_bFy6}RMy;~vPC}FaIA_z*7Jj3{$ z9VIcJp!t7!t_xex8ZTDz0SUeygL>Ba;n}}Xs$2U?MC**#;>20d z<$&7ioe?#{Yh=7K?#c1L89HUJ<4FcIC67V|oZUm>8M2|yUkzQ#Ue#5Q>60#ed}fQs zU$@2Q9$el35>5!2W!ooc@T$GV$;I~b{4>UH+`}6!1F+#FO(!m8uN!Q;Vx(ed--8BK#*9~ej;*;2A(1Q4n#7i};{Ztr*ygDXc zx#0KG=;S+J{vu4;NHO9uG@IMJQs|21^nmUAAaP${e_p@$3kc?q1uOwg%Yw2Kw#P!o zC-3}`%XS&r_7TcnAK%{ksOfou}5?7aaeV_aoo^&_lub+uO~B#l@xeZRdjv3rnlP!qVkn^Wy5- zW^nuF!s_CaYnKC_cH1wlu3zlj*16mX?CefEU0v%e&?soGcG}M!dEer>&U5QcclX`y zzQ@nK|J0cs?|=6r4?gnf_dLQ_PhP9*eP`bvq!(A4m)D!;JIzJ+)Y3{b4Vvxt>Y9Mh z2j^EiI(cVsTaayTHrt)0wN>}j0?ihWyBjy%p&K`KN*4hpx!lkwLbKNKF?KQ*fH2iSQ%S)S`&ESIz zD;Jxtv$p0|7TQlY9lGEa7di}%#H{D~!uh6KX+G6)hQp;LsCe`uS5LVM%?pAL8EY5Y zw0iR5=5xW>)eh8MT$g}0pWEy-FSzpyD=WQL+*x01FSM6do^uyh7cLrG=Fx zIyIZi!M*LZ&CMf=O%3N(mR6VPzp!{@ZIwE?bX$KL& zr)Im4b)BUPptp9hGuZg4i<@xr{}V65Y_BahSKay& zOgek}qq#f_5#(sYN-Rm;x+3sTxRiW*5<0s%aQS%ia>r9?96fcpd0v9Ku+Yf|Dp-Zc zE?z)sf-FCQRp4&oTw8rQ_`q`)o?Kg5I&U0wD{E`(frP)ha3Pnu8a|y*Pd4G-W)m#9`&fIevvz)MC6}0Zki*QSzX>hPPH`h4z&_hXc7~JLY!0nEsz~aIY2fze#dYk@)7imi6jz0cKecc{rYQ*Bhh{=K zMM2SUaEwQqooCnD%QBor_#PD3{Z_P-Wv=>u{f4;kWPu+p<*BFO^`?2D9zh>4=4q_+ z-q>MQeot8SZuY$8!ioahbFyF*^Jz27-qZfOC>2U-TK^0Y4~6=!iv%=W=J{rGQDVVs zFFmui?iTR8xEyZXyRg3S}?po6a+_Zan8+uX#R3= zX!YXC3ZI@V{>%iU!OYBzE-U_CRfn2CCtL;NqdYH-4hP|EwKg3D)gd0%f+6+Edlrp# z+*MovxuNHcAc%shZddiN`@Cq^J=VKtK`^Ov`>Fcd{PsWZYszWdcR9v+SwBJ5-{!af zd0$gbC;BeOb#6aZf16+a-^bm3`}Di>pMmGbyq(*1?@o2kf?%)C?WgK*^V|QtuPLW{ z`Yw0t+!b?%lrx5|;aBP-{Rthbj|JDd2jBZ71!htyefoo9T�W0n)&bCmBd7Cs-1&}o zzU%0*yWX9hy!XCSr;p5k=$82pp^Hc6FW)kM*`bnXYH;?E)4}QjW}H1jHWg%FovVGN zJP7IkU;Td$yaf(que;jwcjXqJyEN-o+M%;lOl=;z!b3!PTP^bM(CwPHE(7O(0~Fc- AivR!s literal 0 HcmV?d00001 From d938e8508ba86ad40183366d4e600feee9c584f9 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Tue, 15 Sep 2020 23:04:48 +0200 Subject: [PATCH 045/117] n-api: add more property defaults Add a default value for class method and js like property in enum napi_property_attributes. n-api currently offers only one default which is non configurable, non writable, non enumerable - like Object.defineProperty(). While this is formal correct the usual way to create properties in JS is either by defining a class or use obj.prop = value. The defaults from these variants are now backed into enum values. PR-URL: https://github.com/nodejs/node/pull/35214 Refs: https://github.com/nodejs/node-addon-api/issues/811 Reviewed-By: Anna Henningsen Reviewed-By: Gabriel Schulhof --- doc/api/n-api.md | 18 ++++++++++++++++++ src/js_native_api_types.h | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 38f5983868cf74..a8620c209c44b3 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3643,6 +3643,12 @@ if (status != napi_ok) return status; ### Structures #### napi_property_attributes + ```c typedef enum { @@ -3654,6 +3660,14 @@ typedef enum { // Used with napi_define_class to distinguish static properties // from instance properties. Ignored by napi_define_properties. napi_static = 1 << 10, + + // Default for class methods. + napi_default_method = napi_writable | napi_configurable, + + // Default for object properties, like in JS obj[prop]. + napi_default_property = napi_writable | + napi_enumerable | + napi_configurable, } napi_property_attributes; ``` @@ -3672,6 +3686,10 @@ They can be one or more of the following bitflags: * `napi_static`: The property will be defined as a static property on a class as opposed to an instance property, which is the default. This is used only by [`napi_define_class`][]. It is ignored by `napi_define_properties`. +* `napi_default_method`: The property is configureable, writeable but not + enumerable like a method in a JS class. +* `napi_default_property`: The property is writable, enumerable and configurable + like a property set via JS code `obj.key = value`. #### napi_property_descriptor diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h index f139a1e2bd3036..b9eddbcba04772 100644 --- a/src/js_native_api_types.h +++ b/src/js_native_api_types.h @@ -30,6 +30,16 @@ typedef enum { // Used with napi_define_class to distinguish static properties // from instance properties. Ignored by napi_define_properties. napi_static = 1 << 10, + +#ifdef NAPI_EXPERIMENTAL + // Default for class methods. + napi_default_method = napi_writable | napi_configurable, + + // Default for object properties, like in JS obj[prop]. + napi_default_jsproperty = napi_writable | + napi_enumerable | + napi_configurable, +#endif // NAPI_EXPERIMENTAL } napi_property_attributes; typedef enum { From 11b10d7d1f956a0e5ed79e2c029317f2eccb5dd9 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 17 Sep 2020 18:12:06 +0200 Subject: [PATCH 046/117] tools,doc: upgrade dependencies PR-URL: https://github.com/nodejs/node/pull/35244 Reviewed-By: Rich Trott Reviewed-By: Shelley Vohr --- tools/doc/generate.js | 2 +- tools/doc/html.js | 6 +- tools/doc/json.js | 4 +- tools/doc/package-lock.json | 918 ++++++++++++++++++++---------------- tools/doc/package.json | 26 +- 5 files changed, 541 insertions(+), 415 deletions(-) diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 93c3b263009bb6..007a0d48eed347 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -87,7 +87,7 @@ async function main() { .use(html.firstHeader) .use(html.preprocessElements, { filename }) .use(html.buildToc, { filename, apilinks }) - .use(remark2rehype, { allowDangerousHTML: true }) + .use(remark2rehype, { allowDangerousHtml: true }) .use(raw) .use(htmlStringify) .process(input); diff --git a/tools/doc/html.js b/tools/doc/html.js index 8d7758f199254f..e84c7526f01844 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -54,7 +54,7 @@ const gtocPath = path.join(docPath, 'api', 'index.md'); const gtocMD = fs.readFileSync(gtocPath, 'utf8').replace(/^/gms, ''); const gtocHTML = unified() .use(markdown) - .use(remark2rehype, { allowDangerousHTML: true }) + .use(remark2rehype, { allowDangerousHtml: true }) .use(raw) .use(navClasses) .use(htmlStringify) @@ -281,7 +281,7 @@ function parseYAML(text) { meta.changes.forEach((change) => { const description = unified() .use(markdown) - .use(remark2rehype, { allowDangerousHTML: true }) + .use(remark2rehype, { allowDangerousHtml: true }) .use(raw) .use(htmlStringify) .processSync(change.description).toString(); @@ -368,7 +368,7 @@ function buildToc({ filename, apilinks }) { file.toc = unified() .use(markdown) - .use(remark2rehype, { allowDangerousHTML: true }) + .use(remark2rehype, { allowDangerousHtml: true }) .use(raw) .use(htmlStringify) .processSync(toc).toString(); diff --git a/tools/doc/json.js b/tools/doc/json.js index 739a4f9f4fd3de..6dd25d41026f84 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -24,7 +24,7 @@ const unified = require('unified'); const common = require('./common.js'); const html = require('remark-html'); -const select = require('unist-util-select'); +const { selectAll } = require('unist-util-select'); module.exports = { jsonAPI }; @@ -38,7 +38,7 @@ function jsonAPI({ filename }) { const stabilityExpr = /^Stability: ([0-5])(?:\s*-\s*)?(.*)$/s; // Extract definitions. - const definitions = select(tree, 'definition'); + const definitions = selectAll('definition', tree); // Determine the start, stop, and depth of each section. const sections = []; diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index b448baa7e3730b..36514e5989c7b7 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -4,34 +4,20 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@types/node": { - "version": "10.5.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.6.tgz", - "integrity": "sha512-c5Z1j1ysgo4878ptz6gxLcgMfJ6Wf908R3l5KAGabr0XJ72ZFmOCgsaodPpNYTfp4iOrSwgTDvR/BxbFfB4zPQ==" + "@types/mdast": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.3.tgz", + "integrity": "sha512-SXPBMnFVQg1s00dlMCc/jCdvPqdE4mXaMMCeRlxLDmTAEoegHT53xKtkDnzDTOcmMHUfcjyf36/YYZ6SxRdnsw==", + "dev": true, + "requires": { + "@types/unist": "*" + } }, "@types/unist": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.3.tgz", - "integrity": "sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==" - }, - "@types/vfile": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/vfile/-/vfile-3.0.2.tgz", - "integrity": "sha512-b3nLFGaGkJ9rzOcuXRfHkZMdjsawuDD0ENL9fzTophtBg8FJHSGbH7daXkEpcwy3v7Xol3pAvsmlYyFhR4pqJw==", - "requires": { - "@types/node": "*", - "@types/unist": "*", - "@types/vfile-message": "*" - } - }, - "@types/vfile-message": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/vfile-message/-/vfile-message-1.0.1.tgz", - "integrity": "sha512-mlGER3Aqmq7bqR1tTTIVHq8KSAFFRyGbrxuM8C/H82g6k7r2fS+IMEkIu3D7JHzG10NvPdR8DNx0jr0pwpp4dA==", - "requires": { - "@types/node": "*", - "@types/unist": "*" - } + "integrity": "sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==", + "dev": true }, "argparse": { "version": "1.0.10", @@ -43,87 +29,64 @@ } }, "bail": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.3.tgz", - "integrity": "sha512-1X8CnjFVQ+a+KW36uBNMTU5s8+v5FzeqrP7hTG5aTb4aPreSbZJlhwPon9VKMuEVgV++JM+SQrALY3kr7eswdg==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "dev": true }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true }, "ccount": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.3.tgz", - "integrity": "sha512-Jt9tIBkRc9POUof7QA/VwWd+58fKkEEfI+/t1/eOlxKM7ZhrczNzMFefge7Ai+39y1pR/pP6cI19guHy3FSLmw==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.5.tgz", + "integrity": "sha512-MOli1W+nfbPLlKEhInaxhRdp7KVLFxLN5ykwzHgLsLI3H3gs5jjFAK4Eoj3OzzcxCtumDaI8onoVDeQyWaNTkw==", + "dev": true }, "character-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.2.tgz", - "integrity": "sha512-sMoHX6/nBiy3KKfC78dnEalnpn0Az0oSNvqUWYTtYrhRI5iUIYsROU48G+E+kMFQzqXaJ8kHJZ85n7y6/PHgwQ==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "dev": true }, "character-entities-html4": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.2.tgz", - "integrity": "sha512-sIrXwyna2+5b0eB9W149izTPJk/KkJTg6mEzDGibwBUkyH1SbDa+nf515Ppdi3MaH35lW0JFJDWeq9Luzes1Iw==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.4.tgz", + "integrity": "sha512-HRcDxZuZqMx3/a+qrzxdBKBPUpxWEq9xw2OPZ3a/174ihfrQKVsFhqtthBInFy1zZ9GgZyFXOatNujm8M+El3g==", + "dev": true }, "character-entities-legacy": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.2.tgz", - "integrity": "sha512-9NB2VbXtXYWdXzqrvAHykE/f0QJxzaKIpZ5QzNZrrgQ7Iyxr2vnfS8fCBNVW9nUEZE0lo57nxKRqnzY/dKrwlA==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "dev": true }, "character-reference-invalid": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.2.tgz", - "integrity": "sha512-7I/xceXfKyUJmSAn/jw8ve/9DyOP7XxufNYLI9Px7CmsKgEUaZLUTax6nZxGQtaoiZCjpu6cHPj20xC/vqRReQ==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "dev": true }, "collapse-white-space": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.4.tgz", - "integrity": "sha512-YfQ1tAUZm561vpYD+5eyWN8+UsceQbSrqqlc/6zDY2gtAE+uZLSdkkovhnGpmCThsvKBFakq4EdY/FF93E8XIw==" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz", + "integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==", + "dev": true }, "comma-separated-tokens": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.5.tgz", - "integrity": "sha512-Cg90/fcK93n0ecgYTAz1jaA3zvnQ0ExlmKY1rdbyHqAx6BHxwoJc+J7HDu0iuQ7ixEs1qaa+WyQ6oeuBpYP1iA==", - "requires": { - "trim": "0.0.1" - } + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz", + "integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==", + "dev": true }, "css-selector-parser": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-1.3.0.tgz", - "integrity": "sha1-XxrUPi2O77/cME/NOaUhZklD4+s=" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "define-properties": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", - "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", - "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" - } - }, - "detab": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detab/-/detab-2.0.1.tgz", - "integrity": "sha512-/hhdqdQc5thGrqzjyO/pz76lDZ5GSuAs6goxOaKTsvPk7HNnzAyFN5lyHgqpX4/s1i66K8qMGj+VhA9504x7DQ==", - "requires": { - "repeat-string": "^1.5.4" - } + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-1.4.1.tgz", + "integrity": "sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==", + "dev": true }, "esprima": { "version": "4.0.1", @@ -134,306 +97,315 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } }, "hast-to-hyperscript": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-3.1.0.tgz", - "integrity": "sha512-/At2y6sQLTAcL6y+3hRQFcaBoRlKrmHSpvvdOZqRz6uI2YyjrU8rJ7e1LbmLtWUmzaIqKEdNSku+AJC0pt4+aw==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-7.0.4.tgz", + "integrity": "sha512-vmwriQ2H0RPS9ho4Kkbf3n3lY436QKLq6VaGA1pzBh36hBi3tm1DO9bR+kaJIbpT10UqaANDkMjxvjVfr+cnOA==", + "dev": true, "requires": { "comma-separated-tokens": "^1.0.0", - "is-nan": "^1.2.1", - "kebab-case": "^1.0.0", - "property-information": "^3.0.0", + "property-information": "^5.3.0", "space-separated-tokens": "^1.0.0", - "trim": "0.0.1", - "unist-util-is": "^2.0.0" + "style-to-object": "^0.2.1", + "unist-util-is": "^3.0.0", + "web-namespaces": "^1.1.2" } }, "hast-util-from-parse5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-2.1.0.tgz", - "integrity": "sha1-9hI9g9NoljCwl+E+Qw0W2dG9iIQ=", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-5.0.3.tgz", + "integrity": "sha512-gOc8UB99F6eWVWFtM9jUikjN7QkWxB3nY0df5Z0Zq1/Nkwl5V4hAAsl0tmwlgWl/1shlTF8DnNYLO8X6wRV9pA==", + "dev": true, "requires": { - "camelcase": "^3.0.0", - "hastscript": "^3.0.0", - "property-information": "^3.1.0", - "vfile-location": "^2.0.0" + "ccount": "^1.0.3", + "hastscript": "^5.0.0", + "property-information": "^5.0.0", + "web-namespaces": "^1.1.2", + "xtend": "^4.0.1" } }, "hast-util-is-element": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.0.1.tgz", - "integrity": "sha512-s/ggaNehYVqmLgTXEv12Lbb72bsOD2r5DhAqPgtDdaI/YFNXVzz0zHFVJnhjIjn7Nak8GbL4nzT2q0RA5div+A==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.1.0.tgz", + "integrity": "sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ==", + "dev": true }, "hast-util-parse-selector": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.0.tgz", - "integrity": "sha512-trw0pqZN7+sH9k7hPWCJNZUbWW2KroSIM/XpIy3G5ZMtx9LSabCyoSp4skJZ4q/eZ5UOBPtvWh4W9c+RE3HRoQ==" + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.4.tgz", + "integrity": "sha512-gW3sxfynIvZApL4L07wryYF4+C9VvH3AUi7LAnVXV4MneGEgwOByXvFo18BgmTWnm7oHAe874jKbIB1YhHSIzA==", + "dev": true }, "hast-util-raw": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-2.0.2.tgz", - "integrity": "sha512-ujytXSAZC85bvh38f8ALzfE2IZDdCwB9XeHUs9l20C1p4/1YeAoZqq9z9U17vWQ9hMmqbVaROuSK8feL3wTCJg==", - "requires": { - "hast-util-from-parse5": "^2.0.0", - "hast-util-to-parse5": "^2.0.0", - "html-void-elements": "^1.0.1", - "parse5": "^3.0.3", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-5.0.2.tgz", + "integrity": "sha512-3ReYQcIHmzSgMq8UrDZHFL0oGlbuVGdLKs8s/Fe8BfHFAyZDrdv1fy/AGn+Fim8ZuvAHcJ61NQhVMtyfHviT/g==", + "dev": true, + "requires": { + "hast-util-from-parse5": "^5.0.0", + "hast-util-to-parse5": "^5.0.0", + "html-void-elements": "^1.0.0", + "parse5": "^5.0.0", "unist-util-position": "^3.0.0", "web-namespaces": "^1.0.0", + "xtend": "^4.0.0", "zwitch": "^1.0.0" } }, "hast-util-sanitize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-1.2.0.tgz", - "integrity": "sha512-VwCTqjt6fbMGacxGB1FKV5sBJaVVkyCGVMDwb4nnqvCW2lkqscA2GEpOyBx4ZWRXty1eAZF58MHBrllEoQEoBg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-3.0.0.tgz", + "integrity": "sha512-gxsM24ARtuulsrWEj8QtVM6FNeAEHklF/t7TEIWvX1wuQcoAQtJtEUcT8t0os4uxCUqh1epX/gTi8fp8gNKvCA==", + "dev": true, "requires": { - "xtend": "^4.0.1" + "xtend": "^4.0.0" } }, "hast-util-to-html": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-3.1.0.tgz", - "integrity": "sha1-iCyZhJ5AEw6ZHAQuRW1FPZXDbP8=", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-7.1.1.tgz", + "integrity": "sha512-Ujqj0hGuo3dIQKilkbauAv5teOqPvhaSLEgs1lgApFT0812e114KiffV8XfE4ttR8dRPqxNOIJOMu6SKOVOGlg==", + "dev": true, "requires": { "ccount": "^1.0.0", - "comma-separated-tokens": "^1.0.1", + "comma-separated-tokens": "^1.0.0", "hast-util-is-element": "^1.0.0", "hast-util-whitespace": "^1.0.0", "html-void-elements": "^1.0.0", - "kebab-case": "^1.0.0", - "property-information": "^3.1.0", + "property-information": "^5.0.0", "space-separated-tokens": "^1.0.0", - "stringify-entities": "^1.0.1", - "unist-util-is": "^2.0.0", - "xtend": "^4.0.1" + "stringify-entities": "^3.0.1", + "unist-util-is": "^4.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "unist-util-is": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "dev": true + } } }, "hast-util-to-parse5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-2.2.0.tgz", - "integrity": "sha512-Eg1mrf0VTT/PipFN5z1+mVi+4GNhinKk/i/HKeX1h17IYiMdm3G8vgA0FU04XCuD1cWV58f5zziFKcBkr+WuKw==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-5.1.2.tgz", + "integrity": "sha512-ZgYLJu9lYknMfsBY0rBV4TJn2xiwF1fXFFjbP6EE7S0s5mS8LIKBVWzhA1MeIs1SWW6GnnE4In6c3kPb+CWhog==", + "dev": true, "requires": { - "hast-to-hyperscript": "^3.0.0", - "mapz": "^1.0.0", + "hast-to-hyperscript": "^7.0.0", + "property-information": "^5.0.0", "web-namespaces": "^1.0.0", - "xtend": "^4.0.1", + "xtend": "^4.0.0", "zwitch": "^1.0.0" } }, "hast-util-whitespace": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.1.tgz", - "integrity": "sha512-Mfx2ZnmVMTAopZ8as42nKrNt650tCZYhy/MPeO1Imdg/cmCWK6GUSnFrrE3ezGjVifn7x5zMfu8jrjwIGyImSw==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz", + "integrity": "sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A==", + "dev": true }, "hastscript": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-3.1.0.tgz", - "integrity": "sha512-8V34dMSDT1Ik+ZSgTzCLdyp89MrWxcxctXPxhmb72GQj1Xkw1aHPM9UaHCWewvH2Q+PVkYUm4ZJVw4T0dgEGNA==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-5.1.2.tgz", + "integrity": "sha512-WlztFuK+Lrvi3EggsqOkQ52rKbxkXL3RwB6t5lwoa8QLMemoWfBuL43eDrwOamJyR7uKQKdmKYaBH1NZBiIRrQ==", + "dev": true, "requires": { - "camelcase": "^3.0.0", "comma-separated-tokens": "^1.0.0", "hast-util-parse-selector": "^2.0.0", - "property-information": "^3.0.0", + "property-information": "^5.0.0", "space-separated-tokens": "^1.0.0" } }, "highlight.js": { - "version": "9.18.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz", - "integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==" + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.1.0.tgz", + "integrity": "sha512-e8aO/LUHDoxW4ntyKQf0/T3OtIZPhsfTr8XRuOq+FW5VdWEg/UDAeArzKF/22BaNZp6hPi/Zu/XQlTLOGLix3Q==", + "dev": true }, "html-void-elements": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.3.tgz", - "integrity": "sha512-SaGhCDPXJVNrQyKMtKy24q6IMdXg5FCPN3z+xizxw9l+oXQw5fOoaj/ERU5KqWhSYhXtW5bWthlDbTDLBhJQrA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.5.tgz", + "integrity": "sha512-uE/TxKuyNIcx44cIWnjr/rfIATDH7ZaOMmstu0CwhFG1Dunhlp4OC6/NMbhiwoq5BpW0ubi303qnEk/PZj614w==", + "dev": true }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "inline-style-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", + "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==", + "dev": true }, "is-alphabetical": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.2.tgz", - "integrity": "sha512-V0xN4BYezDHcBSKb1QHUFMlR4as/XEuCZBzMJUU4n7+Cbt33SmUnSol+pnXFvLxSHNq2CemUXNdaXV6Flg7+xg==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "dev": true }, "is-alphanumerical": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.2.tgz", - "integrity": "sha512-pyfU/0kHdISIgslFfZN9nfY1Gk3MquQgUm1mJTjdkEPpkAKNWuBTSqFwewOpR7N351VkErCiyV71zX7mlQQqsg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dev": true, "requires": { "is-alphabetical": "^1.0.0", "is-decimal": "^1.0.0" } }, "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true }, "is-decimal": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.2.tgz", - "integrity": "sha512-TRzl7mOCchnhchN+f3ICUCzYvL9ul7R+TYOsZ8xia++knyZAJfv/uA1FvQXsAnYIl1T3B2X5E/J7Wb1QXiIBXg==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "dev": true }, "is-hexadecimal": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.2.tgz", - "integrity": "sha512-but/G3sapV3MNyqiDBLrOi4x8uCIw0RY3o/Vb5GT0sMFHrVV7731wFSVy41T5FO1og7G0gXLJh0MkgPRouko/A==" - }, - "is-nan": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.2.1.tgz", - "integrity": "sha1-n69ltvttskt/XAYoR16nH5iEAeI=", - "requires": { - "define-properties": "^1.1.1" - } + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "dev": true }, "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true }, "is-whitespace-character": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz", - "integrity": "sha512-SzM+T5GKUCtLhlHFKt2SDAX2RFzfS6joT91F2/WSi9LxgFdsnhfPK/UIA+JhRR2xuyLdrCys2PiFDrtn1fU5hQ==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", + "integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==", + "dev": true }, "is-word-character": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.2.tgz", - "integrity": "sha512-T3FlsX8rCHAH8e7RE7PfOPZVFQlcV3XRF9eOOBQ1uf70OxO7CjjSOjeImMPCADBdYWcStAbVbYvJ1m2D3tb+EA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz", + "integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==", + "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, - "kebab-case": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/kebab-case/-/kebab-case-1.0.0.tgz", - "integrity": "sha1-P55JkK3K0MaGwOcB92RYaPdfkes=" - }, "lodash.iteratee": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz", - "integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw=" + "integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw=", + "dev": true }, "longest-streak": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-1.0.0.tgz", - "integrity": "sha1-0GWXxNTDG1LMsfXY+P5xSOr9aWU=" - }, - "mapz": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mapz/-/mapz-1.0.2.tgz", - "integrity": "sha512-NuY43BoHy5K4jVg3/oD+g8ysNwdXY3HB5UankVWoikxT9YMqgCYC77pNRENTm/DfslLxPFEOyJUw9h9isRty6w==", - "requires": { - "x-is-array": "^0.1.0" - } + "integrity": "sha1-0GWXxNTDG1LMsfXY+P5xSOr9aWU=", + "dev": true }, "markdown-escapes": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.2.tgz", - "integrity": "sha512-lbRZ2mE3Q9RtLjxZBZ9+IMl68DKIXaVAhwvwn9pmjnPLS0h/6kyBMgNhqi1xFJ/2yv6cSyv0jbiZavZv93JkkA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", + "dev": true }, "markdown-table": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-0.4.0.tgz", - "integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE=" + "integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE=", + "dev": true }, "mdast-util-definitions": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-1.2.2.tgz", - "integrity": "sha512-9NloPSwaB9f1PKcGqaScfqRf6zKOEjTIXVIbPOmgWI/JKxznlgVXC5C+8qgl3AjYg2vJBRgLYfLICaNiac89iA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-3.0.1.tgz", + "integrity": "sha512-BAv2iUm/e6IK/b2/t+Fx69EL/AGcq/IG2S+HxHjDJGfLJtd6i9SZUS76aC9cig+IEucsqxKTR0ot3m933R3iuA==", + "dev": true, "requires": { - "unist-util-visit": "^1.0.0" + "unist-util-visit": "^2.0.0" } }, "mdast-util-to-hast": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-3.0.2.tgz", - "integrity": "sha512-YI8Ea3TFWEZrS31+6Q/d8ZYTOSDKM06IPc3l2+OMFX1o3JTG2mrztlmzDsUMwIXLWofEdTVl/WXBgRG6ddlU/A==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-9.1.1.tgz", + "integrity": "sha512-vpMWKFKM2mnle+YbNgDXxx95vv0CoLU0v/l3F5oFAG5DV7qwkZVWA206LsAdOnEVyf5vQcLnb3cWJywu7mUxsQ==", + "dev": true, "requires": { - "collapse-white-space": "^1.0.0", - "detab": "^2.0.0", - "mdast-util-definitions": "^1.2.0", - "mdurl": "^1.0.1", - "trim": "0.0.1", - "trim-lines": "^1.0.0", - "unist-builder": "^1.0.1", - "unist-util-generated": "^1.1.0", + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.3", + "mdast-util-definitions": "^3.0.0", + "mdurl": "^1.0.0", + "unist-builder": "^2.0.0", + "unist-util-generated": "^1.0.0", "unist-util-position": "^3.0.0", - "unist-util-visit": "^1.1.0", - "xtend": "^4.0.1" + "unist-util-visit": "^2.0.0" } }, "mdurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "dev": true }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "not": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/not/-/not-0.1.0.tgz", + "integrity": "sha1-yWkcF0bFXc++VMvYvU/wQbwrUZ0=", + "dev": true }, "nth-check": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", - "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dev": true, "requires": { "boolbase": "~1.0.0" } }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } }, "parse-entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.2.tgz", - "integrity": "sha512-5N9lmQ7tmxfXf+hO3X6KRG6w7uYO/HL9fHalSySTdyn63C3WNvTM/1R8tn1u1larNcEbo3Slcy2bsVDQqvEpUg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", + "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", + "dev": true, "requires": { "character-entities": "^1.0.0", "character-entities-legacy": "^1.0.0", @@ -444,49 +416,68 @@ } }, "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "requires": { - "@types/node": "*" - } + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "dev": true }, "property-information": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-3.2.0.tgz", - "integrity": "sha1-/RSDyPusYYCPX+NZ52k6H0ilgzE=" + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-5.5.0.tgz", + "integrity": "sha512-RgEbCx2HLa1chNgvChcx+rrCWD0ctBmGSE0M7lVm1yyv4UbvbrWoXp/BkVLZefzjrRBGW8/Js6uh/BnlHXFyjA==", + "dev": true, + "requires": { + "xtend": "^4.0.0" + } }, "rehype-raw": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-2.0.0.tgz", - "integrity": "sha1-Vjep/O7zSAD9fFfKMv2dWSf9Kqo=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-4.0.2.tgz", + "integrity": "sha512-xQt94oXfDaO7sK9mJBtsZXkjW/jm6kArCoYN+HqKZ51O19AFHlp3Xa5UfZZ2tJkbpAZzKtgVUYvnconk9IsFuA==", + "dev": true, "requires": { - "hast-util-raw": "^2.0.0" + "hast-util-raw": "^5.0.0" } }, "rehype-stringify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-3.0.0.tgz", - "integrity": "sha1-n+8IaCE8Lc4veAt289BIjIXoGes=", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-8.0.0.tgz", + "integrity": "sha512-VkIs18G0pj2xklyllrPSvdShAV36Ff3yE5PUO9u36f6+2qJFnn22Z5gKwBOwgXviux4UC7K+/j13AnZfPICi/g==", + "dev": true, "requires": { - "hast-util-to-html": "^3.0.0", - "xtend": "^4.0.1" + "hast-util-to-html": "^7.1.1" } }, "remark": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/remark/-/remark-5.1.0.tgz", "integrity": "sha1-y0Y709vLS5l5STXu4c9x16jjBow=", + "dev": true, "requires": { "remark-parse": "^1.1.0", "remark-stringify": "^1.1.0", "unified": "^4.1.1" }, "dependencies": { + "parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "requires": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + } + }, "remark-parse": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-1.1.0.tgz", "integrity": "sha1-w8oQ+ajaBGFcKPCapOMEUQUm7CE=", + "dev": true, "requires": { "collapse-white-space": "^1.0.0", "extend": "^3.0.0", @@ -503,6 +494,7 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/unified/-/unified-4.2.1.tgz", "integrity": "sha1-dv9Dqo2kMPbn5KVchOusKtLPzS4=", + "dev": true, "requires": { "bail": "^1.0.0", "extend": "^3.0.0", @@ -512,58 +504,97 @@ "vfile": "^1.0.0" } }, + "unist-util-remove-position": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz", + "integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==", + "dev": true, + "requires": { + "unist-util-visit": "^1.1.0" + } + }, + "unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "requires": { + "unist-util-is": "^3.0.0" + } + }, "vfile": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/vfile/-/vfile-1.4.0.tgz", - "integrity": "sha1-wP1vpIT43r23cfaMMe112I2pf+c=" + "integrity": "sha1-wP1vpIT43r23cfaMMe112I2pf+c=", + "dev": true + }, + "vfile-location": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz", + "integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==", + "dev": true } } }, "remark-html": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/remark-html/-/remark-html-7.0.0.tgz", - "integrity": "sha512-jqRzkZXCkM12gIY2ibMLTW41m7rfanliMTVQCFTezHJFsbH00YaTox/BX4gU+f/zCdzfhFJONtebFByvpMv37w==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/remark-html/-/remark-html-12.0.0.tgz", + "integrity": "sha512-M104NMHs48+uswChJkCDXCdabzxAinpHikpt6kS3gmGMyIvPZ5kn53tB9shFsL2O4HUJ9DIEsah1SX1Ve5FXHA==", + "dev": true, "requires": { - "hast-util-sanitize": "^1.0.0", - "hast-util-to-html": "^3.0.0", - "mdast-util-to-hast": "^3.0.0", + "hast-util-sanitize": "^3.0.0", + "hast-util-to-html": "^7.0.0", + "mdast-util-to-hast": "^9.0.0", "xtend": "^4.0.1" } }, "remark-parse": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", - "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-8.0.3.tgz", + "integrity": "sha512-E1K9+QLGgggHxCQtLt++uXltxEprmWzNfg+MxpfHsZlrddKzZ/hZyWHDbK3/Ap8HJQqYJRXP+jHczdL6q6i85Q==", + "dev": true, "requires": { + "ccount": "^1.0.0", "collapse-white-space": "^1.0.2", "is-alphabetical": "^1.0.0", "is-decimal": "^1.0.0", "is-whitespace-character": "^1.0.0", "is-word-character": "^1.0.0", "markdown-escapes": "^1.0.0", - "parse-entities": "^1.1.0", + "parse-entities": "^2.0.0", "repeat-string": "^1.5.4", "state-toggle": "^1.0.0", "trim": "0.0.1", "trim-trailing-lines": "^1.0.0", "unherit": "^1.0.4", - "unist-util-remove-position": "^1.0.0", - "vfile-location": "^2.0.0", + "unist-util-remove-position": "^2.0.0", + "vfile-location": "^3.0.0", "xtend": "^4.0.1" } }, "remark-rehype": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-3.0.2.tgz", - "integrity": "sha512-KDRCnMzRyyCDr0I14Kfk5094W7jjhQwAIJ1C6NniGNjp2OIhcrtqRaiTZCoyEtoYILXTmZKmuOnL5yYGaEFFJA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-7.0.0.tgz", + "integrity": "sha512-uqQ/VbaTdxyu/da6npHAso6hA00cMqhA3a59RziQdOLN2KEIkPykAVy52IcmZEVTuauXO0VtpxkyCey4phtHzQ==", + "dev": true, "requires": { - "mdast-util-to-hast": "^3.0.0" + "mdast-util-to-hast": "^9.1.0" } }, "remark-stringify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-1.1.0.tgz", "integrity": "sha1-pxBeJbnuK/mkm3XSxCPxGwauIJI=", + "dev": true, "requires": { "ccount": "^1.0.0", "extend": "^3.0.0", @@ -573,25 +604,53 @@ "repeat-string": "^1.5.4", "stringify-entities": "^1.0.1", "unherit": "^1.0.4" + }, + "dependencies": { + "parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "requires": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + } + }, + "stringify-entities": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz", + "integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==", + "dev": true, + "requires": { + "character-entities-html4": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-hexadecimal": "^1.0.0" + } + } } }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true }, "replace-ext": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true }, "space-separated-tokens": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.2.tgz", - "integrity": "sha512-G3jprCEw+xFEs0ORweLmblJ3XLymGGr6hxZYTYZjIlvDti9vOBUjRQa1Rzjt012aRrocKstHwdNi+F7HguPsEA==", - "requires": { - "trim": "0.0.1" - } + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz", + "integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==", + "dev": true }, "sprintf-js": { "version": "1.0.3", @@ -600,199 +659,268 @@ "dev": true }, "state-toggle": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", - "integrity": "sha512-Qe8QntFrrpWTnHwvwj2FZTgv+PKIsp0B9VxLzLLbSpPXWOgRgc5LVj/aTiSfK1RqIeF9jeC1UeOH8Q8y60A7og==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", + "dev": true }, "stringify-entities": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz", - "integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.0.1.tgz", + "integrity": "sha512-Lsk3ISA2++eJYqBMPKcr/8eby1I6L0gP0NlxF8Zja6c05yr/yCYyb2c9PwXjd08Ib3If1vn1rbs1H5ZtVuOfvQ==", + "dev": true, "requires": { "character-entities-html4": "^1.0.0", "character-entities-legacy": "^1.0.0", "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.2", "is-hexadecimal": "^1.0.0" } }, + "style-to-object": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.2.3.tgz", + "integrity": "sha512-1d/k4EY2N7jVLOqf2j04dTc37TPOv/hHxZmvpg8Pdh8UYydxeu/C1W1U4vD8alzf5V2Gt7rLsmkr4dxAlDm9ng==", + "dev": true, + "requires": { + "inline-style-parser": "0.1.1" + } + }, "to-vfile": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-5.0.2.tgz", - "integrity": "sha512-Gp2q0HCUR+4At6c6mvFKug75NP/8Cu5r7ONvEcJJPBGiDT4HeLBrRnPKJbOe84nHJqYhIah2y367Tr2+IUkwMA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-6.1.0.tgz", + "integrity": "sha512-BxX8EkCxOAZe+D/ToHdDsJcVI4HqQfmw0tCkp31zf3dNP/XWIAjU4CmeuSwsSoOzOTqHPOL0KUzyZqJplkD0Qw==", + "dev": true, "requires": { "is-buffer": "^2.0.0", - "vfile": "^3.0.0" + "vfile": "^4.0.0" } }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" - }, - "trim-lines": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-1.1.1.tgz", - "integrity": "sha512-X+eloHbgJGxczUk1WSjIvn7aC9oN3jVE3rQfRVKcgpavi3jxtCn0VVKtjOBj64Yop96UYn/ujJRpTbCdAF1vyg==" + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", + "dev": true }, "trim-trailing-lines": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.1.tgz", - "integrity": "sha512-bWLv9BbWbbd7mlqqs2oQYnLD/U/ZqeJeJwbO0FG2zA1aTq+HTvxfHNKFa/HGCVyJpDiioUYaBhfiT6rgk+l4mg==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.3.tgz", + "integrity": "sha512-4ku0mmjXifQcTVfYDfR5lpgV7zVqPg6zV9rdZmwOPqq0+Zq19xDqEgagqVbc4pOOShbncuAOIs59R3+3gcF3ZA==", + "dev": true }, "trough": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.3.tgz", - "integrity": "sha512-fwkLWH+DimvA4YCy+/nvJd61nWQQ2liO/nF/RjkTpiOGi+zxZzVkhb1mvbHIIW4b/8nDsYI8uTmAlc0nNkRMOw==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "dev": true }, "unherit": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz", - "integrity": "sha512-+XZuV691Cn4zHsK0vkKYwBEwB74T3IZIcxrgn2E4rKwTfFyI1zCh7X7grwh9Re08fdPlarIdyWgI8aVB3F5A5g==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", + "dev": true, "requires": { - "inherits": "^2.0.1", - "xtend": "^4.0.1" + "inherits": "^2.0.0", + "xtend": "^4.0.0" } }, "unified": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-7.1.0.tgz", - "integrity": "sha512-lbk82UOIGuCEsZhPj8rNAkXSDXd6p0QLzIuSsCdxrqnqU56St4eyOB+AlXsVgVeRmetPTYydIuvFfpDIed8mqw==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.0.tgz", + "integrity": "sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==", + "dev": true, "requires": { - "@types/unist": "^2.0.0", - "@types/vfile": "^3.0.0", "bail": "^1.0.0", "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^2.0.0", "trough": "^1.0.0", - "vfile": "^3.0.0", - "x-is-string": "^0.1.0" + "vfile": "^4.0.0" } }, "unist-builder": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-1.0.2.tgz", - "integrity": "sha1-jDuZA+9kvPsRfdfPal2Y/Bs7J7Y=", - "requires": { - "object-assign": "^4.1.0" - } + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-2.0.3.tgz", + "integrity": "sha512-f98yt5pnlMWlzP539tPc4grGMsFaQQlP/vM396b00jngsiINumNmsY8rkXjfoi1c6QaM8nQ3vaGDuoKWbe/1Uw==", + "dev": true }, "unist-util-find": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-1.0.1.tgz", "integrity": "sha1-EGK7tpKMepfGrcibU3RdTEbCIqI=", + "dev": true, "requires": { "lodash.iteratee": "^4.5.0", "remark": "^5.0.1", "unist-util-visit": "^1.1.0" + }, + "dependencies": { + "unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "requires": { + "unist-util-is": "^3.0.0" + } + } } }, "unist-util-generated": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.2.tgz", - "integrity": "sha512-1HcwiEO62dr0XWGT+abVK4f0aAm8Ik8N08c5nAYVmuSxfvpA9rCcNyX/le8xXj1pJK5nBrGlZefeWB6bN8Pstw==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.5.tgz", + "integrity": "sha512-1TC+NxQa4N9pNdayCYA1EGUOCAO0Le3fVp7Jzns6lnua/mYgwHo0tz5WUAfrdpNch1RZLHc61VZ1SDgrtNXLSw==", + "dev": true }, "unist-util-is": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.2.tgz", - "integrity": "sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true }, "unist-util-position": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.1.tgz", - "integrity": "sha512-05QfJDPI7PE1BIUtAxeSV+cDx21xP7+tUZgSval5CA7tr0pHBwybF7OnEa1dOFqg6BfYH/qiMUnWwWj+Frhlww==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.1.0.tgz", + "integrity": "sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==", + "dev": true }, "unist-util-remove-position": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.2.tgz", - "integrity": "sha512-XxoNOBvq1WXRKXxgnSYbtCF76TJrRoe5++pD4cCBsssSiWSnPEktyFrFLE8LTk3JW5mt9hB0Sk5zn4x/JeWY7Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-2.0.1.tgz", + "integrity": "sha512-fDZsLYIe2uT+oGFnuZmy73K6ZxOPG/Qcm+w7jbEjaFcJgbQ6cqjs/eSPzXhsmGpAsWPkqZM9pYjww5QTn3LHMA==", + "dev": true, "requires": { - "unist-util-visit": "^1.1.0" + "unist-util-visit": "^2.0.0" } }, "unist-util-select": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-1.5.0.tgz", - "integrity": "sha1-qTwr6MD2U4J4A7gTMa3sKqJM2TM=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.1.tgz", + "integrity": "sha512-VQpTuqZVJlRbosQdnLdTPIIqwZeU70YZ5aMBOqtFNGeeCdYn6ORZt/9RiaVlbl06ocuf58SVMoFa7a13CSGPMA==", + "dev": true, "requires": { - "css-selector-parser": "^1.1.0", - "debug": "^2.2.0", - "nth-check": "^1.0.1" + "css-selector-parser": "^1.0.0", + "not": "^0.1.0", + "nth-check": "^1.0.0", + "unist-util-is": "^4.0.0", + "zwitch": "^1.0.0" + }, + "dependencies": { + "unist-util-is": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "dev": true + } } }, "unist-util-stringify-position": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", - "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "dev": true, + "requires": { + "@types/unist": "^2.0.2" + } }, "unist-util-visit": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.0.tgz", - "integrity": "sha512-FiGu34ziNsZA3ZUteZxSFaczIjGmksfSgdKqBfOejrrfzyUy5b7YrlzT1Bcvi+djkYDituJDy2XB7tGTeBieKw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "dev": true, "requires": { - "unist-util-visit-parents": "^2.0.0" + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "dependencies": { + "unist-util-is": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "dev": true + } } }, "unist-util-visit-parents": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz", - "integrity": "sha512-6B0UTiMfdWql4cQ03gDTCSns+64Zkfo2OCbK31Ov0uMizEz+CJeAp0cgZVb5Fhmcd7Bct2iRNywejT0orpbqUA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "dev": true, "requires": { - "unist-util-is": "^2.1.2" + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "dependencies": { + "unist-util-is": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "dev": true + } } }, "vfile": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz", - "integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.0.tgz", + "integrity": "sha512-a/alcwCvtuc8OX92rqqo7PflxiCgXRFjdyoGVuYV+qbgCb0GgZJRvIgCD4+U/Kl1yhaRsaTwksF88xbPyGsgpw==", + "dev": true, "requires": { + "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" + "unist-util-stringify-position": "^2.0.0", + "vfile-message": "^2.0.0" } }, "vfile-location": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.3.tgz", - "integrity": "sha512-zM5/l4lfw1CBoPx3Jimxoc5RNDAHHpk6AM6LM0pTIkm5SUSsx8ZekZ0PVdf0WEZ7kjlhSt7ZlqbRL6Cd6dBs6A==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", + "integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==", + "dev": true }, "vfile-message": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", - "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz", + "integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==", + "dev": true, "requires": { - "unist-util-stringify-position": "^1.1.1" + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" } }, "web-namespaces": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-1.1.2.tgz", - "integrity": "sha512-II+n2ms4mPxK+RnIxRPOw3zwF2jRscdJIUE9BfkKHm4FYEg9+biIoTMnaZF5MpemE3T+VhMLrhbyD4ilkPCSbg==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-1.1.4.tgz", + "integrity": "sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw==", + "dev": true }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "x-is-array": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/x-is-array/-/x-is-array-0.1.0.tgz", - "integrity": "sha1-3lIBcdR7P0FvVYfWKbidJrEtwp0=" - }, - "x-is-string": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", - "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true }, "zwitch": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.3.tgz", - "integrity": "sha512-aynRpmJDw7JIq6X4NDWJoiK1yVSiG57ArWSg4HLC1SFupX5/bo0Cf4jpX0ifwuzBfxpYBuNSyvMlWNNRuy3cVA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz", + "integrity": "sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==", + "dev": true } } } diff --git a/tools/doc/package.json b/tools/doc/package.json index 23178fcbc10635..e3e60831a85e57 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -6,21 +6,19 @@ "engines": { "node": ">=12.10.0" }, - "dependencies": { - "highlight.js": "^9.18.1", - "rehype-raw": "^2.0.0", - "rehype-stringify": "^3.0.0", - "remark-html": "^7.0.0", - "remark-parse": "^5.0.0", - "remark-rehype": "^3.0.0", - "to-vfile": "^5.0.1", - "unified": "^7.0.0", - "unist-util-find": "^1.0.1", - "unist-util-select": "^1.5.0", - "unist-util-visit": "^1.4.0" - }, "devDependencies": { - "js-yaml": "^3.13.1" + "highlight.js": "10.1.0", + "js-yaml": "3.14.0", + "rehype-raw": "4.0.2", + "rehype-stringify": "8.0.0", + "remark-html": "12.0.0", + "remark-parse": "8.0.3", + "remark-rehype": "7.0.0", + "to-vfile": "6.1.0", + "unified": "9.2.0", + "unist-util-find": "1.0.1", + "unist-util-select": "3.0.1", + "unist-util-visit": "2.0.3" }, "optionalDependencies": {}, "bin": "./generate.js" From f29717437f296cc45855edbfbeda1e0e47d24816 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 17 Sep 2020 18:53:37 +0200 Subject: [PATCH 047/117] tools,doc: enforce alphabetical order for md refs PR-URL: https://github.com/nodejs/node/pull/35244 Reviewed-By: Rich Trott Reviewed-By: Shelley Vohr --- doc/api/inspector.md | 4 ++-- doc/api/punycode.md | 2 +- doc/api/wasi.md | 2 +- doc/guides/backporting-to-release-lines.md | 2 +- doc/guides/collaborator-guide.md | 2 +- doc/guides/contributing/pull-requests.md | 8 ++++---- doc/guides/cpp-style-guide.md | 8 ++++---- doc/guides/maintaining-V8.md | 4 ++-- doc/guides/releases.md | 4 ++-- doc/guides/writing-and-running-benchmarks.md | 6 +++--- doc/guides/writing-tests.md | 4 ++-- onboarding.md | 4 ++-- src/README.md | 8 ++++---- test/wpt/README.md | 2 +- tools/doc/checkLinks.js | 21 +++++++++++++++++--- 15 files changed, 48 insertions(+), 33 deletions(-) diff --git a/doc/api/inspector.md b/doc/api/inspector.md index f541b9eb99fb68..7dc359a0185404 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -239,8 +239,8 @@ session.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => { }); ``` -[`'Debugger.paused'`]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused -[`session.connect()`]: #inspector_session_connect [CPU Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/Profiler [Chrome DevTools Protocol Viewer]: https://chromedevtools.github.io/devtools-protocol/v8/ [Heap Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/HeapProfiler +[`'Debugger.paused'`]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused +[`session.connect()`]: #inspector_session_connect diff --git a/doc/api/punycode.md b/doc/api/punycode.md index d19d79f8195a78..620585afa484c1 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -148,5 +148,5 @@ added: v0.6.1 Returns a string identifying the current [Punycode.js][] version number. -[Punycode.js]: https://github.com/bestiejs/punycode.js [Punycode]: https://tools.ietf.org/html/rfc3492 +[Punycode.js]: https://github.com/bestiejs/punycode.js diff --git a/doc/api/wasi.md b/doc/api/wasi.md index 09dc0671fd1bee..66aeebc6974000 100644 --- a/doc/api/wasi.md +++ b/doc/api/wasi.md @@ -154,6 +154,6 @@ added: v12.16.0 should be passed as the `wasi_snapshot_preview1` import during the instantiation of a [`WebAssembly.Instance`][]. +[WebAssembly System Interface]: https://wasi.dev/ [`WebAssembly.Instance`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance [`WebAssembly.Memory`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory -[WebAssembly System Interface]: https://wasi.dev/ diff --git a/doc/guides/backporting-to-release-lines.md b/doc/guides/backporting-to-release-lines.md index 5a96b160351700..90b4a3dcaf328c 100644 --- a/doc/guides/backporting-to-release-lines.md +++ b/doc/guides/backporting-to-release-lines.md @@ -89,6 +89,6 @@ replace that with the staging branch for the targeted release line. After the pull request lands, replace the `backport-requested-v10.x` label on the original pull request with `backported-to-v10.x`. -[Release Schedule]: https://github.com/nodejs/Release#release-schedule1 [Release Plan]: https://github.com/nodejs/Release#release-plan +[Release Schedule]: https://github.com/nodejs/Release#release-schedule1 [`node-test-pull-request`]: https://ci.nodejs.org/job/node-test-pull-request/build diff --git a/doc/guides/collaborator-guide.md b/doc/guides/collaborator-guide.md index 2867a83df177ce..6f408783449ae0 100644 --- a/doc/guides/collaborator-guide.md +++ b/doc/guides/collaborator-guide.md @@ -771,10 +771,10 @@ If you cannot find who to cc for a file, `git shortlog -n -s ` can help. [backporting guide]: backporting-to-release-lines.md [commit message guidelines]: contributing/pull-requests.md#commit-message-guidelines [commit-example]: https://github.com/nodejs/node/commit/b636ba8186 +[git-email]: https://help.github.com/articles/setting-your-commit-email-address-in-git/ [git-node]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md [git-node-metadata]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-metadata [git-username]: https://help.github.com/articles/setting-your-username-in-git/ -[git-email]: https://help.github.com/articles/setting-your-commit-email-address-in-git/ [node-core-utils-credentials]: https://github.com/nodejs/node-core-utils#setting-up-credentials [node-core-utils-issues]: https://github.com/nodejs/node-core-utils/issues [unreliable tests]: https://github.com/nodejs/node/issues?q=is%3Aopen+is%3Aissue+label%3A%22CI+%2F+flaky+test%22 diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index 18c84068380fa4..5cdf6e82f19ec4 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -593,15 +593,15 @@ widely used, so don't be discouraged! If you want to know more about the code review and the landing process, see the [Collaborator Guide][]. -[approved]: #getting-approvals-for-your-pull-request -[benchmark results]: ../writing-and-running-benchmarks.md [Building guide]: ../../../BUILDING.md [CI (Continuous Integration) test run]: #ci-testing [Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [Collaborator Guide]: ../collaborator-guide.md +[IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 +[Onboarding guide]: ../../../onboarding.md +[approved]: #getting-approvals-for-your-pull-request +[benchmark results]: ../writing-and-running-benchmarks.md [guide for writing tests in Node.js]: ../writing-tests.md [hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment [https://ci.nodejs.org/]: https://ci.nodejs.org/ -[IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 -[Onboarding guide]: ../../../onboarding.md [running tests]: ../../../BUILDING.md#running-tests diff --git a/doc/guides/cpp-style-guide.md b/doc/guides/cpp-style-guide.md index adf8f0481697f8..56f3f5b4c84094 100644 --- a/doc/guides/cpp-style-guide.md +++ b/doc/guides/cpp-style-guide.md @@ -392,15 +392,15 @@ Node.js is built [without C++ exception handling][], so code using `throw` or even `try` and `catch` **will** break. [C++ Core Guidelines]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines -[Google C++ Style Guide]: https://google.github.io/styleguide/cppguide.html -[Google’s `cpplint`]: https://github.com/google/styleguide -[errors]: https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md [ES.47]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-nullptr [ES.48]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts [ES.49]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts-named +[Google C++ Style Guide]: https://google.github.io/styleguide/cppguide.html +[Google’s `cpplint`]: https://github.com/google/styleguide [R.20]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-owner [R.21]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-unique [Run Time Type Information]: https://en.wikipedia.org/wiki/Run-time_type_information +[aliased_buffer.h]: https://github.com/nodejs/node/blob/master/src/aliased_buffer.h#L12 [cppref_auto_ptr]: https://en.cppreference.com/w/cpp/memory/auto_ptr +[errors]: https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md [without C++ exception handling]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html#intro.using.exception.no -[aliased_buffer.h]: https://github.com/nodejs/node/blob/master/src/aliased_buffer.h#L12 diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md index 867bb433be8087..f7e836194ae0e9 100644 --- a/doc/guides/maintaining-V8.md +++ b/doc/guides/maintaining-V8.md @@ -411,8 +411,8 @@ This would require some tooling to: as their support has ended. [ChromiumReleaseCalendar]: https://www.chromium.org/developers/calendar -[Node.js `canary` branch]: https://github.com/nodejs/node-v8/tree/canary [Node.js CI]: https://ci.nodejs.org/job/node-test-pull-request/ +[Node.js `canary` branch]: https://github.com/nodejs/node-v8/tree/canary [NodeJS-Backport-Approved-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Approved [NodeJS-Backport-Approved-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Approved [NodeJS-Backport-Done-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Done @@ -421,10 +421,10 @@ as their support has ended. [NodeJS-Backport-Rejected-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected [NodeJS-Backport-Review-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Review [NodeJS-Backport-Review-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Review -[`git-node`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-v8 [V8 CI]: https://ci.nodejs.org/job/node-test-commit-v8-linux/ [V8ActiveBranches]: https://build.chromium.org/p/client.v8.branches/console [V8Contributing]: https://github.com/v8/v8/wiki/Contributing [V8MergingPatching]: https://github.com/v8/v8/wiki/Merging%20&%20Patching [V8TemplateMergeRequest]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20merge%20request [V8TemplateUpstreamBug]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20upstream%20bug +[`git-node`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-v8 diff --git a/doc/guides/releases.md b/doc/guides/releases.md index c828a4b2826821..74884d45ebbe42 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -866,9 +866,9 @@ test, or doc-related are to be listed as notable changes. Some SEMVER-MINOR commits may be listed as notable changes on a case-by-case basis. Use your judgment there. -[CI lockdown procedure]: https://github.com/nodejs/build/blob/master/doc/jenkins-guide.md#restricting-access-for-security-releases [Build issue tracker]: https://github.com/nodejs/build/issues/new +[CI lockdown procedure]: https://github.com/nodejs/build/blob/master/doc/jenkins-guide.md#restricting-access-for-security-releases +[Partner Communities]: https://github.com/nodejs/community-committee/blob/master/governance/PARTNER_COMMUNITIES.md [nodejs.org release-post.js script]: https://github.com/nodejs/nodejs.org/blob/master/scripts/release-post.js [nodejs.org repository]: https://github.com/nodejs/nodejs.org -[Partner Communities]: https://github.com/nodejs/community-committee/blob/master/governance/PARTNER_COMMUNITIES.md [webchat.freenode.net]: https://webchat.freenode.net/ diff --git a/doc/guides/writing-and-running-benchmarks.md b/doc/guides/writing-and-running-benchmarks.md index 5f630ccc1f805d..b6b22d75c17e2c 100644 --- a/doc/guides/writing-and-running-benchmarks.md +++ b/doc/guides/writing-and-running-benchmarks.md @@ -551,8 +551,8 @@ Supported options keys are: benchmarker [autocannon]: https://github.com/mcollina/autocannon -[wrk]: https://github.com/wg/wrk -[t-test]: https://en.wikipedia.org/wiki/Student%27s_t-test#Equal_or_unequal_sample_sizes.2C_unequal_variances +[benchmark-ci]: https://github.com/nodejs/benchmarking/blob/master/docs/core_benchmarks.md [git-for-windows]: https://git-scm.com/download/win [nghttp2.org]: https://nghttp2.org -[benchmark-ci]: https://github.com/nodejs/benchmarking/blob/master/docs/core_benchmarks.md +[t-test]: https://en.wikipedia.org/wiki/Student%27s_t-test#Equal_or_unequal_sample_sizes.2C_unequal_variances +[wrk]: https://github.com/wg/wrk diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 0aa4cb8221f278..b7d92709444678 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -434,9 +434,9 @@ Nightly coverage reports for the Node.js master branch are available at [ASCII]: https://man7.org/linux/man-pages/man7/ascii.7.html [Google Test]: https://github.com/google/googletest +[Test Coverage section of the Building guide]: https://github.com/nodejs/node/blob/master/BUILDING.md#running-coverage [`common` module]: https://github.com/nodejs/node/blob/master/test/common/README.md [all maintained branches]: https://github.com/nodejs/lts +[directory structure overview]: https://github.com/nodejs/node/blob/master/test/README.md#test-directories [node.green]: https://node.green/ [test fixture]: https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#test-fixtures-using-the-same-data-configuration-for-multiple-tests -[Test Coverage section of the Building guide]: https://github.com/nodejs/node/blob/master/BUILDING.md#running-coverage -[directory structure overview]: https://github.com/nodejs/node/blob/master/test/README.md#test-directories diff --git a/onboarding.md b/onboarding.md index ce176be9a6ab67..8036e459f5122a 100644 --- a/onboarding.md +++ b/onboarding.md @@ -245,12 +245,12 @@ needs to be pointed out separately during the onboarding. the [summit](https://github.com/nodejs/summit) repository for details. [Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md +[Landing Pull Requests]: doc/guides/collaborator-guide.md#landing-pull-requests +[Publicizing or hiding organization membership]: https://help.github.com/articles/publicizing-or-hiding-organization-membership/ [`author-ready`]: doc/guides/collaborator-guide.md#author-ready-pull-requests [`core-validate-commit`]: https://github.com/nodejs/core-validate-commit [`git-node`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md [`node-core-utils`]: https://github.com/nodejs/node-core-utils -[Landing Pull Requests]: doc/guides/collaborator-guide.md#landing-pull-requests -[Publicizing or hiding organization membership]: https://help.github.com/articles/publicizing-or-hiding-organization-membership/ [set up the credentials]: https://github.com/nodejs/node-core-utils#setting-up-credentials [two-factor authentication]: https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/ [using a TOTP mobile app]: https://help.github.com/articles/configuring-two-factor-authentication-via-a-totp-mobile-app/ diff --git a/src/README.md b/src/README.md index 449c207ba9a17c..5ca45fbdbf5911 100644 --- a/src/README.md +++ b/src/README.md @@ -881,6 +881,10 @@ static void GetUserInfo(const FunctionCallbackInfo& args) { } ``` +[C++ coding style]: ../doc/guides/cpp-style-guide.md +[Callback scopes]: #callback-scopes +[JavaScript value handles]: #js-handles +[N-API]: https://nodejs.org/api/n-api.html [`BaseObject`]: #baseobject [`Context`]: #context [`Environment`]: #environment @@ -903,10 +907,6 @@ static void GetUserInfo(const FunctionCallbackInfo& args) { [`v8.h` in Node.js master]: https://github.com/nodejs/node/blob/master/deps/v8/include/v8.h [`v8.h` in V8 master]: https://github.com/v8/v8/blob/master/include/v8.h [`vm` module]: https://nodejs.org/api/vm.html -[C++ coding style]: ../doc/guides/cpp-style-guide.md -[Callback scopes]: #callback-scopes -[JavaScript value handles]: #js-handles -[N-API]: https://nodejs.org/api/n-api.html [binding function]: #binding-functions [cleanup hooks]: #cleanup-hooks [event loop]: #event-loop diff --git a/test/wpt/README.md b/test/wpt/README.md index d2a47737b0367b..ec30c2176849a7 100644 --- a/test/wpt/README.md +++ b/test/wpt/README.md @@ -164,5 +164,5 @@ Web API, or certain harness has not been ported in our test runner yet. In that case it needs to be marked with `skip` instead of `fail`. [Web Platform Tests]: https://github.com/web-platform-tests/wpt -[git node wpt]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt [`test/fixtures/wpt/README.md`]: ../fixtures/wpt/README.md +[git node wpt]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt diff --git a/tools/doc/checkLinks.js b/tools/doc/checkLinks.js index eea9af4cc9cfc9..97210ca03076e4 100644 --- a/tools/doc/checkLinks.js +++ b/tools/doc/checkLinks.js @@ -27,11 +27,12 @@ function findMarkdownFilesRecursively(dirPath) { if ( entry.isDirectory() && entry.name !== 'api' && - entry.name !== 'tmp' && - entry.name !== 'fixtures' && entry.name !== 'changelogs' && entry.name !== 'deps' && - entry.name !== 'node_modules' + entry.name !== 'fixtures' && + entry.name !== 'node_modules' && + entry.name !== 'out' && + entry.name !== 'tmp' ) { findMarkdownFilesRecursively(path); } else if (entry.isFile() && extname(entry.name) === '.md') { @@ -46,6 +47,7 @@ function checkFile(path) { .parse(fs.readFileSync(path)); const base = pathToFileURL(path); + let previousDefinitionLabel; for (const node of getLinksRecursively(tree)) { const targetURL = new URL(node.url, base); if (targetURL.protocol === 'file:' && !fs.existsSync(targetURL)) { @@ -55,5 +57,18 @@ function checkFile(path) { `Broken link at ${path}:${line}:${column} (${node.url})`); process.exitCode = 1; } + if (node.type === 'definition') { + if (previousDefinitionLabel && + previousDefinitionLabel > node.label) { + const { line, column } = node.position.start; + console.error((process.env.GITHUB_ACTIONS ? + `::error file=${path},line=${line},col=${column}::` : '') + + `Unordered reference at ${path}:${line}:${column} (` + + `"${node.label}" should be before "${previousDefinitionLabel})"` + ); + process.exitCode = 1; + } + previousDefinitionLabel = node.label; + } } } From bc7da0c22c0ae1e823481990490e2aea00c5a8eb Mon Sep 17 00:00:00 2001 From: Ash Cripps Date: Wed, 23 Sep 2020 11:35:40 +0100 Subject: [PATCH 048/117] tools: ignore build folder when checking links We checkout build as a subdirectory as part of CI and if you run `make test` instead of `make test-ci` you get loads of errors about markdown link breaks. Ignore this directory as we don't need to examine another repo PR-URL: https://github.com/nodejs/node/pull/35315 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- tools/doc/checkLinks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/doc/checkLinks.js b/tools/doc/checkLinks.js index 97210ca03076e4..f3415f521cc6d5 100644 --- a/tools/doc/checkLinks.js +++ b/tools/doc/checkLinks.js @@ -27,6 +27,7 @@ function findMarkdownFilesRecursively(dirPath) { if ( entry.isDirectory() && entry.name !== 'api' && + entry.name !== 'build' && entry.name !== 'changelogs' && entry.name !== 'deps' && entry.name !== 'fixtures' && From cc11464b4e9f6b37aacd66b58fa399e7c30d350c Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 Sep 2020 21:27:13 -0700 Subject: [PATCH 049/117] deps: upgrade to c-ares v1.16.1 PR-URL: https://github.com/nodejs/node/pull/35324 Refs: https://github.com/c-ares/c-ares/releases/tag/cares-1_16_1 Reviewed-By: Jiawen Geng Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- deps/cares/include/ares_version.h | 4 +- deps/cares/src/RELEASE-NOTES | 99 ++++++-------------------- deps/cares/src/ares_getaddrinfo.c | 13 ++-- deps/cares/src/ares_getnameinfo.c | 4 +- deps/cares/src/ares_parse_a_reply.c | 4 +- deps/cares/src/ares_parse_aaaa_reply.c | 4 +- deps/cares/src/ares_parse_txt_reply.c | 2 +- deps/cares/src/ares_private.h | 5 ++ deps/cares/src/ares_process.c | 4 +- 9 files changed, 45 insertions(+), 94 deletions(-) diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 7758a48148a804..c041d574dee09e 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -7,11 +7,11 @@ #define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MINOR 16 -#define ARES_VERSION_PATCH 0 +#define ARES_VERSION_PATCH 1 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.16.0" +#define ARES_VERSION_STR "1.16.1" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/deps/cares/src/RELEASE-NOTES b/deps/cares/src/RELEASE-NOTES index 0d8573ae8dd933..7a9d75fe788e84 100644 --- a/deps/cares/src/RELEASE-NOTES +++ b/deps/cares/src/RELEASE-NOTES @@ -1,85 +1,30 @@ -c-ares version 1.16.0 +c-ares version 1.16.1 + +Security: + o Prevent possible use-after-free and double-free in ares_getaddrinfo() if + ares_destroy() is called prior to ares_getaddrinfo() completing. Reported + by Jann Horn at Google Project Zero. Changes: - o Introduction of ares_getaddrinfo() API which provides similar output - (including proper sorting as per RFC 6724) to the system native API, but - utilizes different data structures in order to provide additional information - such as TTLs and all aliases. Please reference the respective man pages for - usage details. [3] [4] [5] [7] [8] [13] [14] [15] [16] [17] [22] - o Parse SOA records from ns_t_any response [29] [30] - o CMake: Provide c-ares version in package export file [24] - o CMake: Add CPACK functionality for DEB and RPM [28] - o CMake: Generate PDB files during build [33] [34] - o CMake: Support manpage installation [37] [38] + o Allow TXT records on CHAOS qclass. Used for retriving things like + version.bind, version.server, authoris.bind, hostname.bind, and id.server. + [3] Bug fixes: - o Fix bad expectation in IPv6 localhost test. [1] [2] - o AutoTools: use XC_CHECK_BUILD_FLAGS instead of XC_CHECK_USER_FLAGS to prevent - complaints about CPPFLAGS in CFLAGS. [6] - o Fix .onion handling - o Command line usage was out of date for adig and ahost. [18] - o Typos in manpages [19] [20] - o If ares_getenv is defined, it must return a value on all platforms [21] - o If /etc/resolv.conf has invalid lookup values, use the defaults. [23] - o Tests: Separate live tests from SetServers* tests as only live tests should - require internet access. [25] - o ares_gethostbyname() should return ENODATA if no valid A or AAAA record is - found, but a CNAME was found. [26] [27] - o CMake: Rework library function checking to prevent unintended linking with - system libraries that aren't needed. [31] [32] - o Due to use of inet_addr() it was not possible to return 255.255.255.255 from - ares_gethostbyname(). [35] [36] - o CMake: Fix building of tests on Windows + o Fix Windows Unicode incompatibilities with ares_getaddrinfo() [1] + o Silence false cast-align compiler warnings due to valid casts of + struct sockaddr to struct sockaddr_in and struct sockaddr_in6. + o MacOS should use libresolv for retrieving DNS servers, like iOS + o CMake build system should populate the INCLUDE_DIRECTORIES property of + installed targets [2] + o Correct macros in use for the ares_getaddrinfo.3 man page Thanks go to these friendly people for their efforts and contributions: - Abhishek Arya (@inferno-chromium), Adam Majer (@AdamMajer), - Andrew Selivanov (@ki11roy), Ben Noordhuis (@bnoordhuis), - Brad House (@bradh352), Christian Ammer (@ChristianAmmer), Dan Noé (@dnoe), - Daniel Stenberg (@bagder), Darrin Cullop (@dwcullop), - Dron Rathore (@DronRathore), Fabrice Fontaine (@ffontaine), - Gregor Jasny (@gjasny), @kedixa, Khaidi Chu (@XadillaX), - Kyle Edwards (@KyleFromKitware), @lifenjoiner, Michal Rostecki (@mrostecki), - Peter Eisentraut (@petere), Piotr Pietraszkiewicz (@ppietrasa), - Stephen Bryant (@bf-bryants), @tjwalton, Vy Nguyen (@oontvoo) - (22 contributors) + Brad House (@bradh352), Daniel Stenberg (@bagder), Dmitry Igrishin (@dmitigr), + Jann Horn, Shelly Vohr, Teemu R (@rytilahti) + (6 contributors) References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/pull/227 - [2] = https://github.com/c-ares/c-ares/issues/85 - [3] = https://github.com/c-ares/c-ares/pull/112 - [4] = https://github.com/c-ares/c-ares/pull/233 - [5] = https://github.com/c-ares/c-ares/pull/234 - [6] = https://github.com/c-ares/c-ares/pull/236 - [7] = https://github.com/c-ares/c-ares/pull/235 - [8] = https://github.com/c-ares/c-ares/pull/239 - [9] = https://github.com/c-ares/c-ares/pull/241 - [10] = https://github.com/c-ares/c-ares/pull/187 - [11] = https://github.com/c-ares/c-ares/pull/252 - [12] = https://github.com/c-ares/c-ares/issues/251 - [13] = https://github.com/c-ares/c-ares/pull/258 - [14] = https://github.com/c-ares/c-ares/pull/257 - [15] = https://github.com/c-ares/c-ares/pull/262 - [16] = https://github.com/c-ares/c-ares/pull/264 - [17] = https://github.com/c-ares/c-ares/pull/265 - [18] = https://github.com/c-ares/c-ares/pull/256 - [19] = https://github.com/c-ares/c-ares/pull/269 - [20] = https://github.com/c-ares/c-ares/pull/275 - [21] = https://github.com/c-ares/c-ares/pull/279 - [22] = https://github.com/c-ares/c-ares/pull/290 - [23] = https://github.com/c-ares/c-ares/pull/274 - [24] = https://github.com/c-ares/c-ares/pull/296 - [25] = https://github.com/c-ares/c-ares/pull/299 - [26] = https://github.com/c-ares/c-ares/pull/304 - [27] = https://github.com/c-ares/c-ares/issues/303 - [28] = https://github.com/c-ares/c-ares/pull/283 - [29] = https://github.com/c-ares/c-ares/pull/103 - [30] = https://github.com/c-ares/c-ares/issues/102 - [31] = https://github.com/c-ares/c-ares/pull/310 - [32] = https://github.com/c-ares/c-ares/issues/307 - [33] = https://github.com/c-ares/c-ares/pull/311 - [34] = https://github.com/c-ares/c-ares/issues/245 - [35] = https://github.com/c-ares/c-ares/issues/309 - [36] = https://github.com/c-ares/c-ares/pull/312 - [37] = https://github.com/c-ares/c-ares/issues/297 - [38] = https://github.com/c-ares/c-ares/pull/314 - + [1] = https://github.com/c-ares/c-ares/pull/328 + [2] = https://github.com/c-ares/c-ares/pull/323 + [3] = https://github.com/c-ares/c-ares/pull/321 diff --git a/deps/cares/src/ares_getaddrinfo.c b/deps/cares/src/ares_getaddrinfo.c index 8265e4afc20f60..be168068b1d424 100644 --- a/deps/cares/src/ares_getaddrinfo.c +++ b/deps/cares/src/ares_getaddrinfo.c @@ -408,11 +408,11 @@ static void end_hquery(struct host_query *hquery, int status) { if (next->ai_family == AF_INET) { - ((struct sockaddr_in *)next->ai_addr)->sin_port = htons(hquery->port); + (CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port); } else { - ((struct sockaddr_in6 *)next->ai_addr)->sin6_port = htons(hquery->port); + (CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr))->sin6_port = htons(hquery->port); } next = next->ai_next; } @@ -456,18 +456,18 @@ static int file_lookup(struct host_query *hquery) char tmp[MAX_PATH]; HKEY hkeyHosts; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts) == ERROR_SUCCESS) { DWORD dwLength = MAX_PATH; - RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, + RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, &dwLength); - ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); + ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); RegCloseKey(hkeyHosts); } } else if (platform == WIN_9X) - GetWindowsDirectory(PATH_HOSTS, MAX_PATH); + GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); else return ARES_ENOTFOUND; @@ -548,6 +548,7 @@ static void host_callback(void *arg, int status, int timeouts, else if (status == ARES_EDESTRUCTION) { end_hquery(hquery, status); + return; } if (!hquery->remaining) diff --git a/deps/cares/src/ares_getnameinfo.c b/deps/cares/src/ares_getnameinfo.c index aa089417060fec..53f91ca8459fc1 100644 --- a/deps/cares/src/ares_getnameinfo.c +++ b/deps/cares/src/ares_getnameinfo.c @@ -92,13 +92,13 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, if ((sa->sa_family == AF_INET) && (salen == sizeof(struct sockaddr_in))) { - addr = (struct sockaddr_in *)sa; + addr = CARES_INADDR_CAST(struct sockaddr_in *, sa); port = addr->sin_port; } else if ((sa->sa_family == AF_INET6) && (salen == sizeof(struct sockaddr_in6))) { - addr6 = (struct sockaddr_in6 *)sa; + addr6 = CARES_INADDR_CAST(struct sockaddr_in6 *, sa); port = addr6->sin6_port; } else diff --git a/deps/cares/src/ares_parse_a_reply.c b/deps/cares/src/ares_parse_a_reply.c index f5e4f4fbde7754..e71c993f8de691 100644 --- a/deps/cares/src/ares_parse_a_reply.c +++ b/deps/cares/src/ares_parse_a_reply.c @@ -163,7 +163,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, { hostent->h_addr_list[i] = (char *)&addrs[i]; memcpy(hostent->h_addr_list[i], - &(((struct sockaddr_in *)next->ai_addr)->sin_addr), + &(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr), sizeof(struct in_addr)); if (naddrttls && i < *naddrttls) { @@ -173,7 +173,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, addrttls[i].ttl = next->ai_ttl; memcpy(&addrttls[i].ipaddr, - &(((struct sockaddr_in *)next->ai_addr)->sin_addr), + &(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr), sizeof(struct in_addr)); } ++i; diff --git a/deps/cares/src/ares_parse_aaaa_reply.c b/deps/cares/src/ares_parse_aaaa_reply.c index 41058bf4a6af87..346d430750beab 100644 --- a/deps/cares/src/ares_parse_aaaa_reply.c +++ b/deps/cares/src/ares_parse_aaaa_reply.c @@ -165,7 +165,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, { hostent->h_addr_list[i] = (char*)&addrs[i]; memcpy(hostent->h_addr_list[i], - &(((struct sockaddr_in6 *)next->ai_addr)->sin6_addr), + &(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr), sizeof(struct ares_in6_addr)); if (naddrttls && i < *naddrttls) { @@ -175,7 +175,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, addrttls[i].ttl = next->ai_ttl; memcpy(&addrttls[i].ip6addr, - &(((struct sockaddr_in6 *)next->ai_addr)->sin6_addr), + &(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr), sizeof(struct ares_in6_addr)); } ++i; diff --git a/deps/cares/src/ares_parse_txt_reply.c b/deps/cares/src/ares_parse_txt_reply.c index 4856b4cea31f9f..3f47e23f08637f 100644 --- a/deps/cares/src/ares_parse_txt_reply.c +++ b/deps/cares/src/ares_parse_txt_reply.c @@ -113,7 +113,7 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, } /* Check if we are really looking at a TXT record */ - if (rr_class == C_IN && rr_type == T_TXT) + if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_TXT) { /* * There may be multiple substrings in a single TXT record. Each diff --git a/deps/cares/src/ares_private.h b/deps/cares/src/ares_private.h index 2ee54e5ecd8e21..1884c1659681c1 100644 --- a/deps/cares/src/ares_private.h +++ b/deps/cares/src/ares_private.h @@ -50,6 +50,11 @@ #define STATIC_TESTABLE static #endif +/* By using a double cast, we can get rid of the bogus warning of + * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' increases required alignment from 1 to 4 [-Wcast-align] + */ +#define CARES_INADDR_CAST(type, var) ((type)((void *)var)) + #if defined(WIN32) && !defined(WATT32) #define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" diff --git a/deps/cares/src/ares_process.c b/deps/cares/src/ares_process.c index c86d3f2026b20b..ff71f66a1ecce0 100644 --- a/deps/cares/src/ares_process.c +++ b/deps/cares/src/ares_process.c @@ -1337,13 +1337,13 @@ static int same_address(struct sockaddr *sa, struct ares_addr *aa) { case AF_INET: addr1 = &aa->addrV4; - addr2 = &((struct sockaddr_in *)sa)->sin_addr; + addr2 = &(CARES_INADDR_CAST(struct sockaddr_in *, sa))->sin_addr; if (memcmp(addr1, addr2, sizeof(aa->addrV4)) == 0) return 1; /* match */ break; case AF_INET6: addr1 = &aa->addrV6; - addr2 = &((struct sockaddr_in6 *)sa)->sin6_addr; + addr2 = &(CARES_INADDR_CAST(struct sockaddr_in6 *, sa))->sin6_addr; if (memcmp(addr1, addr2, sizeof(aa->addrV6)) == 0) return 1; /* match */ break; From b0e43c718c89fd69d3822cb02060e59c546975e7 Mon Sep 17 00:00:00 2001 From: Danielle Adams Date: Tue, 22 Sep 2020 12:39:26 -0400 Subject: [PATCH 050/117] doc: add gpg key export directions to releases doc Adds an extra step with instructions for exporting a gpg key to be uploaded to the key server. PR-URL: https://github.com/nodejs/node/pull/35298 Reviewed-By: Richard Lau Reviewed-By: Beth Griggs Reviewed-By: Rich Trott --- doc/guides/releases.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/guides/releases.md b/doc/guides/releases.md index 74884d45ebbe42..c07fcbf5a82b8b 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -92,8 +92,14 @@ signed by someone who has been authorized to create a release. The GPG keys should be fetchable from a known third-party keyserver. The SKS Keyservers at are recommended. Use the -[submission](https://pgp.mit.edu/) form to submit a new GPG key. Keys should be -fetchable via: +[submission](https://pgp.mit.edu/) form to submit a new GPG key. You'll need to +do an ASCII-armored export of your key first: + +```console +$ gpg --armor --export email@server.com > ~/nodekey.asc +``` + +Keys should be fetchable via: ```console $ gpg --keyserver pool.sks-keyservers.net --recv-keys From cf07a8695a2b03489eaeea9cd84b72083dcb6182 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 24 Sep 2020 20:47:14 -0400 Subject: [PATCH 051/117] deps: upgrade to libuv 1.40.0 Notable changes: - The UV_UDP_MMSG_FREE flag has been added. - UV__EPROTO has been remapped from 4046 to -4046 for consistency with other error codes. - On Windows, UTF-16 surrogate pairs are no longer replaced with the Unicode replacement character. - uv_timer_get_due_in() has been added. PR-URL: https://github.com/nodejs/node/pull/35333 Reviewed-By: Richard Lau Reviewed-By: Trivikram Kamat Reviewed-By: Jiawen Geng --- deps/uv/AUTHORS | 5 + deps/uv/CMakeLists.txt | 29 ++++- deps/uv/ChangeLog | 35 ++++++ deps/uv/configure.ac | 2 +- deps/uv/docs/src/loop.rst | 2 + deps/uv/docs/src/metrics.rst | 2 + deps/uv/docs/src/timer.rst | 7 ++ deps/uv/docs/src/udp.rst | 14 ++- deps/uv/include/uv.h | 7 ++ deps/uv/include/uv/errno.h | 2 +- deps/uv/include/uv/unix.h | 2 + deps/uv/include/uv/version.h | 2 +- deps/uv/libuv-static.pc.in | 12 +++ deps/uv/src/random.c | 2 +- deps/uv/src/timer.c | 8 ++ deps/uv/src/unix/bsd-ifaddrs.c | 4 +- deps/uv/src/unix/freebsd.c | 41 +------ deps/uv/src/unix/fs.c | 19 +++- deps/uv/src/unix/internal.h | 11 +- deps/uv/src/unix/linux-core.c | 1 + deps/uv/src/unix/linux-syscalls.c | 56 +++++++--- deps/uv/src/unix/qnx.c | 137 ++++++++++++++++++++++++ deps/uv/src/unix/udp.c | 36 ++++--- deps/uv/src/win/tty.c | 13 ++- deps/uv/src/win/udp.c | 4 +- deps/uv/test/test-dlerror.c | 4 +- deps/uv/test/test-fs-copyfile.c | 2 +- deps/uv/test/test-tcp-connect-timeout.c | 4 +- deps/uv/test/test-timer.c | 4 + deps/uv/test/test-udp-connect.c | 11 ++ deps/uv/test/test-udp-mmsg.c | 26 +++-- 31 files changed, 390 insertions(+), 114 deletions(-) create mode 100644 deps/uv/libuv-static.pc.in create mode 100644 deps/uv/src/unix/qnx.c diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 9078925bb07669..e7c789cfd1b81f 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -443,3 +443,8 @@ escherstair Evan Lucas tjarlama <59913901+tjarlama@users.noreply.github.com> 司徒玟琅 +YuMeiJie +Aleksej Lebedev +Nikolay Mitev +Ulrik Strid +Elad Lahav diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index e9bf77f7c36de0..e648b00be6432f 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -146,7 +146,7 @@ if(WIN32) list(APPEND uv_test_sources src/win/snprintf.c test/runner-win.c) else() list(APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE) - if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390") + if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390|QNX") # TODO: This should be replaced with find_package(Threads) if possible # Android has pthread as part of its c library, not as a separate # libpthread.so. @@ -298,6 +298,30 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") list(APPEND uv_sources src/unix/no-proctitle.c src/unix/sunos.c) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Haiku") + list(APPEND uv_defines _BSD_SOURCE) + list(APPEND uv_libraries bsd network) + list(APPEND uv_sources + src/unix/haiku.c + src/unix/bsd-ifaddrs.c + src/unix/no-fsevents.c + src/unix/no-proctitle.c + src/unix/posix-hrtime.c + src/unix/posix-poll.c) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "QNX") + list(APPEND uv_sources + src/unix/posix-hrtime.c + src/unix/posix-poll.c + src/unix/qnx.c + src/unix/bsd-ifaddrs.c + src/unix/no-proctitle.c + src/unix/no-fsevents.c) + list(APPEND uv_cflags -fno-strict-aliasing) + list(APPEND uv_libraries socket) +endif() + if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") list(APPEND uv_test_libraries util) endif() @@ -568,10 +592,11 @@ if(UNIX OR MINGW) set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) set(prefix ${CMAKE_INSTALL_PREFIX}) configure_file(libuv.pc.in libuv.pc @ONLY) + configure_file(libuv-static.pc.in libuv-static.pc @ONLY) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) - install(FILES ${PROJECT_BINARY_DIR}/libuv.pc + install(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 06509e7d15857d..055dcaf9f18b4e 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,38 @@ +2020.09.26, Version 1.40.0 (Stable), 4e69e333252693bd82d6338d6124f0416538dbfc + +Changes since version 1.39.0: + +* udp: add UV_UDP_MMSG_FREE recv_cb flag (Ryan Liptak) + +* include: re-map UV__EPROTO from 4046 to -4046 (YuMeiJie) + +* doc: correct UV_UDP_MMSG_FREE version added (cjihrig) + +* doc: add uv_metrics_idle_time() version metadata (Ryan Liptak) + +* win,tty: pass through utf-16 surrogate pairs (Mustafa M) + +* unix: fix DragonFly BSD build (Aleksej Lebedev) + +* win,udp: fix error code returned by connect() (Santiago Gimeno) + +* src: suppress user_timeout maybe-uninitialized (Daniel Bevenius) + +* test: fix compiler warning (Vladimír Čunát) + +* build: fix the Haiku cmake build (David Carlier) + +* linux: fix i386 sendmmsg/recvmmsg support (Ben Noordhuis) + +* build: add libuv-static pkg-config file (Nikolay Mitev) + +* unix,win: add uv_timer_get_due_in() (Ulrik Strid) + +* build,unix: add QNX support (Elad Lahav) + +* include: remove incorrect UV__ERR() for EPROTO (cjihrig) + + 2020.08.26, Version 1.39.0 (Stable), 25f4b8b8a3c0f934158cd37a37b0525d75ca488e Changes since version 1.38.1: diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index 8f5c89b1a99ffb..1a66b74d28357a 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.39.0], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.40.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/loop.rst b/deps/uv/docs/src/loop.rst index f9ebb9d4a4f0c2..0f5ddfb3ca21b7 100644 --- a/deps/uv/docs/src/loop.rst +++ b/deps/uv/docs/src/loop.rst @@ -73,6 +73,8 @@ API This option is necessary to use :c:func:`uv_metrics_idle_time`. + .. versionchanged:: 1.39.0 added the UV_METRICS_IDLE_TIME option. + .. 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 index 223f7feb8fdfee..696c620d192f36 100644 --- a/deps/uv/docs/src/metrics.rst +++ b/deps/uv/docs/src/metrics.rst @@ -23,3 +23,5 @@ API 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`. + + .. versionadded:: 1.39.0 diff --git a/deps/uv/docs/src/timer.rst b/deps/uv/docs/src/timer.rst index e163e288fdb275..070fa79da9d6df 100644 --- a/deps/uv/docs/src/timer.rst +++ b/deps/uv/docs/src/timer.rst @@ -78,4 +78,11 @@ API Get the timer repeat value. +.. c:function:: uint64_t uv_timer_get_due_in(const uv_timer_t* handle) + + Get the timer due value or 0 if it has expired. The time is relative to + :c:func:`uv_now()`. + + .. versionadded:: 1.40.0 + .. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/deps/uv/docs/src/udp.rst b/deps/uv/docs/src/udp.rst index aed7ce22716557..30aa4593f01936 100644 --- a/deps/uv/docs/src/udp.rst +++ b/deps/uv/docs/src/udp.rst @@ -47,6 +47,12 @@ Data types * must not be freed by the recv_cb callback. */ UV_UDP_MMSG_CHUNK = 8, + /* + * Indicates that the buffer provided has been fully utilized by recvmmsg and + * that it should now be freed by the recv_cb callback. When this flag is set + * in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL. + */ + UV_UDP_MMSG_FREE = 16, /* * Indicates that recvmmsg should be used, if available. */ @@ -80,8 +86,10 @@ Data types When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set, those must not be freed. There will be a final callback with `nread` set to 0, `addr` set to NULL and the buffer pointing at the initially allocated data with - the `UV_UDP_MMSG_CHUNK` flag cleared. This is a good chance for the callee to - free the provided buffer. + the `UV_UDP_MMSG_CHUNK` flag cleared and the `UV_UDP_MMSG_FREE` flag set. + The callee can now safely free the provided buffer. + + .. versionchanged:: 1.40.0 added the `UV_UDP_MMSG_FREE` flag. .. note:: The receive callback will be called with `nread` == 0 and `addr` == NULL when there is @@ -392,7 +400,7 @@ API 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 + 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) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 06b6d001040e04..2557961eedba7f 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -614,6 +614,12 @@ enum uv_udp_flags { * must not be freed by the recv_cb callback. */ UV_UDP_MMSG_CHUNK = 8, + /* + * Indicates that the buffer provided has been fully utilized by recvmmsg and + * that it should now be freed by the recv_cb callback. When this flag is set + * in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL. + */ + UV_UDP_MMSG_FREE = 16, /* * Indicates that recvmmsg should be used, if available. @@ -865,6 +871,7 @@ UV_EXTERN int uv_timer_stop(uv_timer_t* handle); UV_EXTERN int uv_timer_again(uv_timer_t* handle); UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); +UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle); /* diff --git a/deps/uv/include/uv/errno.h b/deps/uv/include/uv/errno.h index 165fd11c376a1c..aadce9c14c9a6c 100644 --- a/deps/uv/include/uv/errno.h +++ b/deps/uv/include/uv/errno.h @@ -317,7 +317,7 @@ #if defined(EPROTO) && !defined(_WIN32) # define UV__EPROTO UV__ERR(EPROTO) #else -# define UV__EPROTO UV__ERR(4046) +# define UV__EPROTO (-4046) #endif #if defined(EPROTONOSUPPORT) && !defined(_WIN32) diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h index 3a131638f77606..e3cf7bdd4efd82 100644 --- a/deps/uv/include/uv/unix.h +++ b/deps/uv/include/uv/unix.h @@ -69,6 +69,8 @@ # include "uv/posix.h" #elif defined(__HAIKU__) # include "uv/posix.h" +#elif defined(__QNX__) +# include "uv/posix.h" #endif #ifndef NI_MAXHOST diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index 3219e9637f4510..5272008a3434b5 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,7 +31,7 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 39 +#define UV_VERSION_MINOR 40 #define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/libuv-static.pc.in b/deps/uv/libuv-static.pc.in new file mode 100644 index 00000000000000..ea625482d5ebd4 --- /dev/null +++ b/deps/uv/libuv-static.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +includedir=@includedir@ + +Name: libuv-static +Version: @PACKAGE_VERSION@ +Description: multi-platform support library with a focus on asynchronous I/O. +URL: http://libuv.org/ + +Libs: -L${libdir} -luv_a @LIBS@ +Cflags: -I${includedir} diff --git a/deps/uv/src/random.c b/deps/uv/src/random.c index 491bf703309955..e75f77deb2bdaf 100644 --- a/deps/uv/src/random.c +++ b/deps/uv/src/random.c @@ -33,7 +33,7 @@ static int uv__random(void* buf, size_t buflen) { #if defined(__PASE__) rc = uv__random_readpath("/dev/urandom", buf, buflen); -#elif defined(_AIX) +#elif defined(_AIX) || defined(__QNX__) rc = uv__random_readpath("/dev/random", buf, buflen); #elif defined(__APPLE__) || defined(__OpenBSD__) || \ (defined(__ANDROID_API__) && __ANDROID_API__ >= 28) diff --git a/deps/uv/src/timer.c b/deps/uv/src/timer.c index 4cf4ed42648650..1bea2a8bd29cdf 100644 --- a/deps/uv/src/timer.c +++ b/deps/uv/src/timer.c @@ -130,6 +130,14 @@ uint64_t uv_timer_get_repeat(const uv_timer_t* handle) { } +uint64_t uv_timer_get_due_in(const uv_timer_t* handle) { + if (handle->loop->time >= handle->timeout) + return 0; + + return handle->timeout - handle->loop->time; +} + + int uv__next_timeout(const uv_loop_t* loop) { const struct heap_node* heap_node; const uv_timer_t* handle; diff --git a/deps/uv/src/unix/bsd-ifaddrs.c b/deps/uv/src/unix/bsd-ifaddrs.c index a3385af17c889f..5223ab4879677e 100644 --- a/deps/uv/src/unix/bsd-ifaddrs.c +++ b/deps/uv/src/unix/bsd-ifaddrs.c @@ -113,7 +113,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); } - if (ent->ifa_netmask->sa_family == AF_INET6) { + if (ent->ifa_netmask == NULL) { + memset(&address->netmask, 0, sizeof(address->netmask)); + } else if (ent->ifa_netmask->sa_family == AF_INET6) { address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); } else { address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index ef77e127c26c39..fe795a0e75ea1a 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -56,31 +56,6 @@ int uv__platform_loop_init(uv_loop_t* loop) { void uv__platform_loop_delete(uv_loop_t* loop) { } - -#ifdef __DragonFly__ -int uv_exepath(char* buffer, size_t* size) { - char abspath[PATH_MAX * 2 + 1]; - ssize_t abspath_size; - - if (buffer == NULL || size == NULL || *size == 0) - return UV_EINVAL; - - abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath)); - if (abspath_size < 0) - return UV__ERR(errno); - - assert(abspath_size > 0); - *size -= 1; - - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - return 0; -} -#else int uv_exepath(char* buffer, size_t* size) { char abspath[PATH_MAX * 2 + 1]; int mib[4]; @@ -110,7 +85,6 @@ int uv_exepath(char* buffer, size_t* size) { return 0; } -#endif uint64_t uv_get_free_memory(void) { int freecount; @@ -290,25 +264,18 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { } -int uv__sendmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags) { +int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) { #if __FreeBSD__ >= 11 - return sendmmsg(fd, mmsg, vlen, flags); + return sendmmsg(fd, mmsg, vlen, /* flags */ 0); #else return errno = ENOSYS, -1; #endif } -int uv__recvmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags, - struct timespec* timeout) { +int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) { #if __FreeBSD__ >= 11 - return recvmmsg(fd, mmsg, vlen, flags, timeout); + return recvmmsg(fd, mmsg, vlen, 0 /* flags */, NULL /* timeout */); #else return errno = ENOSYS, -1; #endif diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index 87cb8b816aea39..556fd103c3a954 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -79,7 +79,11 @@ defined(__NetBSD__) # include # include -#elif defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__) +#elif defined(__sun) || \ + defined(__MVS__) || \ + defined(__NetBSD__) || \ + defined(__HAIKU__) || \ + defined(__QNX__) # include #else # include @@ -629,7 +633,11 @@ static int uv__fs_closedir(uv_fs_t* req) { static int uv__fs_statfs(uv_fs_t* req) { uv_statfs_t* stat_fs; -#if defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__) +#if defined(__sun) || \ + defined(__MVS__) || \ + defined(__NetBSD__) || \ + defined(__HAIKU__) || \ + defined(__QNX__) struct statvfs buf; if (0 != statvfs(req->path, &buf)) @@ -646,7 +654,12 @@ static int uv__fs_statfs(uv_fs_t* req) { return -1; } -#if defined(__sun) || defined(__MVS__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) +#if defined(__sun) || \ + defined(__MVS__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) || \ + defined(__HAIKU__) || \ + defined(__QNX__) stat_fs->f_type = 0; /* f_type is not supported. */ #else stat_fs->f_type = buf.f_type; diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 9d3c2297f8d764..570274ed60bebc 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -334,15 +334,8 @@ struct uv__mmsghdr { unsigned int msg_len; }; -int uv__recvmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags, - struct timespec* timeout); -int uv__sendmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags); +int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen); +int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen); #else #define HAVE_MMSG 0 #endif diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 14d5f0c04a93bc..4db2f05053a1cc 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -281,6 +281,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { timeout = 0; } else { reset_timeout = 0; + user_timeout = 0; } /* You could argue there is a dependency between these two but diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c index 160056b46ec383..44daaf12d49810 100644 --- a/deps/uv/src/unix/linux-syscalls.c +++ b/deps/uv/src/unix/linux-syscalls.c @@ -37,8 +37,6 @@ #ifndef __NR_recvmmsg # if defined(__x86_64__) # define __NR_recvmmsg 299 -# elif defined(__i386__) -# define __NR_recvmmsg 337 # elif defined(__arm__) # define __NR_recvmmsg (UV_SYSCALL_BASE + 365) # endif @@ -47,8 +45,6 @@ #ifndef __NR_sendmmsg # if defined(__x86_64__) # define __NR_sendmmsg 307 -# elif defined(__i386__) -# define __NR_sendmmsg 345 # elif defined(__arm__) # define __NR_sendmmsg (UV_SYSCALL_BASE + 374) # endif @@ -146,25 +142,51 @@ struct uv__mmsghdr; -int uv__sendmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags) { -#if defined(__NR_sendmmsg) - return syscall(__NR_sendmmsg, fd, mmsg, vlen, flags); +int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) { +#if defined(__i386__) + unsigned long args[4]; + int rc; + + args[0] = (unsigned long) fd; + args[1] = (unsigned long) mmsg; + args[2] = (unsigned long) vlen; + args[3] = /* flags */ 0; + + /* socketcall() raises EINVAL when SYS_SENDMMSG is not supported. */ + rc = syscall(/* __NR_socketcall */ 102, 20 /* SYS_SENDMMSG */, args); + if (rc == -1) + if (errno == EINVAL) + errno = ENOSYS; + + return rc; +#elif defined(__NR_sendmmsg) + return syscall(__NR_sendmmsg, fd, mmsg, vlen, /* flags */ 0); #else return errno = ENOSYS, -1; #endif } -int uv__recvmmsg(int fd, - struct uv__mmsghdr* mmsg, - unsigned int vlen, - unsigned int flags, - struct timespec* timeout) { -#if defined(__NR_recvmmsg) - return syscall(__NR_recvmmsg, fd, mmsg, vlen, flags, timeout); +int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) { +#if defined(__i386__) + unsigned long args[5]; + int rc; + + args[0] = (unsigned long) fd; + args[1] = (unsigned long) mmsg; + args[2] = (unsigned long) vlen; + args[3] = /* flags */ 0; + args[4] = /* timeout */ 0; + + /* socketcall() raises EINVAL when SYS_RECVMMSG is not supported. */ + rc = syscall(/* __NR_socketcall */ 102, 19 /* SYS_RECVMMSG */, args); + if (rc == -1) + if (errno == EINVAL) + errno = ENOSYS; + + return rc; +#elif defined(__NR_recvmmsg) + return syscall(__NR_recvmmsg, fd, mmsg, vlen, /* flags */ 0, /* timeout */ 0); #else return errno = ENOSYS, -1; #endif diff --git a/deps/uv/src/unix/qnx.c b/deps/uv/src/unix/qnx.c new file mode 100644 index 00000000000000..ca148d349f87c8 --- /dev/null +++ b/deps/uv/src/unix/qnx.c @@ -0,0 +1,137 @@ +/* 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 "internal.h" + +#include +#include +#include +#include +#include +#include + +static void +get_mem_info(uint64_t* totalmem, uint64_t* freemem) { + mem_info_t msg; + + memset(&msg, 0, sizeof(msg)); + msg.i.type = _MEM_INFO; + msg.i.fd = -1; + + if (MsgSend(MEMMGR_COID, &msg.i, sizeof(msg.i), &msg.o, sizeof(msg.o)) + != -1) { + *totalmem = msg.o.info.__posix_tmi_total; + *freemem = msg.o.info.posix_tmi_length; + } else { + *totalmem = 0; + *freemem = 0; + } +} + + +void uv_loadavg(double avg[3]) { + avg[0] = 0.0; + avg[1] = 0.0; + avg[2] = 0.0; +} + + +int uv_exepath(char* buffer, size_t* size) { + char path[PATH_MAX]; + if (buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + + realpath(_cmdname(NULL), path); + strlcpy(buffer, path, *size); + *size = strlen(buffer); + return 0; +} + + +uint64_t uv_get_free_memory(void) { + uint64_t totalmem; + uint64_t freemem; + get_mem_info(&totalmem, &freemem); + return freemem; +} + + +uint64_t uv_get_total_memory(void) { + uint64_t totalmem; + uint64_t freemem; + get_mem_info(&totalmem, &freemem); + return totalmem; +} + + +uint64_t uv_get_constrained_memory(void) { + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + int fd; + procfs_asinfo asinfo; + + fd = uv__open_cloexec("/proc/self/ctl", O_RDONLY); + if (fd == -1) + return UV__ERR(errno); + + if (devctl(fd, DCMD_PROC_ASINFO, &asinfo, sizeof(asinfo), 0) == -1) { + uv__close(fd); + return UV__ERR(errno); + } + + uv__close(fd); + *rss = asinfo.rss; + return 0; +} + + +int uv_uptime(double* uptime) { + struct qtime_entry* qtime = _SYSPAGE_ENTRY(_syspage_ptr, qtime); + *uptime = (qtime->nsec / 1000000000.0); + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + struct cpuinfo_entry* cpuinfo = + (struct cpuinfo_entry*)_SYSPAGE_ENTRY(_syspage_ptr, new_cpuinfo); + size_t cpuinfo_size = _SYSPAGE_ELEMENT_SIZE(_syspage_ptr, cpuinfo); + struct strings_entry* strings = _SYSPAGE_ENTRY(_syspage_ptr, strings); + int num_cpus = _syspage_ptr->num_cpu; + int i; + + *count = num_cpus; + *cpu_infos = uv__malloc(num_cpus * sizeof(**cpu_infos)); + if (*cpu_infos == NULL) + return UV_ENOMEM; + + for (i = 0; i < num_cpus; i++) { + (*cpu_infos)[i].model = strdup(&strings->data[cpuinfo->name]); + (*cpu_infos)[i].speed = cpuinfo->speed; + SYSPAGE_ARRAY_ADJ_OFFSET(cpuinfo, cpuinfo, cpuinfo_size); + } + + return 0; +} diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c index 16c7f38ae82473..7d699a16753c6b 100644 --- a/deps/uv/src/unix/udp.c +++ b/deps/uv/src/unix/udp.c @@ -73,12 +73,12 @@ static void uv__udp_mmsg_init(void) { s = uv__socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) return; - ret = uv__sendmmsg(s, NULL, 0, 0); + ret = uv__sendmmsg(s, NULL, 0); if (ret == 0 || errno != ENOSYS) { uv__sendmmsg_avail = 1; uv__recvmmsg_avail = 1; } else { - ret = uv__recvmmsg(s, NULL, 0, 0, NULL); + ret = uv__recvmmsg(s, NULL, 0); if (ret == 0 || errno != ENOSYS) uv__recvmmsg_avail = 1; } @@ -213,7 +213,7 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) { } do - nread = uv__recvmmsg(handle->io_watcher.fd, msgs, chunks, 0, NULL); + nread = uv__recvmmsg(handle->io_watcher.fd, msgs, chunks); while (nread == -1 && errno == EINTR); if (nread < 1) { @@ -238,7 +238,7 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) { /* one last callback so the original buffer is freed */ if (handle->recv_cb != NULL) - handle->recv_cb(handle, 0, buf, NULL, 0); + handle->recv_cb(handle, 0, buf, NULL, UV_UDP_MMSG_FREE); } return nread; } @@ -356,7 +356,7 @@ static void uv__udp_sendmmsg(uv_udp_t* handle) { } do - npkts = uv__sendmmsg(handle->io_watcher.fd, h, pkts, 0); + npkts = uv__sendmmsg(handle->io_watcher.fd, h, pkts); while (npkts == -1 && errno == EINTR); if (npkts < 1) { @@ -851,7 +851,11 @@ static int uv__udp_set_membership6(uv_udp_t* handle, } -#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__) +#if !defined(__OpenBSD__) && \ + !defined(__NetBSD__) && \ + !defined(__ANDROID__) && \ + !defined(__DragonFly__) & \ + !defined(__QNX__) static int uv__udp_set_source_membership4(uv_udp_t* handle, const struct sockaddr_in* multicast_addr, const char* interface_addr, @@ -1039,7 +1043,11 @@ int uv_udp_set_source_membership(uv_udp_t* handle, const char* interface_addr, const char* source_addr, uv_membership membership) { -#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__) +#if !defined(__OpenBSD__) && \ + !defined(__NetBSD__) && \ + !defined(__ANDROID__) && \ + !defined(__DragonFly__) && \ + !defined(__QNX__) int err; union uv__sockaddr mcast_addr; union uv__sockaddr src_addr; @@ -1146,7 +1154,7 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) { * and use the general uv__setsockopt_maybe_char call on other platforms. */ #if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ - defined(__MVS__) + defined(__MVS__) || defined(__QNX__) return uv__setsockopt(handle, IP_TTL, @@ -1155,7 +1163,7 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) { sizeof(ttl)); #else /* !(defined(__sun) || defined(_AIX) || defined (__OpenBSD__) || - defined(__MVS__)) */ + defined(__MVS__) || defined(__QNX__)) */ return uv__setsockopt_maybe_char(handle, IP_TTL, @@ -1163,7 +1171,7 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) { ttl); #endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) || - defined(__MVS__) */ + defined(__MVS__) || defined(__QNX__) */ } @@ -1175,7 +1183,7 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) { * and use the general uv__setsockopt_maybe_char call otherwise. */ #if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ - defined(__MVS__) + defined(__MVS__) || defined(__QNX__) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_TTL, @@ -1183,7 +1191,7 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) { &ttl, sizeof(ttl)); #endif /* defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ - defined(__MVS__) */ + defined(__MVS__) || defined(__QNX__) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_TTL, @@ -1200,7 +1208,7 @@ int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) { * and use the general uv__setsockopt_maybe_char call otherwise. */ #if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ - defined(__MVS__) + defined(__MVS__) || defined(__QNX__) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_LOOP, @@ -1208,7 +1216,7 @@ int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) { &on, sizeof(on)); #endif /* defined(__sun) || defined(_AIX) ||defined(__OpenBSD__) || - defined(__MVS__) */ + defined(__MVS__) || defined(__QNX__) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_LOOP, diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index 4604fb0c874694..1b9d4f8532635c 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -2122,13 +2122,6 @@ static int uv_tty_write_bufs(uv_tty_t* handle, abort(); } - /* We wouldn't mind emitting utf-16 surrogate pairs. Too bad, the windows - * console doesn't really support UTF-16, so just emit the replacement - * character. */ - if (utf8_codepoint > 0xffff) { - utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; - } - if (utf8_codepoint == 0x0a || utf8_codepoint == 0x0d) { /* EOL conversion - emit \r\n when we see \n. */ @@ -2155,6 +2148,12 @@ static int uv_tty_write_bufs(uv_tty_t* handle, ENSURE_BUFFER_SPACE(1); utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint; previous_eol = 0; + } else { + ENSURE_BUFFER_SPACE(2); + utf8_codepoint -= 0x10000; + utf16_buf[utf16_buf_used++] = (WCHAR) (utf8_codepoint / 0x400 + 0xD800); + utf16_buf[utf16_buf_used++] = (WCHAR) (utf8_codepoint % 0x400 + 0xDC00); + previous_eol = 0; } } } diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c index 7032b685dedfd6..68ca728aa5c9cc 100644 --- a/deps/uv/src/win/udp.c +++ b/deps/uv/src/win/udp.c @@ -1073,7 +1073,7 @@ int uv__udp_connect(uv_udp_t* handle, err = connect(handle->socket, addr, addrlen); if (err) - return uv_translate_sys_error(err); + return uv_translate_sys_error(WSAGetLastError()); handle->flags |= UV_HANDLE_UDP_CONNECTED; @@ -1089,7 +1089,7 @@ int uv__udp_disconnect(uv_udp_t* handle) { err = connect(handle->socket, &addr, sizeof(addr)); if (err) - return uv_translate_sys_error(err); + return uv_translate_sys_error(WSAGetLastError()); handle->flags &= ~UV_HANDLE_UDP_CONNECTED; return 0; diff --git a/deps/uv/test/test-dlerror.c b/deps/uv/test/test-dlerror.c index 70cc9bfa884290..42ad68828626b1 100644 --- a/deps/uv/test/test-dlerror.c +++ b/deps/uv/test/test-dlerror.c @@ -42,7 +42,7 @@ TEST_IMPL(dlerror) { msg = uv_dlerror(&lib); ASSERT(msg != NULL); -#ifndef __OpenBSD__ +#if !defined(__OpenBSD__) && !defined(__QNX__) ASSERT(strstr(msg, path) != NULL); #endif ASSERT(strstr(msg, dlerror_no_error) == NULL); @@ -50,7 +50,7 @@ TEST_IMPL(dlerror) { /* Should return the same error twice in a row. */ msg = uv_dlerror(&lib); ASSERT(msg != NULL); -#ifndef __OpenBSD__ +#if !defined(__OpenBSD__) && !defined(__QNX__) ASSERT(strstr(msg, path) != NULL); #endif ASSERT(strstr(msg, dlerror_no_error) == NULL); diff --git a/deps/uv/test/test-fs-copyfile.c b/deps/uv/test/test-fs-copyfile.c index e6f06e6eac5a2b..c785a4b51fbb10 100644 --- a/deps/uv/test/test-fs-copyfile.c +++ b/deps/uv/test/test-fs-copyfile.c @@ -25,7 +25,7 @@ #if defined(__unix__) || defined(__POSIX__) || \ defined(__APPLE__) || defined(__sun) || \ defined(_AIX) || defined(__MVS__) || \ - defined(__HAIKU__) + defined(__HAIKU__) || defined(__QNX__) #include /* unlink, etc. */ #else # include diff --git a/deps/uv/test/test-tcp-connect-timeout.c b/deps/uv/test/test-tcp-connect-timeout.c index 6b455276c516b1..a67d325284da11 100644 --- a/deps/uv/test/test-tcp-connect-timeout.c +++ b/deps/uv/test/test-tcp-connect-timeout.c @@ -100,13 +100,13 @@ static void connect_local_cb(uv_connect_t* req, int status) { connect_cb_called++; } -static int is_supported_system() { +static int is_supported_system(void) { 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) { + 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; diff --git a/deps/uv/test/test-timer.c b/deps/uv/test/test-timer.c index c667da00ec3af8..ee8331c2045ff3 100644 --- a/deps/uv/test/test-timer.c +++ b/deps/uv/test/test-timer.c @@ -161,6 +161,7 @@ TEST_IMPL(timer_init) { ASSERT(0 == uv_timer_init(uv_default_loop(), &handle)); ASSERT(0 == uv_timer_get_repeat(&handle)); + ASSERT_UINT64_LE(0, uv_timer_get_due_in(&handle)); ASSERT(0 == uv_is_active((uv_handle_t*) &handle)); MAKE_VALGRIND_HAPPY(); @@ -232,6 +233,9 @@ TEST_IMPL(timer_huge_timeout) { ASSERT(0 == uv_timer_start(&tiny_timer, tiny_timer_cb, 1, 0)); ASSERT(0 == uv_timer_start(&huge_timer1, tiny_timer_cb, 0xffffffffffffLL, 0)); ASSERT(0 == uv_timer_start(&huge_timer2, tiny_timer_cb, (uint64_t) -1, 0)); + ASSERT_UINT64_EQ(1, uv_timer_get_due_in(&tiny_timer)); + ASSERT_UINT64_EQ(281474976710655, uv_timer_get_due_in(&huge_timer1)); + ASSERT_UINT64_LE(0, uv_timer_get_due_in(&huge_timer2)); ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); MAKE_VALGRIND_HAPPY(); return 0; diff --git a/deps/uv/test/test-udp-connect.c b/deps/uv/test/test-udp-connect.c index 58cf9475a40b57..41ace117a1bba2 100644 --- a/deps/uv/test/test-udp-connect.c +++ b/deps/uv/test/test-udp-connect.c @@ -124,6 +124,17 @@ TEST_IMPL(udp_connect) { buf = uv_buf_init("EXIT", 4); + // connect() to INADDR_ANY fails on Windows wih WSAEADDRNOTAVAIL + ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &tmp_addr)); + r = uv_udp_connect(&client, (const struct sockaddr*) &tmp_addr); +#ifdef _WIN32 + ASSERT_EQ(r, UV_EADDRNOTAVAIL); +#else + ASSERT_EQ(r, 0); + r = uv_udp_connect(&client, NULL); + ASSERT_EQ(r, 0); +#endif + ASSERT(0 == uv_ip4_addr("8.8.8.8", TEST_PORT, &ext_addr)); ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &lo_addr)); diff --git a/deps/uv/test/test-udp-mmsg.c b/deps/uv/test/test-udp-mmsg.c index 94e8d5b82b9246..08628a5046fedc 100644 --- a/deps/uv/test/test-udp-mmsg.c +++ b/deps/uv/test/test-udp-mmsg.c @@ -74,16 +74,22 @@ static void recv_cb(uv_udp_t* handle, 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); - } + /* free and return if this is a mmsg free-only callback invocation */ + if (flags & UV_UDP_MMSG_FREE) { + ASSERT_EQ(nread, 0); + ASSERT(addr == NULL); + free(rcvbuf->base); + return; + } + + 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 */ From fdc67ebf5fd3cfda44d4d734ead68983f21f6ddd Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Tue, 25 Aug 2020 11:53:32 +0000 Subject: [PATCH 052/117] test: replace annonymous functions with arrow PR-URL: https://github.com/nodejs/node/pull/34921 Reviewed-By: Harshitha K P Reviewed-By: Rich Trott Reviewed-By: Daijiro Wachi --- test/parallel/test-net-reconnect.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-net-reconnect.js b/test/parallel/test-net-reconnect.js index eb6b0728478a91..233f5b01e5445a 100644 --- a/test/parallel/test-net-reconnect.js +++ b/test/parallel/test-net-reconnect.js @@ -37,12 +37,12 @@ const server = net.createServer(function(socket) { console.error('SERVER connect, writing'); socket.write('hello\r\n'); - socket.on('end', function() { + socket.on('end', () => { console.error('SERVER socket end, calling end()'); socket.end(); }); - socket.on('close', function(had_error) { + socket.on('close', (had_error) => { console.log(`SERVER had_error: ${JSON.stringify(had_error)}`); assert.strictEqual(had_error, false); }); @@ -54,7 +54,7 @@ server.listen(0, function() { client.setEncoding('UTF8'); - client.on('connect', function() { + client.on('connect', () => { console.error('CLIENT connected', client._writableState); }); @@ -66,12 +66,12 @@ server.listen(0, function() { client.end(); }); - client.on('end', function() { + client.on('end', () => { console.error('CLIENT end'); client_end_count++; }); - client.on('close', function(had_error) { + client.on('close', (had_error) => { console.log('CLIENT disconnect'); assert.strictEqual(had_error, false); if (disconnect_count++ < N) @@ -81,7 +81,7 @@ server.listen(0, function() { }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(disconnect_count, N + 1); assert.strictEqual(client_recv_count, N + 1); assert.strictEqual(client_end_count, N + 1); From a9ce9b2614081fa2cf18d168a7fd7bbaa025e777 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 26 Sep 2020 18:47:09 -0400 Subject: [PATCH 053/117] tools: update ESLint to 7.10.0 Update ESLint to 7.10.0 PR-URL: https://github.com/nodejs/node/pull/35366 Reviewed-By: Rich Trott Reviewed-By: Daijiro Wachi Reviewed-By: Ruben Bridgewater --- tools/node_modules/eslint/README.md | 2 +- .../eslint/lib/rules/no-inline-comments.js | 29 +- .../eslint/lib/rules/prefer-destructuring.js | 2 + .../node_modules/ajv/dist/ajv.bundle.js | 104 +- .../eslint/node_modules/ajv/dist/ajv.min.js | 4 +- .../node_modules/ajv/lib/compile/formats.js | 4 +- .../node_modules/ajv/lib/dot/definitions.def | 3 +- .../node_modules/ajv/lib/dot/validate.jst | 2 +- .../node_modules/ajv/lib/dotjs/allOf.js | 2 +- .../node_modules/ajv/lib/dotjs/anyOf.js | 2 +- .../node_modules/ajv/lib/dotjs/contains.js | 2 +- .../ajv/lib/dotjs/dependencies.js | 2 +- .../eslint/node_modules/ajv/lib/dotjs/if.js | 4 +- .../node_modules/ajv/lib/dotjs/items.js | 6 +- .../eslint/node_modules/ajv/lib/dotjs/not.js | 2 +- .../node_modules/ajv/lib/dotjs/oneOf.js | 2 +- .../node_modules/ajv/lib/dotjs/properties.js | 4 +- .../ajv/lib/dotjs/propertyNames.js | 2 +- .../node_modules/ajv/lib/dotjs/required.js | 2 +- .../node_modules/ajv/lib/dotjs/validate.js | 2 +- .../eslint/node_modules/ajv/package.json | 2 +- .../eslint/node_modules/debug/dist/debug.js | 912 ------------------ .../eslint/node_modules/debug/package.json | 41 +- .../eslint/node_modules/debug/src/browser.js | 15 +- .../eslint/node_modules/debug/src/common.js | 6 +- tools/node_modules/eslint/package.json | 4 +- 26 files changed, 160 insertions(+), 1002 deletions(-) delete mode 100644 tools/node_modules/eslint/node_modules/debug/dist/debug.js diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 7f0a8cdbacfe53..1f778efdf4b8d1 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -251,7 +251,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

+

2021 calendar Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/rules/no-inline-comments.js b/tools/node_modules/eslint/lib/rules/no-inline-comments.js index 41b0f1e664c776..dec278615e2e12 100644 --- a/tools/node_modules/eslint/lib/rules/no-inline-comments.js +++ b/tools/node_modules/eslint/lib/rules/no-inline-comments.js @@ -21,7 +21,17 @@ module.exports = { url: "https://eslint.org/docs/rules/no-inline-comments" }, - schema: [], + schema: [ + { + type: "object", + properties: { + ignorePattern: { + type: "string" + } + }, + additionalProperties: false + } + ], messages: { unexpectedInlineComment: "Unexpected comment inline with code." @@ -30,6 +40,12 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); + const options = context.options[0]; + let customIgnoreRegExp; + + if (options && options.ignorePattern) { + customIgnoreRegExp = new RegExp(options.ignorePattern, "u"); + } /** * Will check that comments are not on lines starting with or ending with code @@ -51,6 +67,11 @@ module.exports = { return; } + // Matches the ignore pattern + if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) { + return; + } + // JSX Exception if ( (isPreambleEmpty || preamble === "{") && @@ -80,9 +101,9 @@ module.exports = { return { Program() { - const comments = sourceCode.getAllComments(); - - comments.filter(token => token.type !== "Shebang").forEach(testCodeAroundComment); + sourceCode.getAllComments() + .filter(token => token.type !== "Shebang") + .forEach(testCodeAroundComment); } }; } diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index d3314dc7e0de77..66e412fd3e3922 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -163,6 +163,8 @@ module.exports = { return node.type === "VariableDeclarator" && node.id.type === "Identifier" && node.init.type === "MemberExpression" && + !node.init.computed && + node.init.property.type === "Identifier" && node.id.name === node.init.property.name; } diff --git a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js index b640d050a141f6..014fc2620ca2f9 100644 --- a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js +++ b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js @@ -193,8 +193,8 @@ formats.fast = { time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, 'uri-template': URITEMPLATE, url: URL, // email (sources from jsen validator): @@ -1847,7 +1847,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $allSchemasEmpty = false; $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; @@ -1890,7 +1890,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) { $it.level++; var $nextValid = 'valid' + $it.level; var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all)); + return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); }); if ($noEmptySchema) { var $currentBaseId = $it.baseId; @@ -2043,7 +2043,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) { $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = 'data' + $dataNxt, $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all)); + $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; if ($nonEmptySchema) { var $wasComposite = it.compositeRule; @@ -2481,7 +2481,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) { var $currentBaseId = $it.baseId; for (var $property in $schemaDeps) { var $sch = $schemaDeps[$property]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; if ($ownProperties) { out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; @@ -2744,8 +2744,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) { var $nextValid = 'valid' + $it.level; var $thenSch = it.schema['then'], $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)), + $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), + $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), $currentBaseId = $it.baseId; if ($thenPresent || $elsePresent) { var $ifClause; @@ -2936,7 +2936,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; var $passData = $data + '[' + $i + ']'; $it.schema = $sch; @@ -2959,7 +2959,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { } } } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) { + if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { $it.schema = $additionalItems; $it.schemaPath = it.schemaPath + '.additionalItems'; $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; @@ -2983,7 +2983,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { $closingBraces += '}'; } } - } else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; @@ -3104,7 +3104,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) { var $it = it.util.copy(it); $it.level++; var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; @@ -3204,7 +3204,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; $it.errSchemaPath = $errSchemaPath + '/' + $i; @@ -3513,7 +3513,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { while (i3 < l3) { $propertyKey = arr3[i3 += 1]; var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { var $prop = it.util.getProperty($propertyKey), $passData = $data + $prop, $hasDefault = $useDefaults && $sch.default !== undefined; @@ -3616,7 +3616,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { while (i4 < l4) { $pProperty = arr4[i4 += 1]; var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $it.schema = $sch; $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); @@ -3676,7 +3676,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) { $it.level++; var $nextValid = 'valid' + $it.level; out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; @@ -3900,7 +3900,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) { while (i1 < l1) { $property = arr1[i1 += 1]; var $propertySch = it.schema.properties[$property]; - if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) { + if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { $required[$required.length] = $property; } } @@ -4323,7 +4323,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); it.baseId = it.baseId || it.rootId; delete it.isTop; - it.dataPathArr = [undefined]; + it.dataPathArr = [""]; if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { var $defaultMsg = 'default is ignored in the schema root'; if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); @@ -5255,7 +5255,7 @@ function escapeJsonPtr(str) { } },{}],45:[function(require,module,exports){ -/** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -6218,9 +6218,9 @@ function _recomposeAuthority(components, options) { return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; })); } - if (typeof components.port === "number") { + if (typeof components.port === "number" || typeof components.port === "string") { uriTokens.push(":"); - uriTokens.push(components.port.toString(10)); + uriTokens.push(String(components.port)); } return uriTokens.length ? uriTokens.join("") : undefined; } @@ -6423,8 +6423,9 @@ var handler = { return components; }, serialize: function serialize(components, options) { + var secure = String(components.scheme).toLowerCase() === "https"; //normalize the default port - if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") { + if (components.port === (secure ? 443 : 80) || components.port === "") { components.port = undefined; } //normalize the empty path @@ -6445,6 +6446,57 @@ var handler$1 = { serialize: handler.serialize }; +function isSecure(wsComponents) { + return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; +} +//RFC 6455 +var handler$2 = { + scheme: "ws", + domainHost: true, + parse: function parse(components, options) { + var wsComponents = components; + //indicate if the secure flag is set + wsComponents.secure = isSecure(wsComponents); + //construct resouce name + wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); + wsComponents.path = undefined; + wsComponents.query = undefined; + return wsComponents; + }, + serialize: function serialize(wsComponents, options) { + //normalize the default port + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { + wsComponents.port = undefined; + } + //ensure scheme matches secure flag + if (typeof wsComponents.secure === 'boolean') { + wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; + wsComponents.secure = undefined; + } + //reconstruct path from resource name + if (wsComponents.resourceName) { + var _wsComponents$resourc = wsComponents.resourceName.split('?'), + _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), + path = _wsComponents$resourc2[0], + query = _wsComponents$resourc2[1]; + + wsComponents.path = path && path !== '/' ? path : undefined; + wsComponents.query = query; + wsComponents.resourceName = undefined; + } + //forbid fragment component + wsComponents.fragment = undefined; + return wsComponents; + } +}; + +var handler$3 = { + scheme: "wss", + domainHost: handler$2.domainHost, + parse: handler$2.parse, + serialize: handler$2.serialize +}; + var O = {}; var isIRI = true; //RFC 3986 @@ -6475,7 +6527,7 @@ function decodeUnreserved(str) { var decStr = pctDecChars(str); return !decStr.match(UNRESERVED) ? str : decStr; } -var handler$2 = { +var handler$4 = { scheme: "mailto", parse: function parse$$1(components, options) { var mailtoComponents = components; @@ -6563,7 +6615,7 @@ var handler$2 = { var URN_PARSE = /^([^\:]+)\:(.*)/; //RFC 2141 -var handler$3 = { +var handler$5 = { scheme: "urn", parse: function parse$$1(components, options) { var matches = components.path && components.path.match(URN_PARSE); @@ -6602,7 +6654,7 @@ var handler$3 = { var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; //RFC 4122 -var handler$4 = { +var handler$6 = { scheme: "urn:uuid", parse: function parse(urnComponents, options) { var uuidComponents = urnComponents; @@ -6626,6 +6678,8 @@ SCHEMES[handler$1.scheme] = handler$1; SCHEMES[handler$2.scheme] = handler$2; SCHEMES[handler$3.scheme] = handler$3; SCHEMES[handler$4.scheme] = handler$4; +SCHEMES[handler$5.scheme] = handler$5; +SCHEMES[handler$6.scheme] = handler$6; exports.SCHEMES = SCHEMES; exports.pctEncChar = pctEncChar; diff --git a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js index 77667f5f340fda..d02ec10a7feaee 100644 --- a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js +++ b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js @@ -1,3 +1,3 @@ -/* ajv 6.12.4: Another JSON Schema Validator */ -!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}(function(){return function o(i,n,l){function c(r,e){if(!n[r]){if(!i[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(u)return u(r,!0);var a=new Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[r]={exports:{}};i[r][0].call(s.exports,function(e){return c(i[r][1][e]||e)},s,s.exports,o,i,n,l)}return n[r].exports}for(var u="function"==typeof require&&require,e=0;e%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,T)+Q(l,N)+Q(m,z)+Q(v,q)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[void 0],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=T(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),M=new RegExp(U,"g"),B=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),G=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',K),"g"),Y=new RegExp(J("[^]",U,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),W=Y;function X(e){var r=p(e);return r.match(M)?r:e}var ee={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,z)+Q(l,N)+Q(m,q)+Q(v,T)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=z(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),Y=new RegExp(M,"g"),W=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),X=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(J("[^]",M,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),re=ee;function te(e){var r=p(e);return r.match(Y)?r:e}var ae={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n 0 + ? (typeof _schema == 'object' && Object.keys(_schema).length > 0) + || _schema === false : it.util.schemaHasRules(_schema, it.RULES.all)) #}} diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dot/validate.jst b/tools/node_modules/eslint/node_modules/ajv/lib/dot/validate.jst index f8a1edfc0eb882..c152e66f169a29 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dot/validate.jst +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dot/validate.jst @@ -81,7 +81,7 @@ it.baseId = it.baseId || it.rootId; delete it.isTop; - it.dataPathArr = [undefined]; + it.dataPathArr = [""]; if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { var $defaultMsg = 'default is ignored in the schema root'; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/allOf.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/allOf.js index 4bad914d605cc5..9c89544429f973 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/allOf.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/allOf.js @@ -17,7 +17,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $allSchemasEmpty = false; $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/anyOf.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/anyOf.js index 01551d54b18dfc..926400e3743b65 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/anyOf.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/anyOf.js @@ -15,7 +15,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) { $it.level++; var $nextValid = 'valid' + $it.level; var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all)); + return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); }); if ($noEmptySchema) { var $currentBaseId = $it.baseId; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/contains.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/contains.js index cd4dfabebfb52f..255f9654e6d0e3 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/contains.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/contains.js @@ -18,7 +18,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) { $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = 'data' + $dataNxt, $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all)); + $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; if ($nonEmptySchema) { var $wasComposite = it.compositeRule; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/dependencies.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/dependencies.js index 96789360ef30db..81c8eb385bdab2 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/dependencies.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/dependencies.js @@ -142,7 +142,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) { var $currentBaseId = $it.baseId; for (var $property in $schemaDeps) { var $sch = $schemaDeps[$property]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; if ($ownProperties) { out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/if.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/if.js index 019f61ab511d5b..36e7200f13a124 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/if.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/if.js @@ -15,8 +15,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) { var $nextValid = 'valid' + $it.level; var $thenSch = it.schema['then'], $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)), + $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), + $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), $currentBaseId = $it.baseId; if ($thenPresent || $elsePresent) { var $ifClause; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/items.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/items.js index d5532f07c59144..8f92224cc7eaf7 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/items.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/items.js @@ -66,7 +66,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; var $passData = $data + '[' + $i + ']'; $it.schema = $sch; @@ -89,7 +89,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { } } } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) { + if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { $it.schema = $additionalItems; $it.schemaPath = it.schemaPath + '.additionalItems'; $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; @@ -113,7 +113,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { $closingBraces += '}'; } } - } else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/not.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/not.js index 6aea6599144f8f..f50c93785b7129 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/not.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/not.js @@ -12,7 +12,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) { var $it = it.util.copy(it); $it.level++; var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js index 30988d5e3d73d6..dfe2fd550ef289 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js @@ -26,7 +26,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) { l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; $it.errSchemaPath = $errSchemaPath + '/' + $i; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/properties.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/properties.js index 34a82c62d5dac6..fb2c23393220b6 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/properties.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/properties.js @@ -183,7 +183,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { while (i3 < l3) { $propertyKey = arr3[i3 += 1]; var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { var $prop = it.util.getProperty($propertyKey), $passData = $data + $prop, $hasDefault = $useDefaults && $sch.default !== undefined; @@ -286,7 +286,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { while (i4 < l4) { $pProperty = arr4[i4 += 1]; var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { $it.schema = $sch; $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/propertyNames.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/propertyNames.js index b2bf2954041212..2ca36e2c980db1 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/propertyNames.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/propertyNames.js @@ -14,7 +14,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) { $it.level++; var $nextValid = 'valid' + $it.level; out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) { + if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { $it.schema = $schema; $it.schemaPath = $schemaPath; $it.errSchemaPath = $errSchemaPath; diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/required.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/required.js index 12110a4a262b53..14873eee3d528e 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/required.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/required.js @@ -28,7 +28,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) { while (i1 < l1) { $property = arr1[i1 += 1]; var $propertySch = it.schema.properties[$property]; - if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) { + if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { $required[$required.length] = $property; } } diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/validate.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/validate.js index 233bf3a8b66daa..563575641c5fe4 100644 --- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/validate.js +++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/validate.js @@ -91,7 +91,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); it.baseId = it.baseId || it.rootId; delete it.isTop; - it.dataPathArr = [undefined]; + it.dataPathArr = [""]; if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { var $defaultMsg = 'default is ignored in the schema root'; if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); diff --git a/tools/node_modules/eslint/node_modules/ajv/package.json b/tools/node_modules/eslint/node_modules/ajv/package.json index 94e4655b335231..bda64eac7c4623 100644 --- a/tools/node_modules/eslint/node_modules/ajv/package.json +++ b/tools/node_modules/eslint/node_modules/ajv/package.json @@ -102,5 +102,5 @@ }, "tonicExampleFilename": ".tonic_example.js", "typings": "lib/ajv.d.ts", - "version": "6.12.4" + "version": "6.12.5" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/debug/dist/debug.js b/tools/node_modules/eslint/node_modules/debug/dist/debug.js deleted file mode 100644 index 89ad0c2175c3d6..00000000000000 --- a/tools/node_modules/eslint/node_modules/debug/dist/debug.js +++ /dev/null @@ -1,912 +0,0 @@ -"use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (f) { - if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { - module.exports = f(); - } else if (typeof define === "function" && define.amd) { - define([], f); - } else { - var g; - - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else { - g = this; - } - - g.debug = f(); - } -})(function () { - var define, module, exports; - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = "function" == typeof require && require; - if (!f && c) return c(i, !0); - if (u) return u(i, !0); - var a = new Error("Cannot find module '" + i + "'"); - throw a.code = "MODULE_NOT_FOUND", a; - } - - var p = n[i] = { - exports: {} - }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - - return n[i].exports; - } - - for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { - o(t[i]); - } - - return o; - } - - return r; - }()({ - 1: [function (require, module, exports) { - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - - module.exports = function (val, options) { - options = options || {}; - - var type = _typeof(val); - - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - - throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse(str) { - str = String(str); - - if (str.length > 100) { - return; - } - - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); - - if (!match) { - return; - } - - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - - case 'weeks': - case 'week': - case 'w': - return n * w; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - - default: - return undefined; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtShort(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtLong(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - - return ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); - } - }, {}], - 2: [function (require, module, exports) { - // shim for using process in browser - var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined - - - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - } - - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined - - - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - } - - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - - draining = false; - - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - - while (len) { - currentQueue = queue; - queue = []; - - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - - queueIndex = -1; - len = queue.length; - } - - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - - queue.push(new Item(fun, args)); - - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; // v8 likes predictible objects - - - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { - return []; - }; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { - return '/'; - }; - - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - - process.umask = function () { - return 0; - }; - }, {}], - 3: [function (require, module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - var prevTime; - - function debug() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - // Disabled? - if (!debug.enabled) { - return; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - - args.splice(index, 1); - index--; - } - - return match; - }); // Apply env-specific formatting (colors, etc.) - - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - - - function disable() { - var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { - return '-' + namespace; - }))).join(','); - createDebug.enable(''); - return namespaces; - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - - - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; - } - - module.exports = setup; - }, { - "ms": 1 - }], - 4: [function (require, module, exports) { - (function (process) { - /* eslint-env browser */ - - /** - * This is the web browser implementation of `debug()`. - */ - exports.log = log; - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - /** - * Colors. - */ - - exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; - /** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - // eslint-disable-next-line complexity - - function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. - - - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - /** - * Colorize log arguments if enabled. - * - * @api public - */ - - - function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } - - index++; - - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - args.splice(lastC, 0, c); - } - /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - - function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - - function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - /** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - - function load() { - var r; - - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - - - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; - } - /** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - - function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - - module.exports = require('./common')(exports); - var formatters = module.exports.formatters; - /** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - - formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } - }; - }).call(this, require('_process')); - }, { - "./common": 3, - "_process": 2 - }] - }, {}, [4])(4); -}); diff --git a/tools/node_modules/eslint/node_modules/debug/package.json b/tools/node_modules/eslint/node_modules/debug/package.json index 7bc94f7f061070..5f2e838cb3d384 100644 --- a/tools/node_modules/eslint/node_modules/debug/package.json +++ b/tools/node_modules/eslint/node_modules/debug/package.json @@ -17,34 +17,35 @@ { "name": "Andrew Rhyne", "email": "rhyneandrew@gmail.com" + }, + { + "name": "Josh Junon", + "email": "josh@junon.me" } ], "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" }, "deprecated": false, "description": "small debugging utility", "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", + "brfs": "^2.0.1", + "browserify": "^16.2.3", "coveralls": "^3.0.2", "istanbul": "^0.4.5", - "karma": "^3.0.0", - "karma-chai": "^0.1.0", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", "mocha": "^5.2.0", "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", "xo": "^0.23.0" }, + "engines": { + "node": ">=6.0" + }, "files": [ "src", - "dist/debug.js", "LICENSE", "README.md" ], @@ -57,23 +58,21 @@ "license": "MIT", "main": "./src/index.js", "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git" }, "scripts": { - "build": "npm run build:debug && npm run build:test", - "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", - "build:test": "babel -d dist test.js", - "clean": "rimraf dist coverage", "lint": "xo", - "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", - "pretest:browser": "npm run build", - "test": "npm run test:node && npm run test:browser", + "test": "npm run test:node && npm run test:browser && npm run lint", "test:browser": "karma start --single-run", "test:coverage": "cat ./coverage/lcov.info | coveralls", "test:node": "istanbul cover _mocha -- test.js" }, - "unpkg": "./dist/debug.js", - "version": "4.1.1" + "version": "4.2.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/debug/src/browser.js b/tools/node_modules/eslint/node_modules/debug/src/browser.js index 5f34c0d0a73f02..ac3f7e1339b985 100644 --- a/tools/node_modules/eslint/node_modules/debug/src/browser.js +++ b/tools/node_modules/eslint/node_modules/debug/src/browser.js @@ -4,7 +4,6 @@ * This is the web browser implementation of `debug()`. */ -exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; @@ -170,18 +169,14 @@ function formatArgs(args) { } /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. * * @api public */ -function log(...args) { - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return typeof console === 'object' && - console.log && - console.log(...args); -} +exports.log = console.debug || console.log || (() => {}); /** * Save `namespaces`. diff --git a/tools/node_modules/eslint/node_modules/debug/src/common.js b/tools/node_modules/eslint/node_modules/debug/src/common.js index 2f82b8dc7d8865..da7eada619f824 100644 --- a/tools/node_modules/eslint/node_modules/debug/src/common.js +++ b/tools/node_modules/eslint/node_modules/debug/src/common.js @@ -117,13 +117,11 @@ function setup(env) { debug.namespace = namespace; debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); + debug.color = createDebug.selectColor(namespace); debug.destroy = destroy; debug.extend = extend; - // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances + // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 8801f73606f62c..3db68cf0490688 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -20,7 +20,7 @@ "doctrine": "^3.0.0", "enquirer": "^2.3.5", "eslint-plugin-markdown": "^1.0.2", - "eslint-scope": "^5.1.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^1.3.0", "espree": "^7.3.0", @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.9.0" + "version": "7.10.0" } \ No newline at end of file From ae149232a159b979aae9f71a338df916ea30d339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 30 Sep 2020 08:21:43 +0200 Subject: [PATCH 054/117] tools: exclude gyp from markdown link checker The changelog format used in gyp-next does not comply to the rules. PR-URL: https://github.com/nodejs/node/pull/35423 Reviewed-By: Ujjwal Sharma Reviewed-By: Jiawen Geng Reviewed-By: Richard Lau --- tools/doc/checkLinks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/doc/checkLinks.js b/tools/doc/checkLinks.js index f3415f521cc6d5..aeb0fe5d03f232 100644 --- a/tools/doc/checkLinks.js +++ b/tools/doc/checkLinks.js @@ -31,6 +31,7 @@ function findMarkdownFilesRecursively(dirPath) { entry.name !== 'changelogs' && entry.name !== 'deps' && entry.name !== 'fixtures' && + entry.name !== 'gyp' && entry.name !== 'node_modules' && entry.name !== 'out' && entry.name !== 'tmp' From 2e766a6adf9c6a2859a134ed4184cbb9d5558a20 Mon Sep 17 00:00:00 2001 From: Leko Date: Tue, 29 Sep 2020 00:00:38 +0800 Subject: [PATCH 055/117] console: add Symbol.toStringTag property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Symbol.toStringTag property to console object to follow WPT changes Update WPT status of console and the repl test case Refs: https://github.com/web-platform-tests/wpt/pull/24717 PR-URL: https://github.com/nodejs/node/pull/35399 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Anna Henningsen Reviewed-By: Zeyu Yang Reviewed-By: James M Snell --- lib/internal/console/constructor.js | 7 +++++++ test/parallel/test-repl.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index a2af66f4b8521c..af027cf3b3cc59 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -17,6 +17,7 @@ const { ReflectOwnKeys, Symbol, SymbolHasInstance, + SymbolToStringTag, WeakMap, } = primordials; @@ -228,6 +229,12 @@ ObjectDefineProperties(Console.prototype, { ...consolePropAttributes, value: groupIndentation }, + [SymbolToStringTag]: { + writable: false, + enumerable: false, + configurable: true, + value: 'console' + } }); } }, diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 73a919e5eacb3c..76dec355381299 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -757,7 +757,7 @@ const errorTests = [ { send: 'console', expect: [ - '{', + 'Object [console] {', ' log: [Function: log],', ' warn: [Function: warn],', ' dir: [Function: dir],', From c192af66e7e8c98f86c567a8bef7a5eaf00ec47b Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 25 Sep 2020 21:22:17 -0700 Subject: [PATCH 056/117] doc: unhide resolver spec PR-URL: https://github.com/nodejs/node/pull/35358 Reviewed-By: Myles Borins Reviewed-By: Rich Trott --- doc/api/esm.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index d9f4007c494825..320f94482ee415 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -953,8 +953,7 @@ The resolver can throw the following errors: * _Package Import Not Defined_: Package imports do not define the specifier. * _Module Not Found_: The package or module requested does not exist. -
-Resolver algorithm specification +### Resolver Algorithm Specification **ESM_RESOLVE**(_specifier_, _parentURL_) @@ -1208,8 +1207,6 @@ _internal_, _conditions_) > 1. Throw an _Invalid Package Configuration_ error. > 1. Return the parsed JSON source of the file at _pjsonURL_. -
- ### Customizing ESM specifier resolution algorithm The current specifier resolution does not support all default behavior of From 42c0dfcc234a75f1ce5a9405c531c012ac3d85f6 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Wed, 30 Sep 2020 15:57:08 -0500 Subject: [PATCH 057/117] doc: importable node protocol URLs PR-URL: https://github.com/nodejs/node/pull/35434 Reviewed-By: Myles Borins Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Jan Krems --- doc/api/esm.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 320f94482ee415..ed4e6482bf9504 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -125,13 +125,27 @@ There are four types of specifiers: Bare specifiers, and the bare specifier portion of deep import specifiers, are strings; but everything else in a specifier is a URL. -Only `file:` and `data:` URLs are supported. A specifier like +`file:`, `node:`, and `data:` URLs are supported. A specifier like `'https://example.com/app.js'` may be supported by browsers but it is not supported in Node.js. Specifiers may not begin with `/` or `//`. These are reserved for potential future use. The root of the current volume may be referenced via `file:///`. +#### `node:` Imports + + + +`node:` URLs are supported as a means to load Node.js builtin modules. This +URL scheme allows for builtin modules to be referenced by valid absolute URL +strings. + +```js +import fs from 'node:fs/promises'; +``` + #### `data:` Imports + +> Stability: 1 - Experimental + +```c +napi_status napi_object_freeze(napi_env env, + napi_value object); +``` + +* `[in] env`: The environment that the N-API call is invoked under. +* `[in] object`: The object to freeze. + +Returns `napi_ok` if the API succeeded. + +This method freezes a given object. This prevents new properties from +being added to it, existing properties from being removed, prevents +changing the enumerability, configurability, or writability of existing +properties, and prevents the values of existing properties from being changed. +It also prevents the object's prototype from being changed. This is described +in [Section 19.1.2.6](https://tc39.es/ecma262/#sec-object.freeze) of the +ECMA-262 specification. + +#### napi_object_seal + + +> Stability: 1 - Experimental + +```c +napi_status napi_object_seal(napi_env env, + napi_value object); +``` + +* `[in] env`: The environment that the N-API call is invoked under. +* `[in] object`: The object to seal. + +Returns `napi_ok` if the API succeeded. + +This method seals a given object. This prevents new properties from being +added to it, as well as marking all existing properties as non-configurable. +This is described in [Section 19.1.2.20](https://tc39.es/ecma262/#sec-object.seal) +of the ECMA-262 specification. + ## Working with JavaScript functions N-API provides a set of APIs that allow JavaScript code to diff --git a/src/js_native_api.h b/src/js_native_api.h index bd8bd35d7b72c9..5daa20f9040096 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -550,6 +550,10 @@ napi_check_object_type_tag(napi_env env, napi_value value, const napi_type_tag* type_tag, bool* result); +NAPI_EXTERN napi_status napi_object_freeze(napi_env env, + napi_value object); +NAPI_EXTERN napi_status napi_object_seal(napi_env env, + napi_value object); #endif // NAPI_EXPERIMENTAL EXTERN_C_END diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 5faed2570d2e39..5e3cee9ea0596f 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -1394,6 +1394,42 @@ napi_status napi_define_properties(napi_env env, return GET_RETURN_STATUS(env); } +napi_status napi_object_freeze(napi_env env, + napi_value object) { + NAPI_PREAMBLE(env); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Maybe set_frozen = + obj->SetIntegrityLevel(context, v8::IntegrityLevel::kFrozen); + + RETURN_STATUS_IF_FALSE_WITH_PREAMBLE(env, + set_frozen.FromMaybe(false), napi_generic_failure); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_object_seal(napi_env env, + napi_value object) { + NAPI_PREAMBLE(env); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Maybe set_sealed = + obj->SetIntegrityLevel(context, v8::IntegrityLevel::kSealed); + + RETURN_STATUS_IF_FALSE_WITH_PREAMBLE(env, + set_sealed.FromMaybe(false), napi_generic_failure); + + return GET_RETURN_STATUS(env); +} + napi_status napi_is_array(napi_env env, napi_value value, bool* result) { CHECK_ENV(env); CHECK_ARG(env, value); diff --git a/test/js-native-api/test_object/test.js b/test/js-native-api/test_object/test.js index b78666995271ff..e5923ecd16c2cf 100644 --- a/test/js-native-api/test_object/test.js +++ b/test/js-native-api/test_object/test.js @@ -275,3 +275,43 @@ assert.deepStrictEqual(test_object.TestGetProperty(), { keyIsNull: 'Invalid argument', resultIsNull: 'Invalid argument' }); + +{ + const obj = { x: 'a', y: 'b', z: 'c' }; + + test_object.TestSeal(obj); + + assert.strictEqual(Object.isSealed(obj), true); + + assert.throws(() => { + obj.w = 'd'; + }, /Cannot add property w, object is not extensible/); + + assert.throws(() => { + delete obj.x; + }, /Cannot delete property 'x' of #/); + + // Sealed objects allow updating existing properties, + // so this should not throw. + obj.x = 'd'; +} + +{ + const obj = { x: 10, y: 10, z: 10 }; + + test_object.TestFreeze(obj); + + assert.strictEqual(Object.isFrozen(obj), true); + + assert.throws(() => { + obj.x = 10; + }, /Cannot assign to read only property 'x' of object '#/); + + assert.throws(() => { + obj.w = 15; + }, /Cannot add property w, object is not extensible/); + + assert.throws(() => { + delete obj.x; + }, /Cannot delete property 'x' of #/); +} diff --git a/test/js-native-api/test_object/test_object.c b/test/js-native-api/test_object/test_object.c index f2ea89d6c60943..70a85e03c725dd 100644 --- a/test/js-native-api/test_object/test_object.c +++ b/test/js-native-api/test_object/test_object.c @@ -472,6 +472,30 @@ static napi_value TestGetProperty(napi_env env, return object; } +static napi_value TestFreeze(napi_env env, + napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value object = args[0]; + NAPI_CALL(env, napi_object_freeze(env, object)); + + return object; +} + +static napi_value TestSeal(napi_env env, + napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value object = args[0]; + NAPI_CALL(env, napi_object_seal(env, object)); + + return object; +} + // We create two type tags. They are basically 128-bit UUIDs. static const napi_type_tag type_tags[2] = { { 0xdaf987b3cc62481a, 0xb745b0497f299531 }, @@ -532,6 +556,8 @@ napi_value Init(napi_env env, napi_value exports) { DECLARE_NAPI_PROPERTY("TypeTaggedInstance", TypeTaggedInstance), DECLARE_NAPI_PROPERTY("CheckTypeTag", CheckTypeTag), DECLARE_NAPI_PROPERTY("TestGetProperty", TestGetProperty), + DECLARE_NAPI_PROPERTY("TestFreeze", TestFreeze), + DECLARE_NAPI_PROPERTY("TestSeal", TestSeal), }; init_test_null(env, exports); From dec004f742c94d4a9aa6a9c61f2d3cc90d672c9d Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 5 Oct 2020 16:16:59 -0700 Subject: [PATCH 074/117] src: expose v8::Isolate setup callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/35512 Reviewed-By: Gus Caplan Reviewed-By: Juan José Arboleda Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/api/environment.cc | 14 +++++++------- src/node.h | 10 ++++++++++ src/node_internals.h | 4 ---- src/node_task_queue.cc | 41 ++++++++++++++++++++--------------------- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/api/environment.cc b/src/api/environment.cc index fa91ed8b404af4..57d05c963df348 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -31,14 +31,14 @@ using v8::PropertyDescriptor; using v8::String; using v8::Value; -static bool AllowWasmCodeGenerationCallback(Local context, - Local) { +bool AllowWasmCodeGenerationCallback(Local context, + Local) { Local wasm_code_gen = context->GetEmbedderData(ContextEmbedderIndex::kAllowWasmCodeGeneration); return wasm_code_gen->IsUndefined() || wasm_code_gen->IsTrue(); } -static bool ShouldAbortOnUncaughtException(Isolate* isolate) { +bool ShouldAbortOnUncaughtException(Isolate* isolate) { DebugSealHandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); return env != nullptr && @@ -48,9 +48,9 @@ static bool ShouldAbortOnUncaughtException(Isolate* isolate) { !env->inside_should_not_abort_on_uncaught_scope(); } -static MaybeLocal PrepareStackTraceCallback(Local context, - Local exception, - Local trace) { +MaybeLocal PrepareStackTraceCallback(Local context, + Local exception, + Local trace) { Environment* env = Environment::GetCurrent(context); if (env == nullptr) { return exception->ToString(context).FromMaybe(Local()); @@ -252,7 +252,7 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) { if ((s.flags & SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK) == 0) { auto* promise_reject_cb = s.promise_reject_callback ? - s.promise_reject_callback : task_queue::PromiseRejectCallback; + s.promise_reject_callback : PromiseRejectCallback; isolate->SetPromiseRejectCallback(promise_reject_cb); } diff --git a/src/node.h b/src/node.h index 001d4972fadb67..2fda6d125e7e09 100644 --- a/src/node.h +++ b/src/node.h @@ -479,6 +479,16 @@ NODE_EXTERN void DefaultProcessExitHandler(Environment* env, int exit_code); // This may return nullptr if context is not associated with a Node instance. NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local context); +NODE_EXTERN void OnFatalError(const char* location, const char* message); +NODE_EXTERN void PromiseRejectCallback(v8::PromiseRejectMessage message); +NODE_EXTERN bool AllowWasmCodeGenerationCallback(v8::Local context, + v8::Local); +NODE_EXTERN bool ShouldAbortOnUncaughtException(v8::Isolate* isolate); +NODE_EXTERN v8::MaybeLocal PrepareStackTraceCallback( + v8::Local context, + v8::Local exception, + v8::Local trace); + // This returns the MultiIsolatePlatform used in the main thread of Node.js. // If NODE_USE_V8_PLATFORM has not been defined when Node.js was built, // it returns nullptr. diff --git a/src/node_internals.h b/src/node_internals.h index 25d279e615109b..fd0b14b0284532 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -104,10 +104,6 @@ std::string GetHumanReadableProcessName(); void InitializeContextRuntime(v8::Local); bool InitializePrimordials(v8::Local context); -namespace task_queue { -void PromiseRejectCallback(v8::PromiseRejectMessage message); -} // namespace task_queue - class NodeArrayBufferAllocator : public ArrayBufferAllocator { public: inline uint32_t* zero_fill_field() { return &zero_fill_field_; } diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc index 3c7d9bae0884c5..b55a2a4387d655 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -28,27 +28,6 @@ using v8::PromiseRejectEvent; using v8::PromiseRejectMessage; using v8::Value; -namespace task_queue { - -static void EnqueueMicrotask(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - Isolate* isolate = env->isolate(); - - CHECK(args[0]->IsFunction()); - - isolate->EnqueueMicrotask(args[0].As()); -} - -static void RunMicrotasks(const FunctionCallbackInfo& args) { - MicrotasksScope::PerformCheckpoint(args.GetIsolate()); -} - -static void SetTickCallback(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args[0]->IsFunction()); - env->set_tick_callback_function(args[0].As()); -} - void PromiseRejectCallback(PromiseRejectMessage message) { static std::atomic unhandledRejections{0}; static std::atomic rejectionsHandledAfter{0}; @@ -108,6 +87,26 @@ void PromiseRejectCallback(PromiseRejectMessage message) { PrintCaughtException(isolate, env->context(), try_catch); } } +namespace task_queue { + +static void EnqueueMicrotask(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + Isolate* isolate = env->isolate(); + + CHECK(args[0]->IsFunction()); + + isolate->EnqueueMicrotask(args[0].As()); +} + +static void RunMicrotasks(const FunctionCallbackInfo& args) { + MicrotasksScope::PerformCheckpoint(args.GetIsolate()); +} + +static void SetTickCallback(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsFunction()); + env->set_tick_callback_function(args[0].As()); +} static void SetPromiseRejectCallback( const FunctionCallbackInfo& args) { From 2d5393bb28fdfe3479c09f492a810277e06dbeb7 Mon Sep 17 00:00:00 2001 From: Aastha Gupta Date: Sun, 4 Oct 2020 20:19:51 +0530 Subject: [PATCH 075/117] src: fix freeing unintialized pointer bug in ParseSoaReply ares_expand_name doesn't guarantee that pointer variable is initialized if return code is ARES_EBADNAME or ARES_ENOMEM. But current usage of the function in the codebase thinks otherwise. There seems to be an assumption that pointer is always initialized even though it is a local variable and we create a unique pointer soon after calling ares_expand_name. This could potentially crash the program with an invalid free pointer. I was able to crash it by poisoning the memory and some manual hooks. By moving the unique_ptr after checking the return code we can fix the problem. As the underlying function guarantees that pointer is initialized when the status is ARES_SUCCESS. PR-URL: https://github.com/nodejs/node/pull/35502 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/cares_wrap.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 4a332db71279a4..e21fc2e303897f 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1067,29 +1067,31 @@ int ParseSoaReply(Environment* env, // Can't use ares_parse_soa_reply() here which can only parse single record const unsigned int ancount = cares_get_16bit(buf + 6); unsigned char* ptr = buf + NS_HFIXEDSZ; - char* name_temp; + char* name_temp = nullptr; long temp_len; // NOLINT(runtime/int) int status = ares_expand_name(ptr, buf, len, &name_temp, &temp_len); - const ares_unique_ptr name(name_temp); if (status != ARES_SUCCESS) { // returns EBADRESP in case of invalid input return status == ARES_EBADNAME ? ARES_EBADRESP : status; } + const ares_unique_ptr name(name_temp); + if (ptr + temp_len + NS_QFIXEDSZ > buf + len) { return ARES_EBADRESP; } ptr += temp_len + NS_QFIXEDSZ; for (unsigned int i = 0; i < ancount; i++) { - char* rr_name_temp; + char* rr_name_temp = nullptr; long rr_temp_len; // NOLINT(runtime/int) int status2 = ares_expand_name(ptr, buf, len, &rr_name_temp, &rr_temp_len); - const ares_unique_ptr rr_name(rr_name_temp); if (status2 != ARES_SUCCESS) return status2 == ARES_EBADNAME ? ARES_EBADRESP : status2; + const ares_unique_ptr rr_name(rr_name_temp); + ptr += rr_temp_len; if (ptr + NS_RRFIXEDSZ > buf + len) { return ARES_EBADRESP; @@ -1101,27 +1103,27 @@ int ParseSoaReply(Environment* env, // only need SOA if (rr_type == ns_t_soa) { - char* nsname_temp; + char* nsname_temp = nullptr; long nsname_temp_len; // NOLINT(runtime/int) int status3 = ares_expand_name(ptr, buf, len, &nsname_temp, &nsname_temp_len); - const ares_unique_ptr nsname(nsname_temp); if (status3 != ARES_SUCCESS) { return status3 == ARES_EBADNAME ? ARES_EBADRESP : status3; } + const ares_unique_ptr nsname(nsname_temp); ptr += nsname_temp_len; - char* hostmaster_temp; + char* hostmaster_temp = nullptr; long hostmaster_temp_len; // NOLINT(runtime/int) int status4 = ares_expand_name(ptr, buf, len, &hostmaster_temp, &hostmaster_temp_len); - const ares_unique_ptr hostmaster(hostmaster_temp); if (status4 != ARES_SUCCESS) { return status4 == ARES_EBADNAME ? ARES_EBADRESP : status4; } + const ares_unique_ptr hostmaster(hostmaster_temp); ptr += hostmaster_temp_len; if (ptr + 5 * 4 > buf + len) { From 48bc3fcd4cadfca7ec091995c72acbaf22475166 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 6 Oct 2020 09:47:36 -0700 Subject: [PATCH 076/117] build: improved release lint error message PR-URL: https://github.com/nodejs/node/pull/35523 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Beth Griggs Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c8731b5f4da534..b8986e9a3c1a97 100644 --- a/Makefile +++ b/Makefile @@ -943,7 +943,9 @@ endif .PHONY: release-only release-only: check-xz @if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \ - echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/guides/releases.md)' ; \ + echo 'Please update REPLACEME tags in the following doc/api/*.md files (See doc/guides/releases.md):\n' ; \ + REPLACEMES="$(shell grep -l REPLACEME doc/api/*.md)" ; \ + echo "$$REPLACEMES\n" | tr " " "\n" ; \ exit 1 ; \ fi @if [ "$(DISTTYPE)" = "release" ] && \ From 6efa140f8f0ef3779515afff72264cda83c75e30 Mon Sep 17 00:00:00 2001 From: Yohanan Baruchel Date: Mon, 5 Oct 2020 23:54:47 +0300 Subject: [PATCH 077/117] lib: change http client path assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - change http client path assignment from to (it's more appropriate in this case). - since the inner condition is the only referencing the variable, moved the assignment to the inner condition. PR-URL: https://github.com/nodejs/node/pull/35508 Reviewed-By: Rich Trott Reviewed-By: Gerhard Stöbich Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- lib/_http_client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 190c13846ced8f..f2639aafce324d 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -141,9 +141,8 @@ function ClientRequest(input, options, cb) { if (this.agent && this.agent.protocol) expectedProtocol = this.agent.protocol; - let path; if (options.path) { - path = String(options.path); + const path = String(options.path); if (INVALID_PATH_REGEX.test(path)) throw new ERR_UNESCAPED_CHARACTERS('Request path'); } From fb9bb05ee2165daeb5e45740d983747a6ed60c4d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 6 Oct 2020 23:17:45 +0200 Subject: [PATCH 078/117] doc: fix util.inspect change history PR-URL: https://github.com/nodejs/node/pull/35528 Reviewed-By: Myles Borins Reviewed-By: Shelley Vohr Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen --- doc/api/util.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index 3556d0d380cc9f..2daf57679b708a 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -414,7 +414,9 @@ stream.write('With ES6'); diff --git a/tools/doc/json.js b/tools/doc/json.js index 6dd25d41026f84..5677fd1ce8b664 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -437,7 +437,7 @@ const eventPrefix = '^Event: +'; const classPrefix = '^[Cc]lass: +'; const ctorPrefix = '^(?:[Cc]onstructor: +)?`?new +'; const classMethodPrefix = '^Static method: +'; -const maybeClassPropertyPrefix = '(?:Class Property: +)?'; +const maybeClassPropertyPrefix = '(?:Class property: +)?'; const maybeQuote = '[\'"]?'; const notQuotes = '[^\'"]+'; From f3a045720c25ac4ffeb70affa1b05686f7d6dc35 Mon Sep 17 00:00:00 2001 From: davkor Date: Wed, 19 Aug 2020 22:02:14 +0100 Subject: [PATCH 080/117] build: fuzzer that targets node::LoadEnvironment() Refs: https://github.com/nodejs/node/pull/34761 Refs: https://github.com/nodejs/node/issues/33724 PR-URL: https://github.com/nodejs/node/pull/34844 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Michael Dawson --- node.gyp | 43 +++++++++++++++ test/fuzzers/fuzz_env.cc | 107 +++++++++++++++++++++++++++++++++++++ test/fuzzers/fuzz_helper.h | 42 +++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 test/fuzzers/fuzz_env.cc create mode 100644 test/fuzzers/fuzz_helper.h diff --git a/node.gyp b/node.gyp index 21f4aab7f0adee..580e1d8d76b04b 100644 --- a/node.gyp +++ b/node.gyp @@ -1143,6 +1143,49 @@ }], ], }, # fuzz_url + { # fuzz_env + 'target_name': 'fuzz_env', + 'type': 'executable', + 'dependencies': [ + '<(node_lib_target_name)', + 'deps/histogram/histogram.gyp:histogram', + 'deps/uvwasi/uvwasi.gyp:uvwasi', + 'node_dtrace_header', + 'node_dtrace_ustack', + 'node_dtrace_provider', + ], + 'includes': [ + 'node.gypi' + ], + 'include_dirs': [ + 'src', + 'tools/msvs/genfiles', + 'deps/v8/include', + 'deps/cares/include', + 'deps/uv/include', + 'deps/uvwasi/include', + 'test/cctest', + ], + 'defines': [ + 'NODE_ARCH="<(target_arch)"', + 'NODE_PLATFORM="<(OS)"', + 'NODE_WANT_INTERNALS=1', + ], + 'sources': [ + 'src/node_snapshot_stub.cc', + 'src/node_code_cache_stub.cc', + 'test/fuzzers/fuzz_env.cc', + ], + 'conditions': [ + ['OS=="linux"', { + 'ldflags': [ '-fsanitize=fuzzer' ] + }], + # Ensure that ossfuzz flag has been set and that we are on Linux + [ 'OS!="linux" or ossfuzz!="true"', { + 'type': 'none', + }], + ], + }, # fuzz_env { 'target_name': 'cctest', 'type': 'executable', diff --git a/test/fuzzers/fuzz_env.cc b/test/fuzzers/fuzz_env.cc new file mode 100644 index 00000000000000..92af0bcb30e660 --- /dev/null +++ b/test/fuzzers/fuzz_env.cc @@ -0,0 +1,107 @@ +/* + * A fuzzer focused on the node::LoadEnvironment() function. + * + * Code here has been inspired by the cctest test case. + */ + +#include +#include "node.h" +#include "node_platform.h" +#include "node_internals.h" +#include "env-inl.h" +#include "util-inl.h" +#include "v8.h" +#include "libplatform/libplatform.h" +#include "aliased_buffer.h" +#include "fuzz_helper.h" + +using node::AliasedBufferBase; + +/* General set up */ +using ArrayBufferUniquePtr = std::unique_ptr; +using TracingAgentUniquePtr = std::unique_ptr; +using NodePlatformUniquePtr = std::unique_ptr; + +static TracingAgentUniquePtr tracing_agent; +static NodePlatformUniquePtr platform; +static uv_loop_t current_loop; + +extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { + uv_os_unsetenv("NODE_OPTIONS"); + std::vector node_argv{ "fuzz_env" }; + std::vector exec_argv; + std::vector errors; + + node::InitializeNodeWithArgs(&node_argv, &exec_argv, &errors); + + tracing_agent = std::make_unique(); + node::tracing::TraceEventHelper::SetAgent(tracing_agent.get()); + node::tracing::TracingController* tracing_controller = + tracing_agent->GetTracingController(); + CHECK_EQ(0, uv_loop_init(¤t_loop)); + static constexpr int kV8ThreadPoolSize = 4; + platform.reset( + new node::NodePlatform(kV8ThreadPoolSize, tracing_controller)); + v8::V8::InitializePlatform(platform.get()); + v8::V8::Initialize(); + return 0; +} + +class FuzzerFixtureHelper { +public: + v8::Isolate* isolate_; + ArrayBufferUniquePtr allocator; + + FuzzerFixtureHelper() + : allocator(ArrayBufferUniquePtr(node::CreateArrayBufferAllocator(), + &node::FreeArrayBufferAllocator)) { + isolate_ = NewIsolate(allocator.get(), ¤t_loop, platform.get()); + CHECK_NOT_NULL(isolate_); + isolate_->Enter(); + }; + + void Teardown() { + platform->DrainTasks(isolate_); + isolate_->Exit(); + platform->UnregisterIsolate(isolate_); + isolate_->Dispose(); + isolate_ = nullptr; + } +}; + +void EnvTest(v8::Isolate* isolate_, char* env_string) { + const v8::HandleScope handle_scope(isolate_); + Argv argv; + + node::EnvironmentFlags::Flags flags = node::EnvironmentFlags::kDefaultFlags; + auto isolate = handle_scope.GetIsolate(); + v8::Local context_ = node::NewContext(isolate); + context_->Enter(); + + node::IsolateData* isolate_data_ = node::CreateIsolateData(isolate, ¤t_loop, + platform.get()); + std::vector args(*argv, *argv + 1); + std::vector exec_args(*argv, *argv + 1); + node::Environment* environment_ = node::CreateEnvironment(isolate_data_, + context_, args, exec_args, flags); + node::Environment* envi = environment_; + SetProcessExitHandler(envi, [&](node::Environment* env_, int exit_code) { + node::Stop(envi); + }); + node::LoadEnvironment(envi, env_string); + + // Cleanup! + node::FreeEnvironment(environment_); + node::FreeIsolateData(isolate_data_); + context_->Exit(); +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data2, size_t size) { + FuzzerFixtureHelper ffh; + std::string s(reinterpret_cast(data2), size); + EnvTest(ffh.isolate_, (char*)s.c_str()); + ffh.Teardown(); + return 0; +} + diff --git a/test/fuzzers/fuzz_helper.h b/test/fuzzers/fuzz_helper.h new file mode 100644 index 00000000000000..707a8183dbd274 --- /dev/null +++ b/test/fuzzers/fuzz_helper.h @@ -0,0 +1,42 @@ +struct Argv { + public: + Argv() : Argv({"node", "-p", "process.version"}) {} + + Argv(const std::initializer_list &args) { + nr_args_ = args.size(); + int total_len = 0; + for (auto it = args.begin(); it != args.end(); ++it) { + total_len += strlen(*it) + 1; + } + argv_ = static_cast(malloc(nr_args_ * sizeof(char*))); + argv_[0] = static_cast(malloc(total_len)); + int i = 0; + int offset = 0; + for (auto it = args.begin(); it != args.end(); ++it, ++i) { + int len = strlen(*it) + 1; + snprintf(argv_[0] + offset, len, "%s", *it); + // Skip argv_[0] as it points the correct location already + if (i > 0) { + argv_[i] = argv_[0] + offset; + } + offset += len; + } + } + + ~Argv() { + free(argv_[0]); + free(argv_); + } + + int nr_args() const { + return nr_args_; + } + + char** operator*() const { + return argv_; + } + + private: + char** argv_; + int nr_args_; +}; From 05db4b8343b244ac39a27130b22b036293ef49f9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 8 Oct 2020 04:08:57 -0700 Subject: [PATCH 081/117] doc: improve SIGINT error text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add kbd elements * correct period/parenthesis order * make fragment a full sentence PR-URL: https://github.com/nodejs/node/pull/35558 Reviewed-By: Anna Henningsen Reviewed-By: Gerhard Stöbich --- doc/api/errors.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index b4d640446c8ca4..d5d8e1efa7ebe8 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1714,8 +1714,8 @@ An attempt was made to `require()` an [ES Module][]. ### `ERR_SCRIPT_EXECUTION_INTERRUPTED` -Script execution was interrupted by `SIGINT` (For example, when Ctrl+C was -pressed). +Script execution was interrupted by `SIGINT` (For example, +Ctrl+C was pressed.) ### `ERR_SCRIPT_EXECUTION_TIMEOUT` From 992355cdf984c4d5e91ae18b3eff93ad8011c16b Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Thu, 8 Oct 2020 11:00:35 +0400 Subject: [PATCH 082/117] doc: simplify wording in tracing APIs doc PR-URL: https://github.com/nodejs/node/pull/35556 Reviewed-By: Harshitha K P Reviewed-By: Rich Trott --- doc/api/tracing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/tracing.md b/doc/api/tracing.md index 9350e0b9ca97da..530f534d82476b 100644 --- a/doc/api/tracing.md +++ b/doc/api/tracing.md @@ -80,9 +80,9 @@ string that supports `${rotation}` and `${pid}`: node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js ``` -Starting with Node.js 10.0.0, the tracing system uses the same time source -as the one used by `process.hrtime()` -however the trace-event timestamps are expressed in microseconds, +The tracing system uses the same time source +as the one used by `process.hrtime()`. +However the trace-event timestamps are expressed in microseconds, unlike `process.hrtime()` which returns nanoseconds. The features from this module are not available in [`Worker`][] threads. From b741f2ff84fb2044d3100a50ecda74779e2c0608 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 2 Oct 2020 14:49:40 -0700 Subject: [PATCH 083/117] src: move node_process to modern THROW_ERR* Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/35472 Reviewed-By: Joyee Cheung --- src/node_process_methods.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 82be06aa7869ca..b506050e507559 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -157,8 +157,9 @@ static void Kill(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Local context = env->context(); - if (args.Length() != 2) - return env->ThrowError("Bad argument."); + if (args.Length() < 2) { + THROW_ERR_MISSING_ARGS(env, "Bad argument."); + } int pid; if (!args[0]->Int32Value(context).To(&pid)) return; @@ -322,8 +323,8 @@ static void ResourceUsage(const FunctionCallbackInfo& args) { static void DebugProcess(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - if (args.Length() != 1) { - return env->ThrowError("Invalid number of arguments."); + if (args.Length() < 1) { + return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments."); } CHECK(args[0]->IsNumber()); @@ -347,9 +348,8 @@ static void DebugProcess(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Isolate* isolate = args.GetIsolate(); - if (args.Length() != 1) { - env->ThrowError("Invalid number of arguments."); - return; + if (args.Length() < 1) { + return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments."); } HANDLE process = nullptr; From e9bee3950c6c06645d6f25f3a47303795467a1c8 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 2 Oct 2020 14:23:11 -0700 Subject: [PATCH 084/117] src: move node_contextify to modern THROW_ERR_* Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/35470 Reviewed-By: Joyee Cheung --- src/node_contextify.cc | 3 ++- src/node_errors.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 5d44c2f76dd7a0..c22247b95c5402 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -903,7 +903,8 @@ bool ContextifyScript::EvalMachine(Environment* env, if (!env->can_call_into_js()) return false; if (!ContextifyScript::InstanceOf(env, args.Holder())) { - env->ThrowTypeError( + THROW_ERR_INVALID_THIS( + env, "Script methods can only be called on script instances."); return false; } diff --git a/src/node_errors.h b/src/node_errors.h index d814d78d9cf412..a47f096b43430b 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -40,6 +40,7 @@ void OnFatalError(const char* location, const char* message); V(ERR_INVALID_ARG_VALUE, TypeError) \ V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \ V(ERR_INVALID_ARG_TYPE, TypeError) \ + V(ERR_INVALID_THIS, TypeError) \ V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \ V(ERR_MEMORY_ALLOCATION_FAILED, Error) \ V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \ @@ -94,6 +95,7 @@ void OnFatalError(const char* location, const char* message); V(ERR_CRYPTO_UNKNOWN_DH_GROUP, "Unknown DH group") \ V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \ "Context not associated with Node.js environment") \ + V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \ V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \ V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \ V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \ From 1173efca2791e7bc1c1e39d80a50d6ad42448920 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 9 Oct 2020 04:33:19 -0700 Subject: [PATCH 085/117] tools: bump cpplint.py to 1.4.6 Refs: https://github.com/cpplint/cpplint/releases/tag/1.4.6 PR-URL: https://github.com/nodejs/node/pull/35569 Reviewed-By: Richard Lau Reviewed-By: Daijiro Wachi Reviewed-By: Jiawen Geng --- tools/cpplint.py | 265 +++++++++++++++++++---------------------------- 1 file changed, 106 insertions(+), 159 deletions(-) diff --git a/tools/cpplint.py b/tools/cpplint.py index 4ea91c0dc04a54..dd6095265d3f38 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -59,7 +59,7 @@ # if empty, use defaults _valid_extensions = set([]) -__VERSION__ = '1.4.4' +__VERSION__ = '1.4.6' try: xrange # Python 2 @@ -280,7 +280,6 @@ 'build/include', 'build/include_subdir', 'build/include_alpha', - 'build/include_inline', 'build/include_order', 'build/include_what_you_use', 'build/namespaces_literals', @@ -295,13 +294,11 @@ 'readability/constructors', 'readability/fn_size', 'readability/inheritance', - 'readability/pointer_notation', 'readability/multiline_comment', 'readability/multiline_string', 'readability/namespace', 'readability/nolint', 'readability/nul', - 'readability/null_usage', 'readability/strings', 'readability/todo', 'readability/utf8', @@ -321,7 +318,6 @@ 'runtime/string', 'runtime/threadsafe_fn', 'runtime/vlog', - 'runtime/v8_persistent', 'whitespace/blank_line', 'whitespace/braces', 'whitespace/comma', @@ -626,14 +622,6 @@ # Match string that indicates we're working on a Linux Kernel file. _SEARCH_KERNEL_FILE = re.compile(r'\b(?:LINT_KERNEL_FILE)') -_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') - -_V8_PERSISTENT_PATTERN = re.compile(r'\bv8::Persistent\b') - -_RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]' - r'(?]*>)?(\s+const)?\s*(?:<\w+>\s*)?&' + Match(r'((const\s+(volatile\s+)?)?|(volatile\s+(const\s+)?))?' + r'%s(\s*<[^>]*>)?(\s+const)?\s*(?:<\w+>\s*)?&' % re.escape(base_classname), constructor_args[0].strip())) if (not is_marked_explicit and @@ -3302,7 +3285,7 @@ def CheckForFunctionLengths(filename, clean_lines, linenum, """Reports for long function bodies. For an overview why this is done, see: - https://google.github.io/styleguide/cppguide.html#Write_Short_Functions + https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. @@ -3343,7 +3326,7 @@ def CheckForFunctionLengths(filename, clean_lines, linenum, if Search(r'(;|})', start_line): # Declarations and trivial functions body_found = True break # ... ignore - elif Search(r'{', start_line): + if Search(r'{', start_line): body_found = True function = Search(r'((\w|:)*)\(', line).group(1) if Match(r'TEST', function): # Handle TEST... macros @@ -3537,8 +3520,8 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error): line = clean_lines.elided[linenum] # You shouldn't have spaces before your brackets, except maybe after - # 'delete []' or 'return []() {};' - if Search(r'\w\s+\[', line) and not Search(r'(?:delete|return)\s+\[', line): + # 'delete []', 'return []() {};', or 'auto [abc, ...] = ...;'. + if Search(r'\w\s+\[', line) and not Search(r'(?:auto&?|delete|return)\s+\[', line): error(filename, linenum, 'whitespace/braces', 5, 'Extra space before [') @@ -4056,11 +4039,11 @@ def CheckBraces(filename, clean_lines, linenum, error): # its line, and the line after that should have an indent level equal to or # lower than the if. We also check for ambiguous if/else nesting without # braces. - if_else_match = Search(r'\b(if\s*\(|else\b)', line) + if_else_match = Search(r'\b(if\s*(|constexpr)\s*\(|else\b)', line) if if_else_match and not Match(r'\s*#', line): if_indent = GetIndentLevel(line) endline, endlinenum, endpos = line, linenum, if_else_match.end() - if_match = Search(r'\bif\s*\(', line) + if_match = Search(r'\bif\s*(|constexpr)\s*\(', line) if if_match: # This could be a multiline if condition, so find the end first. pos = if_match.end() - 1 @@ -4528,71 +4511,6 @@ def CheckAltTokens(filename, clean_lines, linenum, error): 'Use operator %s instead of %s' % ( _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1))) -def CheckNullTokens(filename, clean_lines, linenum, error): - """Check NULL usage. - - Args: - filename: The name of the current file. - clean_lines: A CleansedLines instance containing the file. - linenum: The number of the line to check. - error: The function to call with any errors found. - """ - line = clean_lines.elided[linenum] - - # Avoid preprocessor lines - if Match(r'^\s*#', line): - return - - if line.find('/*') >= 0 or line.find('*/') >= 0: - return - - for match in _NULL_TOKEN_PATTERN.finditer(line): - error(filename, linenum, 'readability/null_usage', 2, - 'Use nullptr instead of NULL') - -def CheckV8PersistentTokens(filename, clean_lines, linenum, error): - """Check v8::Persistent usage. - - Args: - filename: The name of the current file. - clean_lines: A CleansedLines instance containing the file. - linenum: The number of the line to check. - error: The function to call with any errors found. - """ - line = clean_lines.elided[linenum] - - # Avoid preprocessor lines - if Match(r'^\s*#', line): - return - - if line.find('/*') >= 0 or line.find('*/') >= 0: - return - - for match in _V8_PERSISTENT_PATTERN.finditer(line): - error(filename, linenum, 'runtime/v8_persistent', 2, - 'Use v8::Global instead of v8::Persistent') - -def CheckLeftLeaningPointer(filename, clean_lines, linenum, error): - """Check for left-leaning pointer placement. - - Args: - filename: The name of the current file. - clean_lines: A CleansedLines instance containing the file. - linenum: The number of the line to check. - error: The function to call with any errors found. - """ - line = clean_lines.elided[linenum] - - # Avoid preprocessor lines - if Match(r'^\s*#', line): - return - - if '/*' in line or '*/' in line: - return - - for match in _RIGHT_LEANING_POINTER_PATTERN.finditer(line): - error(filename, linenum, 'readability/pointer_notation', 2, - 'Use left leaning pointer instead of right leaning') def GetLineWidth(line): """Determines the width of the line in column positions. @@ -4747,9 +4665,6 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, CheckSpacingForFunctionCall(filename, clean_lines, linenum, error) CheckCheck(filename, clean_lines, linenum, error) CheckAltTokens(filename, clean_lines, linenum, error) - CheckNullTokens(filename, clean_lines, linenum, error) - CheckV8PersistentTokens(filename, clean_lines, linenum, error) - CheckLeftLeaningPointer(filename, clean_lines, linenum, error) classinfo = nesting_state.InnermostClass() if classinfo: CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error) @@ -4910,14 +4825,27 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): 'Do not include .' + extension + ' files from other packages') return - if not _THIRD_PARTY_HEADERS_PATTERN.match(include): + # We DO want to include a 3rd party looking header if it matches the + # filename. Otherwise we get an erroneous error "...should include its + # header" error later. + third_src_header = False + for ext in GetHeaderExtensions(): + basefilename = filename[0:len(filename) - len(fileinfo.Extension())] + headerfile = basefilename + '.' + ext + headername = FileInfo(headerfile).RepositoryName() + if headername in include or include in headername: + third_src_header = True + break + + if third_src_header or not _THIRD_PARTY_HEADERS_PATTERN.match(include): include_state.include_list[-1].append((include, linenum)) # We want to ensure that headers appear in the right order: - # 1) for foo.cc, foo.h - # 2) other project headers - # 3) c system files - # 4) cpp system files + # 1) for foo.cc, foo.h (preferred location) + # 2) c system files + # 3) cpp system files + # 4) for foo.cc, foo.h (deprecated location) + # 5) other google headers # # We classify each include statement as one of those 5 types # using a number of techniques. The include_state object keeps @@ -5180,7 +5108,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, and line[-1] != '\\'): error(filename, linenum, 'build/namespaces', 4, 'Do not use unnamed namespaces in header files. See ' - 'https://google.github.io/styleguide/cppguide.html#Namespaces' + 'https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces' ' for more information.') @@ -5708,11 +5636,11 @@ def ExpectingFunctionArgs(clean_lines, linenum): )), ('', ('numeric_limits',)), ('', ('list',)), - ('', ('map', 'multimap',)), + ('', ('multimap',)), ('', ('allocator', 'make_shared', 'make_unique', 'shared_ptr', 'unique_ptr', 'weak_ptr')), ('', ('queue', 'priority_queue',)), - ('', ('set', 'multiset',)), + ('', ('multiset',)), ('', ('stack',)), ('', ('char_traits', 'basic_string',)), ('', ('tuple',)), @@ -5746,6 +5674,16 @@ def ExpectingFunctionArgs(clean_lines, linenum): (re.compile(r'[^>.]\b' + _template + r'(<.*?>)?\([^\)]'), _template, _header)) +# Match set, but not foo->set, foo.set +_re_pattern_headers_maybe_templates.append( + (re.compile(r'[^>.]\bset\s*\<'), + 'set<>', + '')) +# Match 'map var' and 'std::map(...)', but not 'map(...)'' +_re_pattern_headers_maybe_templates.append( + (re.compile(r'(std\b::\bmap\s*\<)|(^(std\b::\b)map\b\(\s*\<)'), + 'map<>', + '')) # Other scripts may reach in and modify this pattern. _re_pattern_templates = [] @@ -5828,18 +5766,19 @@ def UpdateIncludeState(filename, include_dict, io=codecs): """ headerfile = None try: - headerfile = io.open(filename, 'r', 'utf8', 'replace') + with io.open(filename, 'r', 'utf8', 'replace') as headerfile: + linenum = 0 + for line in headerfile: + linenum += 1 + clean_line = CleanseComments(line) + match = _RE_PATTERN_INCLUDE.search(clean_line) + if match: + include = match.group(2) + include_dict.setdefault(include, linenum) + return True except IOError: return False - linenum = 0 - for line in headerfile: - linenum += 1 - clean_line = CleanseComments(line) - match = _RE_PATTERN_INCLUDE.search(clean_line) - if match: - include = match.group(2) - include_dict.setdefault(include, linenum) - return True + def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error, @@ -6291,8 +6230,6 @@ def ProcessFileData(filename, file_extension, lines, error, CheckForNewlineAtEOF(filename, lines, error) - CheckInlineHeader(filename, include_state, error) - def ProcessConfigOverrides(filename): """ Loads the configuration files and processes the config overrides. @@ -6311,7 +6248,7 @@ def ProcessConfigOverrides(filename): if not base_name: break # Reached the root directory. - cfg_file = os.path.join(abs_path, ".cpplint") + cfg_file = os.path.join(abs_path, "CPPLINT.cfg") abs_filename = abs_path if not os.path.isfile(cfg_file): continue @@ -6355,14 +6292,7 @@ def ProcessConfigOverrides(filename): except ValueError: _cpplint_state.PrintError('Line length must be numeric.') elif name == 'extensions': - global _valid_extensions - try: - extensions = [ext.strip() for ext in val.split(',')] - _valid_extensions = set(extensions) - except ValueError: - sys.stderr.write('Extensions should be a comma-separated list of values;' - 'for example: extensions=hpp,cpp\n' - 'This could not be parsed: "%s"' % (val,)) + ProcessExtensionsOption(val) elif name == 'root': global _root # root directories are specified relative to CPPLINT.cfg dir. @@ -6425,7 +6355,8 @@ def ProcessFile(filename, vlevel, extra_check_functions=None): codecs.getwriter('utf8'), 'replace').read().split('\n') else: - lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n') + with codecs.open(filename, 'r', 'utf8', 'replace') as target_file: + lines = target_file.read().split('\n') # Remove trailing '\r'. # The -1 accounts for the extra trailing blank line we get from split() @@ -6585,11 +6516,7 @@ def ParseArguments(args): _excludes = set() _excludes.update(glob.glob(val)) elif opt == '--extensions': - global _valid_extensions - try: - _valid_extensions = set(val.split(',')) - except ValueError: - PrintUsage('Extensions must be comma seperated list.') + ProcessExtensionsOption(val) elif opt == '--headers': ProcessHppHeadersOption(val) elif opt == '--recursive': @@ -6641,15 +6568,35 @@ def _ExpandDirectories(filenames): for filename in expanded: if os.path.splitext(filename)[1][1:] in GetAllExtensions(): filtered.append(filename) - return filtered -def _FilterExcludedFiles(filenames): +def _FilterExcludedFiles(fnames): """Filters out files listed in the --exclude command line switch. File paths in the switch are evaluated relative to the current working directory """ exclude_paths = [os.path.abspath(f) for f in _excludes] - return [f for f in filenames if os.path.abspath(f) not in exclude_paths] + # because globbing does not work recursively, exclude all subpath of all excluded entries + return [f for f in fnames + if not any(e for e in exclude_paths + if _IsParentOrSame(e, os.path.abspath(f)))] + +def _IsParentOrSame(parent, child): + """Return true if child is subdirectory of parent. + Assumes both paths are absolute and don't contain symlinks. + """ + parent = os.path.normpath(parent) + child = os.path.normpath(child) + if parent == child: + return True + + prefix = os.path.commonprefix([parent, child]) + if prefix != parent: + return False + # Note: os.path.commonprefix operates on character basis, so + # take extra care of situations like '/foo/ba' and '/foo/bar/baz' + child_suffix = child[len(prefix):] + child_suffix = child_suffix.lstrip(os.sep) + return child == os.path.join(prefix, child_suffix) def main(): filenames = ParseArguments(sys.argv[1:]) From adf4f90bce11bbcf0350ec98dc27aa19016507bd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 9 Oct 2020 06:00:00 -0700 Subject: [PATCH 086/117] tools: refloat 7 Node.js patches to cpplint.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cherry-pick 12c8b4d15471cb6211b39c3a2ca5b10fa4b9f12b Original commit message: This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: https://github.com/nodejs/node/pull/17373 Reviewed-By: Jon Moss Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Tobias Nießen Refs: https://github.com/nodejs/node/commit/12c8b4d15471cb6211b39c3a2ca5b10fa4b9f12b Cherry-pick fc81e801913de3e3f3c0c8e26c105f983a74e539 Original commit message: Update cpplint.py to check for inline headers when the corresponding header is already included. PR-URL: https://github.com/nodejs/node/pull/21521 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Refs: https://github.com/nodejs/node/commit/fc81e801913de3e3f3c0c8e26c105f983a74e539 Cherry-pick cbc3dd997eb90d629d1b9912b7a5a40eb82343df Original commit message: src, tools: add check for left leaning pointers This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: https://github.com/nodejs/node/pull/21010 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Refs: https://github.com/nodejs/node/commit/cbc3dd997eb90d629d1b9912b7a5a40eb82343df Cherry-pick 902998190a55d6915b881936f6dd5b6e9cca6ad8 Original commit message: tools: fix cpplint.py header rules THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: https://github.com/nodejs/node/pull/26306 Reviewed-By: Gireesh Punathil Refs: https://github.com/nodejs/node/commit/902998190a55d6915b881936f6dd5b6e9cca6ad8 Cherry-pick 0a25ace9c35b62ece4d32fd90b326d8063265109 Original commit message: tools: move cpplint configuration to .cpplint PR-URL: https://github.com/nodejs/node/pull/27098 Reviewed-By: Joyee Cheung Reviewed-By: Daniel Bevenius Refs: https://github.com/nodejs/node/commit/0a25ace9c35b62ece4d32fd90b326d8063265109 Cherry-pick afa9a7206c26a29a2af226696c145c924a6d3754 Original commit message: tools: refloat update link to google styleguide for cpplint This commit updates two old links to Google's C++ styleguide which currently result in a 404 when accessed. PR-URL: https://github.com/nodejs/node/pull/30876 Reviewed-By: Michaël Zasso Reviewed-By: David Carlier Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Rich Trott Refs: https://github.com/nodejs/node/commit/afa9a7206c26a29a2af226696c145c924a6d3754 Cherry-pick e23bf8f771aa0bd60e25ff079985fc29b5846403 Original commit message: tools,src: refloat forbid usage of v8::Persistent `v8::Persistent` comes with the surprising catch that it requires manual cleanup. `v8::Global` doesn’t, making it easier to use, and additionally provides move semantics. New code should always use `v8::Global`. PR-URL: https://github.com/nodejs/node/pull/31018 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: David Carlier Reviewed-By: Rich Trott Reviewed-By: Gus Caplan Reviewed-By: Joyee Cheung Reviewed-By: Ben Noordhuis Reviewed-By: Stephen Belanger PR-URL: https://github.com/nodejs/node/pull/35569 Reviewed-By: Richard Lau Reviewed-By: Daijiro Wachi Reviewed-By: Jiawen Geng --- tools/cpplint.py | 122 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 13 deletions(-) diff --git a/tools/cpplint.py b/tools/cpplint.py index dd6095265d3f38..1502ec3e057e1b 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -280,6 +280,7 @@ 'build/include', 'build/include_subdir', 'build/include_alpha', + 'build/include_inline', 'build/include_order', 'build/include_what_you_use', 'build/namespaces_literals', @@ -294,11 +295,13 @@ 'readability/constructors', 'readability/fn_size', 'readability/inheritance', + 'readability/pointer_notation', 'readability/multiline_comment', 'readability/multiline_string', 'readability/namespace', 'readability/nolint', 'readability/nul', + 'readability/null_usage', 'readability/strings', 'readability/todo', 'readability/utf8', @@ -318,6 +321,7 @@ 'runtime/string', 'runtime/threadsafe_fn', 'runtime/vlog', + 'runtime/v8_persistent', 'whitespace/blank_line', 'whitespace/braces', 'whitespace/comma', @@ -622,6 +626,14 @@ # Match string that indicates we're working on a Linux Kernel file. _SEARCH_KERNEL_FILE = re.compile(r'\b(?:LINT_KERNEL_FILE)') +_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') + +_V8_PERSISTENT_PATTERN = re.compile(r'\bv8::Persistent\b') + +_RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]' + r'(?= 0 or line.find('*/') >= 0: + return + + for match in _NULL_TOKEN_PATTERN.finditer(line): + error(filename, linenum, 'readability/null_usage', 2, + 'Use nullptr instead of NULL') + +def CheckV8PersistentTokens(filename, clean_lines, linenum, error): + """Check v8::Persistent usage. + + Args: + filename: The name of the current file. + clean_lines: A CleansedLines instance containing the file. + linenum: The number of the line to check. + error: The function to call with any errors found. + """ + line = clean_lines.elided[linenum] + + # Avoid preprocessor lines + if Match(r'^\s*#', line): + return + + if line.find('/*') >= 0 or line.find('*/') >= 0: + return + + for match in _V8_PERSISTENT_PATTERN.finditer(line): + error(filename, linenum, 'runtime/v8_persistent', 2, + 'Use v8::Global instead of v8::Persistent') + +def CheckLeftLeaningPointer(filename, clean_lines, linenum, error): + """Check for left-leaning pointer placement. + + Args: + filename: The name of the current file. + clean_lines: A CleansedLines instance containing the file. + linenum: The number of the line to check. + error: The function to call with any errors found. + """ + line = clean_lines.elided[linenum] + + # Avoid preprocessor lines + if Match(r'^\s*#', line): + return + + if '/*' in line or '*/' in line: + return + + for match in _RIGHT_LEANING_POINTER_PATTERN.finditer(line): + error(filename, linenum, 'readability/pointer_notation', 2, + 'Use left leaning pointer instead of right leaning') def GetLineWidth(line): """Determines the width of the line in column positions. @@ -4665,6 +4757,9 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, CheckSpacingForFunctionCall(filename, clean_lines, linenum, error) CheckCheck(filename, clean_lines, linenum, error) CheckAltTokens(filename, clean_lines, linenum, error) + CheckNullTokens(filename, clean_lines, linenum, error) + CheckV8PersistentTokens(filename, clean_lines, linenum, error) + CheckLeftLeaningPointer(filename, clean_lines, linenum, error) classinfo = nesting_state.InnermostClass() if classinfo: CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error) @@ -4841,11 +4936,10 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): include_state.include_list[-1].append((include, linenum)) # We want to ensure that headers appear in the right order: - # 1) for foo.cc, foo.h (preferred location) - # 2) c system files - # 3) cpp system files - # 4) for foo.cc, foo.h (deprecated location) - # 5) other google headers + # 1) for foo.cc, foo.h + # 2) other project headers + # 3) c system files + # 4) cpp system files # # We classify each include statement as one of those 5 types # using a number of techniques. The include_state object keeps @@ -5108,7 +5202,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, and line[-1] != '\\'): error(filename, linenum, 'build/namespaces', 4, 'Do not use unnamed namespaces in header files. See ' - 'https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces' + 'https://google.github.io/styleguide/cppguide.html#Namespaces' ' for more information.') @@ -6230,6 +6324,8 @@ def ProcessFileData(filename, file_extension, lines, error, CheckForNewlineAtEOF(filename, lines, error) + CheckInlineHeader(filename, include_state, error) + def ProcessConfigOverrides(filename): """ Loads the configuration files and processes the config overrides. @@ -6248,7 +6344,7 @@ def ProcessConfigOverrides(filename): if not base_name: break # Reached the root directory. - cfg_file = os.path.join(abs_path, "CPPLINT.cfg") + cfg_file = os.path.join(abs_path, ".cpplint") abs_filename = abs_path if not os.path.isfile(cfg_file): continue From a0b541c3e05ccf937e3065418e082052ceaad7ac Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 10 Oct 2020 05:30:20 -0700 Subject: [PATCH 087/117] doc: use kbd element in process doc PR-URL: https://github.com/nodejs/node/pull/35584 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Daijiro Wachi --- doc/api/process.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index f3e266229f223d..ae739de78747fc 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -504,11 +504,12 @@ process.on('SIGTERM', handle); installed its default behavior will be removed. * `'SIGTERM'` is not supported on Windows, it can be listened on. * `'SIGINT'` from the terminal is supported on all platforms, and can usually be - generated with `+C` (though this may be configurable). It is not - generated when [terminal raw mode][] is enabled and `+C` is used. -* `'SIGBREAK'` is delivered on Windows when `+` is pressed, on - non-Windows platforms it can be listened on, but there is no way to send or - generate it. + generated with Ctrl+C (though this may be configurable). + It is not generated when [terminal raw mode][] is enabled and + Ctrl+C is used. +* `'SIGBREAK'` is delivered on Windows when Ctrl+Break is + pressed. On non-Windows platforms, it can be listened on, but there is no way + to send or generate it. * `'SIGWINCH'` is delivered when the console has been resized. On Windows, this will only happen on write to the console when the cursor is being moved, or when a readable tty is used in raw mode. From 5fea51b66c0a32379631fd446d1ea10602f6af49 Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Fri, 11 Sep 2020 12:05:16 +0000 Subject: [PATCH 088/117] doc: add PoojaDurgad as a triager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I would like to apply for a triager in this project. My motivation to become a triager is to help with the issues in this repo and the help repo, as well as learn deeper internals of node.js, and to eventually become a collaborator! I hear by declare that I read and understood the project’s Code of Conduct, and will adhere to that. PR-URL: https://github.com/nodejs/node/pull/35153 Reviewed-By: Gireesh Punathil Reviewed-By: Derek Lewis --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a43dcc0bfa813c..a5066a675f0a8e 100644 --- a/README.md +++ b/README.md @@ -570,6 +570,11 @@ For information about the governance of the Node.js project, see Collaborators follow the [Collaborator Guide](./doc/guides/collaborator-guide.md) in maintaining the Node.js project. +### Triagers + +* [PoojaDurgad](https://github.com/PoojaDurgad) - +**Pooja Durgad** <Pooja.D.P@ibm.com> + ### Release Keys Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys): From a3e8829d4a24681a845401af252a2a305ad1df55 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 9 Oct 2020 09:12:40 -0700 Subject: [PATCH 089/117] inspector: do not hardcode Debugger.CallFrameId in tests Debugger.CallFrameId is defined as an opaque string [1]. Some tests currently hardcode the value, relying on undocumented internal details of V8. This makes it hard for V8 to change the internal representation. We should instead use the reported call frame id from the Debugger.paused event directly. This is how every inspector client does it. [1] https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#type-CallFrameId PR-URL: https://github.com/nodejs/node/pull/35570 Reviewed-By: Aleksei Koziatinskii Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- test/common/inspector-helper.js | 9 +++++++++ test/parallel/test-inspector-esm.js | 2 +- test/sequential/test-inspector.js | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 77d7928af135a6..5aea807b7c0b81 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -130,6 +130,7 @@ class InspectorSession { this._unprocessedNotifications = []; this._notificationCallback = null; this._scriptsIdsByUrl = new Map(); + this._pausedDetails = null; let buffer = Buffer.alloc(0); socket.on('data', (data) => { @@ -179,6 +180,10 @@ class InspectorSession { this.mainScriptId = scriptId; } } + if (message.method === 'Debugger.paused') + this._pausedDetails = message.params; + if (message.method === 'Debugger.resumed') + this._pausedDetails = null; if (this._notificationCallback) { // In case callback needs to install another @@ -267,6 +272,10 @@ class InspectorSession { `break on ${url}:${line}`); } + pausedDetails() { + return this._pausedDetails; + } + _matchesConsoleOutputNotification(notification, type, values) { if (!Array.isArray(values)) values = [ values ]; diff --git a/test/parallel/test-inspector-esm.js b/test/parallel/test-inspector-esm.js index 707fa7bb56f9e5..b9813e50c29ded 100644 --- a/test/parallel/test-inspector-esm.js +++ b/test/parallel/test-inspector-esm.js @@ -78,7 +78,7 @@ async function testBreakpoint(session) { let { result } = await session.send({ 'method': 'Debugger.evaluateOnCallFrame', 'params': { - 'callFrameId': '{"ordinal":0,"injectedScriptId":1}', + 'callFrameId': session.pausedDetails().callFrames[0].callFrameId, 'expression': 'k + t', 'objectGroup': 'console', 'includeCommandLineAPI': true, diff --git a/test/sequential/test-inspector.js b/test/sequential/test-inspector.js index a1ef109cf1a9a0..b58d70c864263a 100644 --- a/test/sequential/test-inspector.js +++ b/test/sequential/test-inspector.js @@ -116,7 +116,7 @@ async function testBreakpoint(session) { let { result } = await session.send({ 'method': 'Debugger.evaluateOnCallFrame', 'params': { - 'callFrameId': '{"ordinal":0,"injectedScriptId":1}', + 'callFrameId': session.pausedDetails().callFrames[0].callFrameId, 'expression': 'k + t', 'objectGroup': 'console', 'includeCommandLineAPI': true, @@ -150,7 +150,7 @@ async function testI18NCharacters(session) { const chars = 'טֶ字и'; session.send({ 'method': 'Debugger.evaluateOnCallFrame', 'params': { - 'callFrameId': '{"ordinal":0,"injectedScriptId":1}', + 'callFrameId': session.pausedDetails().callFrames[0].callFrameId, 'expression': `console.log("${chars}")`, 'objectGroup': 'console', 'includeCommandLineAPI': true, @@ -276,7 +276,7 @@ async function testCommandLineAPI(session) { result = await session.send( { 'method': 'Debugger.evaluateOnCallFrame', 'params': { - 'callFrameId': '{"ordinal":0,"injectedScriptId":1}', + 'callFrameId': session.pausedDetails().callFrames[0].callFrameId, 'expression': `( require(${printBModuleStr}), require.cache[${printBModuleStr}].parent.id From 42f64eba89aec12d54dcf1e8c4a6c95c17c47d7d Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 7 Oct 2020 09:36:09 -0700 Subject: [PATCH 090/117] crypto: update certdata to NSS 3.56 This is the certdata.txt[0] from NSS 3.56, released on 2020-08-21. [0] https://hg.mozilla.org/projects/nss/raw-file/NSS_3_56_RTM/lib/ckfw/builtins/certdata.txt crypto: update root certificates Update the list of root certificates in src/node_root_certs.h with tools/mk-ca-bundle.pl. Certificates added: - Microsoft ECC Root Certificate Authority 2017 - Microsoft RSA Root Certificate Authority 2017 - e-Szigno Root CA 2017 - certSIGN Root CA G2 Certificates removed: - Verisign Class 3 Public Primary Certification Authority - G3 - AddTrust External Root - Staat der Nederlanden Root CA - G2 - LuxTrust Global Root 2 PR-URL: https://github.com/nodejs/node/pull/35546 Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott Reviewed-By: Evan Lucas Reviewed-By: James M Snell --- src/node_root_certs.h | 205 ++--- tools/certdata.txt | 2005 ++++++++++++++--------------------------- 2 files changed, 788 insertions(+), 1422 deletions(-) diff --git a/src/node_root_certs.h b/src/node_root_certs.h index f8e84e7d231e33..47beb730f4b853 100644 --- a/src/node_root_certs.h +++ b/src/node_root_certs.h @@ -43,30 +43,6 @@ "jmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==\n" "-----END CERTIFICATE-----", -/* Verisign Class 3 Public Primary Certification Authority - G3 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQG\n" -"EwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0\n" -"IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv\n" -"cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1h\n" -"cnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3\n" -"MTYyMzU5NTlaMIHKMQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAd\n" -"BgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlT\n" -"aWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu\n" -"IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCC\n" -"ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2\n" -"R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6\n" -"yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFU\n" -"okWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyo\n" -"w0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBte\n" -"HRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my\n" -"/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe\n" -"DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC/Y4wjylG\n" -"sB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0xuKh\n" -"XFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa\n" -"t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==\n" -"-----END CERTIFICATE-----", - /* Entrust.net Premium 2048 Secure Server CA */ "-----BEGIN CERTIFICATE-----\n" "MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVz\n" @@ -112,31 +88,6 @@ "R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp\n" "-----END CERTIFICATE-----", -/* AddTrust External Root */ -"-----BEGIN CERTIFICATE-----\n" -"MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UE\n" -"ChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3Jr\n" -"MSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoX\n" -"DTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYw\n" -"JAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1\n" -"c3QgRXh0ZXJuYWwgQ0EgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3\n" -"GjPm8gAELTngTlvtH7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCw\n" -"SXrbLpX9uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX\n" -"mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63u\n" -"bUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5\n" -"aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0WicCAwEAAaOB3DCB2TAdBgNV\n" -"HQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMB\n" -"Af8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYT\n" -"AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwg\n" -"VFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJ\n" -"KoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH\n" -"YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw56wwCURQt\n" -"jr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355e6cJ\n" -"DUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u\n" -"G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49O\n" -"hgQ=\n" -"-----END CERTIFICATE-----", - /* Entrust Root Certification Authority */ "-----BEGIN CERTIFICATE-----\n" "MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAU\n" @@ -1110,38 +1061,6 @@ "dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=\n" "-----END CERTIFICATE-----", -/* Staat der Nederlanden Root CA - G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwG\n" -"A1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJs\n" -"YW5kZW4gUm9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjEL\n" -"MAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwi\n" -"U3RhYXQgZGVyIE5lZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQAD\n" -"ggIPADCCAgoCggIBAMVZ5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZ\n" -"qhQlEq0i6ABtQ8SpuOUfiUtnvWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU2\n" -"54DBtvPUZ5uW6M7XxgpT0GtJlvOjCwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvE\n" -"pMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiile7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV\n" -"3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCROME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9\n" -"whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpICT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2U\n" -"uIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V6548r6f1CGPqI0GAwJaCgRHOThuVw+\n" -"R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIitrzQ1aTsr1SIJSQ8p22xcik/\n" -"Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737qWmRRpdogBQ2HbN/uymY\n" -"NqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMBAAGjgZcwgZQwDwYD\n" -"VR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcCARYxaHR0cDov\n" -"L3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNVHQ8BAf8E\n" -"BAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUAA4IC\n" -"AQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz\n" -"+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUX\n" -"vQwjf/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sU\n" -"OlWDuYaNkqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fM\n" -"dWVSSt7wsKfkCpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2t\n" -"UKRXCnxLvJxxcypFURmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkm\n" -"bEgeqmiSBeGCc1qb3AdbCG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8s\n" -"V4pAWja63XVECDdCcAz+3F4hoKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXq\n" -"ZVUz9zkQxSgqIXobisQk+T8VyJoVIPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOL\n" -"nR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm66+KAQ==\n" -"-----END CERTIFICATE-----", - /* Hongkong Post Root CA 1 */ "-----BEGIN CERTIFICATE-----\n" "MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNV\n" @@ -2818,38 +2737,6 @@ "ElMzrdfkviT8tQp21KW8EA==\n" "-----END CERTIFICATE-----", -/* LuxTrust Global Root 2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjEL\n" -"MAkGA1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0\n" -"IEdsb2JhbCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYD\n" -"VQQGEwJMVTEWMBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xv\n" -"YmFsIFJvb3QgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNM\n" -"PIf5U2o3C/IPPIfOb9wmKb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJI\n" -"cRHIbjuend+JZTemhfY7RBi2xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy9\n" -"5iJMHZP1EMShduxq3sVs35a0VkBCwGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsn\n" -"Xpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCG\n" -"p4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkmFRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9\n" -"MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niFwpN6cj5mj5wWEWCPnolvZ77gR1o7DJpn\n" -"i89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/a4ebsypmQjVGbKq6rfmYe+lQVRQx\n" -"v7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8UubG/Mb2HeFpZZYiq/FkySIbW\n" -"TLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQMC6otOBttpSsvItO13D8\n" -"xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB/zBCBgNVHSAEOzA5\n" -"MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5Lmx1eHRydXN0\n" -"Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT+Et8szAd\n" -"BgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZFO1u\n" -"ecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN\n" -"H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89Bv\n" -"olbW7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaX\n" -"cozrhAIuZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8w\n" -"kbIEa91WvpWAVWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx\n" -"9xIX3eP/JEAdemrRTxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKre\n" -"zrnK+T+Tb/mjuuqlPpmt/f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbD\n" -"WjLtR5EWDrw4wVDej8oqkDQc7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBN\n" -"vUJO/3jaJMobtNeWOWyu8Q6qp31IiyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2\n" -"KuGUaJPHZnJED4AhMmwlxyOAgwrr\n" -"-----END CERTIFICATE-----", - /* TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 */ "-----BEGIN CERTIFICATE-----\n" "MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNV\n" @@ -3455,4 +3342,96 @@ "jnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh\n" "7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw==\n" "-----END CERTIFICATE-----", + +/* Microsoft ECC Root Certificate Authority 2017 */ +"-----BEGIN CERTIFICATE-----\n" +"MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQG\n" +"EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3Nv\n" +"ZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1\n" +"WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENv\n" +"cnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0\n" +"aG9yaXR5IDIwMTcwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiB\n" +"YgtlzPbKnR5vSmZRogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC\n" +"48Zo9OYbhGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E\n" +"BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIB\n" +"ADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG\n" +"7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUBiudQZsIxtzm6uBoiB078a1QW\n" +"IP8rtedMDE2mT3M=\n" +"-----END CERTIFICATE-----", + +/* Microsoft RSA Root Certificate Authority 2017 */ +"-----BEGIN CERTIFICATE-----\n" +"MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYD\n" +"VQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy\n" +"b3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1\n" +"MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0\n" +"IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUg\n" +"QXV0aG9yaXR5IDIwMTcwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wp\n" +"lZEWCpW9R2LBifOZNt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xzto\n" +"kLaCLeX0ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1\n" +"HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu\n" +"+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwS\n" +"lq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUcaDDv70ngNXtk55iwlNpNhTs+\n" +"VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRSMLl6IE9vDzhTyzMMEyuP1pq9Ksgt\n" +"sRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92\n" +"kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK\n" +"0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avN\n" +"JVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/\n" +"BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGCNxUBBAMC\n" +"AQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og6Lq4\n" +"6BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80\n" +"dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl\n" +"3JPk+ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbL\n" +"wVaZOjex/2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7\n" +"o7P4NHmJweDyAmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5T\n" +"kshGsRGRxpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp\n" +"GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy\n" +"4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39l\n" +"t2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E\n" +"-----END CERTIFICATE-----", + +/* e-Szigno Root CA 2017 */ +"-----BEGIN CERTIFICATE-----\n" +"MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhV\n" +"MREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwO\n" +"VkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4\n" +"MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRh\n" +"cGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcx\n" +"HjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEH\n" +"A0IABJbcPYrYsHtvxie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9o\n" +"MrWGQd+HWyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G\n" +"A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87G\n" +"yZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz\n" +"7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ+efcMQ==\n" +"-----END CERTIFICATE-----", + +/* certSIGN Root CA G2 */ +"-----BEGIN CERTIFICATE-----\n" +"MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJP\n" +"MRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAe\n" +"Fw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQK\n" +"EwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZI\n" +"hvcNAQEBBQADggIPADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC\n" +"46+CjobXXo9X69MhWf05N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UP\n" +"HULlj88F0+7cDBrZuIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTE\n" +"CMYmzPhpn+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs\n" +"cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7l\n" +"zw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMq\n" +"z6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiFDsGJ6x9nxUWO/203Nit4ZoOR\n" +"USs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf95xhszWYijqy7DwaNz9+j5LP2RIU\n" +"ZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwy\n" +"c6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGj\n" +"QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg\n" +"4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq\n" +"kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UCb6741jH/\n" +"JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB/AYm\n" +"/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5\n" +"8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvR\n" +"Cjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9\n" +"o4JFWklWatKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq\n" +"2LxndD0UF/tUSxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55\n" +"CJD2AhZkPuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE\n" +"1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3Ng\n" +"hVdJIgc=\n" +"-----END CERTIFICATE-----", #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/tools/certdata.txt b/tools/certdata.txt index ea14926063b4b5..fcef935cbfc96c 100644 --- a/tools/certdata.txt +++ b/tools/certdata.txt @@ -674,285 +674,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE -# -# Certificate "Verisign Class 3 Public Primary Certification Authority - G3" -# -# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Serial Number:00:9b:7e:06:49:a3:3e:62:b9:d5:ee:90:48:71:29:ef:57 -# Subject: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Not Valid Before: Fri Oct 01 00:00:00 1999 -# Not Valid After : Wed Jul 16 23:59:59 2036 -# Fingerprint (MD5): CD:68:B6:A7:C7:C4:CE:75:E0:1D:4F:57:44:61:92:09 -# Fingerprint (SHA1): 13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Verisign Class 3 Public Primary Certification Authority - G3" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\021\000\233\176\006\111\243\076\142\271\325\356\220\110\161 -\051\357\127 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\004\032\060\202\003\002\002\021\000\233\176\006\111\243 -\076\142\271\325\356\220\110\161\051\357\127\060\015\006\011\052 -\206\110\206\367\015\001\001\005\005\000\060\201\312\061\013\060 -\011\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003 -\125\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111 -\156\143\056\061\037\060\035\006\003\125\004\013\023\026\126\145 -\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164 -\167\157\162\153\061\072\060\070\006\003\125\004\013\023\061\050 -\143\051\040\061\071\071\071\040\126\145\162\151\123\151\147\156 -\054\040\111\156\143\056\040\055\040\106\157\162\040\141\165\164 -\150\157\162\151\172\145\144\040\165\163\145\040\157\156\154\171 -\061\105\060\103\006\003\125\004\003\023\074\126\145\162\151\123 -\151\147\156\040\103\154\141\163\163\040\063\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\063\060\036\027\015\071\071\061\060\060 -\061\060\060\060\060\060\060\132\027\015\063\066\060\067\061\066 -\062\063\065\071\065\071\132\060\201\312\061\013\060\011\006\003 -\125\004\006\023\002\125\123\061\027\060\025\006\003\125\004\012 -\023\016\126\145\162\151\123\151\147\156\054\040\111\156\143\056 -\061\037\060\035\006\003\125\004\013\023\026\126\145\162\151\123 -\151\147\156\040\124\162\165\163\164\040\116\145\164\167\157\162 -\153\061\072\060\070\006\003\125\004\013\023\061\050\143\051\040 -\061\071\071\071\040\126\145\162\151\123\151\147\156\054\040\111 -\156\143\056\040\055\040\106\157\162\040\141\165\164\150\157\162 -\151\172\145\144\040\165\163\145\040\157\156\154\171\061\105\060 -\103\006\003\125\004\003\023\074\126\145\162\151\123\151\147\156 -\040\103\154\141\163\163\040\063\040\120\165\142\154\151\143\040 -\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151\143 -\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040 -\055\040\107\063\060\202\001\042\060\015\006\011\052\206\110\206 -\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012 -\002\202\001\001\000\313\272\234\122\374\170\037\032\036\157\033 -\067\163\275\370\311\153\224\022\060\117\360\066\107\365\320\221 -\012\365\027\310\245\141\301\026\100\115\373\212\141\220\345\166 -\040\301\021\006\175\253\054\156\246\365\021\101\216\372\055\255 -\052\141\131\244\147\046\114\320\350\274\122\133\160\040\004\130 -\321\172\311\244\151\274\203\027\144\255\005\213\274\320\130\316 -\215\214\365\353\360\102\111\013\235\227\047\147\062\156\341\256 -\223\025\034\160\274\040\115\057\030\336\222\210\350\154\205\127 -\021\032\351\176\343\046\021\124\242\105\226\125\203\312\060\211 -\350\334\330\243\355\052\200\077\177\171\145\127\076\025\040\146 -\010\057\225\223\277\252\107\057\250\106\227\360\022\342\376\302 -\012\053\121\346\166\346\267\106\267\342\015\246\314\250\303\114 -\131\125\211\346\350\123\134\034\352\235\360\142\026\013\247\311 -\137\014\360\336\302\166\316\257\367\152\362\372\101\246\242\063 -\024\311\345\172\143\323\236\142\067\325\205\145\236\016\346\123 -\044\164\033\136\035\022\123\133\307\054\347\203\111\073\025\256 -\212\150\271\127\227\002\003\001\000\001\060\015\006\011\052\206 -\110\206\367\015\001\001\005\005\000\003\202\001\001\000\021\024 -\226\301\253\222\010\367\077\057\311\262\376\344\132\237\144\336 -\333\041\117\206\231\064\166\066\127\335\320\025\057\305\255\177 -\025\037\067\142\163\076\324\347\137\316\027\003\333\065\372\053 -\333\256\140\011\137\036\137\217\156\273\013\075\352\132\023\036 -\014\140\157\265\300\265\043\042\056\007\013\313\251\164\313\107 -\273\035\301\327\245\153\314\057\322\102\375\111\335\247\211\317 -\123\272\332\000\132\050\277\202\337\370\272\023\035\120\206\202 -\375\216\060\217\051\106\260\036\075\065\332\070\142\026\030\112 -\255\346\266\121\154\336\257\142\353\001\320\036\044\376\172\217 -\022\032\022\150\270\373\146\231\024\024\105\134\256\347\256\151 -\027\201\053\132\067\311\136\052\364\306\342\241\134\124\233\246 -\124\000\317\360\361\301\307\230\060\032\073\066\026\333\243\156 -\352\375\255\262\302\332\357\002\107\023\212\300\361\263\061\255 -\117\034\341\117\234\257\017\014\235\367\170\015\330\364\065\126 -\200\332\267\155\027\217\235\036\201\144\341\376\305\105\272\255 -\153\271\012\172\116\117\113\204\356\113\361\175\335\021 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for Certificate "Verisign Class 3 Public Primary Certification Authority - G3" -# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Serial Number:00:9b:7e:06:49:a3:3e:62:b9:d5:ee:90:48:71:29:ef:57 -# Subject: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Not Valid Before: Fri Oct 01 00:00:00 1999 -# Not Valid After : Wed Jul 16 23:59:59 2036 -# Fingerprint (MD5): CD:68:B6:A7:C7:C4:CE:75:E0:1D:4F:57:44:61:92:09 -# Fingerprint (SHA1): 13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Verisign Class 3 Public Primary Certification Authority - G3" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\023\055\015\105\123\113\151\227\315\262\325\303\071\342\125\166 -\140\233\134\306 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\315\150\266\247\307\304\316\165\340\035\117\127\104\141\222\011 -END -CKA_ISSUER MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\021\000\233\176\006\111\243\076\142\271\325\356\220\110\161 -\051\357\127 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# Distrust "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 1/3)" -# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Serial Number:4c:00:36:1b:e5:08:2b:a9:aa:ce:74:0a:05:3e:fb:34 -# Subject: CN=Egypt Trust Class 3 Managed PKI Enterprise Administrator CA,OU=Terms of use at https://www.egypttrust.com/repository/rpa (c)08,OU=VeriSign Trust Network,O=Egypt Trust,C=EG -# Not Valid Before: Sun May 18 00:00:00 2008 -# Not Valid After : Thu May 17 23:59:59 2018 -# Fingerprint (MD5): A7:91:05:96:B1:56:01:26:4E:BF:80:80:08:86:1B:4D -# Fingerprint (SHA1): 6A:2C:5C:B0:94:D5:E0:B7:57:FB:0F:58:42:AA:C8:13:A5:80:2F:E1 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 1/3)" -CKA_ISSUER MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\114\000\066\033\345\010\053\251\252\316\164\012\005\076 -\373\064 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - - -# Distrust "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 2/3)" -# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Serial Number:3e:0c:9e:87:69:aa:95:5c:ea:23:d8:45:9e:d4:5b:51 -# Subject: CN=Egypt Trust Class 3 Managed PKI Operational Administrator CA,OU=Terms of use at https://www.egypttrust.com/repository/rpa (c)08,OU=VeriSign Trust Network,O=Egypt Trust,C=EG -# Not Valid Before: Sun May 18 00:00:00 2008 -# Not Valid After : Thu May 17 23:59:59 2018 -# Fingerprint (MD5): D0:C3:71:17:3E:39:80:C6:50:4F:04:22:DF:40:E1:34 -# Fingerprint (SHA1): 9C:65:5E:D5:FA:E3:B8:96:4D:89:72:F6:3A:63:53:59:3F:5E:B4:4E -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 2/3)" -CKA_ISSUER MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\076\014\236\207\151\252\225\134\352\043\330\105\236\324 -\133\121 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# Distrust "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 3/3)" -# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US -# Serial Number:12:bd:26:a2:ae:33:c0:7f:24:7b:6a:58:69:f2:0a:76 -# Subject: CN=Egypt Trust Class 3 Managed PKI SCO Administrator CA,OU=Terms of use at https://www.egypttrust.com/repository/rpa (c)08,OU=VeriSign Trust Network,O=Egypt Trust,C=EG -# Not Valid Before: Sun May 18 00:00:00 2008 -# Not Valid After : Thu May 17 23:59:59 2018 -# Fingerprint (MD5): C2:13:5E:B2:67:8A:5C:F7:91:EF:8F:29:0F:9B:77:6E -# Fingerprint (SHA1): 83:23:F1:4F:BC:9F:9B:80:B7:9D:ED:14:CD:01:57:CD:FB:08:95:D2 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Distrust: O=Egypt Trust, OU=VeriSign Trust Network (cert 3/3)" -CKA_ISSUER MULTILINE_OCTAL -\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123 -\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125 -\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165 -\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003 -\125\004\013\023\061\050\143\051\040\061\071\071\071\040\126\145 -\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106 -\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163 -\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023 -\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040 -\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171 -\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101 -\165\164\150\157\162\151\164\171\040\055\040\107\063 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\022\275\046\242\256\063\300\177\044\173\152\130\151\362 -\012\166 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - # # Certificate "Entrust.net Premium 2048 Secure Server CA" # @@ -1251,351 +972,52 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "AddTrust Low-Value Services Root" +# Certificate "Entrust Root Certification Authority" # -# Issuer: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE -# Serial Number: 1 (0x1) -# Subject: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE -# Not Valid Before: Tue May 30 10:38:31 2000 -# Not Valid After : Sat May 30 10:38:31 2020 -# Fingerprint (MD5): 1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC -# Fingerprint (SHA1): CC:AB:0E:A0:4C:23:01:D6:69:7B:DD:37:9F:CD:12:EB:24:E3:94:9D +# Issuer: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US +# Serial Number: 1164660820 (0x456b5054) +# Subject: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US +# Not Valid Before: Mon Nov 27 20:23:42 2006 +# Not Valid After : Fri Nov 27 20:53:42 2026 +# Fingerprint (MD5): D6:A5:C3:ED:5D:DD:3E:00:C1:3D:87:92:1F:1D:3F:E4 +# Fingerprint (SHA1): B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9 CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "AddTrust Low-Value Services Root" +CKA_LABEL UTF8 "Entrust Root Certification Authority" CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 CKA_SUBJECT MULTILINE_OCTAL -\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024 -\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164 -\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101 -\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040 -\103\101\040\122\157\157\164 +\060\201\260\061\013\060\011\006\003\125\004\006\023\002\125\123 +\061\026\060\024\006\003\125\004\012\023\015\105\156\164\162\165 +\163\164\054\040\111\156\143\056\061\071\060\067\006\003\125\004 +\013\023\060\167\167\167\056\145\156\164\162\165\163\164\056\156 +\145\164\057\103\120\123\040\151\163\040\151\156\143\157\162\160 +\157\162\141\164\145\144\040\142\171\040\162\145\146\145\162\145 +\156\143\145\061\037\060\035\006\003\125\004\013\023\026\050\143 +\051\040\062\060\060\066\040\105\156\164\162\165\163\164\054\040 +\111\156\143\056\061\055\060\053\006\003\125\004\003\023\044\105 +\156\164\162\165\163\164\040\122\157\157\164\040\103\145\162\164 +\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162 +\151\164\171 END CKA_ID UTF8 "0" CKA_ISSUER MULTILINE_OCTAL -\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024 -\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164 -\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101 -\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040 -\103\101\040\122\157\157\164 +\060\201\260\061\013\060\011\006\003\125\004\006\023\002\125\123 +\061\026\060\024\006\003\125\004\012\023\015\105\156\164\162\165 +\163\164\054\040\111\156\143\056\061\071\060\067\006\003\125\004 +\013\023\060\167\167\167\056\145\156\164\162\165\163\164\056\156 +\145\164\057\103\120\123\040\151\163\040\151\156\143\157\162\160 +\157\162\141\164\145\144\040\142\171\040\162\145\146\145\162\145 +\156\143\145\061\037\060\035\006\003\125\004\013\023\026\050\143 +\051\040\062\060\060\066\040\105\156\164\162\165\163\164\054\040 +\111\156\143\056\061\055\060\053\006\003\125\004\003\023\044\105 +\156\164\162\165\163\164\040\122\157\157\164\040\103\145\162\164 +\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162 +\151\164\171 END CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\001\001 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\004\030\060\202\003\000\240\003\002\001\002\002\001\001 -\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060 -\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061\024 -\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165\163 -\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024\101 -\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164\167 -\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101\144 -\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040\103 -\101\040\122\157\157\164\060\036\027\015\060\060\060\065\063\060 -\061\060\063\070\063\061\132\027\015\062\060\060\065\063\060\061 -\060\063\070\063\061\132\060\145\061\013\060\011\006\003\125\004 -\006\023\002\123\105\061\024\060\022\006\003\125\004\012\023\013 -\101\144\144\124\162\165\163\164\040\101\102\061\035\060\033\006 -\003\125\004\013\023\024\101\144\144\124\162\165\163\164\040\124 -\124\120\040\116\145\164\167\157\162\153\061\041\060\037\006\003 -\125\004\003\023\030\101\144\144\124\162\165\163\164\040\103\154 -\141\163\163\040\061\040\103\101\040\122\157\157\164\060\202\001 -\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000 -\003\202\001\017\000\060\202\001\012\002\202\001\001\000\226\226 -\324\041\111\140\342\153\350\101\007\014\336\304\340\334\023\043 -\315\301\065\307\373\326\116\021\012\147\136\365\006\133\153\245 -\010\073\133\051\026\072\347\207\262\064\006\305\274\005\245\003 -\174\202\313\051\020\256\341\210\201\275\326\236\323\376\055\126 -\301\025\316\343\046\235\025\056\020\373\006\217\060\004\336\247 -\264\143\264\377\261\234\256\074\257\167\266\126\305\265\253\242 -\351\151\072\075\016\063\171\062\077\160\202\222\231\141\155\215 -\060\010\217\161\077\246\110\127\031\370\045\334\113\146\134\245 -\164\217\230\256\310\371\300\006\042\347\254\163\337\245\056\373 -\122\334\261\025\145\040\372\065\146\151\336\337\054\361\156\274 -\060\333\054\044\022\333\353\065\065\150\220\313\000\260\227\041 -\075\164\041\043\145\064\053\273\170\131\243\326\341\166\071\232 -\244\111\216\214\164\257\156\244\232\243\331\233\322\070\134\233 -\242\030\314\165\043\204\276\353\342\115\063\161\216\032\360\302 -\370\307\035\242\255\003\227\054\370\317\045\306\366\270\044\061 -\261\143\135\222\177\143\360\045\311\123\056\037\277\115\002\003 -\001\000\001\243\201\322\060\201\317\060\035\006\003\125\035\016 -\004\026\004\024\225\261\264\360\224\266\275\307\332\321\021\011 -\041\276\301\257\111\375\020\173\060\013\006\003\125\035\017\004 -\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004 -\005\060\003\001\001\377\060\201\217\006\003\125\035\043\004\201 -\207\060\201\204\200\024\225\261\264\360\224\266\275\307\332\321 -\021\011\041\276\301\257\111\375\020\173\241\151\244\147\060\145 -\061\013\060\011\006\003\125\004\006\023\002\123\105\061\024\060 -\022\006\003\125\004\012\023\013\101\144\144\124\162\165\163\164 -\040\101\102\061\035\060\033\006\003\125\004\013\023\024\101\144 -\144\124\162\165\163\164\040\124\124\120\040\116\145\164\167\157 -\162\153\061\041\060\037\006\003\125\004\003\023\030\101\144\144 -\124\162\165\163\164\040\103\154\141\163\163\040\061\040\103\101 -\040\122\157\157\164\202\001\001\060\015\006\011\052\206\110\206 -\367\015\001\001\005\005\000\003\202\001\001\000\054\155\144\033 -\037\315\015\335\271\001\372\226\143\064\062\110\107\231\256\227 -\355\375\162\026\246\163\107\132\364\353\335\351\365\326\373\105 -\314\051\211\104\135\277\106\071\075\350\356\274\115\124\206\036 -\035\154\343\027\047\103\341\211\126\053\251\157\162\116\111\063 -\343\162\174\052\043\232\274\076\377\050\052\355\243\377\034\043 -\272\103\127\011\147\115\113\142\006\055\370\377\154\235\140\036 -\330\034\113\175\265\061\057\331\320\174\135\370\336\153\203\030 -\170\067\127\057\350\063\007\147\337\036\307\153\052\225\166\256 -\217\127\243\360\364\122\264\251\123\010\317\340\117\323\172\123 -\213\375\273\034\126\066\362\376\262\266\345\166\273\325\042\145 -\247\077\376\321\146\255\013\274\153\231\206\357\077\175\363\030 -\062\312\173\306\343\253\144\106\225\370\046\151\331\125\203\173 -\054\226\007\377\131\054\104\243\306\345\351\251\334\241\143\200 -\132\041\136\041\317\123\124\360\272\157\211\333\250\252\225\317 -\213\343\161\314\036\033\040\104\010\300\172\266\100\375\304\344 -\065\341\035\026\034\320\274\053\216\326\161\331 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for Certificate "AddTrust Low-Value Services Root" -# Issuer: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE -# Serial Number: 1 (0x1) -# Subject: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE -# Not Valid Before: Tue May 30 10:38:31 2000 -# Not Valid After : Sat May 30 10:38:31 2020 -# Fingerprint (MD5): 1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC -# Fingerprint (SHA1): CC:AB:0E:A0:4C:23:01:D6:69:7B:DD:37:9F:CD:12:EB:24:E3:94:9D -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "AddTrust Low-Value Services Root" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\314\253\016\240\114\043\001\326\151\173\335\067\237\315\022\353 -\044\343\224\235 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\036\102\225\002\063\222\153\271\137\300\177\332\326\262\113\374 -END -CKA_ISSUER MULTILINE_OCTAL -\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024 -\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164 -\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101 -\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040 -\103\101\040\122\157\157\164 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\001\001 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "AddTrust External Root" -# -# Issuer: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE -# Serial Number: 1 (0x1) -# Subject: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE -# Not Valid Before: Tue May 30 10:48:38 2000 -# Not Valid After : Sat May 30 10:48:38 2020 -# Fingerprint (MD5): 1D:35:54:04:85:78:B0:3F:42:42:4D:BF:20:73:0A:3F -# Fingerprint (SHA1): 02:FA:F3:E2:91:43:54:68:60:78:57:69:4D:F5:E4:5B:68:85:18:68 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "AddTrust External Root" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\046\060\044\006\003\125\004\013\023\035 -\101\144\144\124\162\165\163\164\040\105\170\164\145\162\156\141 -\154\040\124\124\120\040\116\145\164\167\157\162\153\061\042\060 -\040\006\003\125\004\003\023\031\101\144\144\124\162\165\163\164 -\040\105\170\164\145\162\156\141\154\040\103\101\040\122\157\157 -\164 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\046\060\044\006\003\125\004\013\023\035 -\101\144\144\124\162\165\163\164\040\105\170\164\145\162\156\141 -\154\040\124\124\120\040\116\145\164\167\157\162\153\061\042\060 -\040\006\003\125\004\003\023\031\101\144\144\124\162\165\163\164 -\040\105\170\164\145\162\156\141\154\040\103\101\040\122\157\157 -\164 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\001\001 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\004\066\060\202\003\036\240\003\002\001\002\002\001\001 -\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060 -\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061\024 -\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165\163 -\164\040\101\102\061\046\060\044\006\003\125\004\013\023\035\101 -\144\144\124\162\165\163\164\040\105\170\164\145\162\156\141\154 -\040\124\124\120\040\116\145\164\167\157\162\153\061\042\060\040 -\006\003\125\004\003\023\031\101\144\144\124\162\165\163\164\040 -\105\170\164\145\162\156\141\154\040\103\101\040\122\157\157\164 -\060\036\027\015\060\060\060\065\063\060\061\060\064\070\063\070 -\132\027\015\062\060\060\065\063\060\061\060\064\070\063\070\132 -\060\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\046\060\044\006\003\125\004\013\023\035 -\101\144\144\124\162\165\163\164\040\105\170\164\145\162\156\141 -\154\040\124\124\120\040\116\145\164\167\157\162\153\061\042\060 -\040\006\003\125\004\003\023\031\101\144\144\124\162\165\163\164 -\040\105\170\164\145\162\156\141\154\040\103\101\040\122\157\157 -\164\060\202\001\042\060\015\006\011\052\206\110\206\367\015\001 -\001\001\005\000\003\202\001\017\000\060\202\001\012\002\202\001 -\001\000\267\367\032\063\346\362\000\004\055\071\340\116\133\355 -\037\274\154\017\315\265\372\043\266\316\336\233\021\063\227\244 -\051\114\175\223\237\275\112\274\223\355\003\032\343\217\317\345 -\155\120\132\326\227\051\224\132\200\260\111\172\333\056\225\375 -\270\312\277\067\070\055\036\076\221\101\255\160\126\307\360\117 -\077\350\062\236\164\312\310\220\124\351\306\137\017\170\235\232 -\100\074\016\254\141\252\136\024\217\236\207\241\152\120\334\327 -\232\116\257\005\263\246\161\224\234\161\263\120\140\012\307\023 -\235\070\007\206\002\250\351\250\151\046\030\220\253\114\260\117 -\043\253\072\117\204\330\337\316\237\341\151\157\273\327\102\327 -\153\104\344\307\255\356\155\101\137\162\132\161\010\067\263\171 -\145\244\131\240\224\067\367\000\057\015\302\222\162\332\320\070 -\162\333\024\250\105\304\135\052\175\267\264\326\304\356\254\315 -\023\104\267\311\053\335\103\000\045\372\141\271\151\152\130\043 -\021\267\247\063\217\126\165\131\365\315\051\327\106\267\012\053 -\145\266\323\102\157\025\262\270\173\373\357\351\135\123\325\064 -\132\047\002\003\001\000\001\243\201\334\060\201\331\060\035\006 -\003\125\035\016\004\026\004\024\255\275\230\172\064\264\046\367 -\372\304\046\124\357\003\275\340\044\313\124\032\060\013\006\003 -\125\035\017\004\004\003\002\001\006\060\017\006\003\125\035\023 -\001\001\377\004\005\060\003\001\001\377\060\201\231\006\003\125 -\035\043\004\201\221\060\201\216\200\024\255\275\230\172\064\264 -\046\367\372\304\046\124\357\003\275\340\044\313\124\032\241\163 -\244\161\060\157\061\013\060\011\006\003\125\004\006\023\002\123 -\105\061\024\060\022\006\003\125\004\012\023\013\101\144\144\124 -\162\165\163\164\040\101\102\061\046\060\044\006\003\125\004\013 -\023\035\101\144\144\124\162\165\163\164\040\105\170\164\145\162 -\156\141\154\040\124\124\120\040\116\145\164\167\157\162\153\061 -\042\060\040\006\003\125\004\003\023\031\101\144\144\124\162\165 -\163\164\040\105\170\164\145\162\156\141\154\040\103\101\040\122 -\157\157\164\202\001\001\060\015\006\011\052\206\110\206\367\015 -\001\001\005\005\000\003\202\001\001\000\260\233\340\205\045\302 -\326\043\342\017\226\006\222\235\101\230\234\331\204\171\201\331 -\036\133\024\007\043\066\145\217\260\330\167\273\254\101\154\107 -\140\203\121\260\371\062\075\347\374\366\046\023\307\200\026\245 -\277\132\374\207\317\170\171\211\041\232\342\114\007\012\206\065 -\274\362\336\121\304\322\226\267\334\176\116\356\160\375\034\071 -\353\014\002\121\024\055\216\275\026\340\301\337\106\165\347\044 -\255\354\364\102\264\205\223\160\020\147\272\235\006\065\112\030 -\323\053\172\314\121\102\241\172\143\321\346\273\241\305\053\302 -\066\276\023\015\346\275\143\176\171\173\247\011\015\100\253\152 -\335\217\212\303\366\366\214\032\102\005\121\324\105\365\237\247 -\142\041\150\025\040\103\074\231\347\174\275\044\330\251\221\027 -\163\210\077\126\033\061\070\030\264\161\017\232\315\310\016\236 -\216\056\033\341\214\230\203\313\037\061\361\104\114\306\004\163 -\111\166\140\017\307\370\275\027\200\153\056\351\314\114\016\132 -\232\171\017\040\012\056\325\236\143\046\036\125\222\224\330\202 -\027\132\173\320\274\307\217\116\206\004 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for Certificate "AddTrust External Root" -# Issuer: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE -# Serial Number: 1 (0x1) -# Subject: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE -# Not Valid Before: Tue May 30 10:48:38 2000 -# Not Valid After : Sat May 30 10:48:38 2020 -# Fingerprint (MD5): 1D:35:54:04:85:78:B0:3F:42:42:4D:BF:20:73:0A:3F -# Fingerprint (SHA1): 02:FA:F3:E2:91:43:54:68:60:78:57:69:4D:F5:E4:5B:68:85:18:68 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "AddTrust External Root" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\002\372\363\342\221\103\124\150\140\170\127\151\115\365\344\133 -\150\205\030\150 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\035\065\124\004\205\170\260\077\102\102\115\277\040\163\012\077 -END -CKA_ISSUER MULTILINE_OCTAL -\060\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061 -\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165 -\163\164\040\101\102\061\046\060\044\006\003\125\004\013\023\035 -\101\144\144\124\162\165\163\164\040\105\170\164\145\162\156\141 -\154\040\124\124\120\040\116\145\164\167\157\162\153\061\042\060 -\040\006\003\125\004\003\023\031\101\144\144\124\162\165\163\164 -\040\105\170\164\145\162\156\141\154\040\103\101\040\122\157\157 -\164 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\001\001 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "Entrust Root Certification Authority" -# -# Issuer: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US -# Serial Number: 1164660820 (0x456b5054) -# Subject: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US -# Not Valid Before: Mon Nov 27 20:23:42 2006 -# Not Valid After : Fri Nov 27 20:53:42 2026 -# Fingerprint (MD5): D6:A5:C3:ED:5D:DD:3E:00:C1:3D:87:92:1F:1D:3F:E4 -# Fingerprint (SHA1): B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Entrust Root Certification Authority" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\201\260\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\026\060\024\006\003\125\004\012\023\015\105\156\164\162\165 -\163\164\054\040\111\156\143\056\061\071\060\067\006\003\125\004 -\013\023\060\167\167\167\056\145\156\164\162\165\163\164\056\156 -\145\164\057\103\120\123\040\151\163\040\151\156\143\157\162\160 -\157\162\141\164\145\144\040\142\171\040\162\145\146\145\162\145 -\156\143\145\061\037\060\035\006\003\125\004\013\023\026\050\143 -\051\040\062\060\060\066\040\105\156\164\162\165\163\164\054\040 -\111\156\143\056\061\055\060\053\006\003\125\004\003\023\044\105 -\156\164\162\165\163\164\040\122\157\157\164\040\103\145\162\164 -\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162 -\151\164\171 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\201\260\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\026\060\024\006\003\125\004\012\023\015\105\156\164\162\165 -\163\164\054\040\111\156\143\056\061\071\060\067\006\003\125\004 -\013\023\060\167\167\167\056\145\156\164\162\165\163\164\056\156 -\145\164\057\103\120\123\040\151\163\040\151\156\143\157\162\160 -\157\162\141\164\145\144\040\142\171\040\162\145\146\145\162\145 -\156\143\145\061\037\060\035\006\003\125\004\013\023\026\050\143 -\051\040\062\060\060\066\040\105\156\164\162\165\163\164\054\040 -\111\156\143\056\061\055\060\053\006\003\125\004\003\023\044\105 -\156\164\162\165\163\164\040\122\157\157\164\040\103\145\162\164 -\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162 -\151\164\171 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\004\105\153\120\124 +\002\004\105\153\120\124 END CKA_VALUE MULTILINE_OCTAL \060\202\004\221\060\202\003\171\240\003\002\001\002\002\004\105 @@ -1847,7 +1269,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \002\003\002\064\126 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -2012,7 +1434,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \002\001\001 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -2177,7 +1599,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \002\001\001 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -4178,7 +3600,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \136\366 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -5727,7 +5149,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \073\112 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -7304,7 +6726,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \017\037 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -7744,7 +7166,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \303\153 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -8082,7 +7504,7 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL \254\263 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE @@ -8245,177 +7667,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE -# -# Certificate "Staat der Nederlanden Root CA - G2" -# -# Issuer: CN=Staat der Nederlanden Root CA - G2,O=Staat der Nederlanden,C=NL -# Serial Number: 10000012 (0x98968c) -# Subject: CN=Staat der Nederlanden Root CA - G2,O=Staat der Nederlanden,C=NL -# Not Valid Before: Wed Mar 26 11:18:17 2008 -# Not Valid After : Wed Mar 25 11:03:10 2020 -# Fingerprint (MD5): 7C:A5:0F:F8:5B:9A:7D:6D:30:AE:54:5A:E3:42:A2:8A -# Fingerprint (SHA1): 59:AF:82:79:91:86:C7:B4:75:07:CB:CF:03:57:46:EB:04:DD:B7:16 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Staat der Nederlanden Root CA - G2" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\036\060\034\006\003\125\004\012\014\025\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\061 -\053\060\051\006\003\125\004\003\014\042\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\040 -\122\157\157\164\040\103\101\040\055\040\107\062 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\036\060\034\006\003\125\004\012\014\025\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\061 -\053\060\051\006\003\125\004\003\014\042\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\040 -\122\157\157\164\040\103\101\040\055\040\107\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\004\000\230\226\214 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\005\312\060\202\003\262\240\003\002\001\002\002\004\000 -\230\226\214\060\015\006\011\052\206\110\206\367\015\001\001\013 -\005\000\060\132\061\013\060\011\006\003\125\004\006\023\002\116 -\114\061\036\060\034\006\003\125\004\012\014\025\123\164\141\141 -\164\040\144\145\162\040\116\145\144\145\162\154\141\156\144\145 -\156\061\053\060\051\006\003\125\004\003\014\042\123\164\141\141 -\164\040\144\145\162\040\116\145\144\145\162\154\141\156\144\145 -\156\040\122\157\157\164\040\103\101\040\055\040\107\062\060\036 -\027\015\060\070\060\063\062\066\061\061\061\070\061\067\132\027 -\015\062\060\060\063\062\065\061\061\060\063\061\060\132\060\132 -\061\013\060\011\006\003\125\004\006\023\002\116\114\061\036\060 -\034\006\003\125\004\012\014\025\123\164\141\141\164\040\144\145 -\162\040\116\145\144\145\162\154\141\156\144\145\156\061\053\060 -\051\006\003\125\004\003\014\042\123\164\141\141\164\040\144\145 -\162\040\116\145\144\145\162\154\141\156\144\145\156\040\122\157 -\157\164\040\103\101\040\055\040\107\062\060\202\002\042\060\015 -\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\002 -\017\000\060\202\002\012\002\202\002\001\000\305\131\347\157\165 -\252\076\113\234\265\270\254\236\013\344\371\331\312\253\135\217 -\265\071\020\202\327\257\121\340\073\341\000\110\152\317\332\341 -\006\103\021\231\252\024\045\022\255\042\350\000\155\103\304\251 -\270\345\037\211\113\147\275\141\110\357\375\322\340\140\210\345 -\271\030\140\050\303\167\053\255\260\067\252\067\336\144\131\052 -\106\127\344\113\271\370\067\174\325\066\347\200\301\266\363\324 -\147\233\226\350\316\327\306\012\123\320\153\111\226\363\243\013 -\005\167\110\367\045\345\160\254\060\024\040\045\343\177\165\132 -\345\110\370\116\173\003\007\004\372\202\141\207\156\360\073\304 -\244\307\320\365\164\076\245\135\032\010\362\233\045\322\366\254 -\004\046\076\125\072\142\050\245\173\262\060\257\370\067\302\321 -\272\326\070\375\364\357\111\060\067\231\046\041\110\205\001\251 -\345\026\347\334\220\125\337\017\350\070\315\231\067\041\117\135 -\365\042\157\152\305\022\026\140\027\125\362\145\146\246\247\060 -\221\070\301\070\035\206\004\204\272\032\045\170\136\235\257\314 -\120\140\326\023\207\122\355\143\037\155\145\175\302\025\030\164 -\312\341\176\144\051\214\162\330\026\023\175\013\111\112\361\050 -\033\040\164\153\305\075\335\260\252\110\011\075\056\202\224\315 -\032\145\331\053\210\232\231\274\030\176\237\356\175\146\174\076 -\275\224\270\201\316\315\230\060\170\301\157\147\320\276\137\340 -\150\355\336\342\261\311\054\131\170\222\252\337\053\140\143\362 -\345\136\271\343\312\372\177\120\206\076\242\064\030\014\011\150 -\050\021\034\344\341\271\134\076\107\272\062\077\030\314\133\204 -\365\363\153\164\304\162\164\341\343\213\240\112\275\215\146\057 -\352\255\065\332\040\323\210\202\141\360\022\042\266\274\320\325 -\244\354\257\124\210\045\044\074\247\155\261\162\051\077\076\127 -\246\177\125\257\156\046\306\376\347\314\100\134\121\104\201\012 -\170\336\112\316\125\277\035\325\331\267\126\357\360\166\377\013 -\171\265\257\275\373\251\151\221\106\227\150\200\024\066\035\263 -\177\273\051\230\066\245\040\372\202\140\142\063\244\354\326\272 -\007\247\156\305\317\024\246\347\326\222\064\330\201\365\374\035 -\135\252\134\036\366\243\115\073\270\367\071\002\003\001\000\001 -\243\201\227\060\201\224\060\017\006\003\125\035\023\001\001\377 -\004\005\060\003\001\001\377\060\122\006\003\125\035\040\004\113 -\060\111\060\107\006\004\125\035\040\000\060\077\060\075\006\010 -\053\006\001\005\005\007\002\001\026\061\150\164\164\160\072\057 -\057\167\167\167\056\160\153\151\157\166\145\162\150\145\151\144 -\056\156\154\057\160\157\154\151\143\151\145\163\057\162\157\157 -\164\055\160\157\154\151\143\171\055\107\062\060\016\006\003\125 -\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003\125 -\035\016\004\026\004\024\221\150\062\207\025\035\211\342\265\361 -\254\066\050\064\215\013\174\142\210\353\060\015\006\011\052\206 -\110\206\367\015\001\001\013\005\000\003\202\002\001\000\250\101 -\112\147\052\222\201\202\120\156\341\327\330\263\071\073\363\002 -\025\011\120\121\357\055\275\044\173\210\206\073\371\264\274\222 -\011\226\271\366\300\253\043\140\006\171\214\021\116\121\322\171 -\200\063\373\235\110\276\354\101\103\201\037\176\107\100\034\345 -\172\010\312\252\213\165\255\024\304\302\350\146\074\202\007\247 -\346\047\202\133\030\346\017\156\331\120\076\212\102\030\051\306 -\264\126\374\126\020\240\005\027\275\014\043\177\364\223\355\234 -\032\121\276\335\105\101\277\221\044\264\037\214\351\137\317\173 -\041\231\237\225\237\071\072\106\034\154\371\315\173\234\220\315 -\050\251\307\251\125\273\254\142\064\142\065\023\113\024\072\125 -\203\271\206\215\222\246\306\364\007\045\124\314\026\127\022\112 -\202\170\310\024\331\027\202\046\055\135\040\037\171\256\376\324 -\160\026\026\225\203\330\065\071\377\122\135\165\034\026\305\023 -\125\317\107\314\165\145\122\112\336\360\260\247\344\012\226\013 -\373\255\302\342\045\204\262\335\344\275\176\131\154\233\360\360 -\330\347\312\362\351\227\070\176\211\276\314\373\071\027\141\077 -\162\333\072\221\330\145\001\031\035\255\120\244\127\012\174\113 -\274\234\161\163\052\105\121\031\205\314\216\375\107\247\164\225 -\035\250\321\257\116\027\261\151\046\302\252\170\127\133\305\115 -\247\345\236\005\027\224\312\262\137\240\111\030\215\064\351\046 -\154\110\036\252\150\222\005\341\202\163\132\233\334\007\133\010 -\155\175\235\327\215\041\331\374\024\040\252\302\105\337\077\347 -\000\262\121\344\302\370\005\271\171\032\214\064\363\236\133\344 -\067\133\153\112\337\054\127\212\100\132\066\272\335\165\104\010 -\067\102\160\014\376\334\136\041\240\243\212\300\220\234\150\332 -\120\346\105\020\107\170\266\116\322\145\311\303\067\337\341\102 -\143\260\127\067\105\055\173\212\234\277\005\352\145\125\063\367 -\071\020\305\050\052\041\172\033\212\304\044\371\077\025\310\232 -\025\040\365\125\142\226\355\155\223\120\274\344\252\170\255\331 -\313\012\145\207\246\146\301\304\201\243\167\072\130\036\013\356 -\203\213\235\036\322\122\244\314\035\157\260\230\155\224\061\265 -\370\161\012\334\271\374\175\062\140\346\353\257\212\001 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for Certificate "Staat der Nederlanden Root CA - G2" -# Issuer: CN=Staat der Nederlanden Root CA - G2,O=Staat der Nederlanden,C=NL -# Serial Number: 10000012 (0x98968c) -# Subject: CN=Staat der Nederlanden Root CA - G2,O=Staat der Nederlanden,C=NL -# Not Valid Before: Wed Mar 26 11:18:17 2008 -# Not Valid After : Wed Mar 25 11:03:10 2020 -# Fingerprint (MD5): 7C:A5:0F:F8:5B:9A:7D:6D:30:AE:54:5A:E3:42:A2:8A -# Fingerprint (SHA1): 59:AF:82:79:91:86:C7:B4:75:07:CB:CF:03:57:46:EB:04:DD:B7:16 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Staat der Nederlanden Root CA - G2" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\131\257\202\171\221\206\307\264\165\007\313\317\003\127\106\353 -\004\335\267\026 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\174\245\017\370\133\232\175\155\060\256\124\132\343\102\242\212 -END -CKA_ISSUER MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\036\060\034\006\003\125\004\012\014\025\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\061 -\053\060\051\006\003\125\004\003\014\042\123\164\141\141\164\040 -\144\145\162\040\116\145\144\145\162\154\141\156\144\145\156\040 -\122\157\157\164\040\103\101\040\055\040\107\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\004\000\230\226\214 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - # # Certificate "Hongkong Post Root CA 1" # @@ -19007,176 +18258,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE -# -# Certificate "LuxTrust Global Root 2" -# -# Issuer: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU -# Serial Number:0a:7e:a6:df:4b:44:9e:da:6a:24:85:9e:e6:b8:15:d3:16:7f:bb:b1 -# Subject: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU -# Not Valid Before: Thu Mar 05 13:21:57 2015 -# Not Valid After : Mon Mar 05 13:21:57 2035 -# Fingerprint (SHA-256): 54:45:5F:71:29:C2:0B:14:47:C4:18:F9:97:16:8F:24:C5:8F:C5:02:3B:F5:DA:5B:E2:EB:6E:1D:D8:90:2E:D5 -# Fingerprint (SHA1): 1E:0E:56:19:0A:D1:8B:25:98:B2:04:44:FF:66:8A:04:17:99:5F:3F -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "LuxTrust Global Root 2" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061 -\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165 -\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003 -\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141 -\154\040\122\157\157\164\040\062 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061 -\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165 -\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003 -\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141 -\154\040\122\157\157\164\040\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\012\176\246\337\113\104\236\332\152\044\205\236\346\270 -\025\323\026\177\273\261 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\005\303\060\202\003\253\240\003\002\001\002\002\024\012 -\176\246\337\113\104\236\332\152\044\205\236\346\270\025\323\026 -\177\273\261\060\015\006\011\052\206\110\206\367\015\001\001\013 -\005\000\060\106\061\013\060\011\006\003\125\004\006\023\002\114 -\125\061\026\060\024\006\003\125\004\012\014\015\114\165\170\124 -\162\165\163\164\040\123\056\101\056\061\037\060\035\006\003\125 -\004\003\014\026\114\165\170\124\162\165\163\164\040\107\154\157 -\142\141\154\040\122\157\157\164\040\062\060\036\027\015\061\065 -\060\063\060\065\061\063\062\061\065\067\132\027\015\063\065\060 -\063\060\065\061\063\062\061\065\067\132\060\106\061\013\060\011 -\006\003\125\004\006\023\002\114\125\061\026\060\024\006\003\125 -\004\012\014\015\114\165\170\124\162\165\163\164\040\123\056\101 -\056\061\037\060\035\006\003\125\004\003\014\026\114\165\170\124 -\162\165\163\164\040\107\154\157\142\141\154\040\122\157\157\164 -\040\062\060\202\002\042\060\015\006\011\052\206\110\206\367\015 -\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202 -\002\001\000\327\205\227\277\021\230\351\360\142\203\114\074\207 -\371\123\152\067\013\362\017\074\207\316\157\334\046\051\275\305 -\211\272\311\203\075\367\356\312\133\306\155\111\163\264\311\106 -\243\033\064\023\077\301\211\105\127\364\331\261\373\066\145\113 -\373\010\342\110\161\021\310\156\073\236\235\337\211\145\067\246 -\205\366\073\104\030\266\306\067\060\142\104\222\227\151\175\102 -\060\044\344\015\014\211\153\143\336\305\341\337\116\251\024\154 -\123\340\141\316\366\027\057\035\074\275\346\042\114\035\223\365 -\020\304\241\166\354\152\336\305\154\337\226\264\126\100\102\300 -\142\222\060\241\055\025\224\240\322\040\006\011\156\152\155\345 -\353\267\276\324\360\361\025\174\213\346\116\272\023\314\113\047 -\136\231\074\027\135\217\201\177\063\075\117\323\077\033\354\134 -\077\360\074\114\165\156\362\246\325\235\332\055\007\143\002\306 -\162\351\224\274\114\111\225\117\210\122\310\333\350\151\202\370 -\314\064\133\042\360\206\247\211\275\110\012\155\146\201\155\310 -\310\144\373\001\341\364\341\336\331\236\335\333\133\324\052\231 -\046\025\033\036\114\222\051\202\236\325\222\201\222\101\160\031 -\367\244\345\223\113\274\167\147\061\335\034\375\061\160\015\027 -\231\014\371\014\071\031\052\027\265\060\161\125\325\017\256\130 -\341\075\057\064\233\317\237\366\170\205\302\223\172\162\076\146 -\217\234\026\021\140\217\236\211\157\147\276\340\107\132\073\014 -\232\147\213\317\106\306\256\070\243\362\247\274\346\326\205\153 -\063\044\160\042\113\313\010\233\273\310\370\002\051\035\276\040 -\014\106\277\153\207\233\263\052\146\102\065\106\154\252\272\255 -\371\230\173\351\120\125\024\061\277\261\332\055\355\200\255\150 -\044\373\151\253\330\161\023\060\346\147\263\207\100\375\211\176 -\362\103\321\021\337\057\145\057\144\316\137\024\271\261\277\061 -\275\207\170\132\131\145\210\252\374\131\062\110\206\326\114\271 -\051\113\225\323\166\363\167\045\155\102\034\070\203\115\375\243 -\137\233\177\055\254\171\033\016\102\061\227\143\244\373\212\151 -\325\042\015\064\220\060\056\250\264\340\155\266\224\254\274\213 -\116\327\160\374\305\070\216\144\045\341\115\071\220\316\311\207 -\204\130\161\002\003\001\000\001\243\201\250\060\201\245\060\017 -\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060 -\102\006\003\125\035\040\004\073\060\071\060\067\006\007\053\201 -\053\001\001\001\012\060\054\060\052\006\010\053\006\001\005\005 -\007\002\001\026\036\150\164\164\160\163\072\057\057\162\145\160 -\157\163\151\164\157\162\171\056\154\165\170\164\162\165\163\164 -\056\154\165\060\016\006\003\125\035\017\001\001\377\004\004\003 -\002\001\006\060\037\006\003\125\035\043\004\030\060\026\200\024 -\377\030\050\166\371\110\005\054\241\256\361\053\033\053\262\123 -\370\113\174\263\060\035\006\003\125\035\016\004\026\004\024\377 -\030\050\166\371\110\005\054\241\256\361\053\033\053\262\123\370 -\113\174\263\060\015\006\011\052\206\110\206\367\015\001\001\013 -\005\000\003\202\002\001\000\152\031\024\355\156\171\301\054\207 -\324\015\160\176\327\366\170\311\013\004\116\304\261\316\223\160 -\376\260\124\300\062\315\231\060\144\027\277\017\345\342\063\375 -\007\066\100\162\016\032\266\152\131\326\000\345\150\040\335\056 -\162\015\037\152\144\061\040\204\175\111\246\132\067\353\105\311 -\205\365\324\307\027\231\007\346\233\125\344\014\350\251\264\316 -\214\133\265\021\134\317\212\016\015\326\254\167\201\376\062\234 -\044\236\162\316\124\363\320\157\242\126\326\354\303\067\054\145 -\130\276\127\000\032\362\065\372\353\173\061\135\302\301\022\075 -\226\201\210\226\211\301\131\134\172\346\177\160\064\347\203\342 -\261\341\341\270\130\357\324\225\344\140\234\360\226\227\162\214 -\353\204\002\056\145\217\244\267\322\177\147\335\310\323\236\134 -\252\251\244\240\045\024\006\233\354\117\176\055\013\177\035\165 -\361\063\330\355\316\270\165\155\076\133\271\230\035\061\015\126 -\330\103\017\060\221\262\004\153\335\126\276\225\200\125\147\276 -\330\315\203\331\030\356\056\017\206\055\222\236\160\023\354\336 -\121\311\103\170\002\245\115\310\371\137\304\221\130\106\026\167 -\132\164\252\100\274\007\237\060\271\261\367\022\027\335\343\377 -\044\100\035\172\152\321\117\030\012\252\220\035\353\100\036\337 -\241\036\104\222\020\232\362\215\341\321\113\106\236\350\105\102 -\227\352\105\231\363\354\146\325\002\372\362\246\112\044\252\336 -\316\271\312\371\077\223\157\371\243\272\352\245\076\231\255\375 -\377\173\231\365\145\356\360\131\050\147\327\220\225\244\023\204 -\251\204\301\350\316\316\165\223\143\032\274\074\352\325\144\037 -\055\052\022\071\306\303\132\062\355\107\221\026\016\274\070\301 -\120\336\217\312\052\220\064\034\356\101\224\234\136\031\056\370 -\105\111\231\164\221\260\004\157\343\004\132\261\253\052\253\376 -\307\320\226\266\332\341\112\144\006\156\140\115\275\102\116\377 -\170\332\044\312\033\264\327\226\071\154\256\361\016\252\247\175 -\110\213\040\114\317\144\326\270\227\106\260\116\321\052\126\072 -\240\223\275\257\200\044\340\012\176\347\312\325\312\350\205\125 -\334\066\052\341\224\150\223\307\146\162\104\017\200\041\062\154 -\045\307\043\200\203\012\353 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "LuxTrust Global Root 2" -# Issuer: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU -# Serial Number:0a:7e:a6:df:4b:44:9e:da:6a:24:85:9e:e6:b8:15:d3:16:7f:bb:b1 -# Subject: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU -# Not Valid Before: Thu Mar 05 13:21:57 2015 -# Not Valid After : Mon Mar 05 13:21:57 2035 -# Fingerprint (SHA-256): 54:45:5F:71:29:C2:0B:14:47:C4:18:F9:97:16:8F:24:C5:8F:C5:02:3B:F5:DA:5B:E2:EB:6E:1D:D8:90:2E:D5 -# Fingerprint (SHA1): 1E:0E:56:19:0A:D1:8B:25:98:B2:04:44:FF:66:8A:04:17:99:5F:3F -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "LuxTrust Global Root 2" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\036\016\126\031\012\321\213\045\230\262\004\104\377\146\212\004 -\027\231\137\077 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\262\341\011\000\141\257\367\361\221\157\304\255\215\136\073\174 -END -CKA_ISSUER MULTILINE_OCTAL -\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061 -\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165 -\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003 -\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141 -\154\040\122\157\157\164\040\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\012\176\246\337\113\104\236\332\152\044\205\236\346\270 -\025\323\026\177\273\261 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - # # Certificate "Symantec Class 1 Public Primary Certification Authority - G6" # @@ -19380,363 +18461,93 @@ CKA_SERIAL_NUMBER MULTILINE_OCTAL END CKA_VALUE MULTILINE_OCTAL \060\202\003\366\060\202\002\336\240\003\002\001\002\002\020\144 -\202\236\374\067\036\164\135\374\227\377\227\310\261\377\101\060 -\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\201 -\224\061\013\060\011\006\003\125\004\006\023\002\125\123\061\035 -\060\033\006\003\125\004\012\023\024\123\171\155\141\156\164\145 -\143\040\103\157\162\160\157\162\141\164\151\157\156\061\037\060 -\035\006\003\125\004\013\023\026\123\171\155\141\156\164\145\143 -\040\124\162\165\163\164\040\116\145\164\167\157\162\153\061\105 -\060\103\006\003\125\004\003\023\074\123\171\155\141\156\164\145 -\143\040\103\154\141\163\163\040\062\040\120\165\142\154\151\143 -\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151 -\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171 -\040\055\040\107\066\060\036\027\015\061\061\061\060\061\070\060 -\060\060\060\060\060\132\027\015\063\067\061\062\060\061\062\063 -\065\071\065\071\132\060\201\224\061\013\060\011\006\003\125\004 -\006\023\002\125\123\061\035\060\033\006\003\125\004\012\023\024 -\123\171\155\141\156\164\145\143\040\103\157\162\160\157\162\141 -\164\151\157\156\061\037\060\035\006\003\125\004\013\023\026\123 -\171\155\141\156\164\145\143\040\124\162\165\163\164\040\116\145 -\164\167\157\162\153\061\105\060\103\006\003\125\004\003\023\074 -\123\171\155\141\156\164\145\143\040\103\154\141\163\163\040\062 -\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171\040 -\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165 -\164\150\157\162\151\164\171\040\055\040\107\066\060\202\001\042 -\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003 -\202\001\017\000\060\202\001\012\002\202\001\001\000\315\314\351 -\005\310\143\205\313\077\100\143\027\275\030\372\065\346\004\147 -\127\145\230\051\244\117\311\134\217\017\064\322\370\332\250\023 -\142\252\270\036\120\147\170\260\026\114\240\071\251\025\172\256 -\355\322\242\300\360\220\067\051\030\046\134\350\015\074\266\154 -\111\077\301\340\334\331\113\266\024\031\013\246\323\226\341\326 -\011\343\031\046\034\371\037\145\113\371\032\103\034\000\203\326 -\320\252\111\242\324\333\346\142\070\272\120\024\103\155\371\061 -\370\126\026\331\070\002\221\317\353\154\335\273\071\116\231\341 -\060\147\105\361\324\360\215\303\337\376\362\070\007\041\175\000 -\136\126\104\263\344\140\275\221\053\234\253\133\004\162\017\262 -\050\331\162\253\005\040\102\045\251\133\003\152\040\020\314\061 -\360\053\332\065\054\320\373\232\227\116\360\202\113\053\330\137 -\066\243\013\055\257\143\015\035\045\177\241\156\134\142\241\215 -\050\076\241\374\034\040\370\001\057\272\125\232\021\260\031\322 -\310\120\171\153\016\152\005\327\252\004\066\262\243\362\341\137 -\167\247\167\234\345\036\334\351\337\152\301\145\135\002\003\001 -\000\001\243\102\060\100\060\016\006\003\125\035\017\001\001\377 -\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377 -\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026 -\004\024\207\214\040\225\310\230\112\321\326\200\006\112\220\064 -\104\337\034\115\277\260\060\015\006\011\052\206\110\206\367\015 -\001\001\013\005\000\003\202\001\001\000\201\216\262\245\146\226 -\267\041\245\266\357\157\043\132\137\333\201\305\102\245\170\301 -\151\375\364\074\327\371\134\153\160\162\032\374\132\227\115\000 -\200\210\210\202\212\303\161\015\216\305\211\233\054\355\215\013 -\322\162\124\365\175\324\134\103\127\351\363\256\245\002\021\366 -\166\053\201\127\335\175\332\164\060\375\124\107\366\340\026\156 -\246\264\012\110\346\347\165\007\017\051\031\071\316\171\364\266 -\154\305\137\231\325\037\113\372\337\155\054\074\015\124\200\160 -\360\210\013\200\317\306\150\242\270\035\160\331\166\214\374\356 -\245\311\317\255\035\317\231\045\127\132\142\105\313\026\153\275 -\111\315\245\243\214\151\171\045\256\270\114\154\213\100\146\113 -\026\077\317\002\032\335\341\154\153\007\141\152\166\025\051\231 -\177\033\335\210\200\301\277\265\217\163\305\246\226\043\204\246 -\050\206\044\063\152\001\056\127\163\045\266\136\277\217\346\035 -\141\250\100\051\147\035\207\233\035\177\233\237\231\315\061\326 -\124\276\142\273\071\254\150\022\110\221\040\245\313\261\335\376 -\157\374\132\344\202\125\131\257\061\251 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "Symantec Class 2 Public Primary Certification Authority - G6" -# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Serial Number:64:82:9e:fc:37:1e:74:5d:fc:97:ff:97:c8:b1:ff:41 -# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Not Valid Before: Tue Oct 18 00:00:00 2011 -# Not Valid After : Tue Dec 01 23:59:59 2037 -# Fingerprint (SHA-256): CB:62:7D:18:B5:8A:D5:6D:DE:33:1A:30:45:6B:C6:5C:60:1A:4E:9B:18:DE:DC:EA:08:E7:DA:AA:07:81:5F:F0 -# Fingerprint (SHA1): 40:B3:31:A0:E9:BF:E8:55:BC:39:93:CA:70:4F:4E:C2:51:D4:1D:8F -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G6" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\100\263\061\240\351\277\350\125\274\071\223\312\160\117\116\302 -\121\324\035\217 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\175\013\203\345\373\174\255\007\117\040\251\265\337\143\355\171 -END -CKA_ISSUER MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\066 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\144\202\236\374\067\036\164\135\374\227\377\227\310\261 -\377\101 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "Symantec Class 1 Public Primary Certification Authority - G4" -# -# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Serial Number:21:6e:33:a5:cb:d3:88:a4:6f:29:07:b4:27:3c:c4:d8 -# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Not Valid Before: Wed Oct 05 00:00:00 2011 -# Not Valid After : Mon Jan 18 23:59:59 2038 -# Fingerprint (SHA-256): 36:3F:3C:84:9E:AB:03:B0:A2:A0:F6:36:D7:B8:6D:04:D3:AC:7F:CF:E2:6A:0A:91:21:AB:97:95:F6:E1:76:DF -# Fingerprint (SHA1): 84:F2:E3:DD:83:13:3E:A9:1D:19:52:7F:02:D7:29:BF:C1:5F:E6:67 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G4" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\041\156\063\245\313\323\210\244\157\051\007\264\047\074 -\304\330 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\002\250\060\202\002\055\240\003\002\001\002\002\020\041 -\156\063\245\313\323\210\244\157\051\007\264\047\074\304\330\060 -\012\006\010\052\206\110\316\075\004\003\003\060\201\224\061\013 -\060\011\006\003\125\004\006\023\002\125\123\061\035\060\033\006 -\003\125\004\012\023\024\123\171\155\141\156\164\145\143\040\103 -\157\162\160\157\162\141\164\151\157\156\061\037\060\035\006\003 -\125\004\013\023\026\123\171\155\141\156\164\145\143\040\124\162 -\165\163\164\040\116\145\164\167\157\162\153\061\105\060\103\006 -\003\125\004\003\023\074\123\171\155\141\156\164\145\143\040\103 -\154\141\163\163\040\061\040\120\165\142\154\151\143\040\120\162 -\151\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164 -\151\157\156\040\101\165\164\150\157\162\151\164\171\040\055\040 -\107\064\060\036\027\015\061\061\061\060\060\065\060\060\060\060 -\060\060\132\027\015\063\070\060\061\061\070\062\063\065\071\065 -\071\132\060\201\224\061\013\060\011\006\003\125\004\006\023\002 -\125\123\061\035\060\033\006\003\125\004\012\023\024\123\171\155 -\141\156\164\145\143\040\103\157\162\160\157\162\141\164\151\157 -\156\061\037\060\035\006\003\125\004\013\023\026\123\171\155\141 -\156\164\145\143\040\124\162\165\163\164\040\116\145\164\167\157 -\162\153\061\105\060\103\006\003\125\004\003\023\074\123\171\155 -\141\156\164\145\143\040\103\154\141\163\163\040\061\040\120\165 -\142\154\151\143\040\120\162\151\155\141\162\171\040\103\145\162 -\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157 -\162\151\164\171\040\055\040\107\064\060\166\060\020\006\007\052 -\206\110\316\075\002\001\006\005\053\201\004\000\042\003\142\000 -\004\327\146\265\033\333\256\263\140\356\106\352\210\143\165\073 -\052\224\155\363\137\022\366\343\017\236\266\012\024\123\110\122 -\310\334\072\263\313\110\040\046\022\116\372\211\204\324\337\221 -\344\051\175\050\001\331\333\030\103\151\241\037\265\323\206\026 -\334\307\177\147\043\337\337\061\061\203\003\065\160\261\113\267 -\310\027\273\121\313\334\224\027\333\352\011\073\166\022\336\252 -\265\243\102\060\100\060\016\006\003\125\035\017\001\001\377\004 -\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004 -\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004 -\024\145\300\215\045\365\014\272\227\167\220\077\236\056\340\132 -\365\316\325\341\344\060\012\006\010\052\206\110\316\075\004\003 -\003\003\151\000\060\146\002\061\000\245\256\343\106\123\370\230 -\066\343\042\372\056\050\111\015\356\060\176\063\363\354\077\161 -\136\314\125\211\170\231\254\262\375\334\034\134\063\216\051\271 -\153\027\310\021\150\265\334\203\007\002\061\000\234\310\104\332 -\151\302\066\303\124\031\020\205\002\332\235\107\357\101\347\154 -\046\235\011\075\367\155\220\321\005\104\057\260\274\203\223\150 -\362\014\105\111\071\277\231\004\034\323\020\240 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "Symantec Class 1 Public Primary Certification Authority - G4" -# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Serial Number:21:6e:33:a5:cb:d3:88:a4:6f:29:07:b4:27:3c:c4:d8 -# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Not Valid Before: Wed Oct 05 00:00:00 2011 -# Not Valid After : Mon Jan 18 23:59:59 2038 -# Fingerprint (SHA-256): 36:3F:3C:84:9E:AB:03:B0:A2:A0:F6:36:D7:B8:6D:04:D3:AC:7F:CF:E2:6A:0A:91:21:AB:97:95:F6:E1:76:DF -# Fingerprint (SHA1): 84:F2:E3:DD:83:13:3E:A9:1D:19:52:7F:02:D7:29:BF:C1:5F:E6:67 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G4" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\204\362\343\335\203\023\076\251\035\031\122\177\002\327\051\277 -\301\137\346\147 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\004\345\200\077\125\377\131\207\244\062\322\025\245\345\252\346 -END -CKA_ISSUER MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\041\156\063\245\313\323\210\244\157\051\007\264\047\074 -\304\330 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "Symantec Class 2 Public Primary Certification Authority - G4" -# -# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Serial Number:34:17:65:12:40:3b:b7:56:80:2d:80:cb:79:55:a6:1e -# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Not Valid Before: Wed Oct 05 00:00:00 2011 -# Not Valid After : Mon Jan 18 23:59:59 2038 -# Fingerprint (SHA-256): FE:86:3D:08:22:FE:7A:23:53:FA:48:4D:59:24:E8:75:65:6D:3D:C9:FB:58:77:1F:6F:61:6F:9D:57:1B:C5:92 -# Fingerprint (SHA1): 67:24:90:2E:48:01:B0:22:96:40:10:46:B4:B1:67:2C:A9:75:FD:2B -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G4" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 -\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156 -\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061 -\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164 -\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153 -\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156 -\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154 -\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 -\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\064\027\145\022\100\073\267\126\200\055\200\313\171\125 -\246\036 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\002\250\060\202\002\055\240\003\002\001\002\002\020\064 -\027\145\022\100\073\267\126\200\055\200\313\171\125\246\036\060 -\012\006\010\052\206\110\316\075\004\003\003\060\201\224\061\013 -\060\011\006\003\125\004\006\023\002\125\123\061\035\060\033\006 -\003\125\004\012\023\024\123\171\155\141\156\164\145\143\040\103 -\157\162\160\157\162\141\164\151\157\156\061\037\060\035\006\003 -\125\004\013\023\026\123\171\155\141\156\164\145\143\040\124\162 -\165\163\164\040\116\145\164\167\157\162\153\061\105\060\103\006 -\003\125\004\003\023\074\123\171\155\141\156\164\145\143\040\103 -\154\141\163\163\040\062\040\120\165\142\154\151\143\040\120\162 -\151\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164 -\151\157\156\040\101\165\164\150\157\162\151\164\171\040\055\040 -\107\064\060\036\027\015\061\061\061\060\060\065\060\060\060\060 -\060\060\132\027\015\063\070\060\061\061\070\062\063\065\071\065 -\071\132\060\201\224\061\013\060\011\006\003\125\004\006\023\002 -\125\123\061\035\060\033\006\003\125\004\012\023\024\123\171\155 -\141\156\164\145\143\040\103\157\162\160\157\162\141\164\151\157 -\156\061\037\060\035\006\003\125\004\013\023\026\123\171\155\141 -\156\164\145\143\040\124\162\165\163\164\040\116\145\164\167\157 -\162\153\061\105\060\103\006\003\125\004\003\023\074\123\171\155 -\141\156\164\145\143\040\103\154\141\163\163\040\062\040\120\165 -\142\154\151\143\040\120\162\151\155\141\162\171\040\103\145\162 -\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157 -\162\151\164\171\040\055\040\107\064\060\166\060\020\006\007\052 -\206\110\316\075\002\001\006\005\053\201\004\000\042\003\142\000 -\004\321\331\112\216\114\015\204\112\121\272\174\357\323\314\372 -\072\232\265\247\143\023\075\001\340\111\076\372\301\107\311\222 -\263\072\327\376\157\234\367\232\072\017\365\016\012\012\303\077 -\310\347\022\024\216\325\325\155\230\054\263\161\062\012\353\052 -\275\366\327\152\040\013\147\105\234\322\262\277\123\042\146\011 -\135\333\021\363\361\005\063\130\243\342\270\317\174\315\202\233 -\275\243\102\060\100\060\016\006\003\125\035\017\001\001\377\004 -\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004 -\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004 -\024\075\062\363\072\251\014\220\204\371\242\214\151\006\141\124 -\057\207\162\376\005\060\012\006\010\052\206\110\316\075\004\003 -\003\003\151\000\060\146\002\061\000\310\246\251\257\101\177\265 -\311\021\102\026\150\151\114\134\270\047\030\266\230\361\300\177 -\220\155\207\323\214\106\027\360\076\117\374\352\260\010\304\172 -\113\274\010\057\307\342\247\157\145\002\061\000\326\131\336\206 -\316\137\016\312\124\325\306\320\025\016\374\213\224\162\324\216 -\000\130\123\317\176\261\113\015\345\120\206\353\236\153\337\377 -\051\246\330\107\331\240\226\030\333\362\105\263 +\202\236\374\067\036\164\135\374\227\377\227\310\261\377\101\060 +\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\201 +\224\061\013\060\011\006\003\125\004\006\023\002\125\123\061\035 +\060\033\006\003\125\004\012\023\024\123\171\155\141\156\164\145 +\143\040\103\157\162\160\157\162\141\164\151\157\156\061\037\060 +\035\006\003\125\004\013\023\026\123\171\155\141\156\164\145\143 +\040\124\162\165\163\164\040\116\145\164\167\157\162\153\061\105 +\060\103\006\003\125\004\003\023\074\123\171\155\141\156\164\145 +\143\040\103\154\141\163\163\040\062\040\120\165\142\154\151\143 +\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151 +\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171 +\040\055\040\107\066\060\036\027\015\061\061\061\060\061\070\060 +\060\060\060\060\060\132\027\015\063\067\061\062\060\061\062\063 +\065\071\065\071\132\060\201\224\061\013\060\011\006\003\125\004 +\006\023\002\125\123\061\035\060\033\006\003\125\004\012\023\024 +\123\171\155\141\156\164\145\143\040\103\157\162\160\157\162\141 +\164\151\157\156\061\037\060\035\006\003\125\004\013\023\026\123 +\171\155\141\156\164\145\143\040\124\162\165\163\164\040\116\145 +\164\167\157\162\153\061\105\060\103\006\003\125\004\003\023\074 +\123\171\155\141\156\164\145\143\040\103\154\141\163\163\040\062 +\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171\040 +\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165 +\164\150\157\162\151\164\171\040\055\040\107\066\060\202\001\042 +\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003 +\202\001\017\000\060\202\001\012\002\202\001\001\000\315\314\351 +\005\310\143\205\313\077\100\143\027\275\030\372\065\346\004\147 +\127\145\230\051\244\117\311\134\217\017\064\322\370\332\250\023 +\142\252\270\036\120\147\170\260\026\114\240\071\251\025\172\256 +\355\322\242\300\360\220\067\051\030\046\134\350\015\074\266\154 +\111\077\301\340\334\331\113\266\024\031\013\246\323\226\341\326 +\011\343\031\046\034\371\037\145\113\371\032\103\034\000\203\326 +\320\252\111\242\324\333\346\142\070\272\120\024\103\155\371\061 +\370\126\026\331\070\002\221\317\353\154\335\273\071\116\231\341 +\060\147\105\361\324\360\215\303\337\376\362\070\007\041\175\000 +\136\126\104\263\344\140\275\221\053\234\253\133\004\162\017\262 +\050\331\162\253\005\040\102\045\251\133\003\152\040\020\314\061 +\360\053\332\065\054\320\373\232\227\116\360\202\113\053\330\137 +\066\243\013\055\257\143\015\035\045\177\241\156\134\142\241\215 +\050\076\241\374\034\040\370\001\057\272\125\232\021\260\031\322 +\310\120\171\153\016\152\005\327\252\004\066\262\243\362\341\137 +\167\247\167\234\345\036\334\351\337\152\301\145\135\002\003\001 +\000\001\243\102\060\100\060\016\006\003\125\035\017\001\001\377 +\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377 +\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026 +\004\024\207\214\040\225\310\230\112\321\326\200\006\112\220\064 +\104\337\034\115\277\260\060\015\006\011\052\206\110\206\367\015 +\001\001\013\005\000\003\202\001\001\000\201\216\262\245\146\226 +\267\041\245\266\357\157\043\132\137\333\201\305\102\245\170\301 +\151\375\364\074\327\371\134\153\160\162\032\374\132\227\115\000 +\200\210\210\202\212\303\161\015\216\305\211\233\054\355\215\013 +\322\162\124\365\175\324\134\103\127\351\363\256\245\002\021\366 +\166\053\201\127\335\175\332\164\060\375\124\107\366\340\026\156 +\246\264\012\110\346\347\165\007\017\051\031\071\316\171\364\266 +\154\305\137\231\325\037\113\372\337\155\054\074\015\124\200\160 +\360\210\013\200\317\306\150\242\270\035\160\331\166\214\374\356 +\245\311\317\255\035\317\231\045\127\132\142\105\313\026\153\275 +\111\315\245\243\214\151\171\045\256\270\114\154\213\100\146\113 +\026\077\317\002\032\335\341\154\153\007\141\152\166\025\051\231 +\177\033\335\210\200\301\277\265\217\163\305\246\226\043\204\246 +\050\206\044\063\152\001\056\127\163\045\266\136\277\217\346\035 +\141\250\100\051\147\035\207\233\035\177\233\237\231\315\061\326 +\124\276\142\273\071\254\150\022\110\221\040\245\313\261\335\376 +\157\374\132\344\202\125\131\257\061\251 END CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE -# Trust for "Symantec Class 2 Public Primary Certification Authority - G4" -# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Serial Number:34:17:65:12:40:3b:b7:56:80:2d:80:cb:79:55:a6:1e -# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US -# Not Valid Before: Wed Oct 05 00:00:00 2011 -# Not Valid After : Mon Jan 18 23:59:59 2038 -# Fingerprint (SHA-256): FE:86:3D:08:22:FE:7A:23:53:FA:48:4D:59:24:E8:75:65:6D:3D:C9:FB:58:77:1F:6F:61:6F:9D:57:1B:C5:92 -# Fingerprint (SHA1): 67:24:90:2E:48:01:B0:22:96:40:10:46:B4:B1:67:2C:A9:75:FD:2B +# Trust for "Symantec Class 2 Public Primary Certification Authority - G6" +# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US +# Serial Number:64:82:9e:fc:37:1e:74:5d:fc:97:ff:97:c8:b1:ff:41 +# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US +# Not Valid Before: Tue Oct 18 00:00:00 2011 +# Not Valid After : Tue Dec 01 23:59:59 2037 +# Fingerprint (SHA-256): CB:62:7D:18:B5:8A:D5:6D:DE:33:1A:30:45:6B:C6:5C:60:1A:4E:9B:18:DE:DC:EA:08:E7:DA:AA:07:81:5F:F0 +# Fingerprint (SHA1): 40:B3:31:A0:E9:BF:E8:55:BC:39:93:CA:70:4F:4E:C2:51:D4:1D:8F CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G4" +CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G6" CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\147\044\220\056\110\001\260\042\226\100\020\106\264\261\147\054 -\251\165\375\053 +\100\263\061\240\351\277\350\125\274\071\223\312\160\117\116\302 +\121\324\035\217 END CKA_CERT_MD5_HASH MULTILINE_OCTAL -\160\325\060\361\332\224\227\324\327\164\337\276\355\150\336\226 +\175\013\203\345\373\174\255\007\117\040\251\265\337\143\355\171 END CKA_ISSUER MULTILINE_OCTAL \060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123 @@ -19748,11 +18559,11 @@ CKA_ISSUER MULTILINE_OCTAL \164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154 \151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151 \146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151 -\164\171\040\055\040\107\064 +\164\171\040\055\040\107\066 END CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\064\027\145\022\100\073\267\126\200\055\200\313\171\125 -\246\036 +\002\020\144\202\236\374\067\036\164\135\374\227\377\227\310\261 +\377\101 END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR @@ -23590,3 +22401,579 @@ CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "Microsoft ECC Root Certificate Authority 2017" +# +# Issuer: CN=Microsoft ECC Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Serial Number:66:f2:3d:af:87:de:8b:b1:4a:ea:0c:57:31:01:c2:ec +# Subject: CN=Microsoft ECC Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Not Valid Before: Wed Dec 18 23:06:45 2019 +# Not Valid After : Fri Jul 18 23:16:04 2042 +# Fingerprint (SHA-256): 35:8D:F3:9D:76:4A:F9:E1:B7:66:E9:C9:72:DF:35:2E:E1:5C:FA:C2:27:AF:6A:D1:D7:0E:8E:4A:6E:DC:BA:02 +# Fingerprint (SHA1): 99:9A:64:C3:7F:F4:7D:9F:AB:95:F1:47:69:89:14:60:EE:C4:C3:C5 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "Microsoft ECC Root Certificate Authority 2017" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\105\103\103\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\105\103\103\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\146\362\075\257\207\336\213\261\112\352\014\127\061\001 +\302\354 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\131\060\202\001\337\240\003\002\001\002\002\020\146 +\362\075\257\207\336\213\261\112\352\014\127\061\001\302\354\060 +\012\006\010\052\206\110\316\075\004\003\003\060\145\061\013\060 +\011\006\003\125\004\006\023\002\125\123\061\036\060\034\006\003 +\125\004\012\023\025\115\151\143\162\157\163\157\146\164\040\103 +\157\162\160\157\162\141\164\151\157\156\061\066\060\064\006\003 +\125\004\003\023\055\115\151\143\162\157\163\157\146\164\040\105 +\103\103\040\122\157\157\164\040\103\145\162\164\151\146\151\143 +\141\164\145\040\101\165\164\150\157\162\151\164\171\040\062\060 +\061\067\060\036\027\015\061\071\061\062\061\070\062\063\060\066 +\064\065\132\027\015\064\062\060\067\061\070\062\063\061\066\060 +\064\132\060\145\061\013\060\011\006\003\125\004\006\023\002\125 +\123\061\036\060\034\006\003\125\004\012\023\025\115\151\143\162 +\157\163\157\146\164\040\103\157\162\160\157\162\141\164\151\157 +\156\061\066\060\064\006\003\125\004\003\023\055\115\151\143\162 +\157\163\157\146\164\040\105\103\103\040\122\157\157\164\040\103 +\145\162\164\151\146\151\143\141\164\145\040\101\165\164\150\157 +\162\151\164\171\040\062\060\061\067\060\166\060\020\006\007\052 +\206\110\316\075\002\001\006\005\053\201\004\000\042\003\142\000 +\004\324\274\075\002\102\165\101\023\043\315\200\004\206\002\121 +\057\152\250\201\142\013\145\314\366\312\235\036\157\112\146\121 +\242\003\331\235\221\372\266\026\261\214\156\336\174\315\333\171 +\246\057\316\273\316\161\057\345\245\253\050\354\143\004\146\231 +\370\372\362\223\020\005\341\201\050\102\343\306\150\364\346\033 +\204\140\112\211\257\355\171\017\073\316\361\366\104\365\001\170 +\300\243\124\060\122\060\016\006\003\125\035\017\001\001\377\004 +\004\003\002\001\206\060\017\006\003\125\035\023\001\001\377\004 +\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004 +\024\310\313\231\162\160\122\014\370\346\276\262\004\127\051\052 +\317\102\020\355\065\060\020\006\011\053\006\001\004\001\202\067 +\025\001\004\003\002\001\000\060\012\006\010\052\206\110\316\075 +\004\003\003\003\150\000\060\145\002\060\130\362\115\352\014\371 +\137\136\356\140\051\313\072\362\333\326\062\204\031\077\174\325 +\057\302\261\314\223\256\120\273\011\062\306\306\355\176\311\066 +\224\022\344\150\205\006\242\033\320\057\002\061\000\231\351\026 +\264\016\372\126\110\324\244\060\026\221\170\333\124\214\145\001 +\212\347\120\146\302\061\267\071\272\270\032\042\007\116\374\153 +\124\026\040\377\053\265\347\114\014\115\246\117\163 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "Microsoft ECC Root Certificate Authority 2017" +# Issuer: CN=Microsoft ECC Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Serial Number:66:f2:3d:af:87:de:8b:b1:4a:ea:0c:57:31:01:c2:ec +# Subject: CN=Microsoft ECC Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Not Valid Before: Wed Dec 18 23:06:45 2019 +# Not Valid After : Fri Jul 18 23:16:04 2042 +# Fingerprint (SHA-256): 35:8D:F3:9D:76:4A:F9:E1:B7:66:E9:C9:72:DF:35:2E:E1:5C:FA:C2:27:AF:6A:D1:D7:0E:8E:4A:6E:DC:BA:02 +# Fingerprint (SHA1): 99:9A:64:C3:7F:F4:7D:9F:AB:95:F1:47:69:89:14:60:EE:C4:C3:C5 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "Microsoft ECC Root Certificate Authority 2017" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\231\232\144\303\177\364\175\237\253\225\361\107\151\211\024\140 +\356\304\303\305 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\335\241\003\346\112\223\020\321\277\360\031\102\313\376\355\147 +END +CKA_ISSUER MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\105\103\103\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\146\362\075\257\207\336\213\261\112\352\014\127\061\001 +\302\354 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "Microsoft RSA Root Certificate Authority 2017" +# +# Issuer: CN=Microsoft RSA Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Serial Number:1e:d3:97:09:5f:d8:b4:b3:47:70:1e:aa:be:7f:45:b3 +# Subject: CN=Microsoft RSA Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Not Valid Before: Wed Dec 18 22:51:22 2019 +# Not Valid After : Fri Jul 18 23:00:23 2042 +# Fingerprint (SHA-256): C7:41:F7:0F:4B:2A:8D:88:BF:2E:71:C1:41:22:EF:53:EF:10:EB:A0:CF:A5:E6:4C:FA:20:F4:18:85:30:73:E0 +# Fingerprint (SHA1): 73:A5:E6:4A:3B:FF:83:16:FF:0E:DC:CC:61:8A:90:6E:4E:AE:4D:74 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "Microsoft RSA Root Certificate Authority 2017" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\122\123\101\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\122\123\101\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\036\323\227\011\137\330\264\263\107\160\036\252\276\177 +\105\263 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\250\060\202\003\220\240\003\002\001\002\002\020\036 +\323\227\011\137\330\264\263\107\160\036\252\276\177\105\263\060 +\015\006\011\052\206\110\206\367\015\001\001\014\005\000\060\145 +\061\013\060\011\006\003\125\004\006\023\002\125\123\061\036\060 +\034\006\003\125\004\012\023\025\115\151\143\162\157\163\157\146 +\164\040\103\157\162\160\157\162\141\164\151\157\156\061\066\060 +\064\006\003\125\004\003\023\055\115\151\143\162\157\163\157\146 +\164\040\122\123\101\040\122\157\157\164\040\103\145\162\164\151 +\146\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171 +\040\062\060\061\067\060\036\027\015\061\071\061\062\061\070\062 +\062\065\061\062\062\132\027\015\064\062\060\067\061\070\062\063 +\060\060\062\063\132\060\145\061\013\060\011\006\003\125\004\006 +\023\002\125\123\061\036\060\034\006\003\125\004\012\023\025\115 +\151\143\162\157\163\157\146\164\040\103\157\162\160\157\162\141 +\164\151\157\156\061\066\060\064\006\003\125\004\003\023\055\115 +\151\143\162\157\163\157\146\164\040\122\123\101\040\122\157\157 +\164\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165 +\164\150\157\162\151\164\171\040\062\060\061\067\060\202\002\042 +\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003 +\202\002\017\000\060\202\002\012\002\202\002\001\000\312\133\276 +\224\063\214\051\225\221\026\012\225\275\107\142\301\211\363\231 +\066\337\106\220\311\245\355\170\152\157\107\221\150\370\047\147 +\120\063\035\241\246\373\340\345\103\243\204\002\127\001\135\234 +\110\100\202\123\020\274\277\307\073\150\220\266\202\055\345\364 +\145\320\314\155\031\314\225\371\173\254\112\224\255\016\336\113 +\103\035\207\007\222\023\220\200\203\144\065\071\004\374\345\351 +\154\263\266\037\120\224\070\145\120\134\027\106\271\266\205\265 +\034\265\027\350\326\105\235\330\262\046\260\312\304\160\112\256 +\140\244\335\263\331\354\374\073\325\127\162\274\077\310\311\262 +\336\113\153\370\043\154\003\300\005\275\225\307\315\163\073\146 +\200\144\343\032\254\056\371\107\005\362\006\266\233\163\365\170 +\063\133\307\241\373\047\052\241\264\232\221\214\221\323\072\202 +\076\166\100\264\315\122\141\121\160\050\077\305\305\132\362\311 +\214\111\273\024\133\115\310\377\147\115\114\022\226\255\365\376 +\170\250\227\207\327\375\136\040\200\334\241\113\042\373\324\211 +\255\272\316\107\227\107\125\173\217\105\310\147\050\204\225\034 +\150\060\357\357\111\340\065\173\144\347\230\260\224\332\115\205 +\073\076\125\304\050\257\127\363\236\023\333\106\047\237\036\242 +\136\104\203\244\245\312\325\023\263\113\077\304\343\302\346\206 +\141\244\122\060\271\172\040\117\157\017\070\123\313\063\014\023 +\053\217\326\232\275\052\310\055\261\034\175\113\121\312\107\321 +\110\047\162\135\207\353\325\105\346\110\145\235\257\122\220\272 +\133\242\030\145\127\022\237\150\271\324\025\153\224\304\151\042 +\230\364\063\340\355\371\121\216\101\120\311\064\117\166\220\254 +\374\070\301\330\341\173\271\343\343\224\341\106\151\313\016\012 +\120\153\023\272\254\017\067\132\267\022\265\220\201\036\126\256 +\127\042\206\331\311\322\321\327\121\343\253\073\306\125\375\036 +\016\323\164\012\321\332\252\352\151\270\227\050\217\110\304\007 +\370\122\103\072\364\312\125\065\054\260\246\152\300\234\371\362 +\201\341\022\152\300\105\331\147\263\316\377\043\242\211\012\124 +\324\024\271\052\250\327\354\371\253\315\045\130\062\171\217\220 +\133\230\071\304\010\006\301\254\177\016\075\000\245\002\003\001 +\000\001\243\124\060\122\060\016\006\003\125\035\017\001\001\377 +\004\004\003\002\001\206\060\017\006\003\125\035\023\001\001\377 +\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026 +\004\024\011\313\131\177\206\262\160\217\032\303\071\343\300\331 +\351\277\273\115\262\043\060\020\006\011\053\006\001\004\001\202 +\067\025\001\004\003\002\001\000\060\015\006\011\052\206\110\206 +\367\015\001\001\014\005\000\003\202\002\001\000\254\257\076\135 +\302\021\226\211\216\243\347\222\326\227\025\270\023\242\246\102 +\056\002\315\026\005\131\047\312\040\350\272\270\350\032\354\115 +\250\227\126\256\145\103\261\217\000\233\122\315\125\315\123\071 +\155\142\114\213\015\133\174\056\104\277\203\020\217\363\123\202 +\200\303\117\072\307\156\021\077\346\343\026\221\204\373\155\204 +\177\064\164\255\211\247\316\271\327\327\237\204\144\222\276\225 +\241\255\011\123\063\335\356\012\352\112\121\216\157\125\253\272 +\265\224\106\256\214\177\330\242\120\045\145\140\200\106\333\063 +\004\256\154\265\230\164\124\045\334\223\344\370\343\125\025\075 +\270\155\303\012\244\022\301\151\205\156\337\144\361\123\231\341 +\112\165\040\235\225\017\344\326\334\003\361\131\030\350\107\211 +\262\127\132\224\266\251\330\027\053\027\111\345\166\313\301\126 +\231\072\067\261\377\151\054\221\221\223\341\337\114\243\067\166 +\115\241\237\370\155\036\035\323\372\354\373\364\105\035\023\155 +\317\367\131\345\042\047\162\053\206\363\127\273\060\355\044\115 +\334\175\126\273\243\263\370\064\171\211\301\340\362\002\141\367 +\246\374\017\273\034\027\013\256\101\331\174\275\047\243\375\056 +\072\321\223\224\261\163\035\044\213\257\133\040\211\255\267\147 +\146\171\365\072\306\246\226\063\376\123\222\310\106\261\021\221 +\306\231\177\217\311\326\146\061\040\101\020\207\055\014\326\301 +\257\064\230\312\144\203\373\023\127\321\301\360\074\172\214\245 +\301\375\225\041\240\161\301\223\147\161\022\352\217\210\012\151 +\031\144\231\043\126\373\254\052\056\160\276\146\304\014\204\357 +\345\213\363\223\001\370\152\220\223\147\113\262\150\243\265\142 +\217\351\077\214\172\073\136\017\347\214\270\306\174\357\067\375 +\164\342\310\117\063\162\341\224\071\155\275\022\257\276\014\116 +\160\174\033\157\215\263\062\223\163\104\026\155\350\364\367\340 +\225\200\217\226\135\070\244\364\253\336\012\060\207\223\330\115 +\000\161\142\105\047\113\072\102\204\133\177\145\267\147\064\122 +\055\234\026\153\252\250\330\173\243\102\114\161\307\014\312\076 +\203\344\246\357\267\001\060\136\121\243\171\365\160\151\246\101 +\104\017\206\260\054\221\306\075\352\256\017\204 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "Microsoft RSA Root Certificate Authority 2017" +# Issuer: CN=Microsoft RSA Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Serial Number:1e:d3:97:09:5f:d8:b4:b3:47:70:1e:aa:be:7f:45:b3 +# Subject: CN=Microsoft RSA Root Certificate Authority 2017,O=Microsoft Corporation,C=US +# Not Valid Before: Wed Dec 18 22:51:22 2019 +# Not Valid After : Fri Jul 18 23:00:23 2042 +# Fingerprint (SHA-256): C7:41:F7:0F:4B:2A:8D:88:BF:2E:71:C1:41:22:EF:53:EF:10:EB:A0:CF:A5:E6:4C:FA:20:F4:18:85:30:73:E0 +# Fingerprint (SHA1): 73:A5:E6:4A:3B:FF:83:16:FF:0E:DC:CC:61:8A:90:6E:4E:AE:4D:74 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "Microsoft RSA Root Certificate Authority 2017" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\163\245\346\112\073\377\203\026\377\016\334\314\141\212\220\156 +\116\256\115\164 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\020\377\000\377\317\311\370\307\172\300\356\065\216\311\017\107 +END +CKA_ISSUER MULTILINE_OCTAL +\060\145\061\013\060\011\006\003\125\004\006\023\002\125\123\061 +\036\060\034\006\003\125\004\012\023\025\115\151\143\162\157\163 +\157\146\164\040\103\157\162\160\157\162\141\164\151\157\156\061 +\066\060\064\006\003\125\004\003\023\055\115\151\143\162\157\163 +\157\146\164\040\122\123\101\040\122\157\157\164\040\103\145\162 +\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151 +\164\171\040\062\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\036\323\227\011\137\330\264\263\107\160\036\252\276\177 +\105\263 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "e-Szigno Root CA 2017" +# +# Issuer: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Serial Number:01:54:48:ef:21:fd:97:59:0d:f5:04:0a +# Subject: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Not Valid Before: Tue Aug 22 12:07:06 2017 +# Not Valid After : Fri Aug 22 12:07:06 2042 +# Fingerprint (SHA-256): BE:B0:0B:30:83:9B:9B:C3:2C:32:E4:44:79:05:95:06:41:F2:64:21:B1:5E:D0:89:19:8B:51:8A:E2:EA:1B:99 +# Fingerprint (SHA1): 89:D4:83:03:4F:9E:9A:48:80:5F:72:37:D4:A9:A6:EF:CB:7C:1F:D1 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "e-Szigno Root CA 2017" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\161\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\036\060\034\006\003\125\004\003\014\025\145\055 +\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040\062 +\060\061\067 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\161\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\036\060\034\006\003\125\004\003\014\025\145\055 +\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040\062 +\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\014\001\124\110\357\041\375\227\131\015\365\004\012 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\100\060\202\001\345\240\003\002\001\002\002\014\001 +\124\110\357\041\375\227\131\015\365\004\012\060\012\006\010\052 +\206\110\316\075\004\003\002\060\161\061\013\060\011\006\003\125 +\004\006\023\002\110\125\061\021\060\017\006\003\125\004\007\014 +\010\102\165\144\141\160\145\163\164\061\026\060\024\006\003\125 +\004\012\014\015\115\151\143\162\157\163\145\143\040\114\164\144 +\056\061\027\060\025\006\003\125\004\141\014\016\126\101\124\110 +\125\055\062\063\065\070\064\064\071\067\061\036\060\034\006\003 +\125\004\003\014\025\145\055\123\172\151\147\156\157\040\122\157 +\157\164\040\103\101\040\062\060\061\067\060\036\027\015\061\067 +\060\070\062\062\061\062\060\067\060\066\132\027\015\064\062\060 +\070\062\062\061\062\060\067\060\066\132\060\161\061\013\060\011 +\006\003\125\004\006\023\002\110\125\061\021\060\017\006\003\125 +\004\007\014\010\102\165\144\141\160\145\163\164\061\026\060\024 +\006\003\125\004\012\014\015\115\151\143\162\157\163\145\143\040 +\114\164\144\056\061\027\060\025\006\003\125\004\141\014\016\126 +\101\124\110\125\055\062\063\065\070\064\064\071\067\061\036\060 +\034\006\003\125\004\003\014\025\145\055\123\172\151\147\156\157 +\040\122\157\157\164\040\103\101\040\062\060\061\067\060\131\060 +\023\006\007\052\206\110\316\075\002\001\006\010\052\206\110\316 +\075\003\001\007\003\102\000\004\226\334\075\212\330\260\173\157 +\306\047\276\104\220\261\263\126\025\173\216\103\044\175\032\204 +\131\356\143\150\262\306\136\207\320\025\110\036\250\220\255\275 +\123\242\332\336\072\220\246\140\137\150\062\265\206\101\337\207 +\133\054\173\305\376\174\172\332\243\143\060\141\060\017\006\003 +\125\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006 +\003\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006 +\003\125\035\016\004\026\004\024\207\021\025\010\321\252\301\170 +\014\261\257\316\306\311\220\357\277\060\004\300\060\037\006\003 +\125\035\043\004\030\060\026\200\024\207\021\025\010\321\252\301 +\170\014\261\257\316\306\311\220\357\277\060\004\300\060\012\006 +\010\052\206\110\316\075\004\003\002\003\111\000\060\106\002\041 +\000\265\127\335\327\212\125\013\066\341\206\104\372\324\331\150 +\215\270\334\043\212\212\015\324\057\175\352\163\354\277\115\154 +\250\002\041\000\313\245\264\022\372\347\265\350\317\176\223\374 +\363\065\217\157\116\132\174\264\274\116\262\374\162\252\133\131 +\371\347\334\061 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "e-Szigno Root CA 2017" +# Issuer: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Serial Number:01:54:48:ef:21:fd:97:59:0d:f5:04:0a +# Subject: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Not Valid Before: Tue Aug 22 12:07:06 2017 +# Not Valid After : Fri Aug 22 12:07:06 2042 +# Fingerprint (SHA-256): BE:B0:0B:30:83:9B:9B:C3:2C:32:E4:44:79:05:95:06:41:F2:64:21:B1:5E:D0:89:19:8B:51:8A:E2:EA:1B:99 +# Fingerprint (SHA1): 89:D4:83:03:4F:9E:9A:48:80:5F:72:37:D4:A9:A6:EF:CB:7C:1F:D1 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "e-Szigno Root CA 2017" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\211\324\203\003\117\236\232\110\200\137\162\067\324\251\246\357 +\313\174\037\321 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\336\037\366\236\204\256\247\264\041\316\036\130\175\321\204\230 +END +CKA_ISSUER MULTILINE_OCTAL +\060\161\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\036\060\034\006\003\125\004\003\014\025\145\055 +\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040\062 +\060\061\067 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\014\001\124\110\357\041\375\227\131\015\365\004\012 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "certSIGN Root CA G2" +# +# Issuer: OU=certSIGN ROOT CA G2,O=CERTSIGN SA,C=RO +# Serial Number:11:00:34:b6:4e:c6:36:2d:36 +# Subject: OU=certSIGN ROOT CA G2,O=CERTSIGN SA,C=RO +# Not Valid Before: Mon Feb 06 09:27:35 2017 +# Not Valid After : Thu Feb 06 09:27:35 2042 +# Fingerprint (SHA-256): 65:7C:FE:2F:A7:3F:AA:38:46:25:71:F3:32:A2:36:3A:46:FC:E7:02:09:51:71:07:02:CD:FB:B6:EE:DA:33:05 +# Fingerprint (SHA1): 26:F9:93:B4:ED:3D:28:27:B0:B9:4B:A7:E9:15:1D:A3:8D:92:E5:32 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "certSIGN Root CA G2" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\101\061\013\060\011\006\003\125\004\006\023\002\122\117\061 +\024\060\022\006\003\125\004\012\023\013\103\105\122\124\123\111 +\107\116\040\123\101\061\034\060\032\006\003\125\004\013\023\023 +\143\145\162\164\123\111\107\116\040\122\117\117\124\040\103\101 +\040\107\062 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\101\061\013\060\011\006\003\125\004\006\023\002\122\117\061 +\024\060\022\006\003\125\004\012\023\013\103\105\122\124\123\111 +\107\116\040\123\101\061\034\060\032\006\003\125\004\013\023\023 +\143\145\162\164\123\111\107\116\040\122\117\117\124\040\103\101 +\040\107\062 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\011\021\000\064\266\116\306\066\055\066 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\107\060\202\003\057\240\003\002\001\002\002\011\021 +\000\064\266\116\306\066\055\066\060\015\006\011\052\206\110\206 +\367\015\001\001\013\005\000\060\101\061\013\060\011\006\003\125 +\004\006\023\002\122\117\061\024\060\022\006\003\125\004\012\023 +\013\103\105\122\124\123\111\107\116\040\123\101\061\034\060\032 +\006\003\125\004\013\023\023\143\145\162\164\123\111\107\116\040 +\122\117\117\124\040\103\101\040\107\062\060\036\027\015\061\067 +\060\062\060\066\060\071\062\067\063\065\132\027\015\064\062\060 +\062\060\066\060\071\062\067\063\065\132\060\101\061\013\060\011 +\006\003\125\004\006\023\002\122\117\061\024\060\022\006\003\125 +\004\012\023\013\103\105\122\124\123\111\107\116\040\123\101\061 +\034\060\032\006\003\125\004\013\023\023\143\145\162\164\123\111 +\107\116\040\122\117\117\124\040\103\101\040\107\062\060\202\002 +\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000 +\003\202\002\017\000\060\202\002\012\002\202\002\001\000\300\305 +\165\031\221\175\104\164\164\207\376\016\073\226\334\330\001\026 +\314\356\143\221\347\013\157\316\073\012\151\032\174\302\343\257 +\202\216\206\327\136\217\127\353\323\041\131\375\071\067\102\060 +\276\120\352\266\017\251\210\330\056\055\151\041\347\321\067\030 +\116\175\221\325\026\137\153\133\000\302\071\103\015\066\205\122 +\271\123\145\017\035\102\345\217\317\005\323\356\334\014\032\331 +\270\213\170\042\147\344\151\260\150\305\074\344\154\132\106\347 +\315\307\372\357\304\354\113\275\152\244\254\375\314\050\121\357 +\222\264\051\253\253\065\232\114\344\304\010\306\046\314\370\151 +\237\344\234\360\051\323\134\371\306\026\045\236\043\303\040\301 +\075\017\077\070\100\260\376\202\104\070\252\132\032\212\153\143 +\130\070\264\025\323\266\021\151\173\036\124\356\214\032\042\254 +\162\227\077\043\131\233\311\042\204\301\007\117\314\177\342\127 +\312\022\160\273\246\145\363\151\165\143\275\225\373\033\227\315 +\344\250\257\366\321\116\250\331\212\161\044\315\066\075\274\226 +\304\361\154\251\256\345\317\015\156\050\015\260\016\265\312\121 +\173\170\024\303\040\057\177\373\024\125\341\021\231\375\325\012 +\241\236\002\343\142\137\353\065\113\054\270\162\350\076\075\117 +\254\054\273\056\206\342\243\166\217\345\223\052\317\245\253\310 +\134\215\113\006\377\022\106\254\170\313\024\007\065\340\251\337 +\213\351\257\025\117\026\211\133\275\366\215\306\131\256\210\205 +\016\301\211\353\037\147\305\105\216\377\155\067\066\053\170\146 +\203\221\121\053\075\377\121\167\166\142\241\354\147\076\076\201 +\203\340\126\251\120\037\037\172\231\253\143\277\204\027\167\361 +\015\073\337\367\234\141\263\065\230\212\072\262\354\074\032\067 +\077\176\217\222\317\331\022\024\144\332\020\002\025\101\377\117 +\304\353\034\243\311\372\231\367\106\351\341\030\331\261\270\062 +\055\313\024\014\120\330\203\145\203\356\271\134\317\313\005\132 +\114\372\031\227\153\326\135\023\323\302\134\124\274\062\163\240 +\170\365\361\155\036\313\237\245\246\237\042\334\321\121\236\202 +\171\144\140\051\023\076\243\375\117\162\152\253\342\324\345\270 +\044\125\054\104\113\212\210\104\234\312\204\323\052\073\002\003 +\001\000\001\243\102\060\100\060\017\006\003\125\035\023\001\001 +\377\004\005\060\003\001\001\377\060\016\006\003\125\035\017\001 +\001\377\004\004\003\002\001\006\060\035\006\003\125\035\016\004 +\026\004\024\202\041\055\146\306\327\240\340\025\353\316\114\011 +\167\304\140\236\124\156\003\060\015\006\011\052\206\110\206\367 +\015\001\001\013\005\000\003\202\002\001\000\140\336\032\270\347 +\362\140\202\325\003\063\201\313\006\212\361\042\111\351\350\352 +\221\177\306\063\136\150\031\003\206\073\103\001\317\007\160\344 +\010\036\145\205\221\346\021\042\267\365\002\043\216\256\271\036 +\175\037\176\154\346\275\045\325\225\032\362\005\246\257\205\002 +\157\256\370\326\061\377\045\311\112\310\307\212\251\331\237\113 +\111\233\021\127\231\222\103\021\336\266\063\244\314\327\215\144 +\175\324\315\074\050\054\264\232\226\352\115\365\304\104\304\045 +\252\040\200\330\051\125\367\340\101\374\006\046\377\271\066\365 +\103\024\003\146\170\341\021\261\332\040\137\106\000\170\000\041 +\245\036\000\050\141\170\157\250\001\001\217\235\064\232\377\364 +\070\220\373\270\321\263\162\006\311\161\346\201\305\171\355\013 +\246\171\362\023\013\234\367\135\016\173\044\223\264\110\333\206 +\137\336\120\206\170\347\100\346\061\250\220\166\160\141\257\234 +\067\054\021\265\202\267\252\256\044\064\133\162\014\151\015\315 +\131\237\366\161\257\234\013\321\012\070\371\006\042\203\123\045 +\014\374\121\304\346\276\342\071\225\013\044\255\257\321\225\344 +\226\327\164\144\153\161\116\002\074\252\205\363\040\243\103\071 +\166\133\154\120\376\232\234\024\036\145\024\212\025\275\243\202 +\105\132\111\126\152\322\234\261\143\062\345\141\340\123\042\016 +\247\012\111\352\313\176\037\250\342\142\200\366\020\105\122\230 +\006\030\336\245\315\057\177\252\324\351\076\010\162\354\043\003 +\002\074\246\252\330\274\147\164\075\024\027\373\124\113\027\343 +\323\171\075\155\153\111\311\050\016\056\164\120\277\014\331\106 +\072\020\206\311\247\077\351\240\354\177\353\245\167\130\151\161 +\346\203\012\067\362\206\111\152\276\171\010\220\366\002\026\144 +\076\345\332\114\176\014\064\311\371\137\266\263\050\121\247\247 +\053\252\111\372\215\145\051\116\343\153\023\247\224\243\055\121 +\155\170\014\104\313\337\336\010\157\316\243\144\253\323\225\204 +\324\271\122\124\162\173\226\045\314\274\151\343\110\156\015\320 +\307\235\047\232\252\370\023\222\335\036\337\143\237\065\251\026 +\066\354\214\270\203\364\075\211\217\315\264\027\136\327\263\027 +\101\020\135\047\163\140\205\127\111\042\007 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "certSIGN Root CA G2" +# Issuer: OU=certSIGN ROOT CA G2,O=CERTSIGN SA,C=RO +# Serial Number:11:00:34:b6:4e:c6:36:2d:36 +# Subject: OU=certSIGN ROOT CA G2,O=CERTSIGN SA,C=RO +# Not Valid Before: Mon Feb 06 09:27:35 2017 +# Not Valid After : Thu Feb 06 09:27:35 2042 +# Fingerprint (SHA-256): 65:7C:FE:2F:A7:3F:AA:38:46:25:71:F3:32:A2:36:3A:46:FC:E7:02:09:51:71:07:02:CD:FB:B6:EE:DA:33:05 +# Fingerprint (SHA1): 26:F9:93:B4:ED:3D:28:27:B0:B9:4B:A7:E9:15:1D:A3:8D:92:E5:32 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "certSIGN Root CA G2" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\046\371\223\264\355\075\050\047\260\271\113\247\351\025\035\243 +\215\222\345\062 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\214\361\165\212\306\031\317\224\267\367\145\040\207\303\227\307 +END +CKA_ISSUER MULTILINE_OCTAL +\060\101\061\013\060\011\006\003\125\004\006\023\002\122\117\061 +\024\060\022\006\003\125\004\012\023\013\103\105\122\124\123\111 +\107\116\040\123\101\061\034\060\032\006\003\125\004\013\023\023 +\143\145\162\164\123\111\107\116\040\122\117\117\124\040\103\101 +\040\107\062 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\011\021\000\064\266\116\306\066\055\066 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE From a9ac75480fc676ea111fa10716fc1879272feb46 Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Sat, 10 Oct 2020 23:15:12 +0400 Subject: [PATCH 091/117] doc: add symlink information for process.execpath PR-URL: https://github.com/nodejs/node/pull/35590 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- doc/api/process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index ae739de78747fc..8196fa15a27f06 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1152,7 +1152,7 @@ added: v0.1.100 * {string} The `process.execPath` property returns the absolute pathname of the executable -that started the Node.js process. +that started the Node.js process. Symbolic links, if any, are resolved. ```js From bfff4fc3c9a96c456bbde266f1087103f026784d Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Sat, 10 Oct 2020 22:42:37 +0400 Subject: [PATCH 092/117] doc: revise description of process.ppid PR-URL: https://github.com/nodejs/node/pull/35589 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: James M Snell --- 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 8196fa15a27f06..c644598dc35e64 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1699,7 +1699,8 @@ added: * {integer} -The `process.ppid` property returns the PID of the current parent process. +The `process.ppid` property returns the PID of the parent of the +current process. ```js console.log(`The parent process is pid ${process.ppid}`); From 42a587f9ba117969b9346fb02227ece50cafbd05 Mon Sep 17 00:00:00 2001 From: "Pooja D.P" Date: Mon, 12 Oct 2020 14:24:25 +0400 Subject: [PATCH 093/117] doc: use test username instead of real PR-URL: https://github.com/nodejs/node/pull/35611 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Harshitha K P --- doc/api/process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index c644598dc35e64..00d8de8c93d3a0 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1422,7 +1422,7 @@ Use care when dropping privileges: ```js console.log(process.getgroups()); // [ 0 ] -process.initgroups('bnoordhuis', 1000); // switch user +process.initgroups('nodeuser', 1000); // switch user console.log(process.getgroups()); // [ 27, 30, 46, 1000, 0 ] process.setgid(1000); // drop root gid console.log(process.getgroups()); // [ 27, 30, 46, 1000 ] From df52814113796201dd1662f606e1302e598372e1 Mon Sep 17 00:00:00 2001 From: Andrey Pechkurov Date: Wed, 7 Oct 2020 17:05:39 +0300 Subject: [PATCH 094/117] doc: document Buffer.concat may use internal pool PR-URL: https://github.com/nodejs/node/pull/35541 Refs: https://github.com/nodejs/node/pull/32703 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Harshitha K P Reviewed-By: Rich Trott Reviewed-By: Robert Nagy --- doc/api/buffer.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 605c0ed0af7479..36fa358bcc3c01 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -386,9 +386,9 @@ A `TypeError` will be thrown if `size` is not a number. The `Buffer` module pre-allocates an internal `Buffer` instance of size [`Buffer.poolSize`][] that is used as a pool for the fast allocation of new `Buffer` instances created using [`Buffer.allocUnsafe()`][], -[`Buffer.from(array)`][], and the deprecated `new Buffer(size)` constructor only -when `size` is less than or equal to `Buffer.poolSize >> 1` (floor of -[`Buffer.poolSize`][] divided by two). +[`Buffer.from(array)`][], [`Buffer.concat()`][], and the deprecated +`new Buffer(size)` constructor only when `size` is less than or equal +to `Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`][] divided by two). Use of this pre-allocated internal memory pool is a key difference between calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. @@ -560,6 +560,9 @@ console.log(bufA.length); // Prints: 42 ``` +`Buffer.concat()` may also use the internal `Buffer` pool like +[`Buffer.allocUnsafe()`][] does. + ### Static method: `Buffer.from(array)` ```js @@ -382,8 +382,8 @@ directly on the ES module namespace when the module is imported. Live binding updates or new exports added to `module.exports` are not detected for these named exports. -The detection of named exports is based on common syntax patterns but will not -always correctly detect named exports, in these cases using the default +The detection of named exports is based on common syntax patterns but does not +always correctly detect named exports. In these cases, using the default import form described above can be a better option. Named exports detection covers many common export patterns, reexport patterns @@ -392,7 +392,7 @@ semantics implemented. ## Builtin modules -[Core modules][] will provide named exports of their public API. A +[Core modules][] provide named exports of their public API. A default export is also provided which is the value of the CommonJS exports. The default export can be used for, among other things, modifying the named exports. Named exports of builtin modules are updated only by calling @@ -449,11 +449,11 @@ and are loaded using the CJS loader. [WHATWG JSON modules specification][] are still being standardized, and are experimentally supported by including the additional flag `--experimental-json-modules` when running Node.js. -When the `--experimental-json-modules` flag is included both the -`commonjs` and `module` mode will use the new experimental JSON -loader. The imported JSON only exposes a `default`, there is no +When the `--experimental-json-modules` flag is included, both the +`commonjs` and `module` mode use the new experimental JSON +loader. The imported JSON only exposes a `default`. There is no support for named exports. A cache entry is created in the CommonJS -cache, to avoid duplication. The same object will be returned in +cache to avoid duplication. The same object is returned in CommonJS if the JSON module has already been imported from the same path. @@ -533,7 +533,7 @@ The `conditions` property on the `context` is an array of conditions for for looking up conditional mappings elsewhere or to modify the list when calling the default resolution logic. -The current [package exports conditions][Conditional Exports] will always be in +The current [package exports conditions][Conditional Exports] are always in the `context.conditions` array passed into the hook. To guarantee _default Node.js module specifier resolution behavior_ when calling `defaultResolve`, the `context.conditions` array passed to it _must_ include _all_ elements of the @@ -604,7 +604,7 @@ Note: These types all correspond to classes defined in ECMAScript. * The specific [`TypedArray`][] object is a [`Uint8Array`][]. Note: If the source value of a text-based format (i.e., `'json'`, `'module'`) is -not a string, it will be converted to a string using [`util.TextDecoder`][]. +not a string, it is converted to a string using [`util.TextDecoder`][]. ```js /** @@ -719,15 +719,15 @@ export async function transformSource(source, context, defaultTransformSource) { * Returns: {string} -Sometimes it can be necessary to run some code inside of the same global scope -that the application will run in. This hook allows to return a string that will -be ran as sloppy-mode script on startup. +Sometimes it might be necessary to run some code inside of the same global scope +that the application runs in. This hook allows the return of a string that is +run as sloppy-mode script on startup. Similar to how CommonJS wrappers work, the code runs in an implicit function scope. The only argument is a `require`-like function that can be used to load builtins like "fs": `getBuiltin(request: string)`. -If the code needs more advanced `require` features, it will have to construct +If the code needs more advanced `require` features, it has to construct its own `require` using `module.createRequire()`. ```js @@ -854,13 +854,9 @@ import { VERSION } from 'https://coffeescript.org/browser-compiler-modern/coffee console.log(VERSION); ``` -With this loader, running: - -```bash -node --experimental-loader ./https-loader.mjs ./main.mjs -``` - -Will print the current version of CoffeeScript per the module at the URL in +With the preceding loader, running +`node --experimental-loader ./https-loader.mjs ./main.mjs` +prints the current version of CoffeeScript per the module at the URL in `main.mjs`. #### Transpiler loader @@ -941,13 +937,9 @@ console.log "Brought to you by Node.js version #{version}" export scream = (str) -> str.toUpperCase() ``` -With this loader, running: - -```console -node --experimental-loader ./coffeescript-loader.mjs main.coffee -``` - -Will cause `main.coffee` to be turned into JavaScript after its source code is +With the preceding loader, running +`node --experimental-loader ./coffeescript-loader.mjs main.coffee` +causes `main.coffee` to be turned into JavaScript after its source code is loaded from disk but before Node.js executes it; and so on for any `.coffee`, `.litcoffee` or `.coffee.md` files referenced via `import` statements of any loaded file. From b50b34b30e7b77c0c9cd6243df2c88c13df1dded Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Fri, 18 Sep 2020 12:55:59 -0400 Subject: [PATCH 105/117] doc: put release script specifics in details MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Listing all the steps can be confusing an make it seem like the releaser is meant to run each of these steps manually. In fact I personally did that my first release. Let's put those steps in a details block to make it more obvious that it is informational and not steps to follow PR-URL: https://github.com/nodejs/node/pull/35260 Reviewed-By: Richard Lau Reviewed-By: Ruy Adorno Reviewed-By: Daijiro Wachi Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso --- doc/guides/releases.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/guides/releases.md b/doc/guides/releases.md index c07fcbf5a82b8b..fbbb43b4e3e7a4 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -604,6 +604,8 @@ $ ./tools/release.sh -i ~/.ssh/node_id_rsa `tools/release.sh` will perform the following actions when run: +
+ **a.** Select a GPG key from your private keys. It will use a command similar to: `gpg --list-secret-keys` to list your keys. If you don't have any keys, it will bail. If you have only one key, it will use that. If you have more than @@ -637,6 +639,7 @@ SHASUMS256.txt.sig. **g.** Upload the `SHASUMS256.txt` files back to the server into the release directory. +
If you didn't wait for ARM builds in the previous step before promoting the release, you should re-run `tools/release.sh` after the ARM builds have From 77555d8500e9dd9c9d2d78f12eaf687fc12cd62e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 25 Sep 2020 07:51:23 -0700 Subject: [PATCH 106/117] doc: put landing specifics in details tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Showing all the steps isn't usually useful and makes it seem like the collaborator is meant to follow the manual steps. I've seen this happen during at least one onboarding. The section is also a bit long to comfortably scroll over quickly to find the next section. Let's put those steps in a details block to make it more obvious that it is there for unusual situations only. Co-authored-by: Shelley Vohr PR-URL: https://github.com/nodejs/node/pull/35296 Reviewed-By: Michaël Zasso Reviewed-By: Richard Lau Reviewed-By: Michael Dawson --- doc/guides/collaborator-guide.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/guides/collaborator-guide.md b/doc/guides/collaborator-guide.md index 6f408783449ae0..b6080292713fdd 100644 --- a/doc/guides/collaborator-guide.md +++ b/doc/guides/collaborator-guide.md @@ -469,6 +469,12 @@ code. If you wish to create the token yourself in advance, see ### Technical HOWTO +Infrequently, it is necessary to manually perform the steps required to land a +pull request rather than rely on `git-node`. + +
+Manual Landing Steps + Clear any `am`/`rebase` that might already be underway: ```text @@ -626,6 +632,8 @@ your pull request shows the purple merged status, add the "Landed in \..\" comment if you added more than one commit. +
+ ### Troubleshooting Sometimes, when running `git push upstream master`, you might get an error From 18f01ddcb5c3621a01d97a4dc5e3ac74fbacdc78 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 27 May 2020 12:05:55 -0400 Subject: [PATCH 107/117] repl: improve static import error message in repl Currently the error is rather ambiguous and does not inform folks that static import is not supported in the repl. This overrides the default error message with one that is more informative. Closes: https://github.com/nodejs/node/issues/33576 PR-URL: https://github.com/nodejs/node/pull/33588 Fixes: https://github.com/nodejs/node/issues/33576 Reviewed-By: James M Snell Reviewed-By: Guy Bedford Reviewed-By: Ruben Bridgewater --- lib/repl.js | 9 +++++++++ test/parallel/test-repl.js | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/repl.js b/lib/repl.js index a37e8e0be7bab2..10ca72f0e79d26 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -58,6 +58,7 @@ const { PromiseRace, RegExp, Set, + StringPrototypeIncludes, Symbol, WeakSet, } = primordials; @@ -549,6 +550,14 @@ function REPLServer(prompt, e.stack = e.stack .replace(/^REPL\d+:\d+\r?\n/, '') .replace(/^\s+at\s.*\n?/gm, ''); + const importErrorStr = 'Cannot use import statement outside a ' + + 'module'; + if (StringPrototypeIncludes(e.message, importErrorStr)) { + e.message = 'Cannot use import statement inside the Node.js ' + + 'repl, alternatively use dynamic import'; + e.stack = e.stack.replace(/SyntaxError:.*\n/, + `SyntaxError: ${e.message}\n`); + } } else if (self.replMode === exports.REPL_MODE_STRICT) { e.stack = e.stack.replace(/(\s+at\s+REPL\d+:)(\d+)/, (_, pre, line) => pre + (line - 1)); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 76dec355381299..ee1650be1c9140 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -805,6 +805,16 @@ const tcpTests = [ { send: `require(${JSON.stringify(moduleFilename)}).number`, expect: '42' + }, + { + send: 'import comeOn from \'fhqwhgads\'', + expect: [ + kSource, + kArrow, + '', + 'Uncaught:', + /^SyntaxError: .* dynamic import/ + ] } ]; From f0b06b64ffa794e94fb67cdb86b3779195db1d6e Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Fri, 7 Aug 2020 12:16:08 +0200 Subject: [PATCH 108/117] 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 fe936370a37557..2ad6cc199cedf7 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', 'doc/api/packages.md', 'test/es-module/test-esm-type-flag.js', diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9a93719a22cad6..8333597513a756 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2644,7 +2644,7 @@ const moduleParents = Object.values(require.cache) [`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 4d2b8dfdec5223..ac0f10f51acaa1 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1278,8 +1278,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 ce1af23c6b3bb9..1363822450ec27 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -36,6 +36,7 @@ * [Internationalization](intl.html) * [Modules: CommonJS modules](modules.html) * [Modules: ECMAScript modules](esm.html) +* [Modules: `module` API](module.html) * [Modules: Packages](packages.html) * [Net](net.html) * [OS](os.html) diff --git a/doc/api/module.md b/doc/api/module.md new file mode 100644 index 00000000000000..9ce16900fbbdcc --- /dev/null +++ b/doc/api/module.md @@ -0,0 +1,194 @@ +# Modules: `module` API + + + +## 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 4d392dfb9b205e..4343efa4a017bf 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -953,189 +953,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 @@ -1144,14 +986,7 @@ 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 [`package.json`]: packages.html#packages_node_js_package_json_field_definitions [`"main"`]: packages.html#packages_main diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index c2ad56655f8602..256b262b280b4c 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -109,7 +109,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 7dc3b74c3449a859b4f36400142b3a9e467de9c8 Mon Sep 17 00:00:00 2001 From: Antoine du HAMEL Date: Sat, 22 Aug 2020 11:33:30 +0200 Subject: [PATCH 109/117] doc: add ESM examples in `module` API doc page PR-URL: https://github.com/nodejs/node/pull/34875 Reviewed-By: Myles Borins Reviewed-By: Guy Bedford --- doc/api/module.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/api/module.md b/doc/api/module.md index 9ce16900fbbdcc..89202038d7c10f 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -7,8 +7,8 @@ * {Object} Provides general utility methods when interacting with instances of -`Module`, the `module` variable often seen in file modules. Accessed -via `require('module')`. +`Module`, the [`module`][] variable often seen in [CommonJS][] modules. Accessed +via `import 'module'` or `require('module')`. ### `module.builtinModules` 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. +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'); @@ -116,6 +124,14 @@ To enable source map parsing, Node.js must be run with the flag [`NODE_V8_COVERAGE=dir`][]. ```js +// module.mjs +// In an ECMAScript module +import { findSourceMap, SourceMap } from 'module'; +``` + +```js +// module.cjs +// In a CommonJS module const { findSourceMap, SourceMap } = require('module'); ``` @@ -192,3 +208,6 @@ consists of the following keys: [`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 +[`module`]: modules.html#modules_the_module_object +[CommonJS]: modules.html +[ES Modules]: esm.html From b4941cfaec42244803d03189e2ed94b2b34655e2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Sep 2020 15:33:16 -0700 Subject: [PATCH 110/117] doc: make minor improvements to module.md * sort references in ASCII order * replace abbreviation * split comma splice into two sentences and add appropriate punctuation * replace future tense with present tense PR-URL: https://github.com/nodejs/node/pull/35083 Reviewed-By: Geoffrey Booth Reviewed-By: Derek Lewis Reviewed-By: Daijiro Wachi --- doc/api/module.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/api/module.md b/doc/api/module.md index 89202038d7c10f..d0d454ba697149 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -150,10 +150,10 @@ added: should be fetched. The `error` instance should be passed as the second parameter to `findSourceMap` -in exceptional flows, e.g., when an overridden +in exceptional flows, such as 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`. +the module cache until they are successfully loaded. In these cases, source maps +are associated with the `error` instance along with the `path`. ### Class: `module.SourceMap` * `module.builtinModules` @@ -965,7 +965,7 @@ This section was moved to ## Source map v3 support This section was moved to -[Modules: `module` core module](modules_module.html#modules_module_source_map_v3_support). +[Modules: `module` core module](module.html#module_source_map_v3_support). * `module.findSourceMap(path[, error])` From 1cd1d0159d91c7c5decf9c0c4aed8653e3fe8d9a Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 7 Oct 2020 00:55:10 -0400 Subject: [PATCH 112/117] doc: move package.import content higher This is currently at the end of the doc, it likely should be found right after the documentation about `package.exports`. Refactored the docs while duplicating content as little as possible. Co-authored-by: Guy Bedford Co-authored-by: Antoine du Hamel Co-authored-by: Rich Trott Signed-off-by: Myles Borins PR-URL: https://github.com/nodejs/node/pull/35535 Reviewed-By: Guy Bedford Reviewed-By: Matteo Collina Reviewed-By: Rich Trott Reviewed-By: Ujjwal Sharma Reviewed-By: Benjamin Gruenbaum --- doc/api/packages.md | 77 ++++++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/doc/api/packages.md b/doc/api/packages.md index df7383d2532abf..dd9ad3748bf15a 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -279,13 +279,53 @@ import submodule from 'es-module-package/private-module.js'; // Throws ERR_PACKAGE_PATH_NOT_EXPORTED ``` -### Subpath export patterns +### Subpath imports > Stability: 1 - Experimental -For packages with a small number of exports, we recommend explicitly listing -each exports subpath entry. But for packages that have large numbers of -subpaths, this might cause `package.json` bloat and maintenance issues. +In addition to the [`"exports"`][] field, it is possible to define internal +package import maps that only apply to import specifiers from within the package +itself. + +Entries in the imports field must always start with `#` to ensure they are +disambiguated from package specifiers. + +For example, the imports field can be used to gain the benefits of conditional +exports for internal modules: + +```json +// package.json +{ + "imports": { + "#dep": { + "node": "dep-node-native", + "default": "./dep-polyfill.js" + } + }, + "dependencies": { + "dep-node-native": "^1.0.0" + } +} +``` + +where `import '#dep'` does not get the resolution of the external package +`dep-node-native` (including its exports in turn), and instead gets the local +file `./dep-polyfill.js` relative to the package in other environments. + +Unlike the `"exports"` field, the `"imports"` field permits mapping to external +packages. + +The resolution rules for the imports field are otherwise +analogous to the exports field. + +### Subpath patterns + +> Stability: 1 - Experimental + +For packages with a small number of exports or imports, we recommend +explicitly listing each exports subpath entry. But for packages that have +large numbers of subpaths, this might cause `package.json` bloat and +maintenance issues. For these use cases, subpath export patterns can be used instead: @@ -294,6 +334,9 @@ For these use cases, subpath export patterns can be used instead: { "exports": { "./features/*": "./src/features/*.js" + }, + "imports": { + "#internal/*": "./src/internal/*.js" } } ``` @@ -308,6 +351,9 @@ import featureX from 'es-module-package/features/x'; import featureY from 'es-module-package/features/y/y'; // Loads ./node_modules/es-module-package/src/features/y/y.js + +import internalZ from '#internal/z'; +// Loads ./node_modules/es-module-package/src/internal/z.js ``` This is a direct static replacement without any special handling for file @@ -947,16 +993,6 @@ added: v12.19.0 * Type: {Object} -In addition to the [`"exports"`][] field it is possible to define internal -package import maps that only apply to import specifiers from within the package -itself. - -Entries in the imports field must always start with `#` to ensure they are -clearly disambiguated from package specifiers. - -For example, the imports field can be used to gain the benefits of conditional -exports for internal modules: - ```json // package.json { @@ -972,15 +1008,11 @@ exports for internal modules: } ``` -where `import '#dep'` would now get the resolution of the external package -`dep-node-native` (including its exports in turn), and instead get the local -file `./dep-polyfill.js` relative to the package in other environments. +Entries in the imports field must be strings starting with `#`. -Unlike the `"exports"` field, import maps permit mapping to external packages, -providing an important use case for conditional loading scenarios. +Import maps permit mapping to external packages. -Apart from the above, the resolution rules for the imports field are otherwise -analogous to the exports field. +This field defines [subpath imports][] for the current package. [Babel]: https://babeljs.io/ [Conditional exports]: #packages_conditional_exports @@ -998,5 +1030,6 @@ analogous to the exports field. [`package.json`]: #packages_node_js_package_json_field_definitions [self-reference]: #packages_self_referencing_a_package_using_its_name [subpath exports]: #packages_subpath_exports -[the full specifier path]: modules_esm.html#modules_esm_mandatory_file_extensions +[subpath imports]: #packages_subpath_imports +[the full specifier path]: esm.md#esm_mandatory_file_extensions [the dual CommonJS/ES module packages section]: #packages_dual_commonjs_es_module_packages From 90244362cca9e615af03132b383a889881f6d529 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 3 Oct 2020 19:45:42 +0200 Subject: [PATCH 113/117] crypto: fix KeyObject garbage collection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These objects don’t hold any resources on the event loop, so they should be weak objects that can be garbage collected when nothing refers to them anymore. PR-URL: https://github.com/nodejs/node/pull/35481 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/node_crypto.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_crypto.h b/src/node_crypto.h index 52b3044bd08da0..573d59ddf41771 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -518,7 +518,9 @@ class NativeKeyObject : public BaseObject { v8::Local wrap, const std::shared_ptr& handle_data) : BaseObject(env, wrap), - handle_data_(handle_data) {} + handle_data_(handle_data) { + MakeWeak(); + } std::shared_ptr handle_data_; }; From b78a1a186fd7a1736fb6d54f2b00a2cf3d0e2df0 Mon Sep 17 00:00:00 2001 From: Beth Griggs Date: Tue, 15 Sep 2020 22:47:10 +0100 Subject: [PATCH 114/117] doc: update releaser in v12.18.4 changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/35217 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso --- doc/changelogs/CHANGELOG_V12.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelogs/CHANGELOG_V12.md b/doc/changelogs/CHANGELOG_V12.md index 4c4acc1c4e0954..68711e3e06b642 100644 --- a/doc/changelogs/CHANGELOG_V12.md +++ b/doc/changelogs/CHANGELOG_V12.md @@ -600,7 +600,7 @@ Vulnerabilities fixed: * [[`d60b13f2e3`](https://github.com/nodejs/node/commit/d60b13f2e3)] - **zlib**: switch to lazy init for zlib streams (Andrey Pechkurov) [#34048](https://github.com/nodejs/node/pull/34048) -## 2020-09-15, Version 12.18.4 'Erbium' (LTS), @targos +## 2020-09-15, Version 12.18.4 'Erbium' (LTS), @BethGriggs prepared by @targos ### Notable Changes From c6eb0b62d9d062aa63383cc44dcf58534304db46 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 4 Nov 2020 20:00:37 +0000 Subject: [PATCH 115/117] benchmark: ignore build artifacts for napi addons Add `.gitignore` to ignore the `build` directory in a similar way to the other addons under `benchmark/napi`. PR-URL: https://github.com/nodejs/node/pull/35970 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- benchmark/napi/type-tag-check/.gitignore | 1 + benchmark/napi/type-tag/.gitignore | 1 + 2 files changed, 2 insertions(+) create mode 100644 benchmark/napi/type-tag-check/.gitignore create mode 100644 benchmark/napi/type-tag/.gitignore diff --git a/benchmark/napi/type-tag-check/.gitignore b/benchmark/napi/type-tag-check/.gitignore new file mode 100644 index 00000000000000..567609b1234a9b --- /dev/null +++ b/benchmark/napi/type-tag-check/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/benchmark/napi/type-tag/.gitignore b/benchmark/napi/type-tag/.gitignore new file mode 100644 index 00000000000000..567609b1234a9b --- /dev/null +++ b/benchmark/napi/type-tag/.gitignore @@ -0,0 +1 @@ +build/ From b48473228c3c96933875bc1567c4ecb8b0b10c16 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 26 Oct 2020 16:36:05 +0100 Subject: [PATCH 116/117] events: assume an EventEmitter if emitter.on is a function Assume that the `emitter` argument of `EventEmitter.once()` is an `EventEmitter` if `emitter.on` is a function. Refs: https://github.com/nodejs/node/commit/4b3654e923e7c3c2 Refs: https://github.com/websockets/ws/issues/1795 PR-URL: https://github.com/nodejs/node/pull/35818 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Matteo Collina --- lib/events.js | 5 ++++- test/parallel/test-events-once.js | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/events.js b/lib/events.js index 51259e6821bf23..300f9f1e6b687f 100644 --- a/lib/events.js +++ b/lib/events.js @@ -623,7 +623,10 @@ function unwrapListeners(arr) { function once(emitter, name) { return new Promise((resolve, reject) => { - if (typeof emitter.addEventListener === 'function') { + if ( + typeof emitter.addEventListener === 'function' && + typeof emitter.on !== 'function' + ) { // EventTarget does not have `error` event semantics like Node // EventEmitters, we do not listen to `error` events here. emitter.addEventListener( diff --git a/test/parallel/test-events-once.js b/test/parallel/test-events-once.js index fea143f5877cc7..d07492ea63fa8e 100644 --- a/test/parallel/test-events-once.js +++ b/test/parallel/test-events-once.js @@ -166,6 +166,27 @@ async function onceWithEventTargetError() { strictEqual(Reflect.has(et.events, 'error'), false); } +async function assumesEventEmitterIfOnIsAFunction() { + const ee = new EventEmitter(); + ee.addEventListener = () => {}; + + const expected = new Error('kaboom'); + let err; + process.nextTick(() => { + ee.emit('error', expected); + }); + + try { + await once(ee, 'myevent'); + } catch (_e) { + err = _e; + } + + strictEqual(err, expected); + strictEqual(ee.listenerCount('error'), 0); + strictEqual(ee.listenerCount('myevent'), 0); +} + Promise.all([ onceAnEvent(), onceAnEventWithTwoArgs(), @@ -175,4 +196,5 @@ Promise.all([ onceWithEventTarget(), onceWithEventTargetTwoArgs(), onceWithEventTargetError(), + assumesEventEmitterIfOnIsAFunction(), ]).then(common.mustCall()); From d84392fe9320e3d87abc04e64643ff26a65daeac Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Mon, 16 Nov 2020 12:04:38 -0500 Subject: [PATCH 117/117] 2020-11-24, Version 12.20.0 'Erbium' (LTS) Notable changes: crypto: * update certdata to NSS 3.56 (Shelley Vohr) https://github.com/nodejs/node/pull/35546 deps: * update llhttp to 2.1.3 (Fedor Indutny) https://github.com/nodejs/node/pull/35435 * (SEMVER-MINOR) upgrade to libuv 1.40.0 (Colin Ihrig) https://github.com/nodejs/node/pull/35333 doc: * add aduh95 to collaborators (Antoine du Hamel) https://github.com/nodejs/node/pull/35542 fs: * (SEMVER-MINOR) add .ref() and .unref() methods to watcher classes (rickyes) https://github.com/nodejs/node/pull/33134 http: * (SEMVER-MINOR) added scheduling option to http agent (delvedor) https://github.com/nodejs/node/pull/33278 module: * (SEMVER-MINOR) exports pattern support (Guy Bedford) https://github.com/nodejs/node/pull/34718 * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) https://github.com/nodejs/node/pull/35249 n-api: * (SEMVER-MINOR) add more property defaults (Gerhard Stoebich) https://github.com/nodejs/node/pull/35214 src: * (SEMVER-MINOR) move node_contextify to modern THROW_ERR_* (James M Snell) https://github.com/nodejs/node/pull/35470 * (SEMVER-MINOR) move node_process to modern THROW_ERR* (James M Snell) https://github.com/nodejs/node/pull/35472 * (SEMVER-MINOR) expose v8::Isolate setup callbacks (Shelley Vohr) https://github.com/nodejs/node/pull/35512 PR-URL: https://github.com/nodejs/node/pull/35950 --- CHANGELOG.md | 3 +- doc/api/esm.md | 6 +- doc/api/fs.md | 10 +- doc/api/http.md | 2 +- doc/api/n-api.md | 6 +- doc/api/packages.md | 4 +- doc/changelogs/CHANGELOG_V12.md | 158 ++++++++++++++++++++++++++++++++ src/node_version.h | 6 +- 8 files changed, 177 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95c551796947e2..599bf8f0c4440c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ release. -12.19.1
+12.20.0
+12.19.1
12.19.0
12.18.4
12.18.3
diff --git a/doc/api/esm.md b/doc/api/esm.md index ac0f10f51acaa1..f776f458141df5 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -6,10 +6,10 @@ added: v8.5.0 changes: - version: - - REPLACEME + - v12.20.0 pr-url: https://github.com/nodejs/node/pull/35249 description: Support for detection of CommonJS named exports. - - version: REPLACEME + - version: v12.20.0 pr-url: https://github.com/nodejs/node/pull/31974 description: Remove experimental modules warning. - version: @@ -135,7 +135,7 @@ future use. The root of the current volume may be referenced via `file:///`. #### `node:` Imports `node:` URLs are supported as a means to load Node.js builtin modules. This diff --git a/doc/api/fs.md b/doc/api/fs.md index c3d0b38ff18571..778c6f3ff59630 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -600,7 +600,7 @@ Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the ### `watcher.ref()` * Returns: {fs.FSWatcher} @@ -615,7 +615,7 @@ called previously. ### `watcher.unref()` * Returns: {fs.FSWatcher} @@ -628,7 +628,7 @@ no effect. ## Class: `fs.StatWatcher` * Extends {EventEmitter} @@ -638,7 +638,7 @@ object. ### `watcher.ref()` * Returns: {fs.StatWatcher} @@ -653,7 +653,7 @@ called previously. ### `watcher.unref()` * Returns: {fs.StatWatcher} diff --git a/doc/api/http.md b/doc/api/http.md index d44a349b0e6c6b..ff33288e729208 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -116,7 +116,7 @@ changes: - version: v12.19.0 pr-url: https://github.com/nodejs/node/pull/33617 description: Add `maxTotalSockets` option to agent constructor. - - version: REPLACEME + - version: v12.20.0 pr-url: https://github.com/nodejs/node/pull/33278 description: Add `scheduling` option to specify the free socket scheduling strategy. diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 5cfebd60dc1591..1f3c90de3d461a 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3645,7 +3645,7 @@ if (status != napi_ok) return status; #### napi_property_attributes @@ -4094,7 +4094,7 @@ specification). #### napi_object_freeze > Stability: 1 - Experimental @@ -4119,7 +4119,7 @@ ECMA-262 specification. #### napi_object_seal > Stability: 1 - Experimental diff --git a/doc/api/packages.md b/doc/api/packages.md index dd9ad3748bf15a..216f6f5ba8d830 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -3,7 +3,7 @@ diff --git a/doc/changelogs/CHANGELOG_V12.md b/doc/changelogs/CHANGELOG_V12.md index 68711e3e06b642..08e1203be3d5ce 100644 --- a/doc/changelogs/CHANGELOG_V12.md +++ b/doc/changelogs/CHANGELOG_V12.md @@ -11,6 +11,7 @@ +12.20.0
12.19.1
12.19.0
12.18.4
@@ -65,6 +66,163 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2020-11-24, Version 12.20.0 'Erbium' (LTS), @mylesborins + +### Notable Changes + +* **crypto**: + * update certdata to NSS 3.56 (Shelley Vohr) + https://github.com/nodejs/node/pull/35546 +* **deps**: + * update llhttp to 2.1.3 (Fedor Indutny) + https://github.com/nodejs/node/pull/35435 + * (SEMVER-MINOR) upgrade to libuv 1.40.0 (Colin Ihrig) + https://github.com/nodejs/node/pull/35333 +* **doc**: + * add aduh95 to collaborators (Antoine du Hamel) + https://github.com/nodejs/node/pull/35542 +* **fs**: + * (SEMVER-MINOR) add .ref() and .unref() methods to watcher classes (rickyes) + https://github.com/nodejs/node/pull/33134 +* **http**: + * (SEMVER-MINOR) added scheduling option to http agent (delvedor) + https://github.com/nodejs/node/pull/33278 +* **module**: + * (SEMVER-MINOR) exports pattern support (Guy Bedford) + https://github.com/nodejs/node/pull/34718 + * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) + https://github.com/nodejs/node/pull/35249 +* **n-api**: + * (SEMVER-MINOR) add more property defaults (Gerhard Stoebich) + https://github.com/nodejs/node/pull/35214 +* **src**: + * (SEMVER-MINOR) move node_contextify to modern THROW_ERR_* (James M Snell) + https://github.com/nodejs/node/pull/35470 + * (SEMVER-MINOR) move node_process to modern THROW_ERR* (James M Snell) + https://github.com/nodejs/node/pull/35472 + * (SEMVER-MINOR) expose v8::Isolate setup callbacks (Shelley Vohr) + https://github.com/nodejs/node/pull/35512 + +### Commits + +* [[`c6eb0b62d9`](https://github.com/nodejs/node/commit/c6eb0b62d9)] - **benchmark**: ignore build artifacts for napi addons (Richard Lau) [#35970](https://github.com/nodejs/node/pull/35970) +* [[`f3a045720c`](https://github.com/nodejs/node/commit/f3a045720c)] - **build**: fuzzer that targets node::LoadEnvironment() (davkor) [#34844](https://github.com/nodejs/node/pull/34844) +* [[`48bc3fcd4c`](https://github.com/nodejs/node/commit/48bc3fcd4c)] - **build**: improved release lint error message (Shelley Vohr) [#35523](https://github.com/nodejs/node/pull/35523) +* [[`2e766a6adf`](https://github.com/nodejs/node/commit/2e766a6adf)] - **console**: add Symbol.toStringTag property (Leko) [#35399](https://github.com/nodejs/node/pull/35399) +* [[`90244362cc`](https://github.com/nodejs/node/commit/90244362cc)] - **crypto**: fix KeyObject garbage collection (Anna Henningsen) [#35481](https://github.com/nodejs/node/pull/35481) +* [[`42f64eba89`](https://github.com/nodejs/node/commit/42f64eba89)] - **crypto**: update certdata to NSS 3.56 (Shelley Vohr) [#35546](https://github.com/nodejs/node/pull/35546) +* [[`a6f58c0888`](https://github.com/nodejs/node/commit/a6f58c0888)] - **crypto**: set env values in KeyObject Deserialize method (ThakurKarthik) [#35416](https://github.com/nodejs/node/pull/35416) +* [[`6539cf2725`](https://github.com/nodejs/node/commit/6539cf2725)] - **deps**: upgrade to cjs-module-lexer@1.0.0 (Guy Bedford) [#35928](https://github.com/nodejs/node/pull/35928) +* [[`bdcc77bdf4`](https://github.com/nodejs/node/commit/bdcc77bdf4)] - **deps**: update to cjs-module-lexer@0.5.2 (Guy Bedford) [#35901](https://github.com/nodejs/node/pull/35901) +* [[`5b8d3c74e8`](https://github.com/nodejs/node/commit/5b8d3c74e8)] - **deps**: upgrade to cjs-module-lexer@0.5.0 (Guy Bedford) [#35871](https://github.com/nodejs/node/pull/35871) +* [[`d7f0e3e5f0`](https://github.com/nodejs/node/commit/d7f0e3e5f0)] - **deps**: update to cjs-module-lexer@0.4.3 (Guy Bedford) [#35745](https://github.com/nodejs/node/pull/35745) +* [[`0a1474d9df`](https://github.com/nodejs/node/commit/0a1474d9df)] - **deps**: update llhttp to 2.1.3 (Fedor Indutny) [#35435](https://github.com/nodejs/node/pull/35435) +* [[`cf07a8695a`](https://github.com/nodejs/node/commit/cf07a8695a)] - **deps**: upgrade to libuv 1.40.0 (Colin Ihrig) [#35333](https://github.com/nodejs/node/pull/35333) +* [[`cc11464b4e`](https://github.com/nodejs/node/commit/cc11464b4e)] - **deps**: upgrade to c-ares v1.16.1 (Shelley Vohr) [#35324](https://github.com/nodejs/node/pull/35324) +* [[`5405e62eaf`](https://github.com/nodejs/node/commit/5405e62eaf)] - **deps**: update to uvwasi 0.0.11 (Colin Ihrig) [#35104](https://github.com/nodejs/node/pull/35104) +* [[`44c739cc49`](https://github.com/nodejs/node/commit/44c739cc49)] - **deps**: V8: cherry-pick 6be2f6e26e8d (Benjamin Coe) [#35055](https://github.com/nodejs/node/pull/35055) +* [[`b78a1a186f`](https://github.com/nodejs/node/commit/b78a1a186f)] - **doc**: update releaser in v12.18.4 changelog (Beth Griggs) [#35217](https://github.com/nodejs/node/pull/35217) +* [[`1cd1d0159d`](https://github.com/nodejs/node/commit/1cd1d0159d)] - **doc**: move package.import content higher (Myles Borins) [#35535](https://github.com/nodejs/node/pull/35535) +* [[`79f3c323f6`](https://github.com/nodejs/node/commit/79f3c323f6)] - **doc**: fix broken links in modules.md (Rich Trott) [#35182](https://github.com/nodejs/node/pull/35182) +* [[`b4941cfaec`](https://github.com/nodejs/node/commit/b4941cfaec)] - **doc**: make minor improvements to module.md (Rich Trott) [#35083](https://github.com/nodejs/node/pull/35083) +* [[`7dc3b74c34`](https://github.com/nodejs/node/commit/7dc3b74c34)] - **doc**: add ESM examples in `module` API doc page (Antoine du HAMEL) [#34875](https://github.com/nodejs/node/pull/34875) +* [[`f0b06b64ff`](https://github.com/nodejs/node/commit/f0b06b64ff)] - **doc**: move module core module doc to separate page (Antoine du HAMEL) [#34747](https://github.com/nodejs/node/pull/34747) +* [[`77555d8500`](https://github.com/nodejs/node/commit/77555d8500)] - **doc**: put landing specifics in details tag (Rich Trott) [#35296](https://github.com/nodejs/node/pull/35296) +* [[`b50b34b30e`](https://github.com/nodejs/node/commit/b50b34b30e)] - **doc**: put release script specifics in details (Myles Borins) [#35260](https://github.com/nodejs/node/pull/35260) +* [[`1a8f3a844e`](https://github.com/nodejs/node/commit/1a8f3a844e)] - **doc**: copyedit esm.md (Rich Trott) [#35414](https://github.com/nodejs/node/pull/35414) +* [[`d99120040c`](https://github.com/nodejs/node/commit/d99120040c)] - **doc**: error code fix in resolver spec (Guy Bedford) [#34998](https://github.com/nodejs/node/pull/34998) +* [[`df52814113`](https://github.com/nodejs/node/commit/df52814113)] - **doc**: document Buffer.concat may use internal pool (Andrey Pechkurov) [#35541](https://github.com/nodejs/node/pull/35541) +* [[`42a587f9ba`](https://github.com/nodejs/node/commit/42a587f9ba)] - **doc**: use test username instead of real (Pooja D.P) [#35611](https://github.com/nodejs/node/pull/35611) +* [[`bfff4fc3c9`](https://github.com/nodejs/node/commit/bfff4fc3c9)] - **doc**: revise description of process.ppid (Pooja D.P) [#35589](https://github.com/nodejs/node/pull/35589) +* [[`a9ac75480f`](https://github.com/nodejs/node/commit/a9ac75480f)] - **doc**: add symlink information for process.execpath (Pooja D.P) [#35590](https://github.com/nodejs/node/pull/35590) +* [[`5fea51b66c`](https://github.com/nodejs/node/commit/5fea51b66c)] - **doc**: add PoojaDurgad as a triager (Pooja D.P) [#35153](https://github.com/nodejs/node/pull/35153) +* [[`a0b541c3e0`](https://github.com/nodejs/node/commit/a0b541c3e0)] - **doc**: use kbd element in process doc (Rich Trott) [#35584](https://github.com/nodejs/node/pull/35584) +* [[`992355cdf9`](https://github.com/nodejs/node/commit/992355cdf9)] - **doc**: simplify wording in tracing APIs doc (Pooja D.P) [#35556](https://github.com/nodejs/node/pull/35556) +* [[`05db4b8343`](https://github.com/nodejs/node/commit/05db4b8343)] - **doc**: improve SIGINT error text (Rich Trott) [#35558](https://github.com/nodejs/node/pull/35558) +* [[`42c479572c`](https://github.com/nodejs/node/commit/42c479572c)] - **doc**: use sentence case for class property (Rich Trott) [#35540](https://github.com/nodejs/node/pull/35540) +* [[`fb9bb05ee2`](https://github.com/nodejs/node/commit/fb9bb05ee2)] - **doc**: fix util.inspect change history (Antoine du Hamel) [#35528](https://github.com/nodejs/node/pull/35528) +* [[`6952c45202`](https://github.com/nodejs/node/commit/6952c45202)] - **doc**: add aduh95 to collaborators (Antoine du Hamel) [#35542](https://github.com/nodejs/node/pull/35542) +* [[`b5f752528b`](https://github.com/nodejs/node/commit/b5f752528b)] - **doc**: update AUTHORS list (Anna Henningsen) [#35280](https://github.com/nodejs/node/pull/35280) +* [[`370f8e3afd`](https://github.com/nodejs/node/commit/370f8e3afd)] - **doc**: update sxa's email address to Red Hat from IBM (Stewart X Addison) [#35442](https://github.com/nodejs/node/pull/35442) +* [[`edf3fbbd14`](https://github.com/nodejs/node/commit/edf3fbbd14)] - **doc**: update contact information for @BethGriggs (Beth Griggs) [#35451](https://github.com/nodejs/node/pull/35451) +* [[`8be289e58c`](https://github.com/nodejs/node/commit/8be289e58c)] - **doc**: update contact information for richardlau (Richard Lau) [#35450](https://github.com/nodejs/node/pull/35450) +* [[`42c0dfcc23`](https://github.com/nodejs/node/commit/42c0dfcc23)] - **doc**: importable node protocol URLs (Bradley Meck) [#35434](https://github.com/nodejs/node/pull/35434) +* [[`c192af66e7`](https://github.com/nodejs/node/commit/c192af66e7)] - **doc**: unhide resolver spec (Guy Bedford) [#35358](https://github.com/nodejs/node/pull/35358) +* [[`b0e43c718c`](https://github.com/nodejs/node/commit/b0e43c718c)] - **doc**: add gpg key export directions to releases doc (Danielle Adams) [#35298](https://github.com/nodejs/node/pull/35298) +* [[`884755f1e5`](https://github.com/nodejs/node/commit/884755f1e5)] - **doc**: simplify circular dependencies text in modules.md (Rich Trott) [#35126](https://github.com/nodejs/node/pull/35126) +* [[`85c47d753c`](https://github.com/nodejs/node/commit/85c47d753c)] - **doc**: avoid double-while sentence in perf\_hooks.md (Rich Trott) [#35078](https://github.com/nodejs/node/pull/35078) +* [[`68c5ee45a2`](https://github.com/nodejs/node/commit/68c5ee45a2)] - **doc**: update fs promise-based examples (Richard Lau) [#35760](https://github.com/nodejs/node/pull/35760) +* [[`66f8730441`](https://github.com/nodejs/node/commit/66f8730441)] - **doc**: add history entry for exports patterns (Antoine du Hamel) [#35410](https://github.com/nodejs/node/pull/35410) +* [[`a7e66b635d`](https://github.com/nodejs/node/commit/a7e66b635d)] - **doc**: fix conditional exports flag removal version (Antoine du Hamel) [#35428](https://github.com/nodejs/node/pull/35428) +* [[`9197a6651d`](https://github.com/nodejs/node/commit/9197a6651d)] - **doc**: copyedit packages.md (Rich Trott) [#35427](https://github.com/nodejs/node/pull/35427) +* [[`f507ca9e21`](https://github.com/nodejs/node/commit/f507ca9e21)] - **doc**: packages docs feedback (Guy Bedford) [#35370](https://github.com/nodejs/node/pull/35370) +* [[`5330930128`](https://github.com/nodejs/node/commit/5330930128)] - **doc**: refine require/import conditions constraints (Guy Bedford) [#35311](https://github.com/nodejs/node/pull/35311) +* [[`5f0b1571a7`](https://github.com/nodejs/node/commit/5f0b1571a7)] - **doc**: edit subpath export patterns introduction (Rich Trott) [#35254](https://github.com/nodejs/node/pull/35254) +* [[`d6a13a947e`](https://github.com/nodejs/node/commit/d6a13a947e)] - **doc**: document support for package.json fields (Antoine du HAMEL) [#34970](https://github.com/nodejs/node/pull/34970) +* [[`7c1700e143`](https://github.com/nodejs/node/commit/7c1700e143)] - **doc**: move package config docs to separate page (Antoine du HAMEL) [#34748](https://github.com/nodejs/node/pull/34748) +* [[`7510667d87`](https://github.com/nodejs/node/commit/7510667d87)] - **doc**: rename module pages (Antoine du HAMEL) [#34663](https://github.com/nodejs/node/pull/34663) +* [[`b644ab6ae6`](https://github.com/nodejs/node/commit/b644ab6ae6)] - **doc**: fix line length in worker\_threads.md (Jucke) [#34419](https://github.com/nodejs/node/pull/34419) +* [[`fb9b66bdd7`](https://github.com/nodejs/node/commit/fb9b66bdd7)] - **doc**: fix typos in n-api, tls and worker\_threads (Jucke) [#34419](https://github.com/nodejs/node/pull/34419) +* [[`1f34230373`](https://github.com/nodejs/node/commit/1f34230373)] - **doc,esm**: document experimental warning removal (Antoine du Hamel) [#35750](https://github.com/nodejs/node/pull/35750) +* [[`985b96a7d5`](https://github.com/nodejs/node/commit/985b96a7d5)] - **doc,esm**: add history support info (Antoine du Hamel) [#35395](https://github.com/nodejs/node/pull/35395) +* [[`548137f4ec`](https://github.com/nodejs/node/commit/548137f4ec)] - **errors**: simplify ERR\_REQUIRE\_ESM message generation (Rich Trott) [#35123](https://github.com/nodejs/node/pull/35123) +* [[`f22672de18`](https://github.com/nodejs/node/commit/f22672de18)] - **errors**: improve ERR\_INVALID\_OPT\_VALUE error (Denys Otrishko) [#34671](https://github.com/nodejs/node/pull/34671) +* [[`7a98961a26`](https://github.com/nodejs/node/commit/7a98961a26)] - **esm**: fix hook mistypes and links to types (Derek Lewis) [#34240](https://github.com/nodejs/node/pull/34240) +* [[`0f757bc2df`](https://github.com/nodejs/node/commit/0f757bc2df)] - **esm**: use "node:" namespace for builtins (Guy Bedford) [#35387](https://github.com/nodejs/node/pull/35387) +* [[`b48473228c`](https://github.com/nodejs/node/commit/b48473228c)] - **events**: assume an EventEmitter if emitter.on is a function (Luigi Pinca) [#35818](https://github.com/nodejs/node/pull/35818) +* [[`19d711391e`](https://github.com/nodejs/node/commit/19d711391e)] - **fs**: simplify realpathSync (himself65) [#35413](https://github.com/nodejs/node/pull/35413) +* [[`decfc2ae5c`](https://github.com/nodejs/node/commit/decfc2ae5c)] - **fs**: add .ref() and .unref() methods to watcher classes (rickyes) [#33134](https://github.com/nodejs/node/pull/33134) +* [[`cce464513e`](https://github.com/nodejs/node/commit/cce464513e)] - **http**: added scheduling option to http agent (delvedor) [#33278](https://github.com/nodejs/node/pull/33278) +* [[`d477e2e147`](https://github.com/nodejs/node/commit/d477e2e147)] - **http**: only set keep-alive when not exists (atian25@qq.com) [#35138](https://github.com/nodejs/node/pull/35138) +* [[`f10d721737`](https://github.com/nodejs/node/commit/f10d721737)] - **http**: reset headers timeout on headers complete (Robert Nagy) [#34578](https://github.com/nodejs/node/pull/34578) +* [[`c8a778985b`](https://github.com/nodejs/node/commit/c8a778985b)] - **http2**: avoid unnecessary buffer resize (Denys Otrishko) [#34480](https://github.com/nodejs/node/pull/34480) +* [[`b732c92e3d`](https://github.com/nodejs/node/commit/b732c92e3d)] - **http2**: use and support non-empty DATA frame with END\_STREAM flag (Carlos Lopez) [#33875](https://github.com/nodejs/node/pull/33875) +* [[`bfce0eb13a`](https://github.com/nodejs/node/commit/bfce0eb13a)] - ***Revert*** "**http2**: streamline OnStreamRead streamline memory accounting" (Rich Trott) [#34315](https://github.com/nodejs/node/pull/34315) +* [[`e85ca7af43`](https://github.com/nodejs/node/commit/e85ca7af43)] - **http2**: wait for session socket writable end on close/destroy (Denys Otrishko) [#30854](https://github.com/nodejs/node/pull/30854) +* [[`2471197099`](https://github.com/nodejs/node/commit/2471197099)] - **http2**: wait for session to finish writing before destroy (Denys Otrishko) [#30854](https://github.com/nodejs/node/pull/30854) +* [[`82af8acc8e`](https://github.com/nodejs/node/commit/82af8acc8e)] - **http2,doc**: minor fixes (Alba Mendez) [#28044](https://github.com/nodejs/node/pull/28044) +* [[`a3e8829d4a`](https://github.com/nodejs/node/commit/a3e8829d4a)] - **inspector**: do not hardcode Debugger.CallFrameId in tests (Dmitry Gozman) [#35570](https://github.com/nodejs/node/pull/35570) +* [[`6efa140f8f`](https://github.com/nodejs/node/commit/6efa140f8f)] - **lib**: change http client path assignment (Yohanan Baruchel) [#35508](https://github.com/nodejs/node/pull/35508) +* [[`ad7281b081`](https://github.com/nodejs/node/commit/ad7281b081)] - **lib**: use remaining typed arrays from primordials (Michaël Zasso) [#35499](https://github.com/nodejs/node/pull/35499) +* [[`a9a606f06b`](https://github.com/nodejs/node/commit/a9a606f06b)] - **lib**: use full URL to GitHub issues in comments (Rich Trott) [#34686](https://github.com/nodejs/node/pull/34686) +* [[`ea239392c2`](https://github.com/nodejs/node/commit/ea239392c2)] - **module**: cjs-module-lexer@0.4.1 big endian fix (Guy Bedford) [#35634](https://github.com/nodejs/node/pull/35634) +* [[`354f358c1b`](https://github.com/nodejs/node/commit/354f358c1b)] - **module**: use Wasm CJS lexer when available (Guy Bedford) [#35583](https://github.com/nodejs/node/pull/35583) +* [[`76f76017bf`](https://github.com/nodejs/node/commit/76f76017bf)] - **module**: fix builtin reexport tracing (Guy Bedford) [#35500](https://github.com/nodejs/node/pull/35500) +* [[`992af4e112`](https://github.com/nodejs/node/commit/992af4e112)] - **module**: fix specifier resolution option value (himself65) [#35098](https://github.com/nodejs/node/pull/35098) +* [[`1ff956f49e`](https://github.com/nodejs/node/commit/1ff956f49e)] - **module**: remove experimental modules warning (Guy Bedford) [#31974](https://github.com/nodejs/node/pull/31974) +* [[`41af927efb`](https://github.com/nodejs/node/commit/41af927efb)] - **module**: exports pattern support (Guy Bedford) [#34718](https://github.com/nodejs/node/pull/34718) +* [[`a18d0df33a`](https://github.com/nodejs/node/commit/a18d0df33a)] - **module**: update to cjs-module-lexer@0.4.0 (Guy Bedford) [#35501](https://github.com/nodejs/node/pull/35501) +* [[`6ca8fb552d`](https://github.com/nodejs/node/commit/6ca8fb552d)] - **module**: refine module type mismatch error cases (Guy Bedford) [#35426](https://github.com/nodejs/node/pull/35426) +* [[`9eb1fa1924`](https://github.com/nodejs/node/commit/9eb1fa1924)] - **module**: named exports for CJS via static analysis (Guy Bedford) [#35249](https://github.com/nodejs/node/pull/35249) +* [[`a93ca2d494`](https://github.com/nodejs/node/commit/a93ca2d494)] - **n-api**: revert change to finalization (Michael Dawson) [#35777](https://github.com/nodejs/node/pull/35777) +* [[`5faaa603d8`](https://github.com/nodejs/node/commit/5faaa603d8)] - **n-api**: support for object freeze/seal (Shelley Vohr) [#35359](https://github.com/nodejs/node/pull/35359) +* [[`d938e8508b`](https://github.com/nodejs/node/commit/d938e8508b)] - **n-api**: add more property defaults (Gerhard Stoebich) [#35214](https://github.com/nodejs/node/pull/35214) +* [[`18f01ddcb5`](https://github.com/nodejs/node/commit/18f01ddcb5)] - **repl**: improve static import error message in repl (Myles Borins) [#33588](https://github.com/nodejs/node/pull/33588) +* [[`70768ce109`](https://github.com/nodejs/node/commit/70768ce109)] - **repl**: give repl entries unique names (Bradley Meck) [#34372](https://github.com/nodejs/node/pull/34372) +* [[`e9bee3950c`](https://github.com/nodejs/node/commit/e9bee3950c)] - **src**: move node\_contextify to modern THROW\_ERR\_\* (James M Snell) [#35470](https://github.com/nodejs/node/pull/35470) +* [[`b741f2ff84`](https://github.com/nodejs/node/commit/b741f2ff84)] - **src**: move node\_process to modern THROW\_ERR\* (James M Snell) [#35472](https://github.com/nodejs/node/pull/35472) +* [[`2d5393bb28`](https://github.com/nodejs/node/commit/2d5393bb28)] - **src**: fix freeing unintialized pointer bug in ParseSoaReply (Aastha Gupta) [#35502](https://github.com/nodejs/node/pull/35502) +* [[`dec004f742`](https://github.com/nodejs/node/commit/dec004f742)] - **src**: expose v8::Isolate setup callbacks (Shelley Vohr) [#35512](https://github.com/nodejs/node/pull/35512) +* [[`7f8834f76c`](https://github.com/nodejs/node/commit/7f8834f76c)] - **src**: more idiomatic error pattern in node\_wasi (James M Snell) [#35493](https://github.com/nodejs/node/pull/35493) +* [[`ade27b732b`](https://github.com/nodejs/node/commit/ade27b732b)] - **src**: use env-\>ThrowUVException in pipe\_wrap (James M Snell) [#35493](https://github.com/nodejs/node/pull/35493) +* [[`e70b05208f`](https://github.com/nodejs/node/commit/e70b05208f)] - **src**: remove invalid ToLocalChecked in EmitBeforeExit (Anna Henningsen) [#35484](https://github.com/nodejs/node/pull/35484) +* [[`cd80195524`](https://github.com/nodejs/node/commit/cd80195524)] - **src**: make MakeCallback() check can\_call\_into\_js before getting method (Anna Henningsen) [#35424](https://github.com/nodejs/node/pull/35424) +* [[`8a1091648c`](https://github.com/nodejs/node/commit/8a1091648c)] - **stream**: destroy wrapped streams on error (Robert Nagy) [#34102](https://github.com/nodejs/node/pull/34102) +* [[`fdc67ebf5f`](https://github.com/nodejs/node/commit/fdc67ebf5f)] - **test**: replace annonymous functions with arrow (Pooja D.P) [#34921](https://github.com/nodejs/node/pull/34921) +* [[`c3e1bf78c4`](https://github.com/nodejs/node/commit/c3e1bf78c4)] - **test**: add wasi readdir() test (Colin Ihrig) [#35202](https://github.com/nodejs/node/pull/35202) +* [[`607f3c5d84`](https://github.com/nodejs/node/commit/607f3c5d84)] - **test**: fix comment about DNS lookup test (Tobias Nießen) [#35080](https://github.com/nodejs/node/pull/35080) +* [[`02787ce5d1`](https://github.com/nodejs/node/commit/02787ce5d1)] - **test**: add ALPNProtocols option to clientOptions (Luigi Pinca) [#35482](https://github.com/nodejs/node/pull/35482) +* [[`12d76b8e8e`](https://github.com/nodejs/node/commit/12d76b8e8e)] - **tls**: reset secureConnecting on client socket (David Halls) [#33209](https://github.com/nodejs/node/pull/33209) +* [[`adf4f90bce`](https://github.com/nodejs/node/commit/adf4f90bce)] - **tools**: refloat 7 Node.js patches to cpplint.py (Rich Trott) [#35569](https://github.com/nodejs/node/pull/35569) +* [[`1173efca27`](https://github.com/nodejs/node/commit/1173efca27)] - **tools**: bump cpplint.py to 1.4.6 (Rich Trott) [#35569](https://github.com/nodejs/node/pull/35569) +* [[`09552670fe`](https://github.com/nodejs/node/commit/09552670fe)] - **tools**: add missing uv\_setup\_argv() calls (Anna Henningsen) [#35491](https://github.com/nodejs/node/pull/35491) +* [[`ae149232a1`](https://github.com/nodejs/node/commit/ae149232a1)] - **tools**: exclude gyp from markdown link checker (Michaël Zasso) [#35423](https://github.com/nodejs/node/pull/35423) +* [[`a9ce9b2614`](https://github.com/nodejs/node/commit/a9ce9b2614)] - **tools**: update ESLint to 7.10.0 (Colin Ihrig) [#35366](https://github.com/nodejs/node/pull/35366) +* [[`bc7da0c22c`](https://github.com/nodejs/node/commit/bc7da0c22c)] - **tools**: ignore build folder when checking links (Ash Cripps) [#35315](https://github.com/nodejs/node/pull/35315) +* [[`f29717437f`](https://github.com/nodejs/node/commit/f29717437f)] - **tools,doc**: enforce alphabetical order for md refs (Antoine du Hamel) [#35244](https://github.com/nodejs/node/pull/35244) +* [[`11b10d7d1f`](https://github.com/nodejs/node/commit/11b10d7d1f)] - **tools,doc**: upgrade dependencies (Antoine du Hamel) [#35244](https://github.com/nodejs/node/pull/35244) + ## 2020-11-16, Version 12.19.1 'Erbium' (LTS), @BethGriggs diff --git a/src/node_version.h b/src/node_version.h index c575d81b96adf3..31f1858940bafb 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 12 -#define NODE_MINOR_VERSION 19 -#define NODE_PATCH_VERSION 2 +#define NODE_MINOR_VERSION 20 +#define NODE_PATCH_VERSION 0 #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Erbium" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)