Skip to content

Instantly share code, notes, and snippets.

@demurgos
Last active August 26, 2018 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demurgos/917ee38013ce0d7ee17734e7c5b04628 to your computer and use it in GitHub Desktop.
Save demurgos/917ee38013ce0d7ee17734e7c5b04628 to your computer and use it in GitHub Desktop.
[
"/data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"_stream_duplex.js",
"_stream_passthrough.js",
"_stream_readable.js",
"_stream_transform.js",
"_stream_writable.js",
"assert.js",
"buffer.js",
"cjs-facade:file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"console.js",
"events.js",
"file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/hello-world.mjs",
"file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"fs.js",
"internal/assert.js",
"internal/async_hooks.js",
"internal/bootstrap/loaders.js",
"internal/bootstrap/node.js",
"internal/buffer.js",
"internal/constants.js",
"internal/encoding.js",
"internal/errors.js",
"internal/fixed_queue.js",
"internal/fs/read_file_context.js",
"internal/fs/streams.js",
"internal/fs/utils.js",
"internal/inspector_async_hook.js",
"internal/linkedlist.js",
"internal/modules/cjs/helpers.js",
"internal/modules/cjs/loader.js",
"internal/modules/esm/create_dynamic_module.js",
"internal/modules/esm/default_resolve.js",
"internal/modules/esm/loader.js",
"internal/modules/esm/module_job.js",
"internal/modules/esm/module_map.js",
"internal/modules/esm/translators.js",
"internal/net.js",
"internal/process/esm_loader.js",
"internal/process/main_thread_only.js",
"internal/process/next_tick.js",
"internal/process/per_thread.js",
"internal/process/promises.js",
"internal/process/stdio.js",
"internal/process/warning.js",
"internal/querystring.js",
"internal/safe_globals.js",
"internal/stream_base_commons.js",
"internal/streams/buffer_list.js",
"internal/streams/destroy.js",
"internal/streams/end-of-stream.js",
"internal/streams/legacy.js",
"internal/streams/pipeline.js",
"internal/streams/state.js",
"internal/timers.js",
"internal/url.js",
"internal/util.js",
"internal/util/types.js",
"internal/validators.js",
"internal/vm/source_text_module.js",
"net.js",
"path.js",
"stream.js",
"timers.js",
"url.js",
"util.js",
"vm.js"
]
This file has been truncated, but you can view the full file.
[
{
"url": "/data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"source": "(function (exports, require, module, __filename, __dirname) { import('./hello-world')\n .then(helloWorld => helloWorld.helloWorld())\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 137,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 135,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "then.helloWorld",
"ranges": [
{
"startOffset": 94,
"endOffset": 131,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "_stream_duplex.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\nmodule.exports = Duplex;\n\nconst util = require('util');\nconst Readable = require('_stream_readable');\nconst Writable = require('_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n const keys = Object.keys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n const method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false)\n this.readable = false;\n\n if (options.writable === false)\n this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n return this._writableState.highWaterMark;\n }\n});\n\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n if (this._readableState === undefined ||\n this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined ||\n this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4296,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4294,
"count": 1
},
{
"startOffset": 1731,
"endOffset": 1860,
"count": 11
},
{
"startOffset": 1802,
"endOffset": 1856,
"count": 7
}
],
"isBlockCoverage": true
},
{
"functionName": "Duplex",
"ranges": [
{
"startOffset": 1864,
"endOffset": 2319,
"count": 2
},
{
"startOffset": 1928,
"endOffset": 1955,
"count": 0
},
{
"startOffset": 2176,
"endOffset": 2198,
"count": 0
},
{
"startOffset": 2241,
"endOffset": 2313,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 2545,
"endOffset": 2602,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 2830,
"endOffset": 2913,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 3136,
"endOffset": 3186,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onend",
"ranges": [
{
"startOffset": 3221,
"endOffset": 3455,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onEndNT",
"ranges": [
{
"startOffset": 3457,
"endOffset": 3497,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 3711,
"endOffset": 3913,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 3917,
"endOffset": 4287,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "_stream_passthrough.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nconst Transform = require('_stream_transform');\nconst util = require('util');\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1711,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1709,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "PassThrough",
"ranges": [
{
"startOffset": 1474,
"endOffset": 1616,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "PassThrough._transform",
"ranges": [
{
"startOffset": 1653,
"endOffset": 1705,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "_stream_readable.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = Readable;\nReadable.ReadableState = ReadableState;\n\nconst EE = require('events');\nconst Stream = require('stream');\nconst { Buffer } = require('buffer');\nconst util = require('util');\nconst debug = util.debuglog('stream');\nconst BufferList = require('internal/streams/buffer_list');\nconst destroyImpl = require('internal/streams/destroy');\nconst { getHighWaterMark } = require('internal/streams/state');\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n} = require('internal/errors').codes;\nconst { emitExperimentalWarning } = require('internal/util');\n\n// Lazy loaded to improve the startup performance.\nlet StringDecoder;\nlet ReadableAsyncIterator;\n\nutil.inherits(Readable, Stream);\n\nconst kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function')\n return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean')\n isDuplex = stream instanceof Stream.Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark',\n isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n const isDuplex = (this instanceof Stream.Duplex);\n\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function')\n this._read = options.read;\n\n if (typeof options.destroy === 'function')\n this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function(err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck)\n er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' &&\n !state.objectMode &&\n Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = Stream._uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted)\n stream.emit('error', new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else\n addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, false);\n else\n maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended &&\n (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n\n if (state.needReadable)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!Stream._isUint8Array(chunk) &&\n typeof chunk !== 'string' &&\n chunk !== undefined &&\n !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE(\n 'chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\n\n\nReadable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n // if setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nconst MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || (state.length === 0 && state.ended))\n return 0;\n if (state.objectMode)\n return 1;\n if (Number.isNaN(n)) {\n // Only flow one buffer at a time\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else\n return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length)\n return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n ((state.highWaterMark !== 0 ?\n state.length >= state.highWaterMark :\n state.length > 0) ||\n state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading)\n n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended)\n state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n\n if (ret !== null)\n this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emit readable');\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable =\n !state.flowing &&\n !state.ended &&\n state.length <= state.highWaterMark;\n flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.ended &&\n state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain &&\n (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if (((state.pipesCount === 1 && state.pipes === dest) ||\n (state.pipesCount > 1 && state.pipes.indexOf(dest) !== -1)) &&\n !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this, { hasUnpiped: false });\n return this;\n }\n\n // try to find the right one.\n var index = state.pipes.indexOf(dest);\n if (index === -1)\n return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n const res = Stream.prototype.on.call(this, ev, fn);\n const state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false)\n this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function(ev, fn) {\n const res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function(ev) {\n const res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n self._readableState.readableListening = self.listenerCount('readable') > 0;\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n const state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', () => {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n this.push(chunk);\n }\n\n this.push(null);\n });\n\n stream.on('data', (chunk) => {\n debug('wrapped data');\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n\n var ret = this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = (n) => {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nReadable.prototype[Symbol.asyncIterator] = function() {\n emitExperimentalWarning('Readable[Symbol.asyncIterator]');\n if (ReadableAsyncIterator === undefined)\n ReadableAsyncIterator = require('internal/streams/async_iterator');\n return new ReadableAsyncIterator(this);\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._readableState.highWaterMark;\n }\n});\n\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._readableState && this._readableState.buffer;\n }\n});\n\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._readableState.flowing;\n },\n set: function(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0)\n return null;\n\n var ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder)\n ret = state.buffer.join('');\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 32304,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 32302,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "prependListener",
"ranges": [
{
"startOffset": 2049,
"endOffset": 2857,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadableState",
"ranges": [
{
"startOffset": 2859,
"endOffset": 5596,
"count": 2
},
{
"startOffset": 2931,
"endOffset": 2936,
"count": 0
},
{
"startOffset": 3286,
"endOffset": 3329,
"count": 0
},
{
"startOffset": 5408,
"endOffset": 5594,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Readable",
"ranges": [
{
"startOffset": 5598,
"endOffset": 6197,
"count": 2
},
{
"startOffset": 5666,
"endOffset": 5695,
"count": 0
},
{
"startOffset": 6056,
"endOffset": 6082,
"count": 0
},
{
"startOffset": 6137,
"endOffset": 6169,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 6413,
"endOffset": 6537,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 6541,
"endOffset": 6810,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable._destroy",
"ranges": [
{
"startOffset": 6951,
"endOffset": 6983,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.push",
"ranges": [
{
"startOffset": 7212,
"endOffset": 7684,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.unshift",
"ranges": [
{
"startOffset": 7779,
"endOffset": 7857,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readableAddChunk",
"ranges": [
{
"startOffset": 7860,
"endOffset": 9596,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "addChunk",
"ranges": [
{
"startOffset": 9598,
"endOffset": 10059,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "chunkInvalid",
"ranges": [
{
"startOffset": 10061,
"endOffset": 10350,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.isPaused",
"ranges": [
{
"startOffset": 10383,
"endOffset": 10445,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.setEncoding",
"ranges": [
{
"startOffset": 10509,
"endOffset": 10807,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "computeNewHighWaterMark",
"ranges": [
{
"startOffset": 10865,
"endOffset": 11179,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "howMuchToRead",
"ranges": [
{
"startOffset": 11292,
"endOffset": 11932,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.read",
"ranges": [
{
"startOffset": 12029,
"endOffset": 15676,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onEofChunk",
"ranges": [
{
"startOffset": 15679,
"endOffset": 16388,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitReadable",
"ranges": [
{
"startOffset": 16589,
"endOffset": 16846,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitReadable_",
"ranges": [
{
"startOffset": 16848,
"endOffset": 17402,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "maybeReadMore",
"ranges": [
{
"startOffset": 17752,
"endOffset": 17908,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "maybeReadMore_",
"ranges": [
{
"startOffset": 17910,
"endOffset": 18279,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable._read",
"ranges": [
{
"startOffset": 18550,
"endOffset": 18630,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.pipe",
"ranges": [
{
"startOffset": 18659,
"endOffset": 22469,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "pipeOnDrain",
"ranges": [
{
"startOffset": 22472,
"endOffset": 22804,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.unpipe",
"ranges": [
{
"startOffset": 22835,
"endOffset": 24061,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.on",
"ranges": [
{
"startOffset": 24186,
"endOffset": 25063,
"count": 6
},
{
"startOffset": 24318,
"endOffset": 24649,
"count": 0
},
{
"startOffset": 24678,
"endOffset": 25046,
"count": 0
},
{
"startOffset": 25061,
"endOffset": 25062,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Readable.removeListener",
"ranges": [
{
"startOffset": 25158,
"endOffset": 25672,
"count": 2
},
{
"startOffset": 25269,
"endOffset": 25655,
"count": 0
},
{
"startOffset": 25670,
"endOffset": 25671,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Readable.removeAllListeners",
"ranges": [
{
"startOffset": 25715,
"endOffset": 26253,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "updateReadableListening",
"ranges": [
{
"startOffset": 26256,
"endOffset": 26376,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "nReadingNextTick",
"ranges": [
{
"startOffset": 26378,
"endOffset": 26466,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.resume",
"ranges": [
{
"startOffset": 26620,
"endOffset": 26873,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "resume",
"ranges": [
{
"startOffset": 26876,
"endOffset": 27026,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "resume_",
"ranges": [
{
"startOffset": 27028,
"endOffset": 27279,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.pause",
"ranges": [
{
"startOffset": 27308,
"endOffset": 27536,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "flow",
"ranges": [
{
"startOffset": 27539,
"endOffset": 27686,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.wrap",
"ranges": [
{
"startOffset": 27870,
"endOffset": 29380,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Readable.(anonymous function)",
"ranges": [
{
"startOffset": 29426,
"endOffset": 29658,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 29892,
"endOffset": 29954,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 30184,
"endOffset": 30262,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 30493,
"endOffset": 30549,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 30558,
"endOffset": 30659,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 30954,
"endOffset": 31004,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fromList",
"ranges": [
{
"startOffset": 31234,
"endOffset": 31793,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "endReadable",
"ranges": [
{
"startOffset": 31795,
"endOffset": 32014,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "endReadableNT",
"ranges": [
{
"startOffset": 32016,
"endOffset": 32299,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "_stream_transform.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\nconst {\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0\n} = require('internal/errors').codes;\nconst Duplex = require('_stream_duplex');\nconst util = require('util');\nutil.inherits(Transform, Duplex);\n\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function')\n this._transform = options.transform;\n\n if (typeof options.flush === 'function')\n this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush((er, data) => {\n done(this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nTransform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, (err2) => {\n cb(err2);\n });\n};\n\n\nfunction done(stream, er, data) {\n if (er)\n return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length)\n throw new ERR_TRANSFORM_WITH_LENGTH_0();\n\n if (stream._transformState.transforming)\n throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 7856,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 7854,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "afterTransform",
"ranges": [
{
"startOffset": 3850,
"endOffset": 4361,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform",
"ranges": [
{
"startOffset": 4364,
"endOffset": 5305,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "prefinish",
"ranges": [
{
"startOffset": 5307,
"endOffset": 5519,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform.push",
"ranges": [
{
"startOffset": 5548,
"endOffset": 5683,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform._transform",
"ranges": [
{
"startOffset": 6166,
"endOffset": 6253,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform._write",
"ranges": [
{
"startOffset": 6285,
"endOffset": 6619,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform._read",
"ranges": [
{
"startOffset": 6791,
"endOffset": 7162,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Transform._destroy",
"ranges": [
{
"startOffset": 7197,
"endOffset": 7294,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "done",
"ranges": [
{
"startOffset": 7298,
"endOffset": 7851,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "_stream_writable.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\nWritable.WritableState = WritableState;\n\nconst util = require('util');\nconst internalUtil = require('internal/util');\nconst Stream = require('stream');\nconst { Buffer } = require('buffer');\nconst destroyImpl = require('internal/streams/destroy');\nconst { getHighWaterMark } = require('internal/streams/state');\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n} = require('internal/errors').codes;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean')\n isDuplex = stream instanceof Stream.Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark',\n isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = onwrite.bind(undefined, stream);\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n var corkReq = { next: null, entry: null, finish: undefined };\n corkReq.finish = onCorkedFinish.bind(undefined, corkReq, this);\n this.corkedRequestsFree = corkReq;\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\nObject.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' +\n 'instead.', 'DEP0003')\n});\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance) {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function(object) {\n if (realHasInstance.call(this, object))\n return true;\n if (this !== Writable)\n return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n const isDuplex = (this instanceof Stream.Duplex);\n\n if (!isDuplex && !realHasInstance.call(Writable, this))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function')\n this._write = options.write;\n\n if (typeof options.writev === 'function')\n this._writev = options.writev;\n\n if (typeof options.destroy === 'function')\n this._destroy = options.destroy;\n\n if (typeof options.final === 'function')\n this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new ERR_STREAM_CANNOT_PIPE());\n};\n\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n stream.emit('error', er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && Stream._isUint8Array(chunk);\n\n if (isBuf && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = Stream._uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf)\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function')\n cb = nop;\n\n if (state.ending)\n writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function() {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function() {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing &&\n !state.corked &&\n !state.bufferProcessing &&\n state.bufferedRequest)\n clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string')\n encoding = encoding.toLowerCase();\n if (!Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED('write'));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n if (typeof cb !== 'function')\n throw new ERR_MULTIPLE_CALLBACK();\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished &&\n !state.corked &&\n !state.bufferProcessing &&\n state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf)\n allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n var corkReq = { next: null, entry: null, finish: undefined };\n corkReq.finish = onCorkedFinish.bind(undefined, corkReq, state);\n state.corkedRequestsFree = corkReq;\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined)\n this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending)\n endWritable(this, state, cb);\n\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return (state.ending &&\n state.length === 0 &&\n state.bufferedRequest === null &&\n !state.finished &&\n !state.writing);\n}\nfunction callFinal(stream, state) {\n stream._final((err) => {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function(err, cb) {\n cb(err);\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 20386,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 20384,
"count": 1
},
{
"startOffset": 6918,
"endOffset": 7006,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "nop",
"ranges": [
{
"startOffset": 1980,
"endOffset": 1997,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WritableState",
"ranges": [
{
"startOffset": 1999,
"endOffset": 5896,
"count": 2
},
{
"startOffset": 2071,
"endOffset": 2076,
"count": 0
},
{
"startOffset": 2426,
"endOffset": 2469,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getBuffer",
"ranges": [
{
"startOffset": 5934,
"endOffset": 6101,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writableStateBufferGetter",
"ranges": [
{
"startOffset": 6193,
"endOffset": 6264,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "value",
"ranges": [
{
"startOffset": 6696,
"endOffset": 6910,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "realHasInstance",
"ranges": [
{
"startOffset": 6946,
"endOffset": 7003,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Writable",
"ranges": [
{
"startOffset": 7008,
"endOffset": 8208,
"count": 2
},
{
"startOffset": 7648,
"endOffset": 7688,
"count": 0
},
{
"startOffset": 7694,
"endOffset": 7723,
"count": 0
},
{
"startOffset": 7900,
"endOffset": 7928,
"count": 0
},
{
"startOffset": 7982,
"endOffset": 8012,
"count": 0
},
{
"startOffset": 8067,
"endOffset": 8099,
"count": 0
},
{
"startOffset": 8152,
"endOffset": 8180,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Writable.pipe",
"ranges": [
{
"startOffset": 8304,
"endOffset": 8370,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeAfterEnd",
"ranges": [
{
"startOffset": 8374,
"endOffset": 8584,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validChunk",
"ranges": [
{
"startOffset": 8808,
"endOffset": 9180,
"count": 2
},
{
"startOffset": 8889,
"endOffset": 8933,
"count": 0
},
{
"startOffset": 8969,
"endOffset": 8989,
"count": 0
},
{
"startOffset": 8991,
"endOffset": 9069,
"count": 0
},
{
"startOffset": 9080,
"endOffset": 9163,
"count": 0
},
{
"startOffset": 9178,
"endOffset": 9179,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Writable.write",
"ranges": [
{
"startOffset": 9209,
"endOffset": 9927,
"count": 2
},
{
"startOffset": 9372,
"endOffset": 9424,
"count": 0
},
{
"startOffset": 9426,
"endOffset": 9478,
"count": 0
},
{
"startOffset": 9582,
"endOffset": 9602,
"count": 0
},
{
"startOffset": 9700,
"endOffset": 9709,
"count": 0
},
{
"startOffset": 9735,
"endOffset": 9759,
"count": 0
},
{
"startOffset": 9925,
"endOffset": 9926,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Writable.cork",
"ranges": [
{
"startOffset": 9956,
"endOffset": 10002,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Writable.uncork",
"ranges": [
{
"startOffset": 10033,
"endOffset": 10279,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setDefaultEncoding",
"ranges": [
{
"startOffset": 10322,
"endOffset": 10633,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 10860,
"endOffset": 10943,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "decodeChunk",
"ranges": [
{
"startOffset": 10949,
"endOffset": 11160,
"count": 2
},
{
"startOffset": 11059,
"endOffset": 11093,
"count": 0
},
{
"startOffset": 11095,
"endOffset": 11142,
"count": 0
},
{
"startOffset": 11158,
"endOffset": 11159,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 11393,
"endOffset": 11455,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeOrBuffer",
"ranges": [
{
"startOffset": 11648,
"endOffset": 12601,
"count": 2
},
{
"startOffset": 11816,
"endOffset": 11894,
"count": 0
},
{
"startOffset": 11928,
"endOffset": 11931,
"count": 0
},
{
"startOffset": 12109,
"endOffset": 12132,
"count": 0
},
{
"startOffset": 12171,
"endOffset": 12512,
"count": 0
},
{
"startOffset": 12599,
"endOffset": 12600,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "doWrite",
"ranges": [
{
"startOffset": 12603,
"endOffset": 12981,
"count": 2
},
{
"startOffset": 12789,
"endOffset": 12838,
"count": 0
},
{
"startOffset": 12862,
"endOffset": 12899,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "onwriteError",
"ranges": [
{
"startOffset": 12983,
"endOffset": 13690,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onwriteStateUpdate",
"ranges": [
{
"startOffset": 13692,
"endOffset": 13835,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "onwrite",
"ranges": [
{
"startOffset": 13837,
"endOffset": 14538,
"count": 2
},
{
"startOffset": 13993,
"endOffset": 14027,
"count": 0
},
{
"startOffset": 14073,
"endOffset": 14115,
"count": 0
},
{
"startOffset": 14343,
"endOffset": 14384,
"count": 0
},
{
"startOffset": 14472,
"endOffset": 14532,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "afterWrite",
"ranges": [
{
"startOffset": 14540,
"endOffset": 14701,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "onwriteDrain",
"ranges": [
{
"startOffset": 14894,
"endOffset": 15040,
"count": 2
},
{
"startOffset": 14978,
"endOffset": 15038,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "clearBuffer",
"ranges": [
{
"startOffset": 15105,
"endOffset": 17051,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Writable._write",
"ranges": [
{
"startOffset": 17081,
"endOffset": 17164,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Writable.end",
"ranges": [
{
"startOffset": 17228,
"endOffset": 17762,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 17984,
"endOffset": 18034,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "needFinish",
"ranges": [
{
"startOffset": 18040,
"endOffset": 18228,
"count": 4
},
{
"startOffset": 18092,
"endOffset": 18123,
"count": 0
},
{
"startOffset": 18124,
"endOffset": 18167,
"count": 0
},
{
"startOffset": 18168,
"endOffset": 18196,
"count": 0
},
{
"startOffset": 18197,
"endOffset": 18224,
"count": 0
},
{
"startOffset": 18226,
"endOffset": 18227,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "callFinal",
"ranges": [
{
"startOffset": 18229,
"endOffset": 18468,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "prefinish",
"ranges": [
{
"startOffset": 18469,
"endOffset": 18817,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "finishMaybe",
"ranges": [
{
"startOffset": 18819,
"endOffset": 19050,
"count": 2
},
{
"startOffset": 18901,
"endOffset": 19033,
"count": 0
},
{
"startOffset": 19048,
"endOffset": 19049,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "endWritable",
"ranges": [
{
"startOffset": 19052,
"endOffset": 19307,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onCorkedFinish",
"ranges": [
{
"startOffset": 19309,
"endOffset": 19594,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 19810,
"endOffset": 19934,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 19938,
"endOffset": 20207,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Writable._destroy",
"ranges": [
{
"startOffset": 20348,
"endOffset": 20380,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "assert.js",
"source": "(function (exports, require, module, process) {// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst { Buffer } = require('buffer');\nconst { codes: {\n ERR_AMBIGUOUS_ARGUMENT,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_RETURN_VALUE\n} } = require('internal/errors');\nconst { AssertionError, errorCache } = require('internal/assert');\nconst { openSync, closeSync, readSync } = require('fs');\nconst { inspect, types: { isPromise, isRegExp } } = require('util');\nconst { EOL } = require('internal/constants');\nconst { NativeModule } = require('internal/bootstrap/loaders');\n\nlet isDeepEqual;\nlet isDeepStrictEqual;\nlet parseExpressionAt;\nlet findNodeAround;\nlet columnOffset = 0;\nlet decoder;\n\nfunction lazyLoadComparison() {\n const comparison = require('internal/util/comparisons');\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n}\n\n// Escape control characters but not \\n and \\t to keep the line breaks and\n// indentation intact.\n// eslint-disable-next-line no-control-regex\nconst escapeSequencesRegExp = /[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g;\nconst meta = [\n '\\\\u0000', '\\\\u0001', '\\\\u0002', '\\\\u0003', '\\\\u0004',\n '\\\\u0005', '\\\\u0006', '\\\\u0007', '\\\\b', '',\n '', '\\\\u000b', '\\\\f', '', '\\\\u000e',\n '\\\\u000f', '\\\\u0010', '\\\\u0011', '\\\\u0012', '\\\\u0013',\n '\\\\u0014', '\\\\u0015', '\\\\u0016', '\\\\u0017', '\\\\u0018',\n '\\\\u0019', '\\\\u001a', '\\\\u001b', '\\\\u001c', '\\\\u001d',\n '\\\\u001e', '\\\\u001f'\n];\n\nconst escapeFn = (str) => meta[str.charCodeAt(0)];\n\nlet warned = false;\n\n// The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nconst assert = module.exports = ok;\n\nconst NO_EXCEPTION_SENTINEL = {};\n\n// All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n\n throw new AssertionError(obj);\n}\n\nfunction fail(actual, expected, message, operator, stackStartFn) {\n const argsLen = arguments.length;\n\n if (argsLen === 0) {\n message = 'Failed';\n } else if (argsLen === 1) {\n message = actual;\n actual = undefined;\n } else {\n if (warned === false) {\n warned = true;\n process.emitWarning(\n 'assert.fail() with more than one argument is deprecated. ' +\n 'Please use assert.strictEqual() instead or only pass a message.',\n 'DeprecationWarning',\n 'DEP0094'\n );\n }\n if (argsLen === 2)\n operator = '!=';\n }\n\n innerFail({\n actual,\n expected,\n message,\n operator,\n stackStartFn: stackStartFn || fail\n });\n}\n\nassert.fail = fail;\n\n// The AssertionError is defined in internal/error.\nassert.AssertionError = AssertionError;\n\nfunction findColumn(fd, column, code) {\n if (code.length > column + 100) {\n try {\n return parseCode(code, column);\n } catch {\n // End recursion in case no code could be parsed. The expression should\n // have been found after 2500 characters, so stop trying.\n if (code.length - column > 2500) {\n // eslint-disable-next-line no-throw-literal\n throw null;\n }\n }\n }\n // Read up to 2500 bytes more than necessary in columns. That way we address\n // multi byte characters and read enough data to parse the code.\n const bytesToRead = column - code.length + 2500;\n const buffer = Buffer.allocUnsafe(bytesToRead);\n const bytesRead = readSync(fd, buffer, 0, bytesToRead);\n code += decoder.write(buffer.slice(0, bytesRead));\n // EOF: fast path.\n if (bytesRead < bytesToRead) {\n return parseCode(code, column);\n }\n // Read potentially missing code.\n return findColumn(fd, column, code);\n}\n\nfunction getCode(fd, line, column) {\n let bytesRead = 0;\n if (line === 0) {\n // Special handle line number one. This is more efficient and simplifies the\n // rest of the algorithm. Read more than the regular column number in bytes\n // to prevent multiple reads in case multi byte characters are used.\n return findColumn(fd, column, '');\n }\n let lines = 0;\n // Prevent blocking the event loop by limiting the maximum amount of\n // data that may be read.\n let maxReads = 64; // bytesPerRead * maxReads = 512 kb\n const bytesPerRead = 8192;\n // Use a single buffer up front that is reused until the call site is found.\n let buffer = Buffer.allocUnsafe(bytesPerRead);\n while (maxReads-- !== 0) {\n // Only allocate a new buffer in case the needed line is found. All data\n // before that can be discarded.\n buffer = lines < line ? buffer : Buffer.allocUnsafe(bytesPerRead);\n bytesRead = readSync(fd, buffer, 0, bytesPerRead);\n // Read the buffer until the required code line is found.\n for (var i = 0; i < bytesRead; i++) {\n if (buffer[i] === 10 && ++lines === line) {\n // If the end of file is reached, directly parse the code and return.\n if (bytesRead < bytesPerRead) {\n return parseCode(buffer.toString('utf8', i + 1, bytesRead), column);\n }\n // Check if the read code is sufficient or read more until the whole\n // expression is read. Make sure multi byte characters are preserved\n // properly by using the decoder.\n const code = decoder.write(buffer.slice(i + 1, bytesRead));\n return findColumn(fd, column, code);\n }\n }\n }\n}\n\nfunction parseCode(code, offset) {\n // Lazy load acorn.\n if (parseExpressionAt === undefined) {\n ({ parseExpressionAt } = require('internal/deps/acorn/dist/acorn'));\n ({ findNodeAround } = require('internal/deps/acorn/dist/walk'));\n }\n let node;\n let start = 0;\n // Parse the read code until the correct expression is found.\n do {\n try {\n node = parseExpressionAt(code, start);\n start = node.end + 1 || start;\n // Find the CallExpression in the tree.\n node = findNodeAround(node, offset, 'CallExpression');\n } catch (err) {\n // Unexpected token error and the like.\n start += err.raisedAt || 1;\n if (start > offset) {\n // No matching expression found. This could happen if the assert\n // expression is bigger than the provided buffer.\n // eslint-disable-next-line no-throw-literal\n throw null;\n }\n }\n } while (node === undefined || node.node.end < offset);\n\n return [\n node.node.start,\n code.slice(node.node.start, node.node.end)\n .replace(escapeSequencesRegExp, escapeFn)\n ];\n}\n\nfunction getErrMessage(message, fn) {\n const tmpLimit = Error.stackTraceLimit;\n // Make sure the limit is set to 1. Otherwise it could fail (<= 0) or it\n // does to much work.\n Error.stackTraceLimit = 1;\n // We only need the stack trace. To minimize the overhead use an object\n // instead of an error.\n const err = {};\n Error.captureStackTrace(err, fn);\n Error.stackTraceLimit = tmpLimit;\n\n const tmpPrepare = Error.prepareStackTrace;\n Error.prepareStackTrace = (_, stack) => stack;\n const call = err.stack[0];\n Error.prepareStackTrace = tmpPrepare;\n\n const filename = call.getFileName();\n\n if (!filename) {\n return message;\n }\n\n const line = call.getLineNumber() - 1;\n let column = call.getColumnNumber() - 1;\n\n // Line number one reports the wrong column due to being wrapped in a\n // function. Remove that offset to get the actual call.\n if (line === 0) {\n if (columnOffset === 0) {\n const { wrapper } = require('internal/modules/cjs/loader');\n columnOffset = wrapper[0].length;\n }\n column -= columnOffset;\n }\n\n const identifier = `${filename}${line}${column}`;\n\n if (errorCache.has(identifier)) {\n return errorCache.get(identifier);\n }\n\n // Skip Node.js modules!\n if (filename.endsWith('.js') && NativeModule.exists(filename.slice(0, -3))) {\n errorCache.set(identifier, undefined);\n return;\n }\n\n let fd;\n try {\n // Set the stack trace limit to zero. This makes sure unexpected token\n // errors are handled faster.\n Error.stackTraceLimit = 0;\n\n if (decoder === undefined) {\n const { StringDecoder } = require('string_decoder');\n decoder = new StringDecoder('utf8');\n }\n\n fd = openSync(filename, 'r', 0o666);\n // Reset column and message.\n [column, message] = getCode(fd, line, column);\n // Flush unfinished multi byte characters.\n decoder.end();\n // Always normalize indentation, otherwise the message could look weird.\n if (message.indexOf('\\n') !== -1) {\n if (EOL === '\\r\\n') {\n message = message.replace(/\\r\\n/g, '\\n');\n }\n const frames = message.split('\\n');\n message = frames.shift();\n for (const frame of frames) {\n let pos = 0;\n while (pos < column && (frame[pos] === ' ' || frame[pos] === '\\t')) {\n pos++;\n }\n message += `\\n ${frame.slice(pos)}`;\n }\n }\n message = `The expression evaluated to a falsy value:\\n\\n ${message}\\n`;\n // Make sure to always set the cache! No matter if the message is\n // undefined or not\n errorCache.set(identifier, message);\n\n return message;\n } catch (e) {\n // Invalidate cache to prevent trying to read this part again.\n errorCache.set(identifier, undefined);\n } finally {\n // Reset limit.\n Error.stackTraceLimit = tmpLimit;\n if (fd !== undefined)\n closeSync(fd);\n }\n}\n\nfunction innerOk(fn, argLen, value, message) {\n if (!value) {\n let generatedMessage = false;\n\n if (argLen === 0) {\n generatedMessage = true;\n message = 'No value argument passed to `assert.ok()`';\n } else if (message == null) {\n generatedMessage = true;\n message = getErrMessage(message, fn);\n } else if (message instanceof Error) {\n throw message;\n }\n\n const err = new AssertionError({\n actual: value,\n expected: true,\n message,\n operator: '==',\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n}\n\n// Pure assertion tests whether a value is truthy, as determined\n// by !!value.\nfunction ok(...args) {\n innerOk(ok, args.length, ...args);\n}\nassert.ok = ok;\n\n// The equality assertion tests shallow, coercive equality with ==.\n/* eslint-disable no-restricted-properties */\nassert.equal = function equal(actual, expected, message) {\n // eslint-disable-next-line eqeqeq\n if (actual != expected) {\n innerFail({\n actual,\n expected,\n message,\n operator: '==',\n stackStartFn: equal\n });\n }\n};\n\n// The non-equality assertion tests for whether two objects are not\n// equal with !=.\nassert.notEqual = function notEqual(actual, expected, message) {\n // eslint-disable-next-line eqeqeq\n if (actual == expected) {\n innerFail({\n actual,\n expected,\n message,\n operator: '!=',\n stackStartFn: notEqual\n });\n }\n};\n\n// The equivalence assertion tests a deep equality relation.\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (isDeepEqual === undefined) lazyLoadComparison();\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'deepEqual',\n stackStartFn: deepEqual\n });\n }\n};\n\n// The non-equivalence assertion tests for any deep inequality.\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (isDeepEqual === undefined) lazyLoadComparison();\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'notDeepEqual',\n stackStartFn: notDeepEqual\n });\n }\n};\n/* eslint-enable */\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (isDeepEqual === undefined) lazyLoadComparison();\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'deepStrictEqual',\n stackStartFn: deepStrictEqual\n });\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\nfunction notDeepStrictEqual(actual, expected, message) {\n if (isDeepEqual === undefined) lazyLoadComparison();\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'notDeepStrictEqual',\n stackStartFn: notDeepStrictEqual\n });\n }\n}\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (!Object.is(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'strictEqual',\n stackStartFn: strictEqual\n });\n }\n};\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (Object.is(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: 'notStrictEqual',\n stackStartFn: notStrictEqual\n });\n }\n};\n\nclass Comparison {\n constructor(obj, keys, actual) {\n for (const key of keys) {\n if (key in obj) {\n if (actual !== undefined &&\n typeof actual[key] === 'string' &&\n isRegExp(obj[key]) &&\n obj[key].test(actual[key])) {\n this[key] = actual[key];\n } else {\n this[key] = obj[key];\n }\n }\n }\n }\n}\n\nfunction compareExceptionKey(actual, expected, key, message, keys) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n // Create placeholder objects to create a nice output.\n const a = new Comparison(actual, keys);\n const b = new Comparison(expected, keys, actual);\n\n const err = new AssertionError({\n actual: a,\n expected: b,\n operator: 'deepStrictEqual',\n stackStartFn: assert.throws\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = 'throws';\n throw err;\n }\n innerFail({\n actual,\n expected,\n message,\n operator: 'throws',\n stackStartFn: assert.throws\n });\n }\n}\n\nfunction expectedException(actual, expected, msg) {\n if (typeof expected !== 'function') {\n if (isRegExp(expected))\n return expected.test(actual);\n // assert.doesNotThrow does not accept objects.\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE(\n 'expected', ['Function', 'RegExp'], expected\n );\n }\n\n // TODO: Disallow primitives as error argument.\n // This is here to prevent a breaking change.\n if (typeof expected !== 'object') {\n return true;\n }\n\n // Handle primitives properly.\n if (typeof actual !== 'object' || actual === null) {\n const err = new AssertionError({\n actual,\n expected,\n message: msg,\n operator: 'deepStrictEqual',\n stackStartFn: assert.throws\n });\n err.operator = 'throws';\n throw err;\n }\n\n const keys = Object.keys(expected);\n // Special handle errors to make sure the name and the message are compared\n // as well.\n if (expected instanceof Error) {\n keys.push('name', 'message');\n }\n if (isDeepEqual === undefined) lazyLoadComparison();\n for (const key of keys) {\n if (typeof actual[key] === 'string' &&\n isRegExp(expected[key]) &&\n expected[key].test(actual[key])) {\n continue;\n }\n compareExceptionKey(actual, expected, key, msg, keys);\n }\n return true;\n }\n // Guard instanceof against arrow functions as they don't have a prototype.\n if (expected.prototype !== undefined && actual instanceof expected) {\n return true;\n }\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n return expected.call({}, actual) === true;\n}\n\nfunction getActual(block) {\n if (typeof block !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('block', 'Function', block);\n }\n try {\n block();\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction checkIsPromise(obj) {\n // Accept native ES6 promises and promises that are implemented in a similar\n // way. Do not accept thenables that use a function as `obj` and that have no\n // `catch` handler.\n return isPromise(obj) ||\n obj !== null && typeof obj === 'object' &&\n typeof obj.then === 'function' &&\n typeof obj.catch === 'function';\n}\n\nasync function waitForActual(block) {\n let resultPromise;\n if (typeof block === 'function') {\n // Return a rejected promise if `block` throws synchronously.\n resultPromise = block();\n // Fail in case no promise is returned.\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE('instance of Promise',\n 'block', resultPromise);\n }\n } else if (checkIsPromise(block)) {\n resultPromise = block;\n } else {\n throw new ERR_INVALID_ARG_TYPE('block', ['Function', 'Promise'], block);\n }\n\n try {\n await resultPromise;\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction expectsError(stackStartFn, actual, error, message) {\n if (typeof error === 'string') {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE('error',\n ['Object', 'Error', 'Function', 'RegExp'],\n error);\n }\n if (typeof actual === 'object' && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT(\n 'error/message',\n `The error message \"${actual.message}\" is identical to the message.`\n );\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT(\n 'error/message',\n `The error \"${actual}\" is identical to the message.`\n );\n }\n message = error;\n error = undefined;\n }\n\n if (actual === NO_EXCEPTION_SENTINEL) {\n let details = '';\n if (error && error.name) {\n details += ` (${error.name})`;\n }\n details += message ? `: ${message}` : '.';\n const fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';\n innerFail({\n actual: undefined,\n expected: error,\n operator: stackStartFn.name,\n message: `Missing expected ${fnType}${details}`,\n stackStartFn\n });\n }\n if (error && expectedException(actual, error, message) === false) {\n throw actual;\n }\n}\n\nfunction expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL)\n return;\n\n if (typeof error === 'string') {\n message = error;\n error = undefined;\n }\n\n if (!error || expectedException(actual, error)) {\n const details = message ? `: ${message}` : '.';\n const fnType = stackStartFn.name === 'doesNotReject' ?\n 'rejection' : 'exception';\n innerFail({\n actual,\n expected: error,\n operator: stackStartFn.name,\n message: `Got unwanted ${fnType}${details}\\n` +\n `Actual message: \"${actual && actual.message}\"`,\n stackStartFn\n });\n }\n throw actual;\n}\n\nassert.throws = function throws(block, ...args) {\n expectsError(throws, getActual(block), ...args);\n};\n\nassert.rejects = async function rejects(block, ...args) {\n expectsError(rejects, await waitForActual(block), ...args);\n};\n\nassert.doesNotThrow = function doesNotThrow(block, ...args) {\n expectsNoError(doesNotThrow, getActual(block), ...args);\n};\n\nassert.doesNotReject = async function doesNotReject(block, ...args) {\n expectsNoError(doesNotReject, await waitForActual(block), ...args);\n};\n\nassert.ifError = function ifError(err) {\n if (err !== null && err !== undefined) {\n let message = 'ifError got unwanted exception: ';\n if (typeof err === 'object' && typeof err.message === 'string') {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n\n const newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: 'ifError',\n message,\n stackStartFn: ifError\n });\n\n // Make sure we actually have a stack trace!\n const origStack = err.stack;\n\n if (typeof origStack === 'string') {\n // This will remove any duplicated frames from the error frames taken\n // from within `ifError` and add the original error frames to the newly\n // created ones.\n const tmp2 = origStack.split('\\n');\n tmp2.shift();\n // Filter all frames existing in err.stack.\n let tmp1 = newErr.stack.split('\\n');\n for (var i = 0; i < tmp2.length; i++) {\n // Find the first occurrence of the frame.\n const pos = tmp1.indexOf(tmp2[i]);\n if (pos !== -1) {\n // Only keep new frames.\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n newErr.stack = `${tmp1.join('\\n')}\\n${tmp2.join('\\n')}`;\n }\n\n throw newErr;\n }\n};\n\n// Expose a strict only variant of assert\nfunction strict(...args) {\n innerOk(strict, args.length, ...args);\n}\nassert.strict = Object.assign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n});\nassert.strict.strict = assert.strict;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 22292,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 22290,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "lazyLoadComparison",
"ranges": [
{
"startOffset": 1810,
"endOffset": 1994,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "escapeFn",
"ranges": [
{
"startOffset": 2574,
"endOffset": 2606,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "innerFail",
"ranges": [
{
"startOffset": 3160,
"endOffset": 3276,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fail",
"ranges": [
{
"startOffset": 3278,
"endOffset": 3966,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "findColumn",
"ranges": [
{
"startOffset": 4082,
"endOffset": 5022,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getCode",
"ranges": [
{
"startOffset": 5024,
"endOffset": 6667,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "parseCode",
"ranges": [
{
"startOffset": 6669,
"endOffset": 7752,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getErrMessage",
"ranges": [
{
"startOffset": 7754,
"endOffset": 10585,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "innerOk",
"ranges": [
{
"startOffset": 10587,
"endOffset": 11194,
"count": 3
},
{
"startOffset": 10648,
"endOffset": 11192,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "ok",
"ranges": [
{
"startOffset": 11276,
"endOffset": 11337,
"count": 3
}
],
"isBlockCoverage": true
},
{
"functionName": "equal",
"ranges": [
{
"startOffset": 11484,
"endOffset": 11715,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "notEqual",
"ranges": [
{
"startOffset": 11822,
"endOffset": 12059,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "deepEqual",
"ranges": [
{
"startOffset": 12142,
"endOffset": 12418,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "notDeepEqual",
"ranges": [
{
"startOffset": 12507,
"endOffset": 12791,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "deepStrictEqual",
"ranges": [
{
"startOffset": 12839,
"endOffset": 13139,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "notDeepStrictEqual",
"ranges": [
{
"startOffset": 13190,
"endOffset": 13498,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "strictEqual",
"ranges": [
{
"startOffset": 13521,
"endOffset": 13746,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "notStrictEqual",
"ranges": [
{
"startOffset": 13773,
"endOffset": 14006,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Comparison",
"ranges": [
{
"startOffset": 14030,
"endOffset": 14387,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "compareExceptionKey",
"ranges": [
{
"startOffset": 14391,
"endOffset": 15128,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "expectedException",
"ranges": [
{
"startOffset": 15130,
"endOffset": 16793,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getActual",
"ranges": [
{
"startOffset": 16795,
"endOffset": 17016,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "checkIsPromise",
"ranges": [
{
"startOffset": 17018,
"endOffset": 17380,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "waitForActual",
"ranges": [
{
"startOffset": 17382,
"endOffset": 18053,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "expectsError",
"ranges": [
{
"startOffset": 18055,
"endOffset": 19393,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "expectsNoError",
"ranges": [
{
"startOffset": 19395,
"endOffset": 20046,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "throws",
"ranges": [
{
"startOffset": 20064,
"endOffset": 20150,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "rejects",
"ranges": [
{
"startOffset": 20170,
"endOffset": 20274,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "doesNotThrow",
"ranges": [
{
"startOffset": 20299,
"endOffset": 20399,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "doesNotReject",
"ranges": [
{
"startOffset": 20425,
"endOffset": 20543,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ifError",
"ranges": [
{
"startOffset": 20563,
"endOffset": 21940,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "strict",
"ranges": [
{
"startOffset": 21985,
"endOffset": 22054,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "buffer.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n byteLengthUtf8,\n copy: _copy,\n compare: _compare,\n compareOffset,\n createFromString,\n fill: bindingFill,\n indexOfBuffer,\n indexOfNumber,\n indexOfString,\n swap16: _swap16,\n swap32: _swap32,\n swap64: _swap64,\n kMaxLength,\n kStringMaxLength\n} = process.binding('buffer');\n// We cannot use internalBinding unconditionally here because of the way\n// that test/parallel/test-buffer-bindingobj-no-zerofill.js is written.\nlet isAnyArrayBuffer;\ntry {\n const { internalBinding } = require('internal/bootstrap/loaders');\n isAnyArrayBuffer = internalBinding('types').isAnyArrayBuffer;\n} catch (e) {\n isAnyArrayBuffer = require('util').types.isAnyArrayBuffer;\n}\nconst {\n customInspectSymbol,\n isInsideNodeModules,\n normalizeEncoding,\n kIsEncodingSymbol\n} = require('internal/util');\nconst {\n isArrayBufferView,\n isUint8Array\n} = require('internal/util/types');\nconst {\n pendingDeprecation\n} = process.binding('config');\nconst {\n ERR_BUFFER_OUT_OF_BOUNDS,\n ERR_INDEX_OUT_OF_RANGE,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_INVALID_BUFFER_SIZE,\n ERR_INVALID_OPT_VALUE,\n ERR_NO_LONGER_SUPPORTED,\n ERR_UNKNOWN_ENCODING\n} = require('internal/errors').codes;\nconst { validateString } = require('internal/validators');\n\nconst internalBuffer = require('internal/buffer');\n\nconst { setupBufferJS } = internalBuffer;\n\nconst bindingObj = {};\n\nclass FastBuffer extends Uint8Array {}\nFastBuffer.prototype.constructor = Buffer;\ninternalBuffer.FastBuffer = FastBuffer;\n\nBuffer.prototype = FastBuffer.prototype;\n\nfor (const [name, method] of Object.entries(internalBuffer.readWrites)) {\n Buffer.prototype[name] = method;\n}\n\nconst constants = Object.defineProperties({}, {\n MAX_LENGTH: {\n value: kMaxLength,\n writable: false,\n enumerable: true\n },\n MAX_STRING_LENGTH: {\n value: kStringMaxLength,\n writable: false,\n enumerable: true\n }\n});\n\nBuffer.poolSize = 8 * 1024;\nvar poolSize, poolOffset, allocPool;\n\nsetupBufferJS(Buffer.prototype, bindingObj);\n\n// |zeroFill| can be undefined when running inside an isolate where we\n// do not own the ArrayBuffer allocator. Zero fill is always on in that case.\nconst zeroFill = bindingObj.zeroFill || [0];\n\nfunction createUnsafeBuffer(size) {\n return new FastBuffer(createUnsafeArrayBuffer(size));\n}\n\nfunction createUnsafeArrayBuffer(size) {\n zeroFill[0] = 0;\n try {\n return new ArrayBuffer(size);\n } finally {\n zeroFill[0] = 1;\n }\n}\n\nfunction createPool() {\n poolSize = Buffer.poolSize;\n allocPool = createUnsafeArrayBuffer(poolSize);\n poolOffset = 0;\n}\ncreatePool();\n\nfunction alignPool() {\n // Ensure aligned slices\n if (poolOffset & 0x7) {\n poolOffset |= 0x7;\n poolOffset++;\n }\n}\n\nlet bufferWarningAlreadyEmitted = false;\nlet nodeModulesCheckCounter = 0;\nconst bufferWarning = 'Buffer() is deprecated due to security and usability ' +\n 'issues. Please use the Buffer.alloc(), ' +\n 'Buffer.allocUnsafe(), or Buffer.from() methods instead.';\n\nfunction showFlaggedDeprecation() {\n if (bufferWarningAlreadyEmitted ||\n ++nodeModulesCheckCounter > 10000 ||\n (!pendingDeprecation &&\n isInsideNodeModules())) {\n // We don't emit a warning, because we either:\n // - Already did so, or\n // - Already checked too many times whether a call is coming\n // from node_modules and want to stop slowing down things, or\n // - We aren't running with `--pending-deprecation` enabled,\n // and the code is inside `node_modules`.\n return;\n }\n\n process.emitWarning(bufferWarning, 'DeprecationWarning', 'DEP0005');\n bufferWarningAlreadyEmitted = true;\n}\n\n/**\n * The Buffer() constructor is deprecated in documentation and should not be\n * used moving forward. Rather, developers should use one of the three new\n * factory APIs: Buffer.from(), Buffer.allocUnsafe() or Buffer.alloc() based on\n * their specific needs. There is no runtime deprecation because of the extent\n * to which the Buffer constructor is used in the ecosystem currently -- a\n * runtime deprecation would introduce too much breakage at this time. It's not\n * likely that the Buffer constructors would ever actually be removed.\n * Deprecation Code: DEP0005\n */\nfunction Buffer(arg, encodingOrOffset, length) {\n showFlaggedDeprecation();\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new ERR_INVALID_ARG_TYPE('string', 'string', arg);\n }\n return Buffer.alloc(arg);\n }\n return Buffer.from(arg, encodingOrOffset, length);\n}\n\nObject.defineProperty(Buffer, Symbol.species, {\n enumerable: false,\n configurable: true,\n get() { return FastBuffer; }\n});\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n */\nBuffer.from = function from(value, encodingOrOffset, length) {\n if (typeof value === 'string')\n return fromString(value, encodingOrOffset);\n\n if (isAnyArrayBuffer(value))\n return fromArrayBuffer(value, encodingOrOffset, length);\n\n if (value === null || value === undefined) {\n throw new ERR_INVALID_ARG_TYPE(\n 'first argument',\n ['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],\n value\n );\n }\n\n if (typeof value === 'number') {\n throw new ERR_INVALID_ARG_TYPE('value', 'not number', value);\n }\n\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf !== null && valueOf !== undefined && valueOf !== value)\n return Buffer.from(valueOf, encodingOrOffset, length);\n\n var b = fromObject(value);\n if (b)\n return b;\n\n if (typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'),\n encodingOrOffset,\n length);\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'first argument',\n ['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],\n value\n );\n};\n\n// Identical to the built-in %TypedArray%.of(), but avoids using the deprecated\n// Buffer() constructor. Must use arrow function syntax to avoid automatically\n// adding a `prototype` property and making the function a constructor.\n//\n// Refs: https://tc39.github.io/ecma262/#sec-%typedarray%.of\n// Refs: https://esdiscuss.org/topic/isconstructor#content-11\nconst of = (...items) => {\n const newObj = createUnsafeBuffer(items.length);\n for (var k = 0; k < items.length; k++)\n newObj[k] = items[k];\n return newObj;\n};\nBuffer.of = of;\n\nObject.setPrototypeOf(Buffer, Uint8Array);\n\n// The 'assertSize' method will remove itself from the callstack when an error\n// occurs. This is done simply to keep the internal details of the\n// implementation from bleeding out to users.\nfunction assertSize(size) {\n let err = null;\n\n if (typeof size !== 'number') {\n err = new ERR_INVALID_ARG_TYPE('size', 'number', size);\n } else if (size < 0 || size > kMaxLength) {\n err = new ERR_INVALID_OPT_VALUE.RangeError('size', size);\n }\n\n if (err !== null) {\n Error.captureStackTrace(err, assertSize);\n throw err;\n }\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n */\nBuffer.alloc = function alloc(size, fill, encoding) {\n assertSize(size);\n if (fill !== undefined && fill !== 0 && size > 0) {\n const buf = createUnsafeBuffer(size);\n return _fill(buf, fill, 0, buf.length, encoding);\n }\n return new FastBuffer(size);\n};\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer\n * instance. If `--zero-fill-buffers` is set, will zero-fill the buffer.\n */\nBuffer.allocUnsafe = function allocUnsafe(size) {\n assertSize(size);\n return allocate(size);\n};\n\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled\n * Buffer instance that is not allocated off the pre-initialized pool.\n * If `--zero-fill-buffers` is set, will zero-fill the buffer.\n */\nBuffer.allocUnsafeSlow = function allocUnsafeSlow(size) {\n assertSize(size);\n return createUnsafeBuffer(size);\n};\n\n// If --zero-fill-buffers command line argument is set, a zero-filled\n// buffer is returned.\nfunction SlowBuffer(length) {\n // eslint-disable-next-line eqeqeq\n if (+length != length)\n length = 0;\n assertSize(+length);\n return createUnsafeBuffer(+length);\n}\n\nObject.setPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype);\nObject.setPrototypeOf(SlowBuffer, Uint8Array);\n\nfunction allocate(size) {\n if (size <= 0) {\n return new FastBuffer();\n }\n if (size < (Buffer.poolSize >>> 1)) {\n if (size > (poolSize - poolOffset))\n createPool();\n var b = new FastBuffer(allocPool, poolOffset, size);\n poolOffset += size;\n alignPool();\n return b;\n } else {\n return createUnsafeBuffer(size);\n }\n}\n\nfunction fromString(string, encoding) {\n var length;\n if (typeof encoding !== 'string' || encoding.length === 0) {\n if (string.length === 0)\n return new FastBuffer();\n encoding = 'utf8';\n length = byteLengthUtf8(string);\n } else {\n length = byteLength(string, encoding, true);\n if (length === -1)\n throw new ERR_UNKNOWN_ENCODING(encoding);\n if (string.length === 0)\n return new FastBuffer();\n }\n\n if (length >= (Buffer.poolSize >>> 1))\n return createFromString(string, encoding);\n\n if (length > (poolSize - poolOffset))\n createPool();\n var b = new FastBuffer(allocPool, poolOffset, length);\n const actual = b.write(string, encoding);\n if (actual !== length) {\n // byteLength() may overestimate. That's a rare case, though.\n b = new FastBuffer(allocPool, poolOffset, actual);\n }\n poolOffset += actual;\n alignPool();\n return b;\n}\n\nfunction fromArrayLike(obj) {\n const length = obj.length;\n const b = allocate(length);\n for (var i = 0; i < length; i++)\n b[i] = obj[i];\n return b;\n}\n\nfunction fromArrayBuffer(obj, byteOffset, length) {\n // convert byteOffset to integer\n if (byteOffset === undefined) {\n byteOffset = 0;\n } else {\n byteOffset = +byteOffset;\n if (Number.isNaN(byteOffset))\n byteOffset = 0;\n }\n\n const maxLength = obj.byteLength - byteOffset;\n\n if (maxLength < 0)\n throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');\n\n if (length === undefined) {\n length = maxLength;\n } else {\n // Convert length to non-negative integer.\n length = +length;\n if (length > 0) {\n if (length > maxLength)\n throw new ERR_BUFFER_OUT_OF_BOUNDS('length');\n } else {\n length = 0;\n }\n }\n\n return new FastBuffer(obj, byteOffset, length);\n}\n\nfunction fromObject(obj) {\n if (isUint8Array(obj)) {\n const b = allocate(obj.length);\n\n if (b.length === 0)\n return b;\n\n _copy(obj, b, 0, 0, obj.length);\n return b;\n }\n\n if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {\n if (typeof obj.length !== 'number') {\n return new FastBuffer();\n }\n return fromArrayLike(obj);\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n}\n\n// Static methods\n\nBuffer.isBuffer = function isBuffer(b) {\n return b instanceof Buffer;\n};\n\nBuffer.compare = function compare(buf1, buf2) {\n if (!isUint8Array(buf1)) {\n throw new ERR_INVALID_ARG_TYPE('buf1', ['Buffer', 'Uint8Array'], buf1);\n }\n\n if (!isUint8Array(buf2)) {\n throw new ERR_INVALID_ARG_TYPE('buf2', ['Buffer', 'Uint8Array'], buf2);\n }\n\n if (buf1 === buf2) {\n return 0;\n }\n\n return _compare(buf1, buf2);\n};\n\nBuffer.isEncoding = function isEncoding(encoding) {\n return typeof encoding === 'string' && encoding.length !== 0 &&\n normalizeEncoding(encoding) !== undefined;\n};\nBuffer[kIsEncodingSymbol] = Buffer.isEncoding;\n\nBuffer.concat = function concat(list, length) {\n var i;\n if (!Array.isArray(list)) {\n throw new ERR_INVALID_ARG_TYPE(\n 'list', ['Array', 'Buffer', 'Uint8Array'], list);\n }\n\n if (list.length === 0)\n return new FastBuffer();\n\n if (length === undefined) {\n length = 0;\n for (i = 0; i < list.length; i++)\n length += list[i].length;\n } else {\n length = length >>> 0;\n }\n\n var buffer = Buffer.allocUnsafe(length);\n var pos = 0;\n for (i = 0; i < list.length; i++) {\n var buf = list[i];\n if (!isUint8Array(buf)) {\n // TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.\n // Instead, find the proper error code for this.\n throw new ERR_INVALID_ARG_TYPE(\n `list[${i}]`, ['Array', 'Buffer', 'Uint8Array'], list[i]);\n }\n _copy(buf, buffer, pos);\n pos += buf.length;\n }\n\n // Note: `length` is always equal to `buffer.length` at this point\n if (pos < length) {\n // Zero-fill the remaining bytes if the specified `length` was more than\n // the actual total length, i.e. if we have some remaining allocated bytes\n // there were not initialized.\n buffer.fill(0, pos, length);\n }\n\n return buffer;\n};\n\nfunction base64ByteLength(str, bytes) {\n // Handle padding\n if (str.charCodeAt(bytes - 1) === 0x3D)\n bytes--;\n if (bytes > 1 && str.charCodeAt(bytes - 1) === 0x3D)\n bytes--;\n\n // Base64 ratio: 3/4\n return (bytes * 3) >>> 2;\n}\n\nfunction byteLength(string, encoding) {\n if (typeof string !== 'string') {\n if (isArrayBufferView(string) || isAnyArrayBuffer(string)) {\n return string.byteLength;\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'string', ['string', 'Buffer', 'ArrayBuffer'], string\n );\n }\n\n const len = string.length;\n const mustMatch = (arguments.length > 2 && arguments[2] === true);\n if (!mustMatch && len === 0)\n return 0;\n\n if (!encoding)\n return (mustMatch ? -1 : byteLengthUtf8(string));\n\n encoding += '';\n switch (encoding.length) {\n case 4:\n if (encoding === 'utf8') return byteLengthUtf8(string);\n if (encoding === 'ucs2') return len * 2;\n encoding = encoding.toLowerCase();\n if (encoding === 'utf8') return byteLengthUtf8(string);\n if (encoding === 'ucs2') return len * 2;\n break;\n case 5:\n if (encoding === 'utf-8') return byteLengthUtf8(string);\n if (encoding === 'ascii') return len;\n if (encoding === 'ucs-2') return len * 2;\n encoding = encoding.toLowerCase();\n if (encoding === 'utf-8') return byteLengthUtf8(string);\n if (encoding === 'ascii') return len;\n if (encoding === 'ucs-2') return len * 2;\n break;\n case 7:\n if (encoding === 'utf16le' || encoding.toLowerCase() === 'utf16le')\n return len * 2;\n break;\n case 8:\n if (encoding === 'utf-16le' || encoding.toLowerCase() === 'utf-16le')\n return len * 2;\n break;\n case 6:\n if (encoding === 'latin1' || encoding === 'binary') return len;\n if (encoding === 'base64') return base64ByteLength(string, len);\n encoding = encoding.toLowerCase();\n if (encoding === 'latin1' || encoding === 'binary') return len;\n if (encoding === 'base64') return base64ByteLength(string, len);\n break;\n case 3:\n if (encoding === 'hex' || encoding.toLowerCase() === 'hex')\n return len >>> 1;\n break;\n }\n return (mustMatch ? -1 : byteLengthUtf8(string));\n}\n\nBuffer.byteLength = byteLength;\n\n// For backwards compatibility.\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get() {\n if (!(this instanceof Buffer))\n return undefined;\n return this.buffer;\n }\n});\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get() {\n if (!(this instanceof Buffer))\n return undefined;\n return this.byteOffset;\n }\n});\n\nfunction stringSlice(buf, encoding, start, end) {\n if (encoding === undefined) return buf.utf8Slice(start, end);\n encoding += '';\n switch (encoding.length) {\n case 4:\n if (encoding === 'utf8') return buf.utf8Slice(start, end);\n if (encoding === 'ucs2') return buf.ucs2Slice(start, end);\n encoding = encoding.toLowerCase();\n if (encoding === 'utf8') return buf.utf8Slice(start, end);\n if (encoding === 'ucs2') return buf.ucs2Slice(start, end);\n break;\n case 5:\n if (encoding === 'utf-8') return buf.utf8Slice(start, end);\n if (encoding === 'ascii') return buf.asciiSlice(start, end);\n if (encoding === 'ucs-2') return buf.ucs2Slice(start, end);\n encoding = encoding.toLowerCase();\n if (encoding === 'utf-8') return buf.utf8Slice(start, end);\n if (encoding === 'ascii') return buf.asciiSlice(start, end);\n if (encoding === 'ucs-2') return buf.ucs2Slice(start, end);\n break;\n case 6:\n if (encoding === 'latin1' || encoding === 'binary')\n return buf.latin1Slice(start, end);\n if (encoding === 'base64') return buf.base64Slice(start, end);\n encoding = encoding.toLowerCase();\n if (encoding === 'latin1' || encoding === 'binary')\n return buf.latin1Slice(start, end);\n if (encoding === 'base64') return buf.base64Slice(start, end);\n break;\n case 3:\n if (encoding === 'hex' || encoding.toLowerCase() === 'hex')\n return buf.hexSlice(start, end);\n break;\n case 7:\n if (encoding === 'utf16le' || encoding.toLowerCase() === 'utf16le')\n return buf.ucs2Slice(start, end);\n break;\n case 8:\n if (encoding === 'utf-16le' || encoding.toLowerCase() === 'utf-16le')\n return buf.ucs2Slice(start, end);\n break;\n }\n throw new ERR_UNKNOWN_ENCODING(encoding);\n}\n\nBuffer.prototype.copy =\n function copy(target, targetStart, sourceStart, sourceEnd) {\n return _copy(this, target, targetStart, sourceStart, sourceEnd);\n };\n\n// No need to verify that \"buf.length <= MAX_UINT32\" since it's a read-only\n// property of a typed array.\n// This behaves neither like String nor Uint8Array in that we set start/end\n// to their upper/lower bounds if the value passed is out of range.\nBuffer.prototype.toString = function toString(encoding, start, end) {\n if (arguments.length === 0) {\n return this.utf8Slice(0, this.length);\n }\n\n const len = this.length;\n if (len === 0)\n return '';\n\n if (!start || start < 0)\n start = 0;\n else if (start >= len)\n return '';\n\n if (end === undefined || end > len)\n end = len;\n else if (end <= 0)\n return '';\n\n start |= 0;\n end |= 0;\n\n if (end <= start)\n return '';\n return stringSlice(this, encoding, start, end);\n};\n\nBuffer.prototype.equals = function equals(otherBuffer) {\n if (!isUint8Array(otherBuffer)) {\n throw new ERR_INVALID_ARG_TYPE(\n 'otherBuffer', ['Buffer', 'Uint8Array'], otherBuffer);\n }\n if (this === otherBuffer)\n return true;\n\n return _compare(this, otherBuffer) === 0;\n};\n\n// Override how buffers are presented by util.inspect().\nBuffer.prototype[customInspectSymbol] = function inspect() {\n var str = '';\n var max = exports.INSPECT_MAX_BYTES;\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n if (this.length > max)\n str += ' ... ';\n return `<${this.constructor.name} ${str}>`;\n};\nBuffer.prototype.inspect = Buffer.prototype[customInspectSymbol];\n\nBuffer.prototype.compare = function compare(target,\n start,\n end,\n thisStart,\n thisEnd) {\n if (!isUint8Array(target)) {\n throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);\n }\n if (arguments.length === 1)\n return _compare(this, target);\n\n if (start === undefined)\n start = 0;\n else if (start < 0)\n throw new ERR_INDEX_OUT_OF_RANGE();\n else\n start >>>= 0;\n\n if (end === undefined)\n end = target.length;\n else if (end > target.length)\n throw new ERR_INDEX_OUT_OF_RANGE();\n else\n end >>>= 0;\n\n if (thisStart === undefined)\n thisStart = 0;\n else if (thisStart < 0)\n throw new ERR_INDEX_OUT_OF_RANGE();\n else\n thisStart >>>= 0;\n\n if (thisEnd === undefined)\n thisEnd = this.length;\n else if (thisEnd > this.length)\n throw new ERR_INDEX_OUT_OF_RANGE();\n else\n thisEnd >>>= 0;\n\n if (thisStart >= thisEnd)\n return (start >= end ? 0 : -1);\n else if (start >= end)\n return 1;\n\n return compareOffset(this, target, start, thisStart, end, thisEnd);\n};\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant if val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = undefined;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n // Coerce to Number. Values like null and [] become 0.\n byteOffset = +byteOffset;\n // If the offset is undefined, \"foo\", {}, coerces to NaN, search whole buffer.\n if (Number.isNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length;\n }\n dir = !!dir; // Cast to bool.\n\n if (typeof val === 'string') {\n if (encoding === undefined) {\n return indexOfString(buffer, val, byteOffset, encoding, dir);\n }\n return slowIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (isUint8Array(val)) {\n return indexOfBuffer(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === 'number') {\n return indexOfNumber(buffer, val, byteOffset, dir);\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'value', ['string', 'Buffer', 'Uint8Array'], val\n );\n}\n\nfunction slowIndexOf(buffer, val, byteOffset, encoding, dir) {\n var loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'utf8':\n case 'utf-8':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n case 'latin1':\n case 'binary':\n return indexOfString(buffer, val, byteOffset, encoding, dir);\n\n case 'base64':\n case 'ascii':\n case 'hex':\n return indexOfBuffer(\n buffer, Buffer.from(val, encoding), byteOffset, encoding, dir);\n\n default:\n if (loweredCase) {\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n}\n\nBuffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n};\n\nBuffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n};\n\nBuffer.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n};\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill(val, start, end, encoding) {\n return _fill(this, val, start, end, encoding);\n};\n\nfunction _fill(buf, val, start, end, encoding) {\n if (typeof val === 'string') {\n if (start === undefined || typeof start === 'string') {\n encoding = start;\n start = 0;\n end = buf.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = buf.length;\n }\n\n const normalizedEncoding = normalizeEncoding(encoding);\n if (normalizedEncoding === undefined) {\n validateString(encoding, 'encoding');\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n\n if (val.length === 0) {\n // If val === '' default to zero.\n val = 0;\n } else if (val.length === 1) {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n if (normalizedEncoding === 'utf8') {\n const code = val.charCodeAt(0);\n if (code < 128) {\n val = code;\n }\n } else if (normalizedEncoding === 'latin1') {\n val = val.charCodeAt(0);\n }\n }\n } else {\n encoding = undefined;\n }\n\n if (start === undefined) {\n start = 0;\n end = buf.length;\n } else {\n // Invalid ranges are not set to a default, so can range check early.\n if (end === undefined) {\n if (start < 0)\n throw new ERR_INDEX_OUT_OF_RANGE();\n end = buf.length;\n } else {\n if (start < 0 || end > buf.length || end < 0)\n throw new ERR_INDEX_OUT_OF_RANGE();\n end = end >>> 0;\n }\n start = start >>> 0;\n if (start >= end)\n return buf;\n }\n\n const res = bindingFill(buf, val, start, end, encoding);\n if (res < 0) {\n if (res === -1)\n throw new ERR_INVALID_ARG_VALUE('value', val);\n throw new ERR_INDEX_OUT_OF_RANGE();\n }\n\n return buf;\n}\n\nBuffer.prototype.write = function write(string, offset, length, encoding) {\n // Buffer#write(string);\n if (offset === undefined) {\n return this.utf8Write(string, 0, this.length);\n\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0;\n\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n } else {\n encoding = length;\n length = undefined;\n }\n\n var remaining = this.length - offset;\n if (length === undefined || length > remaining)\n length = remaining;\n\n if (string.length > 0 && (length < 0 || offset < 0))\n throw new ERR_BUFFER_OUT_OF_BOUNDS();\n } else {\n // if someone is still calling the obsolete form of write(), tell them.\n // we don't want eg buf.write(\"foo\", \"utf8\", 10) to silently turn into\n // buf.write(\"foo\", \"utf8\"), so we can't ignore extra args\n throw new ERR_NO_LONGER_SUPPORTED(\n 'Buffer.write(string, encoding, offset[, length])'\n );\n }\n\n if (!encoding) return this.utf8Write(string, offset, length);\n\n encoding += '';\n switch (encoding.length) {\n case 4:\n if (encoding === 'utf8') return this.utf8Write(string, offset, length);\n if (encoding === 'ucs2') return this.ucs2Write(string, offset, length);\n encoding = encoding.toLowerCase();\n if (encoding === 'utf8') return this.utf8Write(string, offset, length);\n if (encoding === 'ucs2') return this.ucs2Write(string, offset, length);\n break;\n case 5:\n if (encoding === 'utf-8') return this.utf8Write(string, offset, length);\n if (encoding === 'ascii') return this.asciiWrite(string, offset, length);\n if (encoding === 'ucs-2') return this.ucs2Write(string, offset, length);\n encoding = encoding.toLowerCase();\n if (encoding === 'utf-8') return this.utf8Write(string, offset, length);\n if (encoding === 'ascii') return this.asciiWrite(string, offset, length);\n if (encoding === 'ucs-2') return this.ucs2Write(string, offset, length);\n break;\n case 7:\n if (encoding === 'utf16le' || encoding.toLowerCase() === 'utf16le')\n return this.ucs2Write(string, offset, length);\n break;\n case 8:\n if (encoding === 'utf-16le' || encoding.toLowerCase() === 'utf-16le')\n return this.ucs2Write(string, offset, length);\n break;\n case 6:\n if (encoding === 'latin1' || encoding === 'binary')\n return this.latin1Write(string, offset, length);\n if (encoding === 'base64')\n return this.base64Write(string, offset, length);\n encoding = encoding.toLowerCase();\n if (encoding === 'latin1' || encoding === 'binary')\n return this.latin1Write(string, offset, length);\n if (encoding === 'base64')\n return this.base64Write(string, offset, length);\n break;\n case 3:\n if (encoding === 'hex' || encoding.toLowerCase() === 'hex')\n return this.hexWrite(string, offset, length);\n break;\n }\n throw new ERR_UNKNOWN_ENCODING(encoding);\n};\n\nBuffer.prototype.toJSON = function toJSON() {\n if (this.length > 0) {\n const data = new Array(this.length);\n for (var i = 0; i < this.length; ++i)\n data[i] = this[i];\n return { type: 'Buffer', data };\n } else {\n return { type: 'Buffer', data: [] };\n }\n};\n\nfunction adjustOffset(offset, length) {\n // Use Math.trunc() to convert offset to an integer value that can be larger\n // than an Int32. Hence, don't use offset | 0 or similar techniques.\n offset = Math.trunc(offset);\n if (offset === 0) {\n return 0;\n }\n if (offset < 0) {\n offset += length;\n return offset > 0 ? offset : 0;\n }\n if (offset < length) {\n return offset;\n }\n return Number.isNaN(offset) ? 0 : length;\n}\n\nBuffer.prototype.slice = function slice(start, end) {\n const srcLength = this.length;\n start = adjustOffset(start, srcLength);\n end = end !== undefined ? adjustOffset(end, srcLength) : srcLength;\n const newLength = end > start ? end - start : 0;\n return new FastBuffer(this.buffer, this.byteOffset + start, newLength);\n};\n\nfunction swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n}\n\nBuffer.prototype.swap16 = function swap16() {\n // For Buffer.length < 128, it's generally faster to\n // do the swap in javascript. For larger buffers,\n // dropping down to the native code is faster.\n const len = this.length;\n if (len % 2 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('16-bits');\n if (len < 128) {\n for (var i = 0; i < len; i += 2)\n swap(this, i, i + 1);\n return this;\n }\n return _swap16(this);\n};\n\nBuffer.prototype.swap32 = function swap32() {\n // For Buffer.length < 192, it's generally faster to\n // do the swap in javascript. For larger buffers,\n // dropping down to the native code is faster.\n const len = this.length;\n if (len % 4 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('32-bits');\n if (len < 192) {\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n }\n return _swap32(this);\n};\n\nBuffer.prototype.swap64 = function swap64() {\n // For Buffer.length < 192, it's generally faster to\n // do the swap in javascript. For larger buffers,\n // dropping down to the native code is faster.\n const len = this.length;\n if (len % 8 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('64-bits');\n if (len < 192) {\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n }\n return _swap64(this);\n};\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString;\n\nlet transcode;\nif (process.binding('config').hasIntl) {\n const {\n icuErrName,\n transcode: _transcode\n } = process.binding('icu');\n\n // Transcodes the Buffer from one encoding to another, returning a new\n // Buffer instance.\n transcode = function transcode(source, fromEncoding, toEncoding) {\n if (!isUint8Array(source)) {\n throw new ERR_INVALID_ARG_TYPE('source',\n ['Buffer', 'Uint8Array'], source);\n }\n if (source.length === 0) return Buffer.alloc(0);\n\n fromEncoding = normalizeEncoding(fromEncoding) || fromEncoding;\n toEncoding = normalizeEncoding(toEncoding) || toEncoding;\n const result = _transcode(source, fromEncoding, toEncoding);\n if (typeof result !== 'number')\n return result;\n\n const code = icuErrName(result);\n // eslint-disable-next-line no-restricted-syntax\n const err = new Error(`Unable to transcode Buffer [${code}]`);\n err.code = code;\n err.errno = result;\n throw err;\n };\n}\n\nmodule.exports = exports = {\n Buffer,\n SlowBuffer,\n transcode,\n INSPECT_MAX_BYTES: 50,\n\n // Legacy\n kMaxLength,\n kStringMaxLength\n};\n\nObject.defineProperty(exports, 'constants', {\n configurable: false,\n enumerable: true,\n value: constants\n});\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 32983,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 32981,
"count": 1
},
{
"startOffset": 1796,
"endOffset": 1870,
"count": 0
},
{
"startOffset": 2803,
"endOffset": 2841,
"count": 36
},
{
"startOffset": 3379,
"endOffset": 3385,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "FastBuffer",
"ranges": [
{
"startOffset": 2566,
"endOffset": 2566,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "createUnsafeBuffer",
"ranges": [
{
"startOffset": 3388,
"endOffset": 3481,
"count": 1
},
{
"startOffset": 3479,
"endOffset": 3480,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "createUnsafeArrayBuffer",
"ranges": [
{
"startOffset": 3483,
"endOffset": 3625,
"count": 2
},
{
"startOffset": 3584,
"endOffset": 3589,
"count": 0
},
{
"startOffset": 3623,
"endOffset": 3624,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "createPool",
"ranges": [
{
"startOffset": 3627,
"endOffset": 3749,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "alignPool",
"ranges": [
{
"startOffset": 3765,
"endOffset": 3887,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "showFlaggedDeprecation",
"ranges": [
{
"startOffset": 4191,
"endOffset": 4822,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Buffer",
"ranges": [
{
"startOffset": 5398,
"endOffset": 5731,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 5826,
"endOffset": 5854,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "from",
"ranges": [
{
"startOffset": 6111,
"endOffset": 7218,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "of",
"ranges": [
{
"startOffset": 7589,
"endOffset": 7741,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "assertSize",
"ranges": [
{
"startOffset": 7996,
"endOffset": 8338,
"count": 2
},
{
"startOffset": 8075,
"endOffset": 8140,
"count": 0
},
{
"startOffset": 8181,
"endOffset": 8248,
"count": 0
},
{
"startOffset": 8270,
"endOffset": 8336,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "alloc",
"ranges": [
{
"startOffset": 8439,
"endOffset": 8684,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "allocUnsafe",
"ranges": [
{
"startOffset": 8863,
"endOffset": 8938,
"count": 1
},
{
"startOffset": 8936,
"endOffset": 8937,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "allocUnsafeSlow",
"ranges": [
{
"startOffset": 9179,
"endOffset": 9268,
"count": 1
},
{
"startOffset": 9266,
"endOffset": 9267,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "SlowBuffer",
"ranges": [
{
"startOffset": 9364,
"endOffset": 9534,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "allocate",
"ranges": [
{
"startOffset": 9651,
"endOffset": 9994,
"count": 1
},
{
"startOffset": 9694,
"endOffset": 9728,
"count": 0
},
{
"startOffset": 9815,
"endOffset": 9828,
"count": 0
},
{
"startOffset": 9940,
"endOffset": 9993,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "fromString",
"ranges": [
{
"startOffset": 9996,
"endOffset": 10881,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fromArrayLike",
"ranges": [
{
"startOffset": 10883,
"endOffset": 11039,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fromArrayBuffer",
"ranges": [
{
"startOffset": 11041,
"endOffset": 11739,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fromObject",
"ranges": [
{
"startOffset": 11741,
"endOffset": 12209,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isBuffer",
"ranges": [
{
"startOffset": 12248,
"endOffset": 12302,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "compare",
"ranges": [
{
"startOffset": 12322,
"endOffset": 12647,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isEncoding",
"ranges": [
{
"startOffset": 12670,
"endOffset": 12821,
"count": 1
},
{
"startOffset": 12819,
"endOffset": 12820,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "concat",
"ranges": [
{
"startOffset": 12887,
"endOffset": 14053,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "base64ByteLength",
"ranges": [
{
"startOffset": 14056,
"endOffset": 14292,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "byteLength",
"ranges": [
{
"startOffset": 14294,
"endOffset": 16275,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 16416,
"endOffset": 16510,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 16589,
"endOffset": 16687,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "stringSlice",
"ranges": [
{
"startOffset": 16693,
"endOffset": 18517,
"count": 1
},
{
"startOffset": 16773,
"endOffset": 16806,
"count": 0
},
{
"startOffset": 16930,
"endOffset": 18516,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "copy",
"ranges": [
{
"startOffset": 18545,
"endOffset": 18678,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toString",
"ranges": [
{
"startOffset": 18959,
"endOffset": 19427,
"count": 2
},
{
"startOffset": 19031,
"endOffset": 19079,
"count": 1
},
{
"startOffset": 19075,
"endOffset": 19079,
"count": 0
},
{
"startOffset": 19079,
"endOffset": 19129,
"count": 1
},
{
"startOffset": 19129,
"endOffset": 19139,
"count": 0
},
{
"startOffset": 19139,
"endOffset": 19154,
"count": 1
},
{
"startOffset": 19154,
"endOffset": 19166,
"count": 0
},
{
"startOffset": 19172,
"endOffset": 19182,
"count": 1
},
{
"startOffset": 19182,
"endOffset": 19222,
"count": 0
},
{
"startOffset": 19222,
"endOffset": 19248,
"count": 1
},
{
"startOffset": 19248,
"endOffset": 19260,
"count": 0
},
{
"startOffset": 19266,
"endOffset": 19276,
"count": 1
},
{
"startOffset": 19276,
"endOffset": 19312,
"count": 0
},
{
"startOffset": 19312,
"endOffset": 19365,
"count": 1
},
{
"startOffset": 19365,
"endOffset": 19375,
"count": 0
},
{
"startOffset": 19375,
"endOffset": 19425,
"count": 1
},
{
"startOffset": 19425,
"endOffset": 19426,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "equals",
"ranges": [
{
"startOffset": 19456,
"endOffset": 19715,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "inspect",
"ranges": [
{
"startOffset": 19815,
"endOffset": 20054,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "compare",
"ranges": [
{
"startOffset": 20150,
"endOffset": 21321,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "bidirectionalIndexOf",
"ranges": [
{
"startOffset": 21749,
"endOffset": 22839,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "slowIndexOf",
"ranges": [
{
"startOffset": 22841,
"endOffset": 23562,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "indexOf",
"ranges": [
{
"startOffset": 23591,
"endOffset": 23708,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lastIndexOf",
"ranges": [
{
"startOffset": 23742,
"endOffset": 23864,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "includes",
"ranges": [
{
"startOffset": 23895,
"endOffset": 24000,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fill",
"ranges": [
{
"startOffset": 24178,
"endOffset": 24271,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "_fill",
"ranges": [
{
"startOffset": 24274,
"endOffset": 25943,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "write",
"ranges": [
{
"startOffset": 25970,
"endOffset": 29110,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toJSON",
"ranges": [
{
"startOffset": 29139,
"endOffset": 29386,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "adjustOffset",
"ranges": [
{
"startOffset": 29389,
"endOffset": 29825,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "slice",
"ranges": [
{
"startOffset": 29852,
"endOffset": 30152,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "swap",
"ranges": [
{
"startOffset": 30155,
"endOffset": 30226,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "swap16",
"ranges": [
{
"startOffset": 30254,
"endOffset": 30658,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "swap32",
"ranges": [
{
"startOffset": 30687,
"endOffset": 31131,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "swap64",
"ranges": [
{
"startOffset": 31160,
"endOffset": 31668,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "transcode",
"ranges": [
{
"startOffset": 31981,
"endOffset": 32721,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "cjs-facade:file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"source": "\n export let executor;\n export let $default;\n /* This function is implicitly returned as the module's completion value */\n (() => ({\n setExecutor: fn => executor = fn,\n reflect: {\n exports: { \n default: {\n get: () => $default,\n set: v => $default = v\n }\n }\n }\n }));",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 321,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 128,
"endOffset": 319,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setExecutor",
"ranges": [
{
"startOffset": 154,
"endOffset": 173,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 242,
"endOffset": 256,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 273,
"endOffset": 290,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "console.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n isStackOverflowError,\n codes: {\n ERR_CONSOLE_WRITABLE_STREAM,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n },\n} = require('internal/errors');\nconst { previewEntries } = process.binding('util');\nconst { Buffer: { isBuffer } } = require('buffer');\nconst util = require('util');\nconst {\n isTypedArray, isSet, isMap, isSetIterator, isMapIterator,\n} = util.types;\nconst kCounts = Symbol('counts');\n\nconst {\n keys: ObjectKeys,\n values: ObjectValues,\n} = Object;\nconst hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);\n\nconst {\n isArray: ArrayIsArray,\n from: ArrayFrom,\n} = Array;\n\n// Lazy loaded for startup performance.\nlet cliTable;\n\n// Track amount of indentation required via `console.group()`.\nconst kGroupIndent = Symbol('kGroupIndent');\n\nconst kFormatForStderr = Symbol('kFormatForStderr');\nconst kFormatForStdout = Symbol('kFormatForStdout');\nconst kGetInspectOptions = Symbol('kGetInspectOptions');\nconst kColorMode = Symbol('kColorMode');\n\nfunction Console(options /* or: stdout, stderr, ignoreErrors = true */) {\n if (!(this instanceof Console)) {\n return new Console(...arguments);\n }\n\n if (!options || typeof options.write === 'function') {\n options = {\n stdout: options,\n stderr: arguments[1],\n ignoreErrors: arguments[2]\n };\n }\n\n const {\n stdout,\n stderr = stdout,\n ignoreErrors = true,\n colorMode = 'auto'\n } = options;\n\n if (!stdout || typeof stdout.write !== 'function') {\n throw new ERR_CONSOLE_WRITABLE_STREAM('stdout');\n }\n if (!stderr || typeof stderr.write !== 'function') {\n throw new ERR_CONSOLE_WRITABLE_STREAM('stderr');\n }\n\n var prop = {\n writable: true,\n enumerable: false,\n configurable: true\n };\n prop.value = stdout;\n Object.defineProperty(this, '_stdout', prop);\n prop.value = stderr;\n Object.defineProperty(this, '_stderr', prop);\n prop.value = Boolean(ignoreErrors);\n Object.defineProperty(this, '_ignoreErrors', prop);\n prop.value = new Map();\n Object.defineProperty(this, '_times', prop);\n prop.value = createWriteErrorHandler(stdout);\n Object.defineProperty(this, '_stdoutErrorHandler', prop);\n prop.value = createWriteErrorHandler(stderr);\n Object.defineProperty(this, '_stderrErrorHandler', prop);\n\n if (typeof colorMode !== 'boolean' && colorMode !== 'auto')\n throw new ERR_INVALID_ARG_VALUE('colorMode', colorMode);\n\n this[kCounts] = new Map();\n this[kColorMode] = colorMode;\n\n Object.defineProperty(this, kGroupIndent, { writable: true });\n this[kGroupIndent] = '';\n\n // bind the prototype functions to this Console instance\n var keys = Object.keys(Console.prototype);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n this[k] = this[k].bind(this);\n }\n}\n\n// Make a function that can serve as the callback passed to `stream.write()`.\nfunction createWriteErrorHandler(stream) {\n return (err) => {\n // This conditional evaluates to true if and only if there was an error\n // that was not already emitted (which happens when the _write callback\n // is invoked asynchronously).\n if (err !== null && !stream._writableState.errorEmitted) {\n // If there was an error, it will be emitted on `stream` as\n // an `error` event. Adding a `once` listener will keep that error\n // from becoming an uncaught exception, but since the handler is\n // removed after the event, non-console.* writes won't be affected.\n // we are only adding noop if there is no one else listening for 'error'\n if (stream.listenerCount('error') === 0) {\n stream.on('error', noop);\n }\n }\n };\n}\n\nfunction write(ignoreErrors, stream, string, errorhandler, groupIndent) {\n if (groupIndent.length !== 0) {\n if (string.indexOf('\\n') !== -1) {\n string = string.replace(/\\n/g, `\\n${groupIndent}`);\n }\n string = groupIndent + string;\n }\n string += '\\n';\n\n if (ignoreErrors === false) return stream.write(string);\n\n // There may be an error occurring synchronously (e.g. for files or TTYs\n // on POSIX systems) or asynchronously (e.g. pipes on POSIX systems), so\n // handle both situations.\n try {\n // Add and later remove a noop error handler to catch synchronous errors.\n stream.once('error', noop);\n\n stream.write(string, errorhandler);\n } catch (e) {\n // console is a debugging utility, so it swallowing errors is not desirable\n // even in edge cases such as low stack space.\n if (isStackOverflowError(e))\n throw e;\n // Sorry, there's no proper way to pass along the error here.\n } finally {\n stream.removeListener('error', noop);\n }\n}\n\nconst kColorInspectOptions = { colors: true };\nconst kNoColorInspectOptions = {};\nConsole.prototype[kGetInspectOptions] = function(stream) {\n let color = this[kColorMode];\n if (color === 'auto') {\n color = stream.isTTY && (\n typeof stream.getColorDepth === 'function' ?\n stream.getColorDepth() > 2 : true);\n }\n\n return color ? kColorInspectOptions : kNoColorInspectOptions;\n};\n\nConsole.prototype[kFormatForStdout] = function(args) {\n const opts = this[kGetInspectOptions](this._stdout);\n return util.formatWithOptions(opts, ...args);\n};\n\nConsole.prototype[kFormatForStderr] = function(args) {\n const opts = this[kGetInspectOptions](this._stderr);\n return util.formatWithOptions(opts, ...args);\n};\n\nConsole.prototype.log = function log(...args) {\n write(this._ignoreErrors,\n this._stdout,\n this[kFormatForStdout](args),\n this._stdoutErrorHandler,\n this[kGroupIndent]);\n};\nConsole.prototype.debug = Console.prototype.log;\nConsole.prototype.info = Console.prototype.log;\nConsole.prototype.dirxml = Console.prototype.log;\n\nConsole.prototype.warn = function warn(...args) {\n write(this._ignoreErrors,\n this._stderr,\n this[kFormatForStderr](args),\n this._stderrErrorHandler,\n this[kGroupIndent]);\n};\nConsole.prototype.error = Console.prototype.warn;\n\nConsole.prototype.dir = function dir(object, options) {\n options = Object.assign({\n customInspect: false\n }, this[kGetInspectOptions](this._stdout), options);\n write(this._ignoreErrors,\n this._stdout,\n util.inspect(object, options),\n this._stdoutErrorHandler,\n this[kGroupIndent]);\n};\n\nConsole.prototype.time = function time(label = 'default') {\n // Coerces everything other than Symbol to a string\n label = `${label}`;\n this._times.set(label, process.hrtime());\n};\n\nConsole.prototype.timeEnd = function timeEnd(label = 'default') {\n // Coerces everything other than Symbol to a string\n label = `${label}`;\n const hasWarned = timeLogImpl(this, 'timeEnd', label);\n if (!hasWarned) {\n this._times.delete(label);\n }\n};\n\nConsole.prototype.timeLog = function timeLog(label, ...data) {\n // Coerces everything other than Symbol to a string\n label = `${label}`;\n timeLogImpl(this, 'timeLog', label, data);\n};\n\n// Returns true if label was not found\nfunction timeLogImpl(self, name, label = 'default', data) {\n const time = self._times.get(label);\n if (!time) {\n process.emitWarning(`No such label '${label}' for console.${name}()`);\n return true;\n }\n const duration = process.hrtime(time);\n const ms = duration[0] * 1000 + duration[1] / 1e6;\n if (data === undefined) {\n self.log('%s: %sms', label, ms.toFixed(3));\n } else {\n self.log('%s: %sms', label, ms.toFixed(3), ...data);\n }\n return false;\n}\n\nConsole.prototype.trace = function trace(...args) {\n const err = {\n name: 'Trace',\n message: this[kFormatForStderr](args)\n };\n Error.captureStackTrace(err, trace);\n this.error(err.stack);\n};\n\nConsole.prototype.assert = function assert(expression, ...args) {\n if (!expression) {\n args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`;\n this.warn(this[kFormatForStderr](args));\n }\n};\n\n// Defined by: https://console.spec.whatwg.org/#clear\nConsole.prototype.clear = function clear() {\n // It only makes sense to clear if _stdout is a TTY.\n // Otherwise, do nothing.\n if (this._stdout.isTTY) {\n // The require is here intentionally to avoid readline being\n // required too early when console is first loaded.\n const { cursorTo, clearScreenDown } = require('readline');\n cursorTo(this._stdout, 0, 0);\n clearScreenDown(this._stdout);\n }\n};\n\n// Defined by: https://console.spec.whatwg.org/#count\nConsole.prototype.count = function count(label = 'default') {\n // Ensures that label is a string, and only things that can be\n // coerced to strings. e.g. Symbol is not allowed\n label = `${label}`;\n const counts = this[kCounts];\n let count = counts.get(label);\n if (count === undefined)\n count = 1;\n else\n count++;\n counts.set(label, count);\n this.log(`${label}: ${count}`);\n};\n\n// Not yet defined by the https://console.spec.whatwg.org, but\n// proposed to be added and currently implemented by Edge. Having\n// the ability to reset counters is important to help prevent\n// the counter from being a memory leak.\nConsole.prototype.countReset = function countReset(label = 'default') {\n const counts = this[kCounts];\n counts.delete(`${label}`);\n};\n\nConsole.prototype.group = function group(...data) {\n if (data.length > 0) {\n this.log(...data);\n }\n this[kGroupIndent] += ' ';\n};\nConsole.prototype.groupCollapsed = Console.prototype.group;\n\nConsole.prototype.groupEnd = function groupEnd() {\n this[kGroupIndent] =\n this[kGroupIndent].slice(0, this[kGroupIndent].length - 2);\n};\n\nconst keyKey = 'Key';\nconst valuesKey = 'Values';\nconst indexKey = '(index)';\nconst iterKey = '(iteration index)';\n\n\nconst isArray = (v) => ArrayIsArray(v) || isTypedArray(v) || isBuffer(v);\n\n// https://console.spec.whatwg.org/#table\nConsole.prototype.table = function(tabularData, properties) {\n if (properties !== undefined && !ArrayIsArray(properties))\n throw new ERR_INVALID_ARG_TYPE('properties', 'Array', properties);\n\n if (tabularData == null || typeof tabularData !== 'object')\n return this.log(tabularData);\n\n if (cliTable === undefined) cliTable = require('internal/cli_table');\n const final = (k, v) => this.log(cliTable(k, v));\n\n const inspect = (v) => {\n const opt = { depth: 0, maxArrayLength: 3 };\n if (v !== null && typeof v === 'object' &&\n !isArray(v) && ObjectKeys(v).length > 2)\n opt.depth = -1;\n Object.assign(opt, this[kGetInspectOptions](this._stdout));\n return util.inspect(v, opt);\n };\n const getIndexArray = (length) => ArrayFrom({ length }, (_, i) => inspect(i));\n\n const mapIter = isMapIterator(tabularData);\n let isKeyValue = false;\n let i = 0;\n if (mapIter) {\n const res = previewEntries(tabularData, true);\n tabularData = res[0];\n isKeyValue = res[1];\n }\n\n if (isKeyValue || isMap(tabularData)) {\n const keys = [];\n const values = [];\n let length = 0;\n if (mapIter) {\n for (; i < tabularData.length / 2; ++i) {\n keys.push(inspect(tabularData[i * 2]));\n values.push(inspect(tabularData[i * 2 + 1]));\n length++;\n }\n } else {\n for (const [k, v] of tabularData) {\n keys.push(inspect(k));\n values.push(inspect(v));\n length++;\n }\n }\n return final([\n iterKey, keyKey, valuesKey\n ], [\n getIndexArray(length),\n keys,\n values,\n ]);\n }\n\n const setIter = isSetIterator(tabularData);\n if (setIter)\n tabularData = previewEntries(tabularData);\n\n const setlike = setIter || (mapIter && !isKeyValue) || isSet(tabularData);\n if (setlike) {\n const values = [];\n let length = 0;\n for (const v of tabularData) {\n values.push(inspect(v));\n length++;\n }\n return final([setlike ? iterKey : indexKey, valuesKey], [\n getIndexArray(length),\n values,\n ]);\n }\n\n const map = {};\n let hasPrimitives = false;\n const valuesKeyArray = [];\n const indexKeyArray = ObjectKeys(tabularData);\n\n for (; i < indexKeyArray.length; i++) {\n const item = tabularData[indexKeyArray[i]];\n const primitive = item === null ||\n (typeof item !== 'function' && typeof item !== 'object');\n if (properties === undefined && primitive) {\n hasPrimitives = true;\n valuesKeyArray[i] = inspect(item);\n } else {\n const keys = properties || ObjectKeys(item);\n for (const key of keys) {\n if (map[key] === undefined)\n map[key] = [];\n if ((primitive && properties) || !hasOwnProperty(item, key))\n map[key][i] = '';\n else\n map[key][i] = item == null ? item : inspect(item[key]);\n }\n }\n }\n\n const keys = ObjectKeys(map);\n const values = ObjectValues(map);\n if (hasPrimitives) {\n keys.push(valuesKey);\n values.push(valuesKeyArray);\n }\n keys.unshift(indexKey);\n values.unshift(indexKeyArray);\n\n return final(keys, values);\n};\n\nmodule.exports = new Console({\n stdout: process.stdout,\n stderr: process.stderr\n});\nmodule.exports.Console = Console;\n\nfunction noop() {}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 14074,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 14072,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "Console",
"ranges": [
{
"startOffset": 2189,
"endOffset": 3938,
"count": 1
},
{
"startOffset": 2297,
"endOffset": 2340,
"count": 0
},
{
"startOffset": 2397,
"endOffset": 2509,
"count": 0
},
{
"startOffset": 2671,
"endOffset": 2729,
"count": 0
},
{
"startOffset": 2783,
"endOffset": 2841,
"count": 0
},
{
"startOffset": 3519,
"endOffset": 3575,
"count": 0
},
{
"startOffset": 3876,
"endOffset": 3936,
"count": 19
}
],
"isBlockCoverage": true
},
{
"functionName": "createWriteErrorHandler",
"ranges": [
{
"startOffset": 4018,
"endOffset": 4797,
"count": 2
},
{
"startOffset": 4795,
"endOffset": 4796,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 4070,
"endOffset": 4794,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "write",
"ranges": [
{
"startOffset": 4799,
"endOffset": 5788,
"count": 2
},
{
"startOffset": 4905,
"endOffset": 5048,
"count": 0
},
{
"startOffset": 5098,
"endOffset": 5126,
"count": 0
},
{
"startOffset": 5470,
"endOffset": 5730,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Console.(anonymous function)",
"ranges": [
{
"startOffset": 5912,
"endOffset": 6184,
"count": 2
},
{
"startOffset": 6014,
"endOffset": 6112,
"count": 0
},
{
"startOffset": 6134,
"endOffset": 6156,
"count": 0
},
{
"startOffset": 6182,
"endOffset": 6183,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Console.(anonymous function)",
"ranges": [
{
"startOffset": 6225,
"endOffset": 6346,
"count": 1
},
{
"startOffset": 6344,
"endOffset": 6345,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Console.(anonymous function)",
"ranges": [
{
"startOffset": 6387,
"endOffset": 6508,
"count": 1
},
{
"startOffset": 6506,
"endOffset": 6507,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "log",
"ranges": [
{
"startOffset": 6535,
"endOffset": 6711,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "warn",
"ranges": [
{
"startOffset": 6886,
"endOffset": 7063,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "dir",
"ranges": [
{
"startOffset": 7140,
"endOffset": 7433,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "time",
"ranges": [
{
"startOffset": 7461,
"endOffset": 7617,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "timeEnd",
"ranges": [
{
"startOffset": 7648,
"endOffset": 7875,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "timeLog",
"ranges": [
{
"startOffset": 7906,
"endOffset": 8063,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "timeLogImpl",
"ranges": [
{
"startOffset": 8105,
"endOffset": 8574,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "trace",
"ranges": [
{
"startOffset": 8602,
"endOffset": 8775,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "assert",
"ranges": [
{
"startOffset": 8805,
"endOffset": 8991,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "clear",
"ranges": [
{
"startOffset": 9074,
"endOffset": 9462,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "count",
"ranges": [
{
"startOffset": 9545,
"endOffset": 9910,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "countReset",
"ranges": [
{
"startOffset": 10176,
"endOffset": 10279,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "group",
"ranges": [
{
"startOffset": 10308,
"endOffset": 10417,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "groupEnd",
"ranges": [
{
"startOffset": 10509,
"endOffset": 10619,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isArray",
"ranges": [
{
"startOffset": 10755,
"endOffset": 10811,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Console.table",
"ranges": [
{
"startOffset": 10882,
"endOffset": 13927,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "noop",
"ranges": [
{
"startOffset": 14051,
"endOffset": 14069,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "events.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar spliceOne;\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.usingDomains = false;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nvar errors;\nfunction lazyErrors() {\n if (errors === undefined)\n errors = require('internal/errors').codes;\n return errors;\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || Number.isNaN(arg)) {\n const errors = lazyErrors();\n throw new errors.ERR_OUT_OF_RANGE('defaultMaxListeners',\n 'a non-negative number',\n arg);\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) {\n const errors = lazyErrors();\n throw new errors.ERR_OUT_OF_RANGE('n', 'a non-negative number', n);\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction $getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return $getMaxListeners(this);\n};\n\n// Returns the longest sequence of `a` that fully appears in `b`,\n// of length at least 3.\n// This is a lazy approach but should work well enough, given that stack\n// frames are usually unequal or otherwise appear in groups, and that\n// we only run this code in case of an unhandled exception.\nfunction longestSeqContainedIn(a, b) {\n for (var len = a.length; len >= 3; --len) {\n for (var i = 0; i < a.length - len; ++i) {\n // Attempt to find a[i:i+len] in b\n for (var j = 0; j < b.length - len; ++j) {\n let matches = true;\n for (var k = 0; k < len; ++k) {\n if (a[i + k] !== b[j + k]) {\n matches = false;\n break;\n }\n }\n if (matches)\n return [ len, i, j ];\n }\n }\n }\n\n return [ 0, 0, 0 ];\n}\n\nfunction enhanceStackTrace(err, own) {\n const sep = '\\nEmitted \\'error\\' event at:\\n';\n\n const errStack = err.stack.split('\\n').slice(1);\n const ownStack = own.stack.split('\\n').slice(1);\n\n const [ len, off ] = longestSeqContainedIn(ownStack, errStack);\n if (len > 0) {\n ownStack.splice(off + 1, len - 1,\n ' [... lines matching original stack trace ...]');\n }\n // Do this last, because it is the only operation with side effects.\n err.stack = err.stack + sep + ownStack.join('\\n');\n}\n\nEventEmitter.prototype.emit = function emit(type, ...args) {\n let doError = (type === 'error');\n\n const events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n let er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n try {\n const { kExpandStackSymbol } = require('internal/util');\n const capture = {};\n Error.captureStackTrace(capture, EventEmitter.prototype.emit);\n Object.defineProperty(er, kExpandStackSymbol, {\n value: enhanceStackTrace.bind(null, er, capture),\n configurable: true\n });\n } catch (e) {}\n\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n const errors = lazyErrors();\n const err = new errors.ERR_UNHANDLED_ERROR(er);\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n const handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n Reflect.apply(handler, this, args);\n } else {\n const len = handler.length;\n const listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n Reflect.apply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n if (typeof listener !== 'function') {\n const errors = lazyErrors();\n throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener);\n }\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = $getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n const w = new Error('Possible EventEmitter memory leak detected. ' +\n `${existing.length} ${String(type)} listeners ` +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n process.emitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper(...args) {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n Reflect.apply(this.listener, this.target, args);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n if (typeof listener !== 'function') {\n const errors = lazyErrors();\n throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener);\n }\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n if (typeof listener !== 'function') {\n const errors = lazyErrors();\n throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener);\n }\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n if (typeof listener !== 'function') {\n const errors = lazyErrors();\n throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener);\n }\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n if (spliceOne === undefined)\n spliceOne = require('internal/util').spliceOne;\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n const events = target._events;\n\n if (events === undefined)\n return [];\n\n const evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n const events = this._events;\n\n if (events !== undefined) {\n const evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction unwrapListeners(arr) {\n const ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\n});",
"functions": [
{
"functionName": "EventEmitter",
"ranges": [
{
"startOffset": 1212,
"endOffset": 1271,
"count": 4
}
],
"isBlockCoverage": false
},
{
"functionName": "EventEmitter.init",
"ranges": [
{
"startOffset": 2375,
"endOffset": 2616,
"count": 4
}
],
"isBlockCoverage": false
},
{
"functionName": "emit",
"ranges": [
{
"startOffset": 4627,
"endOffset": 6122,
"count": 5
},
{
"startOffset": 4777,
"endOffset": 4806,
"count": 0
},
{
"startOffset": 4808,
"endOffset": 4847,
"count": 0
},
{
"startOffset": 4919,
"endOffset": 5767,
"count": 0
},
{
"startOffset": 5835,
"endOffset": 5848,
"count": 2
},
{
"startOffset": 5848,
"endOffset": 5932,
"count": 3
},
{
"startOffset": 5932,
"endOffset": 6104,
"count": 0
},
{
"startOffset": 6104,
"endOffset": 6120,
"count": 3
},
{
"startOffset": 6120,
"endOffset": 6121,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "_addListener",
"ranges": [
{
"startOffset": 6125,
"endOffset": 8282,
"count": 9
},
{
"startOffset": 6260,
"endOffset": 6375,
"count": 0
},
{
"startOffset": 6432,
"endOffset": 6517,
"count": 0
},
{
"startOffset": 6702,
"endOffset": 6982,
"count": 2
},
{
"startOffset": 6779,
"endOffset": 6798,
"count": 0
},
{
"startOffset": 7196,
"endOffset": 8262,
"count": 0
},
{
"startOffset": 8280,
"endOffset": 8281,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "addListener",
"ranges": [
{
"startOffset": 8321,
"endOffset": 8413,
"count": 9
},
{
"startOffset": 8411,
"endOffset": 8412,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "_onceWrap",
"ranges": [
{
"startOffset": 8824,
"endOffset": 9061,
"count": 2
},
{
"startOffset": 9059,
"endOffset": 9060,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "once",
"ranges": [
{
"startOffset": 9093,
"endOffset": 9345,
"count": 2
},
{
"startOffset": 9163,
"endOffset": 9278,
"count": 0
},
{
"startOffset": 9343,
"endOffset": 9344,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "removeListener",
"ranges": [
{
"startOffset": 9827,
"endOffset": 11366,
"count": 2
},
{
"startOffset": 9967,
"endOffset": 10094,
"count": 0
},
{
"startOffset": 10165,
"endOffset": 10177,
"count": 0
},
{
"startOffset": 10244,
"endOffset": 10256,
"count": 0
},
{
"startOffset": 10368,
"endOffset": 10403,
"count": 0
},
{
"startOffset": 10499,
"endOffset": 10560,
"count": 0
},
{
"startOffset": 10578,
"endOffset": 11340,
"count": 0
},
{
"startOffset": 11360,
"endOffset": 11365,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "listenerCount",
"ranges": [
{
"startOffset": 13809,
"endOffset": 14099,
"count": 2
},
{
"startOffset": 13982,
"endOffset": 14005,
"count": 0
},
{
"startOffset": 14074,
"endOffset": 14080,
"count": 0
},
{
"startOffset": 14097,
"endOffset": 14098,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/hello-world.mjs",
"source": "export function helloWorld () {\n console.log('Hello, World!')\n}\n",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 65,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "helloWorld",
"ranges": [
{
"startOffset": 7,
"endOffset": 64,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"source": "\n import {\n executor,\n $default\n } from \"\";\n export {\n $default as default\n }\n if (typeof executor === \"function\") {\n // add await to this later if top level await comes along\n executor()\n }",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 211,
"count": 2
},
{
"startOffset": 129,
"endOffset": 211,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "fs.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// Maintainers, keep in mind that ES1-style octal literals (`0666`) are not\n// allowed in strict mode. Use ES6-style octal literals instead (`0o666`).\n\n'use strict';\n\nconst { fs: constants } = process.binding('constants');\nconst {\n S_IFIFO,\n S_IFLNK,\n S_IFMT,\n S_IFREG,\n S_IFSOCK,\n F_OK,\n R_OK,\n W_OK,\n X_OK,\n O_WRONLY,\n O_SYMLINK\n} = constants;\n\nconst { _extend } = require('util');\nconst pathModule = require('path');\nconst { isUint8Array } = require('internal/util/types');\nconst binding = process.binding('fs');\nconst { Buffer, kMaxLength } = require('buffer');\nconst errors = require('internal/errors');\nconst {\n ERR_FS_FILE_TOO_LARGE,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_CALLBACK\n} = errors.codes;\n\nconst { FSReqWrap, statValues } = binding;\nconst { ReadStream, WriteStream } = require('internal/fs/streams');\nconst internalFS = require('internal/fs/utils');\nconst { getPathFromURL } = require('internal/url');\nconst internalUtil = require('internal/util');\nconst {\n copyObject,\n getOptions,\n nullCheck,\n preprocessSymlinkDestination,\n Stats,\n getStatsFromBinding,\n realpathCacheKey,\n stringToFlags,\n stringToSymlinkType,\n toUnixTimestamp,\n validateBuffer,\n validateOffsetLengthRead,\n validateOffsetLengthWrite,\n validatePath\n} = internalFS;\nconst {\n CHAR_FORWARD_SLASH,\n CHAR_BACKWARD_SLASH,\n} = require('internal/constants');\nconst {\n isUint32,\n validateMode,\n validateInteger,\n validateInt32,\n validateUint32\n} = require('internal/validators');\n\nlet promisesWarn = true;\nlet truncateWarn = true;\nlet fs;\n\n// Lazy loaded\nlet promises;\nlet watchers;\nlet ReadFileContext;\n\nconst isWindows = process.platform === 'win32';\n\n\nfunction showTruncateDeprecation() {\n if (truncateWarn) {\n process.emitWarning(\n 'Using fs.truncate with a file descriptor is deprecated. Please use ' +\n 'fs.ftruncate with a file descriptor instead.',\n 'DeprecationWarning', 'DEP0081');\n truncateWarn = false;\n }\n}\n\nfunction handleErrorFromBinding(ctx) {\n if (ctx.errno !== undefined) { // libuv error numbers\n const err = errors.uvException(ctx);\n Error.captureStackTrace(err, handleErrorFromBinding);\n throw err;\n } else if (ctx.error !== undefined) { // errors created in C++ land.\n // TODO(joyeecheung): currently, ctx.error are encoding errors\n // usually caused by memory problems. We need to figure out proper error\n // code(s) for this.\n Error.captureStackTrace(ctx.error, handleErrorFromBinding);\n throw ctx.error;\n }\n}\n\nfunction maybeCallback(cb) {\n if (typeof cb === 'function')\n return cb;\n\n throw new ERR_INVALID_CALLBACK();\n}\n\n// Ensure that callbacks run in the global context. Only use this function\n// for callbacks that are passed to the binding layer, callbacks that are\n// invoked from JS already run in the proper scope.\nfunction makeCallback(cb) {\n if (typeof cb !== 'function') {\n throw new ERR_INVALID_CALLBACK();\n }\n\n return function(...args) {\n return Reflect.apply(cb, undefined, args);\n };\n}\n\n// Special case of `makeCallback()` that is specific to async `*stat()` calls as\n// an optimization, since the data passed back to the callback needs to be\n// transformed anyway.\nfunction makeStatsCallback(cb) {\n if (typeof cb !== 'function') {\n throw new ERR_INVALID_CALLBACK();\n }\n\n return function(err, stats) {\n if (err) return cb(err);\n cb(err, getStatsFromBinding(stats));\n };\n}\n\nconst isFd = isUint32;\n\nfunction isFileType(stats, fileType) {\n // Use stats array directly to avoid creating an fs.Stats instance just for\n // our internal use.\n return (stats[1/* mode */] & S_IFMT) === fileType;\n}\n\nfunction access(path, mode, callback) {\n if (typeof mode === 'function') {\n callback = mode;\n mode = F_OK;\n }\n\n path = getPathFromURL(path);\n validatePath(path);\n\n mode = mode | 0;\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.access(pathModule.toNamespacedPath(path), mode, req);\n}\n\nfunction accessSync(path, mode) {\n path = getPathFromURL(path);\n validatePath(path);\n\n if (mode === undefined)\n mode = F_OK;\n else\n mode = mode | 0;\n\n const ctx = { path };\n binding.access(pathModule.toNamespacedPath(path), mode, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction exists(path, callback) {\n maybeCallback(callback);\n\n function suppressedCallback(err) {\n callback(err ? false : true);\n }\n\n try {\n fs.access(path, F_OK, suppressedCallback);\n } catch (err) {\n return callback(false);\n }\n}\n\nObject.defineProperty(exists, internalUtil.promisify.custom, {\n value: (path) => {\n return new Promise((resolve) => fs.exists(path, resolve));\n }\n});\n\n// fs.existsSync never throws, it only returns true or false.\n// Since fs.existsSync never throws, users have established\n// the expectation that passing invalid arguments to it, even like\n// fs.existsSync(), would only get a false in return, so we cannot signal\n// validation errors to users properly out of compatibility concerns.\n// TODO(joyeecheung): deprecate the never-throw-on-invalid-arguments behavior\nfunction existsSync(path) {\n try {\n fs.accessSync(path, F_OK);\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction readFileAfterOpen(err, fd) {\n const context = this.context;\n\n if (err) {\n context.callback(err);\n return;\n }\n\n context.fd = fd;\n\n const req = new FSReqWrap();\n req.oncomplete = readFileAfterStat;\n req.context = context;\n binding.fstat(fd, false, req);\n}\n\nfunction readFileAfterStat(err, stats) {\n const context = this.context;\n\n if (err)\n return context.close(err);\n\n const size = context.size = isFileType(stats, S_IFREG) ? stats[8] : 0;\n\n if (size === 0) {\n context.buffers = [];\n context.read();\n return;\n }\n\n if (size > kMaxLength) {\n err = new ERR_FS_FILE_TOO_LARGE(size);\n return context.close(err);\n }\n\n try {\n context.buffer = Buffer.allocUnsafeSlow(size);\n } catch (err) {\n return context.close(err);\n }\n context.read();\n}\n\nfunction readFile(path, options, callback) {\n callback = maybeCallback(callback || options);\n options = getOptions(options, { flag: 'r' });\n if (!ReadFileContext)\n ReadFileContext = require('internal/fs/read_file_context');\n const context = new ReadFileContext(callback, options.encoding);\n context.isUserFd = isFd(path); // file descriptor ownership\n\n const req = new FSReqWrap();\n req.context = context;\n req.oncomplete = readFileAfterOpen;\n\n if (context.isUserFd) {\n process.nextTick(function tick() {\n req.oncomplete(null, path);\n });\n return;\n }\n\n path = getPathFromURL(path);\n validatePath(path);\n binding.open(pathModule.toNamespacedPath(path),\n stringToFlags(options.flag || 'r'),\n 0o666,\n req);\n}\n\nfunction tryStatSync(fd, isUserFd) {\n const ctx = {};\n const stats = binding.fstat(fd, false, undefined, ctx);\n if (ctx.errno !== undefined && !isUserFd) {\n fs.closeSync(fd);\n throw errors.uvException(ctx);\n }\n return stats;\n}\n\nfunction tryCreateBuffer(size, fd, isUserFd) {\n let threw = true;\n let buffer;\n try {\n if (size > kMaxLength) {\n throw new ERR_FS_FILE_TOO_LARGE(size);\n }\n buffer = Buffer.allocUnsafe(size);\n threw = false;\n } finally {\n if (threw && !isUserFd) fs.closeSync(fd);\n }\n return buffer;\n}\n\nfunction tryReadSync(fd, isUserFd, buffer, pos, len) {\n let threw = true;\n let bytesRead;\n try {\n bytesRead = fs.readSync(fd, buffer, pos, len);\n threw = false;\n } finally {\n if (threw && !isUserFd) fs.closeSync(fd);\n }\n return bytesRead;\n}\n\nfunction readFileSync(path, options) {\n options = getOptions(options, { flag: 'r' });\n const isUserFd = isFd(path); // file descriptor ownership\n const fd = isUserFd ? path : fs.openSync(path, options.flag || 'r', 0o666);\n\n const stats = tryStatSync(fd, isUserFd);\n const size = isFileType(stats, S_IFREG) ? stats[8] : 0;\n let pos = 0;\n let buffer; // single buffer with file data\n let buffers; // list for when size is unknown\n\n if (size === 0) {\n buffers = [];\n } else {\n buffer = tryCreateBuffer(size, fd, isUserFd);\n }\n\n let bytesRead;\n\n if (size !== 0) {\n do {\n bytesRead = tryReadSync(fd, isUserFd, buffer, pos, size - pos);\n pos += bytesRead;\n } while (bytesRead !== 0 && pos < size);\n } else {\n do {\n // the kernel lies about many files.\n // Go ahead and try to read some bytes.\n buffer = Buffer.allocUnsafe(8192);\n bytesRead = tryReadSync(fd, isUserFd, buffer, 0, 8192);\n if (bytesRead !== 0) {\n buffers.push(buffer.slice(0, bytesRead));\n }\n pos += bytesRead;\n } while (bytesRead !== 0);\n }\n\n if (!isUserFd)\n fs.closeSync(fd);\n\n if (size === 0) {\n // data was collected into the buffers list.\n buffer = Buffer.concat(buffers, pos);\n } else if (pos < size) {\n buffer = buffer.slice(0, pos);\n }\n\n if (options.encoding) buffer = buffer.toString(options.encoding);\n return buffer;\n}\n\nfunction close(fd, callback) {\n validateUint32(fd, 'fd');\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.close(fd, req);\n}\n\nfunction closeSync(fd) {\n validateUint32(fd, 'fd');\n\n const ctx = {};\n binding.close(fd, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction open(path, flags, mode, callback) {\n path = getPathFromURL(path);\n validatePath(path);\n const flagsNumber = stringToFlags(flags);\n if (arguments.length < 4) {\n callback = makeCallback(mode);\n mode = 0o666;\n } else {\n mode = validateMode(mode, 'mode', 0o666);\n callback = makeCallback(callback);\n }\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n\n binding.open(pathModule.toNamespacedPath(path),\n flagsNumber,\n mode,\n req);\n}\n\n\nfunction openSync(path, flags, mode) {\n path = getPathFromURL(path);\n validatePath(path);\n const flagsNumber = stringToFlags(flags);\n mode = validateMode(mode, 'mode', 0o666);\n\n const ctx = { path };\n const result = binding.open(pathModule.toNamespacedPath(path),\n flagsNumber, mode,\n undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\nfunction read(fd, buffer, offset, length, position, callback) {\n validateUint32(fd, 'fd');\n validateBuffer(buffer);\n\n offset |= 0;\n length |= 0;\n\n if (length === 0) {\n return process.nextTick(function tick() {\n callback && callback(null, 0, buffer);\n });\n }\n\n validateOffsetLengthRead(offset, length, buffer.length);\n\n if (!Number.isSafeInteger(position))\n position = -1;\n\n function wrapper(err, bytesRead) {\n // Retain a reference to buffer so that it can't be GC'ed too soon.\n callback && callback(err, bytesRead || 0, buffer);\n }\n\n const req = new FSReqWrap();\n req.oncomplete = wrapper;\n\n binding.read(fd, buffer, offset, length, position, req);\n}\n\nObject.defineProperty(read, internalUtil.customPromisifyArgs,\n { value: ['bytesRead', 'buffer'], enumerable: false });\n\nfunction readSync(fd, buffer, offset, length, position) {\n validateUint32(fd, 'fd');\n validateBuffer(buffer);\n\n offset |= 0;\n length |= 0;\n\n if (length === 0) {\n return 0;\n }\n\n validateOffsetLengthRead(offset, length, buffer.length);\n\n if (!Number.isSafeInteger(position))\n position = -1;\n\n const ctx = {};\n const result = binding.read(fd, buffer, offset, length, position,\n undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\n// usage:\n// fs.write(fd, buffer[, offset[, length[, position]]], callback);\n// OR\n// fs.write(fd, string[, position[, encoding]], callback);\nfunction write(fd, buffer, offset, length, position, callback) {\n function wrapper(err, written) {\n // Retain a reference to buffer so that it can't be GC'ed too soon.\n callback(err, written || 0, buffer);\n }\n\n validateUint32(fd, 'fd');\n\n const req = new FSReqWrap();\n req.oncomplete = wrapper;\n\n if (isUint8Array(buffer)) {\n callback = maybeCallback(callback || position || length || offset);\n if (typeof offset !== 'number')\n offset = 0;\n if (typeof length !== 'number')\n length = buffer.length - offset;\n if (typeof position !== 'number')\n position = null;\n validateOffsetLengthWrite(offset, length, buffer.byteLength);\n return binding.writeBuffer(fd, buffer, offset, length, position, req);\n }\n\n if (typeof buffer !== 'string')\n buffer += '';\n if (typeof position !== 'function') {\n if (typeof offset === 'function') {\n position = offset;\n offset = null;\n } else {\n position = length;\n }\n length = 'utf8';\n }\n callback = maybeCallback(position);\n return binding.writeString(fd, buffer, offset, length, req);\n}\n\nObject.defineProperty(write, internalUtil.customPromisifyArgs,\n { value: ['bytesWritten', 'buffer'], enumerable: false });\n\n// usage:\n// fs.writeSync(fd, buffer[, offset[, length[, position]]]);\n// OR\n// fs.writeSync(fd, string[, position[, encoding]]);\nfunction writeSync(fd, buffer, offset, length, position) {\n validateUint32(fd, 'fd');\n const ctx = {};\n let result;\n if (isUint8Array(buffer)) {\n if (position === undefined)\n position = null;\n if (typeof offset !== 'number')\n offset = 0;\n if (typeof length !== 'number')\n length = buffer.length - offset;\n validateOffsetLengthWrite(offset, length, buffer.byteLength);\n result = binding.writeBuffer(fd, buffer, offset, length, position,\n undefined, ctx);\n } else {\n if (typeof buffer !== 'string')\n buffer += '';\n if (offset === undefined)\n offset = null;\n result = binding.writeString(fd, buffer, offset, length,\n undefined, ctx);\n }\n handleErrorFromBinding(ctx);\n return result;\n}\n\nfunction rename(oldPath, newPath, callback) {\n callback = makeCallback(callback);\n oldPath = getPathFromURL(oldPath);\n validatePath(oldPath, 'oldPath');\n newPath = getPathFromURL(newPath);\n validatePath(newPath, 'newPath');\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.rename(pathModule.toNamespacedPath(oldPath),\n pathModule.toNamespacedPath(newPath),\n req);\n}\n\nfunction renameSync(oldPath, newPath) {\n oldPath = getPathFromURL(oldPath);\n validatePath(oldPath, 'oldPath');\n newPath = getPathFromURL(newPath);\n validatePath(newPath, 'newPath');\n const ctx = { path: oldPath, dest: newPath };\n binding.rename(pathModule.toNamespacedPath(oldPath),\n pathModule.toNamespacedPath(newPath), undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction truncate(path, len, callback) {\n if (typeof path === 'number') {\n showTruncateDeprecation();\n return fs.ftruncate(path, len, callback);\n }\n if (typeof len === 'function') {\n callback = len;\n len = 0;\n } else if (len === undefined) {\n len = 0;\n }\n\n validateInteger(len, 'len');\n callback = maybeCallback(callback);\n fs.open(path, 'r+', function(er, fd) {\n if (er) return callback(er);\n const req = new FSReqWrap();\n req.oncomplete = function oncomplete(er) {\n fs.close(fd, function(er2) {\n callback(er || er2);\n });\n };\n binding.ftruncate(fd, len, req);\n });\n}\n\nfunction truncateSync(path, len) {\n if (typeof path === 'number') {\n // legacy\n showTruncateDeprecation();\n return fs.ftruncateSync(path, len);\n }\n if (len === undefined) {\n len = 0;\n }\n // allow error to be thrown, but still close fd.\n const fd = fs.openSync(path, 'r+');\n let ret;\n\n try {\n ret = fs.ftruncateSync(fd, len);\n } finally {\n fs.closeSync(fd);\n }\n return ret;\n}\n\nfunction ftruncate(fd, len = 0, callback) {\n if (typeof len === 'function') {\n callback = len;\n len = 0;\n }\n validateUint32(fd, 'fd');\n validateInteger(len, 'len');\n len = Math.max(0, len);\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.ftruncate(fd, len, req);\n}\n\nfunction ftruncateSync(fd, len = 0) {\n validateUint32(fd, 'fd');\n validateInteger(len, 'len');\n len = Math.max(0, len);\n const ctx = {};\n binding.ftruncate(fd, len, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction rmdir(path, callback) {\n callback = makeCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.rmdir(pathModule.toNamespacedPath(path), req);\n}\n\nfunction rmdirSync(path) {\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n binding.rmdir(pathModule.toNamespacedPath(path), undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction fdatasync(fd, callback) {\n validateUint32(fd, 'fd');\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.fdatasync(fd, req);\n}\n\nfunction fdatasyncSync(fd) {\n validateUint32(fd, 'fd');\n const ctx = {};\n binding.fdatasync(fd, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction fsync(fd, callback) {\n validateUint32(fd, 'fd');\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.fsync(fd, req);\n}\n\nfunction fsyncSync(fd) {\n validateUint32(fd, 'fd');\n const ctx = {};\n binding.fsync(fd, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction mkdir(path, mode, callback) {\n path = getPathFromURL(path);\n validatePath(path);\n\n if (arguments.length < 3) {\n callback = makeCallback(mode);\n mode = 0o777;\n } else {\n callback = makeCallback(callback);\n mode = validateMode(mode, 'mode', 0o777);\n }\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.mkdir(pathModule.toNamespacedPath(path), mode, req);\n}\n\nfunction mkdirSync(path, mode) {\n path = getPathFromURL(path);\n validatePath(path);\n mode = validateMode(mode, 'mode', 0o777);\n const ctx = { path };\n binding.mkdir(pathModule.toNamespacedPath(path), mode, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction readdir(path, options, callback) {\n callback = makeCallback(typeof options === 'function' ? options : callback);\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path);\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.readdir(pathModule.toNamespacedPath(path), options.encoding, req);\n}\n\nfunction readdirSync(path, options) {\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n const result = binding.readdir(pathModule.toNamespacedPath(path),\n options.encoding, undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\nfunction fstat(fd, options, callback) {\n if (arguments.length < 3) {\n callback = options;\n options = {};\n }\n validateUint32(fd, 'fd');\n const req = new FSReqWrap(options.bigint);\n req.oncomplete = makeStatsCallback(callback);\n binding.fstat(fd, options.bigint, req);\n}\n\nfunction lstat(path, options, callback) {\n if (arguments.length < 3) {\n callback = options;\n options = {};\n }\n callback = makeStatsCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n const req = new FSReqWrap(options.bigint);\n req.oncomplete = callback;\n binding.lstat(pathModule.toNamespacedPath(path), options.bigint, req);\n}\n\nfunction stat(path, options, callback) {\n if (arguments.length < 3) {\n callback = options;\n options = {};\n }\n callback = makeStatsCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n const req = new FSReqWrap(options.bigint);\n req.oncomplete = callback;\n binding.stat(pathModule.toNamespacedPath(path), options.bigint, req);\n}\n\nfunction fstatSync(fd, options = {}) {\n validateUint32(fd, 'fd');\n const ctx = { fd };\n const stats = binding.fstat(fd, options.bigint, undefined, ctx);\n handleErrorFromBinding(ctx);\n return getStatsFromBinding(stats);\n}\n\nfunction lstatSync(path, options = {}) {\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n const stats = binding.lstat(pathModule.toNamespacedPath(path),\n options.bigint, undefined, ctx);\n handleErrorFromBinding(ctx);\n return getStatsFromBinding(stats);\n}\n\nfunction statSync(path, options = {}) {\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n const stats = binding.stat(pathModule.toNamespacedPath(path),\n options.bigint, undefined, ctx);\n handleErrorFromBinding(ctx);\n return getStatsFromBinding(stats);\n}\n\nfunction readlink(path, options, callback) {\n callback = makeCallback(typeof options === 'function' ? options : callback);\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path, 'oldPath');\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.readlink(pathModule.toNamespacedPath(path), options.encoding, req);\n}\n\nfunction readlinkSync(path, options) {\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path, 'oldPath');\n const ctx = { path };\n const result = binding.readlink(pathModule.toNamespacedPath(path),\n options.encoding, undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\nfunction symlink(target, path, type_, callback_) {\n const type = (typeof type_ === 'string' ? type_ : null);\n const callback = makeCallback(arguments[arguments.length - 1]);\n\n target = getPathFromURL(target);\n path = getPathFromURL(path);\n validatePath(target, 'target');\n validatePath(path);\n\n const flags = stringToSymlinkType(type);\n const req = new FSReqWrap();\n req.oncomplete = callback;\n\n binding.symlink(preprocessSymlinkDestination(target, type, path),\n pathModule.toNamespacedPath(path), flags, req);\n}\n\nfunction symlinkSync(target, path, type) {\n type = (typeof type === 'string' ? type : null);\n target = getPathFromURL(target);\n path = getPathFromURL(path);\n validatePath(target, 'target');\n validatePath(path);\n const flags = stringToSymlinkType(type);\n\n const ctx = { path: target, dest: path };\n binding.symlink(preprocessSymlinkDestination(target, type, path),\n pathModule.toNamespacedPath(path), flags, undefined, ctx);\n\n handleErrorFromBinding(ctx);\n}\n\nfunction link(existingPath, newPath, callback) {\n callback = makeCallback(callback);\n\n existingPath = getPathFromURL(existingPath);\n newPath = getPathFromURL(newPath);\n validatePath(existingPath, 'existingPath');\n validatePath(newPath, 'newPath');\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n\n binding.link(pathModule.toNamespacedPath(existingPath),\n pathModule.toNamespacedPath(newPath),\n req);\n}\n\nfunction linkSync(existingPath, newPath) {\n existingPath = getPathFromURL(existingPath);\n newPath = getPathFromURL(newPath);\n validatePath(existingPath, 'existingPath');\n validatePath(newPath, 'newPath');\n\n const ctx = { path: existingPath, dest: newPath };\n const result = binding.link(pathModule.toNamespacedPath(existingPath),\n pathModule.toNamespacedPath(newPath),\n undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\nfunction unlink(path, callback) {\n callback = makeCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.unlink(pathModule.toNamespacedPath(path), req);\n}\n\nfunction unlinkSync(path) {\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n binding.unlink(pathModule.toNamespacedPath(path), undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction fchmod(fd, mode, callback) {\n validateInt32(fd, 'fd', 0);\n mode = validateMode(mode, 'mode');\n callback = makeCallback(callback);\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.fchmod(fd, mode, req);\n}\n\nfunction fchmodSync(fd, mode) {\n validateInt32(fd, 'fd', 0);\n mode = validateMode(mode, 'mode');\n const ctx = {};\n binding.fchmod(fd, mode, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction lchmod(path, mode, callback) {\n callback = maybeCallback(callback);\n fs.open(path, O_WRONLY | O_SYMLINK, function(err, fd) {\n if (err) {\n callback(err);\n return;\n }\n // Prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n fs.fchmod(fd, mode, function(err) {\n fs.close(fd, function(err2) {\n callback(err || err2);\n });\n });\n });\n}\n\nfunction lchmodSync(path, mode) {\n const fd = fs.openSync(path, O_WRONLY | O_SYMLINK);\n\n // Prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n let ret;\n try {\n ret = fs.fchmodSync(fd, mode);\n } finally {\n fs.closeSync(fd);\n }\n return ret;\n}\n\n\nfunction chmod(path, mode, callback) {\n path = getPathFromURL(path);\n validatePath(path);\n mode = validateMode(mode, 'mode');\n callback = makeCallback(callback);\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.chmod(pathModule.toNamespacedPath(path), mode, req);\n}\n\nfunction chmodSync(path, mode) {\n path = getPathFromURL(path);\n validatePath(path);\n mode = validateMode(mode, 'mode');\n\n const ctx = { path };\n binding.chmod(pathModule.toNamespacedPath(path), mode, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction lchown(path, uid, gid, callback) {\n callback = makeCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.lchown(pathModule.toNamespacedPath(path), uid, gid, req);\n}\n\nfunction lchownSync(path, uid, gid) {\n path = getPathFromURL(path);\n validatePath(path);\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n const ctx = { path };\n binding.lchown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction fchown(fd, uid, gid, callback) {\n validateUint32(fd, 'fd');\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.fchown(fd, uid, gid, req);\n}\n\nfunction fchownSync(fd, uid, gid) {\n validateUint32(fd, 'fd');\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n\n const ctx = {};\n binding.fchown(fd, uid, gid, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction chown(path, uid, gid, callback) {\n callback = makeCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.chown(pathModule.toNamespacedPath(path), uid, gid, req);\n}\n\nfunction chownSync(path, uid, gid) {\n path = getPathFromURL(path);\n validatePath(path);\n validateUint32(uid, 'uid');\n validateUint32(gid, 'gid');\n const ctx = { path };\n binding.chown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction utimes(path, atime, mtime, callback) {\n callback = makeCallback(callback);\n path = getPathFromURL(path);\n validatePath(path);\n\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.utimes(pathModule.toNamespacedPath(path),\n toUnixTimestamp(atime),\n toUnixTimestamp(mtime),\n req);\n}\n\nfunction utimesSync(path, atime, mtime) {\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n binding.utimes(pathModule.toNamespacedPath(path),\n toUnixTimestamp(atime), toUnixTimestamp(mtime),\n undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction futimes(fd, atime, mtime, callback) {\n validateUint32(fd, 'fd');\n atime = toUnixTimestamp(atime, 'atime');\n mtime = toUnixTimestamp(mtime, 'mtime');\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.futimes(fd, atime, mtime, req);\n}\n\nfunction futimesSync(fd, atime, mtime) {\n validateUint32(fd, 'fd');\n atime = toUnixTimestamp(atime, 'atime');\n mtime = toUnixTimestamp(mtime, 'mtime');\n const ctx = {};\n binding.futimes(fd, atime, mtime, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction writeAll(fd, isUserFd, buffer, offset, length, position, callback) {\n // write(fd, buffer, offset, length, position, callback)\n fs.write(fd, buffer, offset, length, position, function(writeErr, written) {\n if (writeErr) {\n if (isUserFd) {\n callback(writeErr);\n } else {\n fs.close(fd, function close() {\n callback(writeErr);\n });\n }\n } else if (written === length) {\n if (isUserFd) {\n callback(null);\n } else {\n fs.close(fd, callback);\n }\n } else {\n offset += written;\n length -= written;\n if (position !== null) {\n position += written;\n }\n writeAll(fd, isUserFd, buffer, offset, length, position, callback);\n }\n });\n}\n\nfunction writeFile(path, data, options, callback) {\n callback = maybeCallback(callback || options);\n options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' });\n const flag = options.flag || 'w';\n\n if (isFd(path)) {\n writeFd(path, true);\n return;\n }\n\n fs.open(path, flag, options.mode, function(openErr, fd) {\n if (openErr) {\n callback(openErr);\n } else {\n writeFd(fd, false);\n }\n });\n\n function writeFd(fd, isUserFd) {\n const buffer = isUint8Array(data) ?\n data : Buffer.from('' + data, options.encoding || 'utf8');\n const position = /a/.test(flag) ? null : 0;\n\n writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback);\n }\n}\n\nfunction writeFileSync(path, data, options) {\n options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' });\n const flag = options.flag || 'w';\n\n const isUserFd = isFd(path); // file descriptor ownership\n const fd = isUserFd ? path : fs.openSync(path, flag, options.mode);\n\n if (!isUint8Array(data)) {\n data = Buffer.from('' + data, options.encoding || 'utf8');\n }\n let offset = 0;\n let length = data.length;\n let position = /a/.test(flag) ? null : 0;\n try {\n while (length > 0) {\n const written = fs.writeSync(fd, data, offset, length, position);\n offset += written;\n length -= written;\n if (position !== null) {\n position += written;\n }\n }\n } finally {\n if (!isUserFd) fs.closeSync(fd);\n }\n}\n\nfunction appendFile(path, data, options, callback) {\n callback = maybeCallback(callback || options);\n options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'a' });\n\n // Don't make changes directly on options object\n options = copyObject(options);\n\n // force append behavior when using a supplied file descriptor\n if (!options.flag || isFd(path))\n options.flag = 'a';\n\n fs.writeFile(path, data, options, callback);\n}\n\nfunction appendFileSync(path, data, options) {\n options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'a' });\n\n // Don't make changes directly on options object\n options = copyObject(options);\n\n // force append behavior when using a supplied file descriptor\n if (!options.flag || isFd(path))\n options.flag = 'a';\n\n fs.writeFileSync(path, data, options);\n}\n\nfunction watch(filename, options, listener) {\n if (typeof options === 'function') {\n listener = options;\n }\n options = getOptions(options, {});\n\n // Don't make changes directly on options object\n options = copyObject(options);\n\n if (options.persistent === undefined) options.persistent = true;\n if (options.recursive === undefined) options.recursive = false;\n\n if (!watchers)\n watchers = require('internal/fs/watchers');\n const watcher = new watchers.FSWatcher();\n watcher.start(filename,\n options.persistent,\n options.recursive,\n options.encoding);\n\n if (listener) {\n watcher.addListener('change', listener);\n }\n\n return watcher;\n}\n\n\nconst statWatchers = new Map();\n\nfunction watchFile(filename, options, listener) {\n filename = getPathFromURL(filename);\n validatePath(filename);\n filename = pathModule.resolve(filename);\n let stat;\n\n const defaults = {\n // Poll interval in milliseconds. 5007 is what libev used to use. It's\n // a little on the slow side but let's stick with it for now to keep\n // behavioral changes to a minimum.\n interval: 5007,\n persistent: true\n };\n\n if (options !== null && typeof options === 'object') {\n options = _extend(defaults, options);\n } else {\n listener = options;\n options = defaults;\n }\n\n if (typeof listener !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('listener', 'Function', listener);\n }\n\n stat = statWatchers.get(filename);\n\n if (stat === undefined) {\n if (!watchers)\n watchers = require('internal/fs/watchers');\n stat = new watchers.StatWatcher(options.bigint);\n stat.start(filename, options.persistent, options.interval);\n statWatchers.set(filename, stat);\n }\n\n stat.addListener('change', listener);\n return stat;\n}\n\nfunction unwatchFile(filename, listener) {\n filename = getPathFromURL(filename);\n validatePath(filename);\n filename = pathModule.resolve(filename);\n const stat = statWatchers.get(filename);\n\n if (stat === undefined) return;\n\n if (typeof listener === 'function') {\n stat.removeListener('change', listener);\n } else {\n stat.removeAllListeners('change');\n }\n\n if (stat.listenerCount('change') === 0) {\n stat.stop();\n statWatchers.delete(filename);\n }\n}\n\n\nlet splitRoot;\nif (isWindows) {\n // Regex to find the device root on Windows (e.g. 'c:\\\\'), including trailing\n // slash.\n const splitRootRe = /^(?:[a-zA-Z]:|[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+)?[\\\\/]*/;\n splitRoot = function splitRoot(str) {\n return splitRootRe.exec(str)[0];\n };\n} else {\n splitRoot = function splitRoot(str) {\n for (var i = 0; i < str.length; ++i) {\n if (str.charCodeAt(i) !== CHAR_FORWARD_SLASH)\n return str.slice(0, i);\n }\n return str;\n };\n}\n\nfunction encodeRealpathResult(result, options) {\n if (!options || !options.encoding || options.encoding === 'utf8')\n return result;\n const asBuffer = Buffer.from(result);\n if (options.encoding === 'buffer') {\n return asBuffer;\n } else {\n return asBuffer.toString(options.encoding);\n }\n}\n\n// Finds the next portion of a (partial) path, up to the next path delimiter\nlet nextPart;\nif (isWindows) {\n nextPart = function nextPart(p, i) {\n for (; i < p.length; ++i) {\n const ch = p.charCodeAt(i);\n\n // Check for a separator character\n if (ch === CHAR_BACKWARD_SLASH || ch === CHAR_FORWARD_SLASH)\n return i;\n }\n return -1;\n };\n} else {\n nextPart = function nextPart(p, i) { return p.indexOf('/', i); };\n}\n\nconst emptyObj = Object.create(null);\nfunction realpathSync(p, options) {\n if (!options)\n options = emptyObj;\n else\n options = getOptions(options, emptyObj);\n p = getPathFromURL(p);\n if (typeof p !== 'string') {\n p += '';\n }\n validatePath(p);\n p = pathModule.resolve(p);\n\n const cache = options[realpathCacheKey];\n const maybeCachedResult = cache && cache.get(p);\n if (maybeCachedResult) {\n return maybeCachedResult;\n }\n\n const seenLinks = Object.create(null);\n const knownHard = Object.create(null);\n const original = p;\n\n // current character position in p\n let pos;\n // the partial path so far, including a trailing slash if any\n let current;\n // the partial path without a trailing slash (except when pointing at a root)\n let base;\n // the partial path scanned in the previous round, with slash\n let previous;\n\n // Skip over roots\n current = base = splitRoot(p);\n pos = current.length;\n\n // On windows, check that the root exists. On unix there is no need.\n if (isWindows && !knownHard[base]) {\n const ctx = { path: base };\n binding.lstat(pathModule.toNamespacedPath(base), false, undefined, ctx);\n handleErrorFromBinding(ctx);\n knownHard[base] = true;\n }\n\n // walk down the path, swapping out linked path parts for their real\n // values\n // NB: p.length changes.\n while (pos < p.length) {\n // find the next part\n const result = nextPart(p, pos);\n previous = current;\n if (result === -1) {\n const last = p.slice(pos);\n current += last;\n base = previous + last;\n pos = p.length;\n } else {\n current += p.slice(pos, result + 1);\n base = previous + p.slice(pos, result);\n pos = result + 1;\n }\n\n // continue if not a symlink, break if a pipe/socket\n if (knownHard[base] || (cache && cache.get(base) === base)) {\n if (isFileType(statValues, S_IFIFO) ||\n isFileType(statValues, S_IFSOCK)) {\n break;\n }\n continue;\n }\n\n let resolvedLink;\n const maybeCachedResolved = cache && cache.get(base);\n if (maybeCachedResolved) {\n resolvedLink = maybeCachedResolved;\n } else {\n // Use stats array directly to avoid creating an fs.Stats instance just\n // for our internal use.\n\n const baseLong = pathModule.toNamespacedPath(base);\n const ctx = { path: base };\n const stats = binding.lstat(baseLong, false, undefined, ctx);\n handleErrorFromBinding(ctx);\n\n if (!isFileType(stats, S_IFLNK)) {\n knownHard[base] = true;\n if (cache) cache.set(base, base);\n continue;\n }\n\n // read the link if it wasn't read before\n // dev/ino always return 0 on windows, so skip the check.\n let linkTarget = null;\n let id;\n if (!isWindows) {\n const dev = stats[0].toString(32);\n const ino = stats[7].toString(32);\n id = `${dev}:${ino}`;\n if (seenLinks[id]) {\n linkTarget = seenLinks[id];\n }\n }\n if (linkTarget === null) {\n const ctx = { path: base };\n binding.stat(baseLong, false, undefined, ctx);\n handleErrorFromBinding(ctx);\n linkTarget = binding.readlink(baseLong, undefined, undefined, ctx);\n handleErrorFromBinding(ctx);\n }\n resolvedLink = pathModule.resolve(previous, linkTarget);\n\n if (cache) cache.set(base, resolvedLink);\n if (!isWindows) seenLinks[id] = linkTarget;\n }\n\n // resolve the link, then start over\n p = pathModule.resolve(resolvedLink, p.slice(pos));\n\n // Skip over roots\n current = base = splitRoot(p);\n pos = current.length;\n\n // On windows, check that the root exists. On unix there is no need.\n if (isWindows && !knownHard[base]) {\n const ctx = { path: base };\n binding.lstat(pathModule.toNamespacedPath(base), false, undefined, ctx);\n handleErrorFromBinding(ctx);\n knownHard[base] = true;\n }\n }\n\n if (cache) cache.set(original, p);\n return encodeRealpathResult(p, options);\n}\n\n\nrealpathSync.native = function(path, options) {\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path);\n const ctx = { path };\n const result = binding.realpath(path, options.encoding, undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n};\n\n\nfunction realpath(p, options, callback) {\n callback = maybeCallback(typeof options === 'function' ? options : callback);\n if (!options)\n options = emptyObj;\n else\n options = getOptions(options, emptyObj);\n p = getPathFromURL(p);\n if (typeof p !== 'string') {\n p += '';\n }\n validatePath(p);\n p = pathModule.resolve(p);\n\n const seenLinks = Object.create(null);\n const knownHard = Object.create(null);\n\n // current character position in p\n let pos;\n // the partial path so far, including a trailing slash if any\n let current;\n // the partial path without a trailing slash (except when pointing at a root)\n let base;\n // the partial path scanned in the previous round, with slash\n let previous;\n\n current = base = splitRoot(p);\n pos = current.length;\n\n // On windows, check that the root exists. On unix there is no need.\n if (isWindows && !knownHard[base]) {\n fs.lstat(base, function(err, stats) {\n if (err) return callback(err);\n knownHard[base] = true;\n LOOP();\n });\n } else {\n process.nextTick(LOOP);\n }\n\n // walk down the path, swapping out linked path parts for their real\n // values\n function LOOP() {\n // stop if scanned past end of path\n if (pos >= p.length) {\n return callback(null, encodeRealpathResult(p, options));\n }\n\n // find the next part\n const result = nextPart(p, pos);\n previous = current;\n if (result === -1) {\n const last = p.slice(pos);\n current += last;\n base = previous + last;\n pos = p.length;\n } else {\n current += p.slice(pos, result + 1);\n base = previous + p.slice(pos, result);\n pos = result + 1;\n }\n\n // continue if not a symlink, break if a pipe/socket\n if (knownHard[base]) {\n if (isFileType(statValues, S_IFIFO) ||\n isFileType(statValues, S_IFSOCK)) {\n return callback(null, encodeRealpathResult(p, options));\n }\n return process.nextTick(LOOP);\n }\n\n return fs.lstat(base, gotStat);\n }\n\n function gotStat(err, stats) {\n if (err) return callback(err);\n\n // if not a symlink, skip to the next path part\n if (!stats.isSymbolicLink()) {\n knownHard[base] = true;\n return process.nextTick(LOOP);\n }\n\n // stat & read the link if not read before\n // call gotTarget as soon as the link target is known\n // dev/ino always return 0 on windows, so skip the check.\n let id;\n if (!isWindows) {\n const dev = stats.dev.toString(32);\n const ino = stats.ino.toString(32);\n id = `${dev}:${ino}`;\n if (seenLinks[id]) {\n return gotTarget(null, seenLinks[id], base);\n }\n }\n fs.stat(base, function(err) {\n if (err) return callback(err);\n\n fs.readlink(base, function(err, target) {\n if (!isWindows) seenLinks[id] = target;\n gotTarget(err, target);\n });\n });\n }\n\n function gotTarget(err, target, base) {\n if (err) return callback(err);\n\n gotResolvedLink(pathModule.resolve(previous, target));\n }\n\n function gotResolvedLink(resolvedLink) {\n // resolve the link, then start over\n p = pathModule.resolve(resolvedLink, p.slice(pos));\n current = base = splitRoot(p);\n pos = current.length;\n\n // On windows, check that the root exists. On unix there is no need.\n if (isWindows && !knownHard[base]) {\n fs.lstat(base, function(err) {\n if (err) return callback(err);\n knownHard[base] = true;\n LOOP();\n });\n } else {\n process.nextTick(LOOP);\n }\n }\n}\n\n\nrealpath.native = function(path, options, callback) {\n callback = makeCallback(callback || options);\n options = getOptions(options, {});\n path = getPathFromURL(path);\n validatePath(path);\n const req = new FSReqWrap();\n req.oncomplete = callback;\n return binding.realpath(path, options.encoding, req);\n};\n\nfunction mkdtemp(prefix, options, callback) {\n callback = makeCallback(typeof options === 'function' ? options : callback);\n options = getOptions(options, {});\n if (!prefix || typeof prefix !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix);\n }\n nullCheck(prefix, 'prefix');\n const req = new FSReqWrap();\n req.oncomplete = callback;\n binding.mkdtemp(`${prefix}XXXXXX`, options.encoding, req);\n}\n\n\nfunction mkdtempSync(prefix, options) {\n options = getOptions(options, {});\n if (!prefix || typeof prefix !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix);\n }\n nullCheck(prefix, 'prefix');\n const path = `${prefix}XXXXXX`;\n const ctx = { path };\n const result = binding.mkdtemp(path, options.encoding,\n undefined, ctx);\n handleErrorFromBinding(ctx);\n return result;\n}\n\n\nfunction copyFile(src, dest, flags, callback) {\n if (typeof flags === 'function') {\n callback = flags;\n flags = 0;\n } else if (typeof callback !== 'function') {\n throw new ERR_INVALID_CALLBACK();\n }\n\n src = getPathFromURL(src);\n dest = getPathFromURL(dest);\n validatePath(src, 'src');\n validatePath(dest, 'dest');\n\n src = pathModule._makeLong(src);\n dest = pathModule._makeLong(dest);\n flags = flags | 0;\n const req = new FSReqWrap();\n req.oncomplete = makeCallback(callback);\n binding.copyFile(src, dest, flags, req);\n}\n\n\nfunction copyFileSync(src, dest, flags) {\n src = getPathFromURL(src);\n dest = getPathFromURL(dest);\n validatePath(src, 'src');\n validatePath(dest, 'dest');\n\n const ctx = { path: src, dest }; // non-prefixed\n\n src = pathModule._makeLong(src);\n dest = pathModule._makeLong(dest);\n flags = flags | 0;\n binding.copyFile(src, dest, flags, undefined, ctx);\n handleErrorFromBinding(ctx);\n}\n\nfunction createReadStream(path, options) {\n return new ReadStream(path, options);\n}\n\nfunction createWriteStream(path, options) {\n return new WriteStream(path, options);\n}\n\n\nmodule.exports = fs = {\n appendFile,\n appendFileSync,\n access,\n accessSync,\n chown,\n chownSync,\n chmod,\n chmodSync,\n close,\n closeSync,\n copyFile,\n copyFileSync,\n createReadStream,\n createWriteStream,\n exists,\n existsSync,\n fchown,\n fchownSync,\n fchmod,\n fchmodSync,\n fdatasync,\n fdatasyncSync,\n fstat,\n fstatSync,\n fsync,\n fsyncSync,\n ftruncate,\n ftruncateSync,\n futimes,\n futimesSync,\n lchown,\n lchownSync,\n lchmod: constants.O_SYMLINK !== undefined ? lchmod : undefined,\n lchmodSync: constants.O_SYMLINK !== undefined ? lchmodSync : undefined,\n link,\n linkSync,\n lstat,\n lstatSync,\n mkdir,\n mkdirSync,\n mkdtemp,\n mkdtempSync,\n open,\n openSync,\n readdir,\n readdirSync,\n read,\n readSync,\n readFile,\n readFileSync,\n readlink,\n readlinkSync,\n realpath,\n realpathSync,\n rename,\n renameSync,\n rmdir,\n rmdirSync,\n stat,\n statSync,\n symlink,\n symlinkSync,\n truncate,\n truncateSync,\n unwatchFile,\n unlink,\n unlinkSync,\n utimes,\n utimesSync,\n watch,\n watchFile,\n writeFile,\n writeFileSync,\n write,\n writeSync,\n Stats,\n\n // Stream constructors\n ReadStream,\n WriteStream,\n // Legacy names...\n FileReadStream: ReadStream,\n FileWriteStream: WriteStream,\n\n // For tests\n _toUnixTimestamp: toUnixTimestamp\n};\n\nObject.defineProperties(fs, {\n F_OK: { enumerable: true, value: F_OK || 0 },\n R_OK: { enumerable: true, value: R_OK || 0 },\n W_OK: { enumerable: true, value: W_OK || 0 },\n X_OK: { enumerable: true, value: X_OK || 0 },\n constants: {\n configurable: false,\n enumerable: true,\n value: constants\n },\n promises: {\n configurable: true,\n enumerable: false,\n get() {\n if (promisesWarn) {\n promises = require('internal/fs/promises');\n promisesWarn = false;\n process.emitWarning('The fs.promises API is experimental',\n 'ExperimentalWarning');\n }\n return promises;\n }\n }\n});\n\n// SyncWriteStream is internal. DO NOT USE.\n// This undocumented API was never intended to be made public.\nvar SyncWriteStream = internalFS.SyncWriteStream;\nObject.defineProperty(fs, 'SyncWriteStream', {\n configurable: true,\n get: internalUtil.deprecate(() => SyncWriteStream,\n 'fs.SyncWriteStream is deprecated.', 'DEP0061'),\n set: internalUtil.deprecate((val) => { SyncWriteStream = val; },\n 'fs.SyncWriteStream is deprecated.', 'DEP0061')\n});\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 48549,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 48547,
"count": 1
},
{
"startOffset": 34831,
"endOffset": 35083,
"count": 0
},
{
"startOffset": 35696,
"endOffset": 35957,
"count": 0
},
{
"startOffset": 46586,
"endOffset": 46594,
"count": 0
},
{
"startOffset": 46656,
"endOffset": 46668,
"count": 0
},
{
"startOffset": 47500,
"endOffset": 47504,
"count": 0
},
{
"startOffset": 47548,
"endOffset": 47552,
"count": 0
},
{
"startOffset": 47596,
"endOffset": 47600,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "showTruncateDeprecation",
"ranges": [
{
"startOffset": 2845,
"endOffset": 3132,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "handleErrorFromBinding",
"ranges": [
{
"startOffset": 3134,
"endOffset": 3675,
"count": 22
},
{
"startOffset": 3204,
"endOffset": 3347,
"count": 0
},
{
"startOffset": 3382,
"endOffset": 3673,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "maybeCallback",
"ranges": [
{
"startOffset": 3677,
"endOffset": 3791,
"count": 1
},
{
"startOffset": 3752,
"endOffset": 3790,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "makeCallback",
"ranges": [
{
"startOffset": 3994,
"endOffset": 4181,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeStatsCallback",
"ranges": [
{
"startOffset": 4362,
"endOffset": 4580,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isFileType",
"ranges": [
{
"startOffset": 4606,
"endOffset": 4800,
"count": 37
},
{
"startOffset": 4798,
"endOffset": 4799,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "access",
"ranges": [
{
"startOffset": 4802,
"endOffset": 5133,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "accessSync",
"ranges": [
{
"startOffset": 5135,
"endOffset": 5426,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "exists",
"ranges": [
{
"startOffset": 5428,
"endOffset": 5672,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "value",
"ranges": [
{
"startOffset": 5746,
"endOffset": 5824,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "existsSync",
"ranges": [
{
"startOffset": 6241,
"endOffset": 6364,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readFileAfterOpen",
"ranges": [
{
"startOffset": 6366,
"endOffset": 6642,
"count": 1
},
{
"startOffset": 6448,
"endOffset": 6492,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "readFileAfterStat",
"ranges": [
{
"startOffset": 6644,
"endOffset": 7155,
"count": 1
},
{
"startOffset": 6733,
"endOffset": 6759,
"count": 0
},
{
"startOffset": 6829,
"endOffset": 6832,
"count": 0
},
{
"startOffset": 6853,
"endOffset": 6916,
"count": 0
},
{
"startOffset": 6943,
"endOffset": 7022,
"count": 0
},
{
"startOffset": 7087,
"endOffset": 7135,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "readFile",
"ranges": [
{
"startOffset": 7157,
"endOffset": 7934,
"count": 1
},
{
"startOffset": 7636,
"endOffset": 7734,
"count": 0
},
{
"startOffset": 7881,
"endOffset": 7887,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tick",
"ranges": [
{
"startOffset": 7659,
"endOffset": 7716,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "tryStatSync",
"ranges": [
{
"startOffset": 7936,
"endOffset": 8173,
"count": 1
},
{
"startOffset": 8079,
"endOffset": 8091,
"count": 0
},
{
"startOffset": 8093,
"endOffset": 8155,
"count": 0
},
{
"startOffset": 8171,
"endOffset": 8172,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tryCreateBuffer",
"ranges": [
{
"startOffset": 8175,
"endOffset": 8484,
"count": 1
},
{
"startOffset": 8291,
"endOffset": 8343,
"count": 0
},
{
"startOffset": 8430,
"endOffset": 8442,
"count": 0
},
{
"startOffset": 8444,
"endOffset": 8461,
"count": 0
},
{
"startOffset": 8482,
"endOffset": 8483,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tryReadSync",
"ranges": [
{
"startOffset": 8486,
"endOffset": 8741,
"count": 1
},
{
"startOffset": 8684,
"endOffset": 8696,
"count": 0
},
{
"startOffset": 8698,
"endOffset": 8715,
"count": 0
},
{
"startOffset": 8739,
"endOffset": 8740,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "readFileSync",
"ranges": [
{
"startOffset": 8743,
"endOffset": 10133,
"count": 1
},
{
"startOffset": 8912,
"endOffset": 8918,
"count": 0
},
{
"startOffset": 8952,
"endOffset": 8958,
"count": 0
},
{
"startOffset": 9065,
"endOffset": 9068,
"count": 0
},
{
"startOffset": 9198,
"endOffset": 9221,
"count": 0
},
{
"startOffset": 9473,
"endOffset": 9827,
"count": 0
},
{
"startOffset": 9887,
"endOffset": 9983,
"count": 0
},
{
"startOffset": 10005,
"endOffset": 10045,
"count": 0
},
{
"startOffset": 10131,
"endOffset": 10132,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "close",
"ranges": [
{
"startOffset": 10135,
"endOffset": 10295,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "closeSync",
"ranges": [
{
"startOffset": 10297,
"endOffset": 10438,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "open",
"ranges": [
{
"startOffset": 10440,
"endOffset": 10948,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "openSync",
"ranges": [
{
"startOffset": 10951,
"endOffset": 11366,
"count": 1
},
{
"startOffset": 11364,
"endOffset": 11365,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "read",
"ranges": [
{
"startOffset": 11368,
"endOffset": 12052,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readSync",
"ranges": [
{
"startOffset": 12195,
"endOffset": 12681,
"count": 1
},
{
"startOffset": 12359,
"endOffset": 12378,
"count": 0
},
{
"startOffset": 12679,
"endOffset": 12680,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "write",
"ranges": [
{
"startOffset": 12827,
"endOffset": 13921,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeSync",
"ranges": [
{
"startOffset": 14200,
"endOffset": 15002,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "rename",
"ranges": [
{
"startOffset": 15004,
"endOffset": 15427,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "renameSync",
"ranges": [
{
"startOffset": 15429,
"endOffset": 15822,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "truncate",
"ranges": [
{
"startOffset": 15824,
"endOffset": 16448,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "truncateSync",
"ranges": [
{
"startOffset": 16450,
"endOffset": 16853,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ftruncate",
"ranges": [
{
"startOffset": 16855,
"endOffset": 17166,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ftruncateSync",
"ranges": [
{
"startOffset": 17168,
"endOffset": 17387,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "rmdir",
"ranges": [
{
"startOffset": 17389,
"endOffset": 17630,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "rmdirSync",
"ranges": [
{
"startOffset": 17632,
"endOffset": 17836,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fdatasync",
"ranges": [
{
"startOffset": 17838,
"endOffset": 18006,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fdatasyncSync",
"ranges": [
{
"startOffset": 18008,
"endOffset": 18156,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fsync",
"ranges": [
{
"startOffset": 18158,
"endOffset": 18318,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fsyncSync",
"ranges": [
{
"startOffset": 18320,
"endOffset": 18460,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "mkdir",
"ranges": [
{
"startOffset": 18462,
"endOffset": 18863,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "mkdirSync",
"ranges": [
{
"startOffset": 18865,
"endOffset": 19125,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readdir",
"ranges": [
{
"startOffset": 19127,
"endOffset": 19479,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readdirSync",
"ranges": [
{
"startOffset": 19481,
"endOffset": 19818,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fstat",
"ranges": [
{
"startOffset": 19820,
"endOffset": 20100,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lstat",
"ranges": [
{
"startOffset": 20102,
"endOffset": 20463,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "stat",
"ranges": [
{
"startOffset": 20465,
"endOffset": 20824,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fstatSync",
"ranges": [
{
"startOffset": 20826,
"endOffset": 21051,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lstatSync",
"ranges": [
{
"startOffset": 21053,
"endOffset": 21368,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "statSync",
"ranges": [
{
"startOffset": 21370,
"endOffset": 21682,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readlink",
"ranges": [
{
"startOffset": 21684,
"endOffset": 22048,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readlinkSync",
"ranges": [
{
"startOffset": 22050,
"endOffset": 22401,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "symlink",
"ranges": [
{
"startOffset": 22403,
"endOffset": 22942,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "symlinkSync",
"ranges": [
{
"startOffset": 22944,
"endOffset": 23426,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "link",
"ranges": [
{
"startOffset": 23428,
"endOffset": 23876,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "linkSync",
"ranges": [
{
"startOffset": 23878,
"endOffset": 24378,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "unlink",
"ranges": [
{
"startOffset": 24380,
"endOffset": 24623,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "unlinkSync",
"ranges": [
{
"startOffset": 24625,
"endOffset": 24831,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fchmod",
"ranges": [
{
"startOffset": 24833,
"endOffset": 25070,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fchmodSync",
"ranges": [
{
"startOffset": 25072,
"endOffset": 25265,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lchmod",
"ranges": [
{
"startOffset": 25267,
"endOffset": 25719,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lchmodSync",
"ranges": [
{
"startOffset": 25721,
"endOffset": 26043,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "chmod",
"ranges": [
{
"startOffset": 26046,
"endOffset": 26337,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "chmodSync",
"ranges": [
{
"startOffset": 26339,
"endOffset": 26593,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lchown",
"ranges": [
{
"startOffset": 26595,
"endOffset": 26918,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lchownSync",
"ranges": [
{
"startOffset": 26920,
"endOffset": 27206,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fchown",
"ranges": [
{
"startOffset": 27208,
"endOffset": 27451,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "fchownSync",
"ranges": [
{
"startOffset": 27453,
"endOffset": 27676,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "chown",
"ranges": [
{
"startOffset": 27678,
"endOffset": 28000,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "chownSync",
"ranges": [
{
"startOffset": 28002,
"endOffset": 28286,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "utimes",
"ranges": [
{
"startOffset": 28288,
"endOffset": 28645,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "utimesSync",
"ranges": [
{
"startOffset": 28647,
"endOffset": 28949,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "futimes",
"ranges": [
{
"startOffset": 28951,
"endOffset": 29229,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "futimesSync",
"ranges": [
{
"startOffset": 29231,
"endOffset": 29489,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeAll",
"ranges": [
{
"startOffset": 29491,
"endOffset": 30238,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeFile",
"ranges": [
{
"startOffset": 30240,
"endOffset": 30943,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeFileSync",
"ranges": [
{
"startOffset": 30945,
"endOffset": 31709,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "appendFile",
"ranges": [
{
"startOffset": 31711,
"endOffset": 32151,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "appendFileSync",
"ranges": [
{
"startOffset": 32153,
"endOffset": 32532,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "watch",
"ranges": [
{
"startOffset": 32534,
"endOffset": 33233,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "watchFile",
"ranges": [
{
"startOffset": 33269,
"endOffset": 34325,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "unwatchFile",
"ranges": [
{
"startOffset": 34327,
"endOffset": 34798,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "splitRoot",
"ranges": [
{
"startOffset": 35014,
"endOffset": 35080,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "splitRoot",
"ranges": [
{
"startOffset": 35105,
"endOffset": 35283,
"count": 3
},
{
"startOffset": 35172,
"endOffset": 35263,
"count": 6
},
{
"startOffset": 35234,
"endOffset": 35263,
"count": 3
},
{
"startOffset": 35279,
"endOffset": 35282,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "encodeRealpathResult",
"ranges": [
{
"startOffset": 35288,
"endOffset": 35588,
"count": 3
},
{
"startOffset": 35373,
"endOffset": 35403,
"count": 0
},
{
"startOffset": 35423,
"endOffset": 35587,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "nextPart",
"ranges": [
{
"startOffset": 35711,
"endOffset": 35954,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "nextPart",
"ranges": [
{
"startOffset": 35978,
"endOffset": 36031,
"count": 27
},
{
"startOffset": 36029,
"endOffset": 36030,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "realpathSync",
"ranges": [
{
"startOffset": 36074,
"endOffset": 40011,
"count": 3
},
{
"startOffset": 36130,
"endOffset": 36149,
"count": 0
},
{
"startOffset": 36256,
"endOffset": 36274,
"count": 0
},
{
"startOffset": 36443,
"endOffset": 36478,
"count": 0
},
{
"startOffset": 37051,
"endOffset": 37070,
"count": 0
},
{
"startOffset": 37072,
"endOffset": 37247,
"count": 0
},
{
"startOffset": 37384,
"endOffset": 39928,
"count": 27
},
{
"startOffset": 37496,
"endOffset": 37611,
"count": 3
},
{
"startOffset": 37611,
"endOffset": 37737,
"count": 24
},
{
"startOffset": 37860,
"endOffset": 37997,
"count": 8
},
{
"startOffset": 37951,
"endOffset": 37975,
"count": 0
},
{
"startOffset": 37991,
"endOffset": 37997,
"count": 0
},
{
"startOffset": 37997,
"endOffset": 38077,
"count": 19
},
{
"startOffset": 38108,
"endOffset": 38157,
"count": 0
},
{
"startOffset": 38157,
"endOffset": 39442,
"count": 19
},
{
"startOffset": 38603,
"endOffset": 39442,
"count": 0
},
{
"startOffset": 39442,
"endOffset": 39737,
"count": 0
},
{
"startOffset": 39739,
"endOffset": 39928,
"count": 0
},
{
"startOffset": 40009,
"endOffset": 40010,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "realpathSync.native",
"ranges": [
{
"startOffset": 40036,
"endOffset": 40300,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "realpath",
"ranges": [
{
"startOffset": 40304,
"endOffset": 43798,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "realpath.native",
"ranges": [
{
"startOffset": 43819,
"endOffset": 44110,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "mkdtemp",
"ranges": [
{
"startOffset": 44113,
"endOffset": 44543,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "mkdtempSync",
"ranges": [
{
"startOffset": 44546,
"endOffset": 44983,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "copyFile",
"ranges": [
{
"startOffset": 44986,
"endOffset": 45528,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "copyFileSync",
"ranges": [
{
"startOffset": 45531,
"endOffset": 45924,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createReadStream",
"ranges": [
{
"startOffset": 45926,
"endOffset": 46010,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createWriteStream",
"ranges": [
{
"startOffset": 46012,
"endOffset": 46098,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 47757,
"endOffset": 48028,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Object.defineProperty.get.internalUtil.deprecate",
"ranges": [
{
"startOffset": 48294,
"endOffset": 48315,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Object.defineProperty.set.internalUtil.deprecate",
"ranges": [
{
"startOffset": 48426,
"endOffset": 48461,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/assert.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { inspect } = require('util');\nconst { codes: {\n ERR_INVALID_ARG_TYPE\n} } = require('internal/errors');\n\nlet blue = '';\nlet green = '';\nlet red = '';\nlet white = '';\n\nconst READABLE_OPERATOR = {\n deepStrictEqual: 'Input A expected to strictly deep-equal input B',\n notDeepStrictEqual: 'Input A expected to strictly not deep-equal input B',\n strictEqual: 'Input A expected to strictly equal input B',\n notStrictEqual: 'Input A expected to strictly not equal input B'\n};\n\nfunction copyError(source) {\n const keys = Object.keys(source);\n const target = Object.create(Object.getPrototypeOf(source));\n for (const key of keys) {\n target[key] = source[key];\n }\n Object.defineProperty(target, 'message', { value: source.message });\n return target;\n}\n\nfunction inspectValue(val) {\n // The util.inspect default values could be changed. This makes sure the\n // error messages contain the necessary information nevertheless.\n return inspect(\n val,\n {\n compact: false,\n customInspect: false,\n depth: 1000,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison.\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false\n }\n ).split('\\n');\n}\n\nfunction createErrDiff(actual, expected, operator) {\n var other = '';\n var res = '';\n var lastPos = 0;\n var end = '';\n var skipped = false;\n const actualLines = inspectValue(actual);\n const expectedLines = inspectValue(expected);\n const msg = READABLE_OPERATOR[operator] +\n `:\\n${green}+ expected${white} ${red}- actual${white}`;\n const skippedMsg = ` ${blue}...${white} Lines skipped`;\n\n // Remove all ending lines that match (this optimizes the output for\n // readability by reducing the number of total changed lines).\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n var i = 0;\n while (a === b) {\n if (i++ < 2) {\n end = `\\n ${a}${end}`;\n } else {\n other = a;\n }\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0)\n break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n if (i > 3) {\n end = `\\n${blue}...${white}${end}`;\n skipped = true;\n }\n if (other !== '') {\n end = `\\n ${other}${end}`;\n other = '';\n }\n\n const maxLines = Math.max(actualLines.length, expectedLines.length);\n var printedLines = 0;\n var identical = 0;\n for (i = 0; i < maxLines; i++) {\n // Only extra expected lines exist\n const cur = i - lastPos;\n if (actualLines.length < i + 1) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += `\\n${blue}...${white}`;\n skipped = true;\n } else if (cur > 3) {\n res += `\\n ${expectedLines[i - 2]}`;\n printedLines++;\n }\n res += `\\n ${expectedLines[i - 1]}`;\n printedLines++;\n }\n lastPos = i;\n other += `\\n${green}+${white} ${expectedLines[i]}`;\n printedLines++;\n // Only extra actual lines exist\n } else if (expectedLines.length < i + 1) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += `\\n${blue}...${white}`;\n skipped = true;\n } else if (cur > 3) {\n res += `\\n ${actualLines[i - 2]}`;\n printedLines++;\n }\n res += `\\n ${actualLines[i - 1]}`;\n printedLines++;\n }\n lastPos = i;\n res += `\\n${red}-${white} ${actualLines[i]}`;\n printedLines++;\n // Lines diverge\n } else if (actualLines[i] !== expectedLines[i]) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += `\\n${blue}...${white}`;\n skipped = true;\n } else if (cur > 3) {\n res += `\\n ${actualLines[i - 2]}`;\n printedLines++;\n }\n res += `\\n ${actualLines[i - 1]}`;\n printedLines++;\n }\n lastPos = i;\n res += `\\n${red}-${white} ${actualLines[i]}`;\n other += `\\n${green}+${white} ${expectedLines[i]}`;\n printedLines += 2;\n // Lines are identical\n } else {\n res += other;\n other = '';\n if (cur === 1 || i === 0) {\n res += `\\n ${actualLines[i]}`;\n printedLines++;\n }\n identical++;\n }\n // Inspected object to big (Show ~20 rows max)\n if (printedLines > 20 && i < maxLines - 2) {\n return `${msg}${skippedMsg}\\n${res}\\n${blue}...${white}${other}\\n` +\n `${blue}...${white}`;\n }\n }\n\n // Strict equal with identical objects that are not identical by reference.\n if (identical === maxLines) {\n // E.g., assert.deepStrictEqual(Symbol(), Symbol())\n const base = operator === 'strictEqual' ?\n 'Input objects identical but not reference equal:' :\n 'Input objects not identical:';\n\n // We have to get the result again. The lines were all removed before.\n const actualLines = inspectValue(actual);\n\n // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n if (actualLines.length > 30) {\n actualLines[26] = `${blue}...${white}`;\n while (actualLines.length > 27) {\n actualLines.pop();\n }\n }\n\n return `${base}\\n\\n${actualLines.join('\\n')}\\n`;\n }\n return `${msg}${skipped ? skippedMsg : ''}\\n${res}${other}${end}`;\n}\n\nclass AssertionError extends Error {\n constructor(options) {\n if (typeof options !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n var {\n actual,\n expected,\n message,\n operator,\n stackStartFn\n } = options;\n\n if (message != null) {\n super(String(message));\n } else {\n if (process.stdout.isTTY) {\n // Reset on each call to make sure we handle dynamically set environment\n // variables correct.\n if (process.stdout.getColorDepth() !== 1) {\n blue = '\\u001b[34m';\n green = '\\u001b[32m';\n white = '\\u001b[39m';\n red = '\\u001b[31m';\n } else {\n blue = '';\n green = '';\n white = '';\n red = '';\n }\n }\n // Prevent the error stack from being visible by duplicating the error\n // in a very close way to the original in case both sides are actually\n // instances of Error.\n if (typeof actual === 'object' && actual !== null &&\n typeof expected === 'object' && expected !== null &&\n 'stack' in actual && actual instanceof Error &&\n 'stack' in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n\n if (operator === 'deepStrictEqual' || operator === 'strictEqual') {\n super(createErrDiff(actual, expected, operator));\n } else if (operator === 'notDeepStrictEqual' ||\n operator === 'notStrictEqual') {\n // In case the objects are equal but the operator requires unequal, show\n // the first object and say A equals B\n const res = inspectValue(actual);\n const base = `Identical input passed to ${operator}:`;\n\n // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n if (res.length > 30) {\n res[26] = `${blue}...${white}`;\n while (res.length > 27) {\n res.pop();\n }\n }\n\n // Only print a single input.\n if (res.length === 1) {\n super(`${base} ${res[0]}`);\n } else {\n super(`${base}\\n\\n${res.join('\\n')}\\n`);\n }\n } else {\n let res = inspect(actual);\n let other = inspect(expected);\n if (res.length > 128)\n res = `${res.slice(0, 125)}...`;\n if (other.length > 128)\n other = `${other.slice(0, 125)}...`;\n super(`${res} ${operator} ${other}`);\n }\n }\n\n this.generatedMessage = !message;\n this.name = 'AssertionError [ERR_ASSERTION]';\n this.code = 'ERR_ASSERTION';\n this.actual = actual;\n this.expected = expected;\n this.operator = operator;\n Error.captureStackTrace(this, stackStartFn);\n }\n}\n\nmodule.exports = {\n AssertionError,\n errorCache: new Map()\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 8441,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 8439,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "copyError",
"ranges": [
{
"startOffset": 543,
"endOffset": 823,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "inspectValue",
"ranges": [
{
"startOffset": 825,
"endOffset": 1455,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createErrDiff",
"ranges": [
{
"startOffset": 1457,
"endOffset": 5549,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "AssertionError",
"ranges": [
{
"startOffset": 5590,
"endOffset": 8369,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/async_hooks.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n ERR_ASYNC_TYPE,\n ERR_INVALID_ASYNC_ID\n} = require('internal/errors').codes;\nconst async_wrap = process.binding('async_wrap');\n/* async_hook_fields is a Uint32Array wrapping the uint32_t array of\n * Environment::AsyncHooks::fields_[]. Each index tracks the number of active\n * hooks for each type.\n *\n * async_id_fields is a Float64Array wrapping the double array of\n * Environment::AsyncHooks::async_id_fields_[]. Each index contains the ids for\n * the various asynchronous states of the application. These are:\n * kExecutionAsyncId: The async_id assigned to the resource responsible for the\n * current execution stack.\n * kTriggerAsyncId: The async_id of the resource that caused (or 'triggered')\n * the resource corresponding to the current execution stack.\n * kAsyncIdCounter: Incremental counter tracking the next assigned async_id.\n * kDefaultTriggerAsyncId: Written immediately before a resource's constructor\n * that sets the value of the init()'s triggerAsyncId. The precedence order\n * of retrieving the triggerAsyncId value is:\n * 1. the value passed directly to the constructor\n * 2. value set in kDefaultTriggerAsyncId\n * 3. executionAsyncId of the current resource.\n *\n * async_ids_stack is a Float64Array that contains part of the async ID\n * stack. Each pushAsyncIds() call adds two doubles to it, and each\n * popAsyncIds() call removes two doubles from it.\n * It has a fixed size, so if that is exceeded, calls to the native\n * side are used instead in pushAsyncIds() and popAsyncIds().\n */\nconst { async_hook_fields, async_id_fields } = async_wrap;\n// Store the pair executionAsyncId and triggerAsyncId in a std::stack on\n// Environment::AsyncHooks::async_ids_stack_ tracks the resource responsible for\n// the current execution stack. This is unwound as each resource exits. In the\n// case of a fatal exception this stack is emptied after calling each hook's\n// after() callback.\nconst { pushAsyncIds: pushAsyncIds_, popAsyncIds: popAsyncIds_ } = async_wrap;\n// For performance reasons, only track Promises when a hook is enabled.\nconst { enablePromiseHook, disablePromiseHook } = async_wrap;\n// Properties in active_hooks are used to keep track of the set of hooks being\n// executed in case another hook is enabled/disabled. The new set of hooks is\n// then restored once the active set of hooks is finished executing.\nconst active_hooks = {\n // Array of all AsyncHooks that will be iterated whenever an async event\n // fires. Using var instead of (preferably const) in order to assign\n // active_hooks.tmp_array if a hook is enabled/disabled during hook\n // execution.\n array: [],\n // Use a counter to track nested calls of async hook callbacks and make sure\n // the active_hooks.array isn't altered mid execution.\n call_depth: 0,\n // Use to temporarily store and updated active_hooks.array if the user\n // enables or disables a hook while hooks are being processed. If a hook is\n // enabled() or disabled() during hook execution then the current set of\n // active hooks is duplicated and set equal to active_hooks.tmp_array. Any\n // subsequent changes are on the duplicated array. When all hooks have\n // completed executing active_hooks.tmp_array is assigned to\n // active_hooks.array.\n tmp_array: null,\n // Keep track of the field counts held in active_hooks.tmp_array. Because the\n // async_hook_fields can't be reassigned, store each uint32 in an array that\n // is written back to async_hook_fields when active_hooks.array is restored.\n tmp_fields: null\n};\n\nconst { registerDestroyHook } = async_wrap;\n\n// Each constant tracks how many callbacks there are for any given step of\n// async execution. These are tracked so if the user didn't include callbacks\n// for a given step, that step can bail out early.\nconst { kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,\n kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,\n kDefaultTriggerAsyncId, kStackLength } = async_wrap.constants;\n\n// Used in AsyncHook and AsyncResource.\nconst async_id_symbol = Symbol('asyncId');\nconst trigger_async_id_symbol = Symbol('triggerAsyncId');\nconst init_symbol = Symbol('init');\nconst before_symbol = Symbol('before');\nconst after_symbol = Symbol('after');\nconst destroy_symbol = Symbol('destroy');\nconst promise_resolve_symbol = Symbol('promiseResolve');\nconst emitBeforeNative = emitHookFactory(before_symbol, 'emitBeforeNative');\nconst emitAfterNative = emitHookFactory(after_symbol, 'emitAfterNative');\nconst emitDestroyNative = emitHookFactory(destroy_symbol, 'emitDestroyNative');\nconst emitPromiseResolveNative =\n emitHookFactory(promise_resolve_symbol, 'emitPromiseResolveNative');\n\n// Setup the callbacks that node::AsyncWrap will call when there are hooks to\n// process. They use the same functions as the JS embedder API. These callbacks\n// are setup immediately to prevent async_wrap.setupHooks() from being hijacked\n// and the cost of doing so is negligible.\nasync_wrap.setupHooks({ init: emitInitNative,\n before: emitBeforeNative,\n after: emitAfterNative,\n destroy: emitDestroyNative,\n promise_resolve: emitPromiseResolveNative });\n\n// Used to fatally abort the process if a callback throws.\nfunction fatalError(e) {\n if (typeof e.stack === 'string') {\n process._rawDebug(e.stack);\n } else {\n const o = { message: e };\n Error.captureStackTrace(o, fatalError);\n process._rawDebug(o.stack);\n }\n if (process.binding('config').shouldAbortOnUncaughtException) {\n process.abort();\n }\n process.exit(1);\n}\n\n\nfunction validateAsyncId(asyncId, type) {\n // Skip validation when async_hooks is disabled\n if (async_hook_fields[kCheck] <= 0) return;\n\n if (!Number.isSafeInteger(asyncId) || asyncId < -1) {\n fatalError(new ERR_INVALID_ASYNC_ID(type, asyncId));\n }\n}\n\n// Emit From Native //\n\n// Used by C++ to call all init() callbacks. Because some state can be setup\n// from C++ there's no need to perform all the same operations as in\n// emitInitScript.\nfunction emitInitNative(asyncId, type, triggerAsyncId, resource) {\n active_hooks.call_depth += 1;\n // Use a single try/catch for all hooks to avoid setting up one per iteration.\n try {\n for (var i = 0; i < active_hooks.array.length; i++) {\n if (typeof active_hooks.array[i][init_symbol] === 'function') {\n active_hooks.array[i][init_symbol](\n asyncId, type, triggerAsyncId,\n resource\n );\n }\n }\n } catch (e) {\n fatalError(e);\n } finally {\n active_hooks.call_depth -= 1;\n }\n\n // Hooks can only be restored if there have been no recursive hook calls.\n // Also the active hooks do not need to be restored if enable()/disable()\n // weren't called during hook execution, in which case active_hooks.tmp_array\n // will be null.\n if (active_hooks.call_depth === 0 && active_hooks.tmp_array !== null) {\n restoreActiveHooks();\n }\n}\n\n\nfunction emitHookFactory(symbol, name) {\n // Called from native. The asyncId stack handling is taken care of there\n // before this is called.\n // eslint-disable-next-line func-style\n const fn = function(asyncId) {\n active_hooks.call_depth += 1;\n // Use a single try/catch for all hook to avoid setting up one per\n // iteration.\n try {\n for (var i = 0; i < active_hooks.array.length; i++) {\n if (typeof active_hooks.array[i][symbol] === 'function') {\n active_hooks.array[i][symbol](asyncId);\n }\n }\n } catch (e) {\n fatalError(e);\n } finally {\n active_hooks.call_depth -= 1;\n }\n\n // Hooks can only be restored if there have been no recursive hook calls.\n // Also the active hooks do not need to be restored if enable()/disable()\n // weren't called during hook execution, in which case\n // active_hooks.tmp_array will be null.\n if (active_hooks.call_depth === 0 && active_hooks.tmp_array !== null) {\n restoreActiveHooks();\n }\n };\n\n // Set the name property of the anonymous function as it looks good in the\n // stack trace.\n Object.defineProperty(fn, 'name', {\n value: name\n });\n return fn;\n}\n\n// Manage Active Hooks //\n\nfunction getHookArrays() {\n if (active_hooks.call_depth === 0)\n return [active_hooks.array, async_hook_fields];\n // If this hook is being enabled while in the middle of processing the array\n // of currently active hooks then duplicate the current set of active hooks\n // and store this there. This shouldn't fire until the next time hooks are\n // processed.\n if (active_hooks.tmp_array === null)\n storeActiveHooks();\n return [active_hooks.tmp_array, active_hooks.tmp_fields];\n}\n\n\nfunction storeActiveHooks() {\n active_hooks.tmp_array = active_hooks.array.slice();\n // Don't want to make the assumption that kInit to kDestroy are indexes 0 to\n // 4. So do this the long way.\n active_hooks.tmp_fields = [];\n copyHooks(active_hooks.tmp_fields, async_hook_fields);\n}\n\nfunction copyHooks(destination, source) {\n destination[kInit] = source[kInit];\n destination[kBefore] = source[kBefore];\n destination[kAfter] = source[kAfter];\n destination[kDestroy] = source[kDestroy];\n destination[kPromiseResolve] = source[kPromiseResolve];\n}\n\n\n// Then restore the correct hooks array in case any hooks were added/removed\n// during hook callback execution.\nfunction restoreActiveHooks() {\n active_hooks.array = active_hooks.tmp_array;\n copyHooks(async_hook_fields, active_hooks.tmp_fields);\n\n active_hooks.tmp_array = null;\n active_hooks.tmp_fields = null;\n}\n\n\nfunction enableHooks() {\n enablePromiseHook();\n async_hook_fields[kCheck] += 1;\n}\n\nfunction disableHooks() {\n disablePromiseHook();\n async_hook_fields[kCheck] -= 1;\n}\n\n// Internal Embedder API //\n\n// Increment the internal id counter and return the value. Important that the\n// counter increment first. Since it's done the same way in\n// Environment::new_async_uid()\nfunction newAsyncId() {\n return ++async_id_fields[kAsyncIdCounter];\n}\n\nfunction getOrSetAsyncId(object) {\n if (object.hasOwnProperty(async_id_symbol)) {\n return object[async_id_symbol];\n }\n\n return object[async_id_symbol] = newAsyncId();\n}\n\n\n// Return the triggerAsyncId meant for the constructor calling it. It's up to\n// the user to safeguard this call and make sure it's zero'd out when the\n// constructor is complete.\nfunction getDefaultTriggerAsyncId() {\n let defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];\n // If defaultTriggerAsyncId isn't set, use the executionAsyncId\n if (defaultTriggerAsyncId < 0)\n defaultTriggerAsyncId = async_id_fields[kExecutionAsyncId];\n return defaultTriggerAsyncId;\n}\n\n\nfunction clearDefaultTriggerAsyncId() {\n async_id_fields[kDefaultTriggerAsyncId] = -1;\n}\n\n\nfunction defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) {\n if (triggerAsyncId === undefined)\n return Reflect.apply(block, null, args);\n // do { if (!(Number.isSafeInteger(triggerAsyncId))) (process._rawDebug(\"CHECK: Number.isSafeInteger(triggerAsyncId) == true\"), process.abort()) } while (0)\n // do { if (!(triggerAsyncId > 0)) (process._rawDebug(\"CHECK: triggerAsyncId > 0 == true\"), process.abort()) } while (0)\n const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];\n async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId;\n\n let ret;\n try {\n ret = Reflect.apply(block, null, args);\n } finally {\n async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId;\n }\n\n return ret;\n}\n\n\nfunction initHooksExist() {\n return async_hook_fields[kInit] > 0;\n}\n\nfunction afterHooksExist() {\n return async_hook_fields[kAfter] > 0;\n}\n\nfunction destroyHooksExist() {\n return async_hook_fields[kDestroy] > 0;\n}\n\n\nfunction emitInitScript(asyncId, type, triggerAsyncId, resource) {\n validateAsyncId(asyncId, 'asyncId');\n if (triggerAsyncId !== null)\n validateAsyncId(triggerAsyncId, 'triggerAsyncId');\n if (async_hook_fields[kCheck] > 0 &&\n (typeof type !== 'string' || type.length <= 0)) {\n throw new ERR_ASYNC_TYPE(type);\n }\n\n // Short circuit all checks for the common case. Which is that no hooks have\n // been set. Do this to remove performance impact for embedders (and core).\n if (async_hook_fields[kInit] === 0)\n return;\n\n // This can run after the early return check b/c running this function\n // manually means that the embedder must have used getDefaultTriggerAsyncId().\n if (triggerAsyncId === null) {\n triggerAsyncId = getDefaultTriggerAsyncId();\n }\n\n emitInitNative(asyncId, type, triggerAsyncId, resource);\n}\n\n\nfunction emitBeforeScript(asyncId, triggerAsyncId) {\n // Validate the ids. An id of -1 means it was never set and is visible on the\n // call graph. An id < -1 should never happen in any circumstance. Throw\n // on user calls because async state should still be recoverable.\n validateAsyncId(asyncId, 'asyncId');\n validateAsyncId(triggerAsyncId, 'triggerAsyncId');\n\n pushAsyncIds(asyncId, triggerAsyncId);\n\n if (async_hook_fields[kBefore] > 0)\n emitBeforeNative(asyncId);\n}\n\n\nfunction emitAfterScript(asyncId) {\n validateAsyncId(asyncId, 'asyncId');\n\n if (async_hook_fields[kAfter] > 0)\n emitAfterNative(asyncId);\n\n popAsyncIds(asyncId);\n}\n\n\nfunction emitDestroyScript(asyncId) {\n validateAsyncId(asyncId, 'asyncId');\n\n // Return early if there are no destroy callbacks, or invalid asyncId.\n if (async_hook_fields[kDestroy] === 0 || asyncId <= 0)\n return;\n async_wrap.queueDestroyAsyncId(asyncId);\n}\n\n\n// Keep in sync with Environment::AsyncHooks::clear_async_id_stack\n// in src/env-inl.h.\nfunction clearAsyncIdStack() {\n async_id_fields[kExecutionAsyncId] = 0;\n async_id_fields[kTriggerAsyncId] = 0;\n async_hook_fields[kStackLength] = 0;\n}\n\n\nfunction hasAsyncIdStack() {\n return async_hook_fields[kStackLength] > 0;\n}\n\n\n// This is the equivalent of the native push_async_ids() call.\nfunction pushAsyncIds(asyncId, triggerAsyncId) {\n const offset = async_hook_fields[kStackLength];\n if (offset * 2 >= async_wrap.async_ids_stack.length)\n return pushAsyncIds_(asyncId, triggerAsyncId);\n async_wrap.async_ids_stack[offset * 2] = async_id_fields[kExecutionAsyncId];\n async_wrap.async_ids_stack[offset * 2 + 1] = async_id_fields[kTriggerAsyncId];\n async_hook_fields[kStackLength]++;\n async_id_fields[kExecutionAsyncId] = asyncId;\n async_id_fields[kTriggerAsyncId] = triggerAsyncId;\n}\n\n\n// This is the equivalent of the native pop_async_ids() call.\nfunction popAsyncIds(asyncId) {\n if (async_hook_fields[kStackLength] === 0) return false;\n const stackLength = async_hook_fields[kStackLength];\n\n if (async_hook_fields[kCheck] > 0 &&\n async_id_fields[kExecutionAsyncId] !== asyncId) {\n // Do the same thing as the native code (i.e. crash hard).\n return popAsyncIds_(asyncId);\n }\n\n const offset = stackLength - 1;\n async_id_fields[kExecutionAsyncId] = async_wrap.async_ids_stack[2 * offset];\n async_id_fields[kTriggerAsyncId] = async_wrap.async_ids_stack[2 * offset + 1];\n async_hook_fields[kStackLength] = offset;\n return offset > 0;\n}\n\n\nfunction executionAsyncId() {\n return async_id_fields[kExecutionAsyncId];\n}\n\nfunction triggerAsyncId() {\n return async_id_fields[kTriggerAsyncId];\n}\n\n\nmodule.exports = {\n executionAsyncId,\n triggerAsyncId,\n // Private API\n getHookArrays,\n symbols: {\n async_id_symbol, trigger_async_id_symbol,\n init_symbol, before_symbol, after_symbol, destroy_symbol,\n promise_resolve_symbol\n },\n constants: {\n kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve\n },\n enableHooks,\n disableHooks,\n clearDefaultTriggerAsyncId,\n clearAsyncIdStack,\n hasAsyncIdStack,\n // Internal Embedder API\n newAsyncId,\n getOrSetAsyncId,\n getDefaultTriggerAsyncId,\n defaultTriggerAsyncIdScope,\n initHooksExist,\n afterHooksExist,\n destroyHooksExist,\n emitInit: emitInitScript,\n emitBefore: emitBeforeScript,\n emitAfter: emitAfterScript,\n emitDestroy: emitDestroyScript,\n registerDestroyHook,\n};\n\n});",
"functions": [
{
"functionName": "validateAsyncId",
"ranges": [
{
"startOffset": 5685,
"endOffset": 5942,
"count": 9
},
{
"startOffset": 5815,
"endOffset": 5822,
"count": 0
},
{
"startOffset": 5878,
"endOffset": 5940,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "emitHookFactory",
"ranges": [
{
"startOffset": 7025,
"endOffset": 8213,
"count": 4
},
{
"startOffset": 8211,
"endOffset": 8212,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "fn",
"ranges": [
{
"startOffset": 7223,
"endOffset": 8041,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "newAsyncId",
"ranges": [
{
"startOffset": 9983,
"endOffset": 10053,
"count": 3
},
{
"startOffset": 10051,
"endOffset": 10052,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getDefaultTriggerAsyncId",
"ranges": [
{
"startOffset": 10412,
"endOffset": 10717,
"count": 3
},
{
"startOffset": 10715,
"endOffset": 10716,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "initHooksExist",
"ranges": [
{
"startOffset": 11554,
"endOffset": 11622,
"count": 3
},
{
"startOffset": 11620,
"endOffset": 11621,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "destroyHooksExist",
"ranges": [
{
"startOffset": 11696,
"endOffset": 11770,
"count": 3
},
{
"startOffset": 11768,
"endOffset": 11769,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "emitBeforeScript",
"ranges": [
{
"startOffset": 12613,
"endOffset": 13094,
"count": 3
},
{
"startOffset": 13066,
"endOffset": 13092,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "emitAfterScript",
"ranges": [
{
"startOffset": 13097,
"endOffset": 13266,
"count": 3
},
{
"startOffset": 13214,
"endOffset": 13239,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "pushAsyncIds",
"ranges": [
{
"startOffset": 13922,
"endOffset": 14426,
"count": 3
},
{
"startOffset": 14080,
"endOffset": 14126,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "popAsyncIds",
"ranges": [
{
"startOffset": 14491,
"endOffset": 15095,
"count": 3
},
{
"startOffset": 14568,
"endOffset": 14581,
"count": 0
},
{
"startOffset": 14731,
"endOffset": 14833,
"count": 0
},
{
"startOffset": 15093,
"endOffset": 15094,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/bootstrap/loaders.js",
"source": "// This file creates the internal module & binding loaders used by built-in\n// modules. In contrast, user land modules are loaded using\n// lib/internal/modules/cjs/loader.js (CommonJS Modules) or\n// lib/internal/modules/esm/* (ES Modules).\n//\n// This file is compiled and run by node.cc before bootstrap/node.js\n// was called, therefore the loaders are bootstraped before we start to\n// actually bootstrap Node.js. It creates the following objects:\n//\n// C++ binding loaders:\n// - process.binding(): the legacy C++ binding loader, accessible from user land\n// because it is an object attached to the global process object.\n// These C++ bindings are created using NODE_BUILTIN_MODULE_CONTEXT_AWARE()\n// and have their nm_flags set to NM_F_BUILTIN. We do not make any guarantees\n// about the stability of these bindings, but still have to take care of\n// compatibility issues caused by them from time to time.\n// - process._linkedBinding(): intended to be used by embedders to add\n// additional C++ bindings in their applications. These C++ bindings\n// can be created using NODE_MODULE_CONTEXT_AWARE_CPP() with the flag\n// NM_F_LINKED.\n// - internalBinding(): the private internal C++ binding loader, inaccessible\n// from user land because they are only available from NativeModule.require()\n// These C++ bindings are created using NODE_MODULE_CONTEXT_AWARE_INTERNAL()\n// and have their nm_flags set to NM_F_INTERNAL.\n//\n// Internal JavaScript module loader:\n// - NativeModule: a minimal module system used to load the JavaScript core\n// modules found in lib/**/*.js and deps/**/*.js. All core modules are\n// compiled into the node binary via node_javascript.cc generated by js2c.py,\n// so they can be loaded faster without the cost of I/O. This class makes the\n// lib/internal/*, deps/internal/* modules and internalBinding() available by\n// default to core modules, and lets the core modules require itself via\n// require('internal/bootstrap/loaders') even when this file is not written in\n// CommonJS style.\n//\n// Other objects:\n// - process.moduleLoadList: an array recording the bindings and the modules\n// loaded in the process and the order in which they are loaded.\n\n'use strict';\n\n(function bootstrapInternalLoaders(process, getBinding, getLinkedBinding,\n getInternalBinding, debugBreak) {\n if (debugBreak)\n debugger; // eslint-disable-line no-debugger\n\n const {\n apply: ReflectApply,\n deleteProperty: ReflectDeleteProperty,\n get: ReflectGet,\n getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor,\n has: ReflectHas,\n set: ReflectSet,\n } = Reflect;\n const {\n prototype: {\n hasOwnProperty: ObjectHasOwnProperty,\n },\n create: ObjectCreate,\n defineProperty: ObjectDefineProperty,\n keys: ObjectKeys,\n } = Object;\n\n // Set up process.moduleLoadList\n const moduleLoadList = [];\n ObjectDefineProperty(process, 'moduleLoadList', {\n value: moduleLoadList,\n configurable: true,\n enumerable: true,\n writable: false\n });\n\n // Set up process.binding() and process._linkedBinding()\n {\n const bindingObj = ObjectCreate(null);\n\n process.binding = function binding(module) {\n module = String(module);\n let mod = bindingObj[module];\n if (typeof mod !== 'object') {\n mod = bindingObj[module] = getBinding(module);\n moduleLoadList.push(`Binding ${module}`);\n }\n return mod;\n };\n\n process._linkedBinding = function _linkedBinding(module) {\n module = String(module);\n let mod = bindingObj[module];\n if (typeof mod !== 'object')\n mod = bindingObj[module] = getLinkedBinding(module);\n return mod;\n };\n }\n\n // Set up internalBinding() in the closure\n let internalBinding;\n {\n const bindingObj = ObjectCreate(null);\n internalBinding = function internalBinding(module) {\n let mod = bindingObj[module];\n if (typeof mod !== 'object') {\n mod = bindingObj[module] = getInternalBinding(module);\n moduleLoadList.push(`Internal Binding ${module}`);\n }\n return mod;\n };\n }\n\n const { ContextifyScript } = process.binding('contextify');\n\n // Set up NativeModule\n function NativeModule(id) {\n this.filename = `${id}.js`;\n this.id = id;\n this.exports = {};\n this.reflect = undefined;\n this.exportKeys = undefined;\n this.loaded = false;\n this.loading = false;\n this.script = null; // The ContextifyScript of the module\n }\n\n NativeModule._source = getBinding('natives');\n NativeModule._cache = {};\n\n const config = getBinding('config');\n\n const codeCache = getInternalBinding('code_cache');\n const compiledWithoutCache = NativeModule.compiledWithoutCache = [];\n const compiledWithCache = NativeModule.compiledWithCache = [];\n\n // Think of this as module.exports in this file even though it is not\n // written in CommonJS style.\n const loaderExports = { internalBinding, NativeModule };\n const loaderId = 'internal/bootstrap/loaders';\n\n NativeModule.require = function(id) {\n if (id === loaderId) {\n return loaderExports;\n }\n\n const cached = NativeModule.getCached(id);\n if (cached && (cached.loaded || cached.loading)) {\n return cached.exports;\n }\n\n if (!NativeModule.exists(id)) {\n // Model the error off the internal/errors.js model, but\n // do not use that module given that it could actually be\n // the one causing the error if there's a bug in Node.js\n // eslint-disable-next-line no-restricted-syntax\n const err = new Error(`No such built-in module: ${id}`);\n err.code = 'ERR_UNKNOWN_BUILTIN_MODULE';\n err.name = 'Error [ERR_UNKNOWN_BUILTIN_MODULE]';\n throw err;\n }\n\n moduleLoadList.push(`NativeModule ${id}`);\n\n const nativeModule = new NativeModule(id);\n\n nativeModule.cache();\n nativeModule.compile();\n\n return nativeModule.exports;\n };\n\n NativeModule.isDepsModule = function(id) {\n return id.startsWith('node-inspect/') || id.startsWith('v8/');\n };\n\n NativeModule.requireForDeps = function(id) {\n if (!NativeModule.exists(id) ||\n // TODO(TimothyGu): remove when DEP0084 reaches end of life.\n NativeModule.isDepsModule(id)) {\n id = `internal/deps/${id}`;\n }\n return NativeModule.require(id);\n };\n\n NativeModule.getCached = function(id) {\n return NativeModule._cache[id];\n };\n\n NativeModule.exists = function(id) {\n return NativeModule._source.hasOwnProperty(id);\n };\n\n if (config.exposeInternals) {\n NativeModule.nonInternalExists = function(id) {\n // Do not expose this to user land even with --expose-internals\n if (id === loaderId) {\n return false;\n }\n return NativeModule.exists(id);\n };\n\n NativeModule.isInternal = function(id) {\n // Do not expose this to user land even with --expose-internals\n return id === loaderId;\n };\n } else {\n NativeModule.nonInternalExists = function(id) {\n return NativeModule.exists(id) && !NativeModule.isInternal(id);\n };\n\n NativeModule.isInternal = function(id) {\n return id.startsWith('internal/') ||\n (id === 'worker_threads' &&\n !process.binding('config').experimentalWorker);\n };\n }\n\n NativeModule.getSource = function(id) {\n return NativeModule._source[id];\n };\n\n NativeModule.wrap = function(script) {\n return NativeModule.wrapper[0] + script + NativeModule.wrapper[1];\n };\n\n NativeModule.wrapper = [\n '(function (exports, require, module, process) {',\n '\\n});'\n ];\n\n const getOwn = (target, property, receiver) => {\n return ReflectApply(ObjectHasOwnProperty, target, [property]) ?\n ReflectGet(target, property, receiver) :\n undefined;\n };\n\n NativeModule.prototype.compile = function() {\n let source = NativeModule.getSource(this.id);\n source = NativeModule.wrap(source);\n\n this.loading = true;\n\n try {\n // (code, filename, lineOffset, columnOffset\n // cachedData, produceCachedData, parsingContext)\n const script = new ContextifyScript(\n source, this.filename, 0, 0,\n codeCache[this.id], false, undefined\n );\n\n this.script = script;\n\n // One of these conditions may be false when any of the inputs\n // of the `node_js2c` target in node.gyp is modified.\n // FIXME(joyeecheung):\n // 1. Figure out how to resolve the dependency issue. When the\n // code cache was introduced we were at a point where refactoring\n // node.gyp may not be worth the effort.\n // 2. Calculate checksums in both js2c and generate_code_cache.js\n // and compare them before compiling the native modules since\n // V8 only checks the length of the source to decide whether to\n // reject the cache.\n if (!codeCache[this.id] || script.cachedDataRejected) {\n compiledWithoutCache.push(this.id);\n } else {\n compiledWithCache.push(this.id);\n }\n\n // Arguments: timeout, displayErrors, breakOnSigint\n const fn = script.runInThisContext(-1, true, false);\n const requireFn = this.id.startsWith('internal/deps/') ?\n NativeModule.requireForDeps :\n NativeModule.require;\n fn(this.exports, requireFn, this, process);\n\n if (config.experimentalModules && !NativeModule.isInternal(this.id)) {\n this.exportKeys = ObjectKeys(this.exports);\n\n const update = (property, value) => {\n if (this.reflect !== undefined &&\n ReflectApply(ObjectHasOwnProperty,\n this.reflect.exports, [property]))\n this.reflect.exports[property].set(value);\n };\n\n const handler = {\n __proto__: null,\n defineProperty: (target, prop, descriptor) => {\n // Use `Object.defineProperty` instead of `Reflect.defineProperty`\n // to throw the appropriate error if something goes wrong.\n ObjectDefineProperty(target, prop, descriptor);\n if (typeof descriptor.get === 'function' &&\n !ReflectHas(handler, 'get')) {\n handler.get = (target, prop, receiver) => {\n const value = ReflectGet(target, prop, receiver);\n if (ReflectApply(ObjectHasOwnProperty, target, [prop]))\n update(prop, value);\n return value;\n };\n }\n update(prop, getOwn(target, prop));\n return true;\n },\n deleteProperty: (target, prop) => {\n if (ReflectDeleteProperty(target, prop)) {\n update(prop, undefined);\n return true;\n }\n return false;\n },\n set: (target, prop, value, receiver) => {\n const descriptor = ReflectGetOwnPropertyDescriptor(target, prop);\n if (ReflectSet(target, prop, value, receiver)) {\n if (descriptor && typeof descriptor.set === 'function') {\n for (const key of this.exportKeys) {\n update(key, getOwn(target, key, receiver));\n }\n } else {\n update(prop, getOwn(target, prop, receiver));\n }\n return true;\n }\n return false;\n }\n };\n\n this.exports = new Proxy(this.exports, handler);\n }\n\n this.loaded = true;\n } finally {\n this.loading = false;\n }\n };\n\n NativeModule.prototype.cache = function() {\n NativeModule._cache[this.id] = this;\n };\n\n // This will be passed to the bootstrapNodeJSCore function in\n // bootstrap/node.js.\n return loaderExports;\n});\n",
"functions": [
{
"functionName": "binding",
"ranges": [
{
"startOffset": 3184,
"endOffset": 3451,
"count": 64
}
],
"isBlockCoverage": false
},
{
"functionName": "internalBinding",
"ranges": [
{
"startOffset": 3847,
"endOffset": 4108,
"count": 11
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule",
"ranges": [
{
"startOffset": 4205,
"endOffset": 4486,
"count": 57
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.require",
"ranges": [
{
"startOffset": 5034,
"endOffset": 5906,
"count": 232
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.getCached",
"ranges": [
{
"startOffset": 6330,
"endOffset": 6384,
"count": 221
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.exists",
"ranges": [
{
"startOffset": 6411,
"endOffset": 6481,
"count": 247
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.nonInternalExists",
"ranges": [
{
"startOffset": 6943,
"endOffset": 7033,
"count": 189
},
{
"startOffset": 6995,
"endOffset": 7026,
"count": 184
},
{
"startOffset": 7027,
"endOffset": 7032,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NativeModule.isInternal",
"ranges": [
{
"startOffset": 7066,
"endOffset": 7226,
"count": 243
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.getSource",
"ranges": [
{
"startOffset": 7260,
"endOffset": 7315,
"count": 57
}
],
"isBlockCoverage": false
},
{
"functionName": "NativeModule.wrap",
"ranges": [
{
"startOffset": 7340,
"endOffset": 7433,
"count": 57
}
],
"isBlockCoverage": false
},
{
"functionName": "getOwn",
"ranges": [
{
"startOffset": 7553,
"endOffset": 7722,
"count": 50
},
{
"startOffset": 7700,
"endOffset": 7717,
"count": 0
},
{
"startOffset": 7718,
"endOffset": 7721,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NativeModule.compile",
"ranges": [
{
"startOffset": 7760,
"endOffset": 11396,
"count": 57
}
],
"isBlockCoverage": false
},
{
"functionName": "update",
"ranges": [
{
"startOffset": 9392,
"endOffset": 9634,
"count": 50
},
{
"startOffset": 9456,
"endOffset": 9568,
"count": 0
},
{
"startOffset": 9582,
"endOffset": 9624,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "defineProperty",
"ranges": [
{
"startOffset": 9716,
"endOffset": 10441,
"count": 25
},
{
"startOffset": 10011,
"endOffset": 10057,
"count": 0
},
{
"startOffset": 10059,
"endOffset": 10356,
"count": 0
},
{
"startOffset": 10429,
"endOffset": 10440,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "handler.get",
"ranges": [
{
"startOffset": 10089,
"endOffset": 10341,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "deleteProperty",
"ranges": [
{
"startOffset": 10469,
"endOffset": 10661,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 10678,
"endOffset": 11238,
"count": 25
},
{
"startOffset": 10883,
"endOffset": 10922,
"count": 18
},
{
"startOffset": 10924,
"endOffset": 11074,
"count": 0
},
{
"startOffset": 11186,
"endOffset": 11237,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NativeModule.cache",
"ranges": [
{
"startOffset": 11432,
"endOffset": 11489,
"count": 57
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/bootstrap/node.js",
"source": "// Hello, and welcome to hacking node.js!\n//\n// This file is invoked by node::LoadEnvironment in src/node.cc, and is\n// responsible for bootstrapping the node.js core. As special caution is given\n// to the performance of the startup process, many dependencies are invoked\n// lazily.\n//\n// Before this file is run, lib/internal/bootstrap/loaders.js gets run first\n// to bootstrap the internal binding and module loaders, including\n// process.binding(), process._linkedBinding(), internalBinding() and\n// NativeModule. And then { internalBinding, NativeModule } will be passed\n// into this bootstrapper to bootstrap Node.js core.\n'use strict';\n\n(function bootstrapNodeJSCore(process,\n // bootstrapper properties... destructured to\n // avoid retaining a reference to the bootstrap\n // object.\n { _setupProcessObject, _setupNextTick,\n _setupPromises, _chdir, _cpuUsage,\n _hrtime, _hrtimeBigInt,\n _memoryUsage, _rawDebug,\n _umask, _initgroups, _setegid, _seteuid,\n _setgid, _setuid, _setgroups,\n _shouldAbortOnUncaughtToggle },\n { internalBinding, NativeModule }) {\n const exceptionHandlerState = { captureFn: null };\n const isMainThread = internalBinding('worker').threadId === 0;\n\n function startup() {\n const EventEmitter = NativeModule.require('events');\n\n const origProcProto = Object.getPrototypeOf(process);\n Object.setPrototypeOf(origProcProto, EventEmitter.prototype);\n\n EventEmitter.call(process);\n\n setupProcessObject();\n\n // Do this good and early, since it handles errors.\n setupProcessFatal();\n\n setupProcessICUVersions();\n\n setupGlobalVariables();\n\n // Bootstrappers for all threads, including worker threads and main thread\n const perThreadSetup = NativeModule.require('internal/process/per_thread');\n // Bootstrappers for the main thread only\n let mainThreadSetup;\n // Bootstrappers for the worker threads only\n let workerThreadSetup;\n if (isMainThread) {\n mainThreadSetup = NativeModule.require(\n 'internal/process/main_thread_only'\n );\n } else {\n workerThreadSetup = NativeModule.require(\n 'internal/process/worker_thread_only'\n );\n }\n\n perThreadSetup.setupAssert();\n perThreadSetup.setupConfig(NativeModule._source);\n\n if (isMainThread) {\n mainThreadSetup.setupSignalHandlers();\n }\n\n perThreadSetup.setupUncaughtExceptionCapture(exceptionHandlerState,\n _shouldAbortOnUncaughtToggle);\n\n NativeModule.require('internal/process/warning').setup();\n NativeModule.require('internal/process/next_tick').setup(_setupNextTick,\n _setupPromises);\n\n if (isMainThread) {\n mainThreadSetup.setupStdio();\n mainThreadSetup.setupProcessMethods(\n _chdir, _umask, _initgroups, _setegid, _seteuid,\n _setgid, _setuid, _setgroups\n );\n } else {\n workerThreadSetup.setupStdio();\n }\n\n const perf = process.binding('performance');\n const {\n NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,\n } = perf.constants;\n\n perThreadSetup.setupRawDebug(_rawDebug);\n perThreadSetup.setupHrtime(_hrtime, _hrtimeBigInt);\n perThreadSetup.setupCpuUsage(_cpuUsage);\n perThreadSetup.setupMemoryUsage(_memoryUsage);\n perThreadSetup.setupKillAndExit();\n\n if (global.__coverage__)\n NativeModule.require('internal/process/write-coverage').setup();\n\n\n {\n const traceEvents = process.binding('trace_events');\n const traceEventCategory = 'node,node.async_hooks';\n\n if (traceEvents.categoryGroupEnabled(traceEventCategory)) {\n NativeModule.require('internal/trace_events_async_hooks')\n .setup(traceEvents, traceEventCategory);\n }\n }\n\n\n if (process.config.variables.v8_enable_inspector) {\n NativeModule.require('internal/inspector_async_hook').setup();\n }\n\n if (isMainThread) {\n mainThreadSetup.setupChildProcessIpcChannel();\n }\n\n const browserGlobals = !process._noBrowserGlobals;\n if (browserGlobals) {\n // we are setting this here to foward it to the inspector later\n perThreadSetup.originalConsole = global.console;\n setupGlobalTimeouts();\n setupGlobalConsole();\n setupGlobalURL();\n }\n\n if (process.binding('config').experimentalWorker) {\n setupDOMException();\n }\n\n // On OpenBSD process.execPath will be relative unless we\n // get the full path before process.execPath is used.\n if (process.platform === 'openbsd') {\n const { realpathSync } = NativeModule.require('fs');\n process.execPath = realpathSync.native(process.execPath);\n }\n\n Object.defineProperty(process, 'argv0', {\n enumerable: true,\n configurable: false,\n value: process.argv[0]\n });\n process.argv[0] = process.execPath;\n\n // Handle `--debug*` deprecation and invalidation.\n if (process._invalidDebug) {\n process.emitWarning(\n '`node --debug` and `node --debug-brk` are invalid. ' +\n 'Please use `node --inspect` or `node --inspect-brk` instead.',\n 'DeprecationWarning', 'DEP0062', startup, true);\n process.exit(9);\n } else if (process._deprecatedDebugBrk) {\n process.emitWarning(\n '`node --inspect --debug-brk` is deprecated. ' +\n 'Please use `node --inspect-brk` instead.',\n 'DeprecationWarning', 'DEP0062', startup, true);\n }\n\n if (process.binding('config').experimentalModules ||\n process.binding('config').experimentalVMModules) {\n if (process.binding('config').experimentalModules) {\n process.emitWarning(\n 'The ESM module loader is experimental.',\n 'ExperimentalWarning', undefined);\n }\n NativeModule.require('internal/process/esm_loader').setup();\n }\n\n {\n // Install legacy getters on the `util` binding for typechecking.\n // TODO(addaleax): Turn into a full runtime deprecation.\n const { pendingDeprecation } = process.binding('config');\n const { deprecate } = NativeModule.require('internal/util');\n const utilBinding = process.binding('util');\n const types = internalBinding('types');\n for (const name of [\n 'isArrayBuffer', 'isArrayBufferView', 'isAsyncFunction',\n 'isDataView', 'isDate', 'isExternal', 'isMap', 'isMapIterator',\n 'isNativeError', 'isPromise', 'isRegExp', 'isSet', 'isSetIterator',\n 'isTypedArray', 'isUint8Array', 'isAnyArrayBuffer'\n ]) {\n utilBinding[name] = pendingDeprecation ?\n deprecate(types[name],\n 'Accessing native typechecking bindings of Node ' +\n 'directly is deprecated. ' +\n `Please use \\`util.types.${name}\\` instead.`,\n 'DEP0103') :\n types[name];\n }\n }\n\n perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);\n\n // There are various modes that Node can run in. The most common two\n // are running from a script and running the REPL - but there are a few\n // others like the debugger or running --eval arguments. Here we decide\n // which mode we run in.\n if (internalBinding('worker').getEnvMessagePort() !== undefined) {\n // This means we are in a Worker context, and any script execution\n // will be directed by the worker module.\n NativeModule.require('internal/worker').setupChild(evalScript);\n } else if (NativeModule.exists('_third_party_main')) {\n // To allow people to extend Node in different ways, this hook allows\n // one to drop a file lib/_third_party_main.js into the build\n // directory which will be executed instead of Node's normal loading.\n process.nextTick(function() {\n NativeModule.require('_third_party_main');\n });\n } else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {\n if (process.argv[1] === 'debug') {\n process.emitWarning(\n '`node debug` is deprecated. Please use `node inspect` instead.',\n 'DeprecationWarning', 'DEP0068');\n }\n\n // Start the debugger agent.\n process.nextTick(function() {\n NativeModule.require('internal/deps/node-inspect/lib/_inspect').start();\n });\n\n } else if (process.profProcess) {\n NativeModule.require('internal/v8_prof_processor');\n } else {\n // There is user code to be run.\n\n // If this is a worker in cluster mode, start up the communication\n // channel. This needs to be done before any user code gets executed\n // (including preload modules).\n if (process.argv[1] && process.env.NODE_UNIQUE_ID) {\n const cluster = NativeModule.require('cluster');\n cluster._setupWorker();\n // Make sure it's not accidentally inherited by child processes.\n delete process.env.NODE_UNIQUE_ID;\n }\n\n if (process._eval != null && !process._forceRepl) {\n // User passed '-e' or '--eval' arguments to Node without '-i' or\n // '--interactive'.\n preloadModules();\n\n const {\n addBuiltinLibsToObject\n } = NativeModule.require('internal/modules/cjs/helpers');\n addBuiltinLibsToObject(global);\n evalScript('[eval]');\n } else if (process.argv[1] && process.argv[1] !== '-') {\n // Make process.argv[1] into a full path.\n const path = NativeModule.require('path');\n process.argv[1] = path.resolve(process.argv[1]);\n\n const CJSModule = NativeModule.require('internal/modules/cjs/loader');\n\n preloadModules();\n // Check if user passed `-c` or `--check` arguments to Node.\n if (process._syntax_check_only != null) {\n const fs = NativeModule.require('fs');\n // Read the source.\n const filename = CJSModule._resolveFilename(process.argv[1]);\n const source = fs.readFileSync(filename, 'utf-8');\n checkScriptSyntax(source, filename);\n process.exit(0);\n }\n CJSModule.runMain();\n } else {\n preloadModules();\n // If -i or --interactive were passed, or stdin is a TTY.\n if (process._forceRepl || NativeModule.require('tty').isatty(0)) {\n // REPL\n const cliRepl = NativeModule.require('internal/repl');\n cliRepl.createInternalRepl(process.env, function(err, repl) {\n if (err) {\n throw err;\n }\n repl.on('exit', function() {\n if (repl._flushing) {\n repl.pause();\n return repl.once('flushHistory', function() {\n process.exit();\n });\n }\n process.exit();\n });\n });\n\n if (process._eval != null) {\n // User passed '-e' or '--eval'\n evalScript('[eval]');\n }\n } else {\n // Read all of stdin - execute it.\n process.stdin.setEncoding('utf8');\n\n let code = '';\n process.stdin.on('data', function(d) {\n code += d;\n });\n\n process.stdin.on('end', function() {\n if (process._syntax_check_only != null) {\n checkScriptSyntax(code, '[stdin]');\n } else {\n process._eval = code;\n evalScript('[stdin]');\n }\n });\n }\n }\n }\n }\n\n function setupProcessObject() {\n _setupProcessObject(pushValueToArray);\n\n function pushValueToArray() {\n for (var i = 0; i < arguments.length; i++)\n this.push(arguments[i]);\n }\n }\n\n function setupGlobalVariables() {\n Object.defineProperty(global, Symbol.toStringTag, {\n value: 'global',\n writable: false,\n enumerable: false,\n configurable: true\n });\n global.process = process;\n const util = NativeModule.require('util');\n\n function makeGetter(name) {\n return util.deprecate(function() {\n return this;\n }, `'${name}' is deprecated, use 'global'`, 'DEP0016');\n }\n\n function makeSetter(name) {\n return util.deprecate(function(value) {\n Object.defineProperty(this, name, {\n configurable: true,\n writable: true,\n enumerable: true,\n value: value\n });\n }, `'${name}' is deprecated, use 'global'`, 'DEP0016');\n }\n\n Object.defineProperties(global, {\n GLOBAL: {\n configurable: true,\n get: makeGetter('GLOBAL'),\n set: makeSetter('GLOBAL')\n },\n root: {\n configurable: true,\n get: makeGetter('root'),\n set: makeSetter('root')\n }\n });\n\n // This, as side effect, removes `setupBufferJS` from the buffer binding,\n // and exposes it on `internal/buffer`.\n NativeModule.require('internal/buffer');\n\n global.Buffer = NativeModule.require('buffer').Buffer;\n process.domain = null;\n process._exiting = false;\n }\n\n function setupGlobalTimeouts() {\n const timers = NativeModule.require('timers');\n global.clearImmediate = timers.clearImmediate;\n global.clearInterval = timers.clearInterval;\n global.clearTimeout = timers.clearTimeout;\n global.setImmediate = timers.setImmediate;\n global.setInterval = timers.setInterval;\n global.setTimeout = timers.setTimeout;\n }\n\n function setupGlobalConsole() {\n const originalConsole = global.console;\n const CJSModule = NativeModule.require('internal/modules/cjs/loader');\n // Setup Node.js global.console.\n const wrappedConsole = NativeModule.require('console');\n Object.defineProperty(global, 'console', {\n configurable: true,\n enumerable: false,\n value: wrappedConsole,\n writable: true\n });\n setupInspector(originalConsole, wrappedConsole, CJSModule);\n }\n\n function setupGlobalURL() {\n const { URL, URLSearchParams } = NativeModule.require('internal/url');\n Object.defineProperties(global, {\n URL: {\n value: URL,\n writable: true,\n configurable: true,\n enumerable: false\n },\n URLSearchParams: {\n value: URLSearchParams,\n writable: true,\n configurable: true,\n enumerable: false\n }\n });\n }\n\n function setupDOMException() {\n // Registers the constructor with C++.\n NativeModule.require('internal/domexception');\n }\n\n function setupInspector(originalConsole, wrappedConsole, CJSModule) {\n if (!process.config.variables.v8_enable_inspector) {\n return;\n }\n const { addCommandLineAPI, consoleCall } = process.binding('inspector');\n // Setup inspector command line API.\n const { makeRequireFunction } =\n NativeModule.require('internal/modules/cjs/helpers');\n const path = NativeModule.require('path');\n const cwd = tryGetCwd(path);\n\n const consoleAPIModule = new CJSModule('<inspector console>');\n consoleAPIModule.paths =\n CJSModule._nodeModulePaths(cwd).concat(CJSModule.globalPaths);\n addCommandLineAPI('require', makeRequireFunction(consoleAPIModule));\n const config = {};\n for (const key of Object.keys(wrappedConsole)) {\n if (!originalConsole.hasOwnProperty(key))\n continue;\n // If global console has the same method as inspector console,\n // then wrap these two methods into one. Native wrapper will preserve\n // the original stack.\n wrappedConsole[key] = consoleCall.bind(wrappedConsole,\n originalConsole[key],\n wrappedConsole[key],\n config);\n }\n for (const key of Object.keys(originalConsole)) {\n if (wrappedConsole.hasOwnProperty(key))\n continue;\n wrappedConsole[key] = originalConsole[key];\n }\n }\n\n function noop() {}\n\n function setupProcessFatal() {\n const {\n executionAsyncId,\n clearDefaultTriggerAsyncId,\n clearAsyncIdStack,\n hasAsyncIdStack,\n afterHooksExist,\n emitAfter\n } = NativeModule.require('internal/async_hooks');\n\n process._fatalException = function(er) {\n // It's possible that defaultTriggerAsyncId was set for a constructor\n // call that threw and was never cleared. So clear it now.\n clearDefaultTriggerAsyncId();\n\n if (exceptionHandlerState.captureFn !== null) {\n exceptionHandlerState.captureFn(er);\n } else if (!process.emit('uncaughtException', er)) {\n // If someone handled it, then great. otherwise, die in C++ land\n // since that means that we'll exit the process, emit the 'exit' event.\n try {\n if (!process._exiting) {\n process._exiting = true;\n process.exitCode = 1;\n process.emit('exit', 1);\n }\n } catch {\n // Nothing to be done about it at this point.\n }\n try {\n const { kExpandStackSymbol } = NativeModule.require('internal/util');\n if (typeof er[kExpandStackSymbol] === 'function')\n er[kExpandStackSymbol]();\n } catch (er) {}\n return false;\n }\n\n // If we handled an error, then make sure any ticks get processed\n // by ensuring that the next Immediate cycle isn't empty.\n NativeModule.require('timers').setImmediate(noop);\n\n // Emit the after() hooks now that the exception has been handled.\n if (afterHooksExist()) {\n do {\n emitAfter(executionAsyncId());\n } while (hasAsyncIdStack());\n // Or completely empty the id stack.\n } else {\n clearAsyncIdStack();\n }\n\n return true;\n };\n }\n\n function setupProcessICUVersions() {\n const icu = process.binding('config').hasIntl ?\n process.binding('icu') : undefined;\n if (!icu) return; // no Intl/ICU: nothing to add here.\n // With no argument, getVersion() returns a comma separated list\n // of possible types.\n const versionTypes = icu.getVersion().split(',');\n\n for (var n = 0; n < versionTypes.length; n++) {\n const name = versionTypes[n];\n const version = icu.getVersion(name);\n Object.defineProperty(process.versions, name, {\n writable: false,\n enumerable: true,\n value: version\n });\n }\n }\n\n function tryGetCwd(path) {\n try {\n return process.cwd();\n } catch (ex) {\n // getcwd(3) can fail if the current working directory has been deleted.\n // Fall back to the directory name of the (absolute) executable path.\n // It's not really correct but what are the alternatives?\n return path.dirname(process.execPath);\n }\n }\n\n function wrapForBreakOnFirstLine(source) {\n if (!process._breakFirstLine)\n return source;\n const fn = `function() {\\n\\n${source};\\n\\n}`;\n return `process.binding('inspector').callAndPauseOnStart(${fn}, {})`;\n }\n\n function evalScript(name, body = wrapForBreakOnFirstLine(process._eval)) {\n const CJSModule = NativeModule.require('internal/modules/cjs/loader');\n const path = NativeModule.require('path');\n const cwd = tryGetCwd(path);\n\n const module = new CJSModule(name);\n module.filename = path.join(cwd, name);\n module.paths = CJSModule._nodeModulePaths(cwd);\n const script = `global.__filename = ${JSON.stringify(name)};\\n` +\n 'global.exports = exports;\\n' +\n 'global.module = module;\\n' +\n 'global.__dirname = __dirname;\\n' +\n 'global.require = require;\\n' +\n 'return require(\"vm\").runInThisContext(' +\n `${JSON.stringify(body)}, { filename: ` +\n `${JSON.stringify(name)}, displayErrors: true });\\n`;\n const result = module._compile(script, `${name}-wrapper`);\n if (process._print_eval) console.log(result);\n // Handle any nextTicks added in the first tick of the program.\n process._tickCallback();\n }\n\n // Load preload modules.\n function preloadModules() {\n if (process._preload_modules) {\n const {\n _preloadModules\n } = NativeModule.require('internal/modules/cjs/loader');\n _preloadModules(process._preload_modules);\n }\n }\n\n function checkScriptSyntax(source, filename) {\n const CJSModule = NativeModule.require('internal/modules/cjs/loader');\n const vm = NativeModule.require('vm');\n const {\n stripShebang, stripBOM\n } = NativeModule.require('internal/modules/cjs/helpers');\n\n // Remove Shebang.\n source = stripShebang(source);\n // Remove BOM.\n source = stripBOM(source);\n // Wrap it.\n source = CJSModule.wrap(source);\n // Compile the script, this will throw if it fails.\n new vm.Script(source, { displayErrors: true, filename });\n }\n\n startup();\n});\n",
"functions": [
{
"functionName": "setupGlobalVariables",
"ranges": [
{
"startOffset": 11833,
"endOffset": 13149,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "makeGetter",
"ranges": [
{
"startOffset": 12109,
"endOffset": 12266,
"count": 2
},
{
"startOffset": 12260,
"endOffset": 12265,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 12165,
"endOffset": 12206,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeSetter",
"ranges": [
{
"startOffset": 12272,
"endOffset": 12576,
"count": 2
},
{
"startOffset": 12570,
"endOffset": 12575,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 12328,
"endOffset": 12516,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupGlobalTimeouts",
"ranges": [
{
"startOffset": 13153,
"endOffset": 13522,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupGlobalConsole",
"ranges": [
{
"startOffset": 13526,
"endOffset": 13997,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupGlobalURL",
"ranges": [
{
"startOffset": 14001,
"endOffset": 14416,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupInspector",
"ranges": [
{
"startOffset": 14552,
"endOffset": 15981,
"count": 1
},
{
"startOffset": 14677,
"endOffset": 14698,
"count": 0
},
{
"startOffset": 15308,
"endOffset": 15803,
"count": 20
},
{
"startOffset": 15366,
"endOffset": 15375,
"count": 2
},
{
"startOffset": 15375,
"endOffset": 15803,
"count": 18
},
{
"startOffset": 15803,
"endOffset": 15856,
"count": 18
},
{
"startOffset": 15856,
"endOffset": 15977,
"count": 25
},
{
"startOffset": 15912,
"endOffset": 15921,
"count": 18
},
{
"startOffset": 15921,
"endOffset": 15977,
"count": 7
},
{
"startOffset": 15977,
"endOffset": 15980,
"count": 7
}
],
"isBlockCoverage": true
},
{
"functionName": "setupProcessICUVersions",
"ranges": [
{
"startOffset": 17803,
"endOffset": 18423,
"count": 1
},
{
"startOffset": 17921,
"endOffset": 17932,
"count": 0
},
{
"startOffset": 17948,
"endOffset": 17955,
"count": 0
},
{
"startOffset": 18194,
"endOffset": 18419,
"count": 4
}
],
"isBlockCoverage": true
},
{
"functionName": "tryGetCwd",
"ranges": [
{
"startOffset": 18427,
"endOffset": 18784,
"count": 1
},
{
"startOffset": 18491,
"endOffset": 18783,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "preloadModules",
"ranges": [
{
"startOffset": 20100,
"endOffset": 20323,
"count": 1
},
{
"startOffset": 20162,
"endOffset": 20319,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/buffer.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst binding = process.binding('buffer');\nconst {\n ERR_BUFFER_OUT_OF_BOUNDS,\n ERR_INVALID_ARG_TYPE,\n ERR_OUT_OF_RANGE\n} = require('internal/errors').codes;\nconst { setupBufferJS } = binding;\n\n// Remove from the binding so that function is only available as exported here.\n// (That is, for internal use only.)\ndelete binding.setupBufferJS;\n\n// Temporary buffers to convert numbers.\nconst float32Array = new Float32Array(1);\nconst uInt8Float32Array = new Uint8Array(float32Array.buffer);\nconst float64Array = new Float64Array(1);\nconst uInt8Float64Array = new Uint8Array(float64Array.buffer);\n\n// Check endianness.\nfloat32Array[0] = -1; // 0xBF800000\n// Either it is [0, 0, 128, 191] or [191, 128, 0, 0]. It is not possible to\n// check this with `os.endianness()` because that is determined at compile time.\nconst bigEndian = uInt8Float32Array[3] === 0;\n\nfunction checkBounds(buf, offset, byteLength) {\n checkNumberType(offset);\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined)\n boundsError(offset, buf.length - (byteLength + 1));\n}\n\nfunction checkInt(value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value);\n }\n checkBounds(buf, offset, byteLength);\n}\n\nfunction checkNumberType(value, type) {\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(type || 'offset', 'number', value);\n }\n}\n\nfunction boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n checkNumberType(value, type);\n throw new ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value);\n }\n\n if (length < 0)\n throw new ERR_BUFFER_OUT_OF_BOUNDS();\n\n throw new ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value);\n}\n\n// Read integers.\nfunction readUIntLE(offset, byteLength) {\n if (byteLength === 6)\n return readUInt48LE(this, offset);\n if (byteLength === 5)\n return readUInt40LE(this, offset);\n if (byteLength === 3)\n return readUInt24LE(this, offset);\n if (byteLength === 4)\n return this.readUInt32LE(offset);\n if (byteLength === 2)\n return this.readUInt16LE(offset);\n if (byteLength === 1 || byteLength === undefined)\n return this.readUInt8(offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readUInt48LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24 +\n (buf[++offset] + last * 2 ** 8) * 2 ** 32;\n}\n\nfunction readUInt40LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24 +\n last * 2 ** 32;\n}\n\nfunction readUInt32LE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n return first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24;\n}\n\nfunction readUInt24LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n return first + buf[++offset] * 2 ** 8 + last * 2 ** 16;\n}\n\nfunction readUInt16LE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 2);\n\n return first + last * 2 ** 8;\n}\n\nfunction readUInt8(offset = 0) {\n checkNumberType(offset);\n const val = this[offset];\n if (val === undefined)\n boundsError(offset, this.length - 1);\n\n return val;\n}\n\nfunction readUIntBE(offset, byteLength) {\n if (byteLength === 6)\n return readUInt48BE(this, offset);\n if (byteLength === 5)\n return readUInt40BE(this, offset);\n if (byteLength === 3)\n return readUInt24BE(this, offset);\n if (byteLength === 4)\n return this.readUInt32BE(offset);\n if (byteLength === 2)\n return this.readUInt16BE(offset);\n if (byteLength === 1 || byteLength === undefined)\n return this.readUInt8(offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readUInt48BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n return (first * 2 ** 8 + buf[++offset]) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt40BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return first * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt32BE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n return first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt24BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n return first * 2 ** 16 + buf[++offset] * 2 ** 8 + last;\n}\n\nfunction readUInt16BE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 2);\n\n return first * 2 ** 8 + last;\n}\n\nfunction readIntLE(offset, byteLength) {\n if (byteLength === 6)\n return readInt48LE(this, offset);\n if (byteLength === 5)\n return readInt40LE(this, offset);\n if (byteLength === 3)\n return readInt24LE(this, offset);\n if (byteLength === 4)\n return this.readInt32LE(offset);\n if (byteLength === 2)\n return this.readInt16LE(offset);\n if (byteLength === 1 || byteLength === undefined)\n return this.readInt8(offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readInt48LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n const val = buf[offset + 4] + last * 2 ** 8;\n return (val | (val & 2 ** 15) * 0x1fffe) * 2 ** 32 +\n first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24;\n}\n\nfunction readInt40LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return (last | (last & 2 ** 7) * 0x1fffffe) * 2 ** 32 +\n first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24;\n}\n\nfunction readInt32LE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n return first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n (last << 24); // Overflow\n}\n\nfunction readInt24LE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n const val = first + buf[++offset] * 2 ** 8 + last * 2 ** 16;\n return val | (val & 2 ** 23) * 0x1fe;\n}\n\nfunction readInt16LE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 2);\n\n const val = first + last * 2 ** 8;\n return val | (val & 2 ** 15) * 0x1fffe;\n}\n\nfunction readInt8(offset = 0) {\n checkNumberType(offset);\n const val = this[offset];\n if (val === undefined)\n boundsError(offset, this.length - 1);\n\n return val | (val & 2 ** 7) * 0x1fffffe;\n}\n\nfunction readIntBE(offset, byteLength) {\n if (byteLength === 6)\n return readInt48BE(this, offset);\n if (byteLength === 5)\n return readInt40BE(this, offset);\n if (byteLength === 3)\n return readInt24BE(this, offset);\n if (byteLength === 4)\n return this.readInt32BE(offset);\n if (byteLength === 2)\n return this.readInt16BE(offset);\n if (byteLength === 1 || byteLength === undefined)\n return this.readInt8(offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readInt48BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n const val = buf[++offset] + first * 2 ** 8;\n return (val | (val & 2 ** 15) * 0x1fffe) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt40BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return (first | (first & 2 ** 7) * 0x1fffffe) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt32BE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n return (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt24BE(buf, offset = 0) {\n checkNumberType(offset);\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n const val = first * 2 ** 16 + buf[++offset] * 2 ** 8 + last;\n return val | (val & 2 ** 23) * 0x1fe;\n}\n\nfunction readInt16BE(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 2);\n\n const val = first * 2 ** 8 + last;\n return val | (val & 2 ** 15) * 0x1fffe;\n}\n\n// Read floats\nfunction readFloatBackwards(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n uInt8Float32Array[3] = first;\n uInt8Float32Array[2] = this[++offset];\n uInt8Float32Array[1] = this[++offset];\n uInt8Float32Array[0] = last;\n return float32Array[0];\n}\n\nfunction readFloatForwards(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n uInt8Float32Array[0] = first;\n uInt8Float32Array[1] = this[++offset];\n uInt8Float32Array[2] = this[++offset];\n uInt8Float32Array[3] = last;\n return float32Array[0];\n}\n\nfunction readDoubleBackwards(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n uInt8Float64Array[7] = first;\n uInt8Float64Array[6] = this[++offset];\n uInt8Float64Array[5] = this[++offset];\n uInt8Float64Array[4] = this[++offset];\n uInt8Float64Array[3] = this[++offset];\n uInt8Float64Array[2] = this[++offset];\n uInt8Float64Array[1] = this[++offset];\n uInt8Float64Array[0] = last;\n return float64Array[0];\n}\n\nfunction readDoubleForwards(offset = 0) {\n checkNumberType(offset);\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n uInt8Float64Array[0] = first;\n uInt8Float64Array[1] = this[++offset];\n uInt8Float64Array[2] = this[++offset];\n uInt8Float64Array[3] = this[++offset];\n uInt8Float64Array[4] = this[++offset];\n uInt8Float64Array[5] = this[++offset];\n uInt8Float64Array[6] = this[++offset];\n uInt8Float64Array[7] = last;\n return float64Array[0];\n}\n\n// Write integers.\nfunction writeUIntLE(value, offset = 0, byteLength) {\n if (byteLength === 6)\n return writeU_Int48LE(this, value, offset, 0, 0xffffffffffff);\n if (byteLength === 5)\n return writeU_Int40LE(this, value, offset, 0, 0xffffffffff);\n if (byteLength === 3)\n return writeU_Int24LE(this, value, offset, 0, 0xffffff);\n if (byteLength === 4)\n return writeU_Int32LE(this, value, offset, 0, 0xffffffff);\n if (byteLength === 2)\n return writeU_Int16LE(this, value, offset, 0, 0xffff);\n if (byteLength === 1 || byteLength === undefined)\n return writeU_Int8(this, value, offset, 0, 0xff);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeU_Int48LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 5);\n\n const newVal = Math.floor(value * 2 ** -32);\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n buf[offset++] = newVal;\n buf[offset++] = (newVal >>> 8);\n return offset;\n}\n\nfunction writeU_Int40LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 4);\n\n const newVal = value;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n buf[offset++] = Math.floor(newVal * 2 ** -32);\n return offset;\n}\n\nfunction writeU_Int32LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 3);\n\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeUInt32LE(value, offset = 0) {\n return writeU_Int32LE(this, value, offset, 0, 0xffffffff);\n}\n\nfunction writeU_Int24LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 2);\n\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeU_Int16LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 1);\n\n buf[offset++] = value;\n buf[offset++] = (value >>> 8);\n return offset;\n}\n\nfunction writeUInt16LE(value, offset = 0) {\n return writeU_Int16LE(this, value, offset, 0, 0xffff);\n}\n\nfunction writeU_Int8(buf, value, offset, min, max) {\n value = +value;\n // `checkInt()` can not be used here because it checks two entries.\n checkNumberType(offset);\n if (value > max || value < min) {\n throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value);\n }\n if (buf[offset] === undefined)\n boundsError(offset, buf.length - 1);\n\n buf[offset] = value;\n return offset + 1;\n}\n\nfunction writeUInt8(value, offset = 0) {\n return writeU_Int8(this, value, offset, 0, 0xff);\n}\n\nfunction writeUIntBE(value, offset = 0, byteLength) {\n if (byteLength === 6)\n return writeU_Int48BE(this, value, offset, 0, 0xffffffffffffff);\n if (byteLength === 5)\n return writeU_Int40BE(this, value, offset, 0, 0xffffffffff);\n if (byteLength === 3)\n return writeU_Int24BE(this, value, offset, 0, 0xffffff);\n if (byteLength === 4)\n return writeU_Int32BE(this, value, offset, 0, 0xffffffff);\n if (byteLength === 2)\n return writeU_Int16BE(this, value, offset, 0, 0xffff);\n if (byteLength === 1 || byteLength === undefined)\n return writeU_Int8(this, value, offset, 0, 0xff);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeU_Int48BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 5);\n\n const newVal = Math.floor(value * 2 ** -32);\n buf[offset++] = (newVal >>> 8);\n buf[offset++] = newVal;\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeU_Int40BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 4);\n\n buf[offset++] = Math.floor(value * 2 ** -32);\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeU_Int32BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 3);\n\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeUInt32BE(value, offset = 0) {\n return writeU_Int32BE(this, value, offset, 0, 0xffffffff);\n}\n\nfunction writeU_Int24BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 2);\n\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 3;\n}\n\nfunction writeU_Int16BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 1);\n\n buf[offset++] = (value >>> 8);\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeUInt16BE(value, offset = 0) {\n return writeU_Int16BE(this, value, offset, 0, 0xffffffff);\n}\n\nfunction writeIntLE(value, offset = 0, byteLength) {\n if (byteLength === 6)\n return writeU_Int48LE(this, value, offset, -0x800000000000, 0x7fffffffffff);\n if (byteLength === 5)\n return writeU_Int40LE(this, value, offset, -0x8000000000, 0x7fffffffff);\n if (byteLength === 3)\n return writeU_Int24LE(this, value, offset, -0x800000, 0x7fffff);\n if (byteLength === 4)\n return writeU_Int32LE(this, value, offset, -0x80000000, 0x7fffffff);\n if (byteLength === 2)\n return writeU_Int16LE(this, value, offset, -0x8000, 0x7fff);\n if (byteLength === 1 || byteLength === undefined)\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeInt32LE(value, offset = 0) {\n return writeU_Int32LE(this, value, offset, -0x80000000, 0x7fffffff);\n}\n\nfunction writeInt16LE(value, offset = 0) {\n return writeU_Int16LE(this, value, offset, -0x8000, 0x7fff);\n}\n\nfunction writeInt8(value, offset = 0) {\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n}\n\nfunction writeIntBE(value, offset = 0, byteLength) {\n if (byteLength === 6)\n return writeU_Int48BE(this, value, offset, -0x800000000000, 0x7fffffffffff);\n if (byteLength === 5)\n return writeU_Int40BE(this, value, offset, -0x8000000000, 0x7fffffffff);\n if (byteLength === 3)\n return writeU_Int24BE(this, value, offset, -0x800000, 0x7fffff);\n if (byteLength === 4)\n return writeU_Int32BE(this, value, offset, -0x80000000, 0x7fffffff);\n if (byteLength === 2)\n return writeU_Int16BE(this, value, offset, -0x8000, 0x7fff);\n if (byteLength === 1 || byteLength === undefined)\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeInt32BE(value, offset = 0) {\n return writeU_Int32BE(this, value, offset, -0x80000000, 0x7fffffff);\n}\n\nfunction writeInt16BE(value, offset = 0) {\n return writeU_Int16BE(this, value, offset, -0x8000, 0x7fff);\n}\n\n// Write floats.\nfunction writeDoubleForwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 7);\n\n float64Array[0] = val;\n this[offset++] = uInt8Float64Array[0];\n this[offset++] = uInt8Float64Array[1];\n this[offset++] = uInt8Float64Array[2];\n this[offset++] = uInt8Float64Array[3];\n this[offset++] = uInt8Float64Array[4];\n this[offset++] = uInt8Float64Array[5];\n this[offset++] = uInt8Float64Array[6];\n this[offset++] = uInt8Float64Array[7];\n return offset;\n}\n\nfunction writeDoubleBackwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 7);\n\n float64Array[0] = val;\n this[offset++] = uInt8Float64Array[7];\n this[offset++] = uInt8Float64Array[6];\n this[offset++] = uInt8Float64Array[5];\n this[offset++] = uInt8Float64Array[4];\n this[offset++] = uInt8Float64Array[3];\n this[offset++] = uInt8Float64Array[2];\n this[offset++] = uInt8Float64Array[1];\n this[offset++] = uInt8Float64Array[0];\n return offset;\n}\n\nfunction writeFloatForwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 3);\n\n float32Array[0] = val;\n this[offset++] = uInt8Float32Array[0];\n this[offset++] = uInt8Float32Array[1];\n this[offset++] = uInt8Float32Array[2];\n this[offset++] = uInt8Float32Array[3];\n return offset;\n}\n\nfunction writeFloatBackwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 3);\n\n float32Array[0] = val;\n this[offset++] = uInt8Float32Array[3];\n this[offset++] = uInt8Float32Array[2];\n this[offset++] = uInt8Float32Array[1];\n this[offset++] = uInt8Float32Array[0];\n return offset;\n}\n\n// FastBuffer wil be inserted here by lib/buffer.js\nmodule.exports = {\n setupBufferJS,\n // Container to export all read write functions.\n readWrites: {\n readUIntLE,\n readUInt32LE,\n readUInt16LE,\n readUInt8,\n readUIntBE,\n readUInt32BE,\n readUInt16BE,\n readIntLE,\n readInt32LE,\n readInt16LE,\n readInt8,\n readIntBE,\n readInt32BE,\n readInt16BE,\n writeUIntLE,\n writeUInt32LE,\n writeUInt16LE,\n writeUInt8,\n writeUIntBE,\n writeUInt32BE,\n writeUInt16BE,\n writeIntLE,\n writeInt32LE,\n writeInt16LE,\n writeInt8,\n writeIntBE,\n writeInt32BE,\n writeInt16BE,\n readFloatLE: bigEndian ? readFloatBackwards : readFloatForwards,\n readFloatBE: bigEndian ? readFloatForwards : readFloatBackwards,\n readDoubleLE: bigEndian ? readDoubleBackwards : readDoubleForwards,\n readDoubleBE: bigEndian ? readDoubleForwards : readDoubleBackwards,\n writeFloatLE: bigEndian ? writeFloatBackwards : writeFloatForwards,\n writeFloatBE: bigEndian ? writeFloatForwards : writeFloatBackwards,\n writeDoubleLE: bigEndian ? writeDoubleBackwards : writeDoubleForwards,\n writeDoubleBE: bigEndian ? writeDoubleForwards : writeDoubleBackwards\n }\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 22942,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 22940,
"count": 1
},
{
"startOffset": 22383,
"endOffset": 22403,
"count": 0
},
{
"startOffset": 22452,
"endOffset": 22471,
"count": 0
},
{
"startOffset": 22522,
"endOffset": 22543,
"count": 0
},
{
"startOffset": 22594,
"endOffset": 22614,
"count": 0
},
{
"startOffset": 22666,
"endOffset": 22687,
"count": 0
},
{
"startOffset": 22738,
"endOffset": 22758,
"count": 0
},
{
"startOffset": 22811,
"endOffset": 22833,
"count": 0
},
{
"startOffset": 22886,
"endOffset": 22907,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "checkBounds",
"ranges": [
{
"startOffset": 919,
"endOffset": 1126,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "checkInt",
"ranges": [
{
"startOffset": 1128,
"endOffset": 1346,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "checkNumberType",
"ranges": [
{
"startOffset": 1348,
"endOffset": 1499,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "boundsError",
"ranges": [
{
"startOffset": 1501,
"endOffset": 1906,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUIntLE",
"ranges": [
{
"startOffset": 1926,
"endOffset": 2414,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt48LE",
"ranges": [
{
"startOffset": 2416,
"endOffset": 2790,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt40LE",
"ranges": [
{
"startOffset": 2792,
"endOffset": 3139,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt32LE",
"ranges": [
{
"startOffset": 3141,
"endOffset": 3458,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt24LE",
"ranges": [
{
"startOffset": 3460,
"endOffset": 3739,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt16LE",
"ranges": [
{
"startOffset": 3741,
"endOffset": 3992,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt8",
"ranges": [
{
"startOffset": 3994,
"endOffset": 4165,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUIntBE",
"ranges": [
{
"startOffset": 4167,
"endOffset": 4655,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt48BE",
"ranges": [
{
"startOffset": 4657,
"endOffset": 5031,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt40BE",
"ranges": [
{
"startOffset": 5033,
"endOffset": 5380,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt32BE",
"ranges": [
{
"startOffset": 5382,
"endOffset": 5699,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt24BE",
"ranges": [
{
"startOffset": 5701,
"endOffset": 5980,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readUInt16BE",
"ranges": [
{
"startOffset": 5982,
"endOffset": 6233,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readIntLE",
"ranges": [
{
"startOffset": 6235,
"endOffset": 6716,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt48LE",
"ranges": [
{
"startOffset": 6718,
"endOffset": 7140,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt40LE",
"ranges": [
{
"startOffset": 7142,
"endOffset": 7520,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt32LE",
"ranges": [
{
"startOffset": 7522,
"endOffset": 7848,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt24LE",
"ranges": [
{
"startOffset": 7850,
"endOffset": 8173,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt16LE",
"ranges": [
{
"startOffset": 8175,
"endOffset": 8472,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt8",
"ranges": [
{
"startOffset": 8474,
"endOffset": 8673,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readIntBE",
"ranges": [
{
"startOffset": 8675,
"endOffset": 9156,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt48BE",
"ranges": [
{
"startOffset": 9158,
"endOffset": 9578,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt40BE",
"ranges": [
{
"startOffset": 9580,
"endOffset": 9959,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt32BE",
"ranges": [
{
"startOffset": 9961,
"endOffset": 10287,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt24BE",
"ranges": [
{
"startOffset": 10289,
"endOffset": 10612,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readInt16BE",
"ranges": [
{
"startOffset": 10614,
"endOffset": 10911,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readFloatBackwards",
"ranges": [
{
"startOffset": 10928,
"endOffset": 11324,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readFloatForwards",
"ranges": [
{
"startOffset": 11326,
"endOffset": 11721,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readDoubleBackwards",
"ranges": [
{
"startOffset": 11723,
"endOffset": 12284,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "readDoubleForwards",
"ranges": [
{
"startOffset": 12286,
"endOffset": 12846,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUIntLE",
"ranges": [
{
"startOffset": 12867,
"endOffset": 13508,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int48LE",
"ranges": [
{
"startOffset": 13510,
"endOffset": 13924,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int40LE",
"ranges": [
{
"startOffset": 13926,
"endOffset": 14306,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int32LE",
"ranges": [
{
"startOffset": 14308,
"endOffset": 14615,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUInt32LE",
"ranges": [
{
"startOffset": 14617,
"endOffset": 14723,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int24LE",
"ranges": [
{
"startOffset": 14725,
"endOffset": 14984,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int16LE",
"ranges": [
{
"startOffset": 14986,
"endOffset": 15182,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUInt16LE",
"ranges": [
{
"startOffset": 15184,
"endOffset": 15286,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int8",
"ranges": [
{
"startOffset": 15288,
"endOffset": 15691,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUInt8",
"ranges": [
{
"startOffset": 15693,
"endOffset": 15787,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUIntBE",
"ranges": [
{
"startOffset": 15789,
"endOffset": 16432,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int48BE",
"ranges": [
{
"startOffset": 16434,
"endOffset": 16856,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int40BE",
"ranges": [
{
"startOffset": 16858,
"endOffset": 17221,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int32BE",
"ranges": [
{
"startOffset": 17223,
"endOffset": 17538,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUInt32BE",
"ranges": [
{
"startOffset": 17540,
"endOffset": 17646,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int24BE",
"ranges": [
{
"startOffset": 17648,
"endOffset": 17913,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeU_Int16BE",
"ranges": [
{
"startOffset": 17915,
"endOffset": 18111,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeUInt16BE",
"ranges": [
{
"startOffset": 18113,
"endOffset": 18219,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeIntLE",
"ranges": [
{
"startOffset": 18221,
"endOffset": 18915,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeInt32LE",
"ranges": [
{
"startOffset": 18917,
"endOffset": 19032,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeInt16LE",
"ranges": [
{
"startOffset": 19034,
"endOffset": 19141,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeInt8",
"ranges": [
{
"startOffset": 19143,
"endOffset": 19240,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeIntBE",
"ranges": [
{
"startOffset": 19242,
"endOffset": 19936,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeInt32BE",
"ranges": [
{
"startOffset": 19938,
"endOffset": 20053,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeInt16BE",
"ranges": [
{
"startOffset": 20055,
"endOffset": 20162,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeDoubleForwards",
"ranges": [
{
"startOffset": 20181,
"endOffset": 20647,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeDoubleBackwards",
"ranges": [
{
"startOffset": 20649,
"endOffset": 21116,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeFloatForwards",
"ranges": [
{
"startOffset": 21118,
"endOffset": 21419,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeFloatBackwards",
"ranges": [
{
"startOffset": 21421,
"endOffset": 21723,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/constants.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst isWindows = process.platform === 'win32';\n\nmodule.exports = {\n // Alphabet chars.\n CHAR_UPPERCASE_A: 65, /* A */\n CHAR_LOWERCASE_A: 97, /* a */\n CHAR_UPPERCASE_Z: 90, /* Z */\n CHAR_LOWERCASE_Z: 122, /* z */\n\n // Non-alphabetic chars.\n CHAR_DOT: 46, /* . */\n CHAR_FORWARD_SLASH: 47, /* / */\n CHAR_BACKWARD_SLASH: 92, /* \\ */\n CHAR_VERTICAL_LINE: 124, /* | */\n CHAR_COLON: 58, /* : */\n CHAR_QUESTION_MARK: 63, /* ? */\n CHAR_UNDERSCORE: 95, /* _ */\n CHAR_LINE_FEED: 10, /* \\n */\n CHAR_CARRIAGE_RETURN: 13, /* \\r */\n CHAR_TAB: 9, /* \\t */\n CHAR_FORM_FEED: 12, /* \\f */\n CHAR_EXCLAMATION_MARK: 33, /* ! */\n CHAR_HASH: 35, /* # */\n CHAR_SPACE: 32, /* */\n CHAR_NO_BREAK_SPACE: 160, /* \\u00A0 */\n CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \\uFEFF */\n CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */\n CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */\n CHAR_LEFT_ANGLE_BRACKET: 60, /* < */\n CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */\n CHAR_LEFT_CURLY_BRACKET: 123, /* { */\n CHAR_RIGHT_CURLY_BRACKET: 125, /* } */\n CHAR_HYPHEN_MINUS: 45, /* - */\n CHAR_PLUS: 43, /* + */\n CHAR_DOUBLE_QUOTE: 34, /* \" */\n CHAR_SINGLE_QUOTE: 39, /* ' */\n CHAR_PERCENT: 37, /* % */\n CHAR_SEMICOLON: 59, /* ; */\n CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */\n CHAR_GRAVE_ACCENT: 96, /* ` */\n CHAR_AT: 64, /* @ */\n CHAR_AMPERSAND: 38, /* & */\n CHAR_EQUAL: 61, /* = */\n\n // Digits\n CHAR_0: 48, /* 0 */\n CHAR_9: 57, /* 9 */\n\n EOL: isWindows ? '\\r\\n' : '\\n'\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1503,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1501,
"count": 1
},
{
"startOffset": 1480,
"endOffset": 1488,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/encoding.js",
"source": "(function (exports, require, module, process) {'use strict';\n\n// An implementation of the WHATWG Encoding Standard\n// https://encoding.spec.whatwg.org\n\nconst {\n ERR_ENCODING_INVALID_ENCODED_DATA,\n ERR_ENCODING_NOT_SUPPORTED,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_THIS,\n ERR_NO_ICU\n} = require('internal/errors').codes;\nconst kHandle = Symbol('handle');\nconst kFlags = Symbol('flags');\nconst kEncoding = Symbol('encoding');\nconst kDecoder = Symbol('decoder');\nconst kEncoder = Symbol('encoder');\n\nconst {\n getConstructorOf,\n customInspectSymbol: inspect\n} = require('internal/util');\n\nconst { isArrayBufferView } = require('internal/util/types');\n\nconst { internalBinding } = require('internal/bootstrap/loaders');\nconst {\n isArrayBuffer\n} = internalBinding('types');\n\nconst {\n encodeUtf8String\n} = process.binding('buffer');\n\nvar Buffer;\nfunction lazyBuffer() {\n if (Buffer === undefined)\n Buffer = require('buffer').Buffer;\n return Buffer;\n}\n\nfunction validateEncoder(obj) {\n if (obj == null || obj[kEncoder] !== true)\n throw new ERR_INVALID_THIS('TextEncoder');\n}\n\nfunction validateDecoder(obj) {\n if (obj == null || obj[kDecoder] !== true)\n throw new ERR_INVALID_THIS('TextDecoder');\n}\n\nfunction validateArgument(prop, expected, propName, expectedName) {\n if (typeof prop !== expected)\n throw new ERR_INVALID_ARG_TYPE(propName, expectedName, prop);\n}\n\nconst CONVERTER_FLAGS_FLUSH = 0x1;\nconst CONVERTER_FLAGS_FATAL = 0x2;\nconst CONVERTER_FLAGS_IGNORE_BOM = 0x4;\n\nconst empty = new Uint8Array(0);\n\nconst encodings = new Map([\n ['unicode-1-1-utf-8', 'utf-8'],\n ['utf8', 'utf-8'],\n ['utf-8', 'utf-8'],\n ['866', 'ibm866'],\n ['cp866', 'ibm866'],\n ['csibm866', 'ibm866'],\n ['ibm866', 'ibm866'],\n ['csisolatin2', 'iso-8859-2'],\n ['iso-8859-2', 'iso-8859-2'],\n ['iso-ir-101', 'iso-8859-2'],\n ['iso8859-2', 'iso-8859-2'],\n ['iso88592', 'iso-8859-2'],\n ['iso_8859-2', 'iso-8859-2'],\n ['iso_8859-2:1987', 'iso-8859-2'],\n ['l2', 'iso-8859-2'],\n ['latin2', 'iso-8859-2'],\n ['csisolatin3', 'iso-8859-3'],\n ['iso-8859-3', 'iso-8859-3'],\n ['iso-ir-109', 'iso-8859-3'],\n ['iso8859-3', 'iso-8859-3'],\n ['iso88593', 'iso-8859-3'],\n ['iso_8859-3', 'iso-8859-3'],\n ['iso_8859-3:1988', 'iso-8859-3'],\n ['l3', 'iso-8859-3'],\n ['latin3', 'iso-8859-3'],\n ['csisolatin4', 'iso-8859-4'],\n ['iso-8859-4', 'iso-8859-4'],\n ['iso-ir-110', 'iso-8859-4'],\n ['iso8859-4', 'iso-8859-4'],\n ['iso88594', 'iso-8859-4'],\n ['iso_8859-4', 'iso-8859-4'],\n ['iso_8859-4:1988', 'iso-8859-4'],\n ['l4', 'iso-8859-4'],\n ['latin4', 'iso-8859-4'],\n ['csisolatincyrillic', 'iso-8859-5'],\n ['cyrillic', 'iso-8859-5'],\n ['iso-8859-5', 'iso-8859-5'],\n ['iso-ir-144', 'iso-8859-5'],\n ['iso8859-5', 'iso-8859-5'],\n ['iso88595', 'iso-8859-5'],\n ['iso_8859-5', 'iso-8859-5'],\n ['iso_8859-5:1988', 'iso-8859-5'],\n ['arabic', 'iso-8859-6'],\n ['asmo-708', 'iso-8859-6'],\n ['csiso88596e', 'iso-8859-6'],\n ['csiso88596i', 'iso-8859-6'],\n ['csisolatinarabic', 'iso-8859-6'],\n ['ecma-114', 'iso-8859-6'],\n ['iso-8859-6', 'iso-8859-6'],\n ['iso-8859-6-e', 'iso-8859-6'],\n ['iso-8859-6-i', 'iso-8859-6'],\n ['iso-ir-127', 'iso-8859-6'],\n ['iso8859-6', 'iso-8859-6'],\n ['iso88596', 'iso-8859-6'],\n ['iso_8859-6', 'iso-8859-6'],\n ['iso_8859-6:1987', 'iso-8859-6'],\n ['csisolatingreek', 'iso-8859-7'],\n ['ecma-118', 'iso-8859-7'],\n ['elot_928', 'iso-8859-7'],\n ['greek', 'iso-8859-7'],\n ['greek8', 'iso-8859-7'],\n ['iso-8859-7', 'iso-8859-7'],\n ['iso-ir-126', 'iso-8859-7'],\n ['iso8859-7', 'iso-8859-7'],\n ['iso88597', 'iso-8859-7'],\n ['iso_8859-7', 'iso-8859-7'],\n ['iso_8859-7:1987', 'iso-8859-7'],\n ['sun_eu_greek', 'iso-8859-7'],\n ['csiso88598e', 'iso-8859-8'],\n ['csisolatinhebrew', 'iso-8859-8'],\n ['hebrew', 'iso-8859-8'],\n ['iso-8859-8', 'iso-8859-8'],\n ['iso-8859-8-e', 'iso-8859-8'],\n ['iso-ir-138', 'iso-8859-8'],\n ['iso8859-8', 'iso-8859-8'],\n ['iso88598', 'iso-8859-8'],\n ['iso_8859-8', 'iso-8859-8'],\n ['iso_8859-8:1988', 'iso-8859-8'],\n ['visual', 'iso-8859-8'],\n ['csiso88598i', 'iso-8859-8-i'],\n ['iso-8859-8-i', 'iso-8859-8-i'],\n ['logical', 'iso-8859-8-i'],\n ['csisolatin6', 'iso-8859-10'],\n ['iso-8859-10', 'iso-8859-10'],\n ['iso-ir-157', 'iso-8859-10'],\n ['iso8859-10', 'iso-8859-10'],\n ['iso885910', 'iso-8859-10'],\n ['l6', 'iso-8859-10'],\n ['latin6', 'iso-8859-10'],\n ['iso-8859-13', 'iso-8859-13'],\n ['iso8859-13', 'iso-8859-13'],\n ['iso885913', 'iso-8859-13'],\n ['iso-8859-14', 'iso-8859-14'],\n ['iso8859-14', 'iso-8859-14'],\n ['iso885914', 'iso-8859-14'],\n ['csisolatin9', 'iso-8859-15'],\n ['iso-8859-15', 'iso-8859-15'],\n ['iso8859-15', 'iso-8859-15'],\n ['iso885915', 'iso-8859-15'],\n ['iso_8859-15', 'iso-8859-15'],\n ['l9', 'iso-8859-15'],\n ['cskoi8r', 'koi8-r'],\n ['koi', 'koi8-r'],\n ['koi8', 'koi8-r'],\n ['koi8-r', 'koi8-r'],\n ['koi8_r', 'koi8-r'],\n ['koi8-ru', 'koi8-u'],\n ['koi8-u', 'koi8-u'],\n ['csmacintosh', 'macintosh'],\n ['mac', 'macintosh'],\n ['macintosh', 'macintosh'],\n ['x-mac-roman', 'macintosh'],\n ['dos-874', 'windows-874'],\n ['iso-8859-11', 'windows-874'],\n ['iso8859-11', 'windows-874'],\n ['iso885911', 'windows-874'],\n ['tis-620', 'windows-874'],\n ['windows-874', 'windows-874'],\n ['cp1250', 'windows-1250'],\n ['windows-1250', 'windows-1250'],\n ['x-cp1250', 'windows-1250'],\n ['cp1251', 'windows-1251'],\n ['windows-1251', 'windows-1251'],\n ['x-cp1251', 'windows-1251'],\n ['ansi_x3.4-1968', 'windows-1252'],\n ['ascii', 'windows-1252'],\n ['cp1252', 'windows-1252'],\n ['cp819', 'windows-1252'],\n ['csisolatin1', 'windows-1252'],\n ['ibm819', 'windows-1252'],\n ['iso-8859-1', 'windows-1252'],\n ['iso-ir-100', 'windows-1252'],\n ['iso8859-1', 'windows-1252'],\n ['iso88591', 'windows-1252'],\n ['iso_8859-1', 'windows-1252'],\n ['iso_8859-1:1987', 'windows-1252'],\n ['l1', 'windows-1252'],\n ['latin1', 'windows-1252'],\n ['us-ascii', 'windows-1252'],\n ['windows-1252', 'windows-1252'],\n ['x-cp1252', 'windows-1252'],\n ['cp1253', 'windows-1253'],\n ['windows-1253', 'windows-1253'],\n ['x-cp1253', 'windows-1253'],\n ['cp1254', 'windows-1254'],\n ['csisolatin5', 'windows-1254'],\n ['iso-8859-9', 'windows-1254'],\n ['iso-ir-148', 'windows-1254'],\n ['iso8859-9', 'windows-1254'],\n ['iso88599', 'windows-1254'],\n ['iso_8859-9', 'windows-1254'],\n ['iso_8859-9:1989', 'windows-1254'],\n ['l5', 'windows-1254'],\n ['latin5', 'windows-1254'],\n ['windows-1254', 'windows-1254'],\n ['x-cp1254', 'windows-1254'],\n ['cp1255', 'windows-1255'],\n ['windows-1255', 'windows-1255'],\n ['x-cp1255', 'windows-1255'],\n ['cp1256', 'windows-1256'],\n ['windows-1256', 'windows-1256'],\n ['x-cp1256', 'windows-1256'],\n ['cp1257', 'windows-1257'],\n ['windows-1257', 'windows-1257'],\n ['x-cp1257', 'windows-1257'],\n ['cp1258', 'windows-1258'],\n ['windows-1258', 'windows-1258'],\n ['x-cp1258', 'windows-1258'],\n ['x-mac-cyrillic', 'x-mac-cyrillic'],\n ['x-mac-ukrainian', 'x-mac-cyrillic'],\n ['chinese', 'gbk'],\n ['csgb2312', 'gbk'],\n ['csiso58gb231280', 'gbk'],\n ['gb2312', 'gbk'],\n ['gb_2312', 'gbk'],\n ['gb_2312-80', 'gbk'],\n ['gbk', 'gbk'],\n ['iso-ir-58', 'gbk'],\n ['x-gbk', 'gbk'],\n ['gb18030', 'gb18030'],\n ['big5', 'big5'],\n ['big5-hkscs', 'big5'],\n ['cn-big5', 'big5'],\n ['csbig5', 'big5'],\n ['x-x-big5', 'big5'],\n ['cseucpkdfmtjapanese', 'euc-jp'],\n ['euc-jp', 'euc-jp'],\n ['x-euc-jp', 'euc-jp'],\n ['csiso2022jp', 'iso-2022-jp'],\n ['iso-2022-jp', 'iso-2022-jp'],\n ['csshiftjis', 'shift_jis'],\n ['ms932', 'shift_jis'],\n ['ms_kanji', 'shift_jis'],\n ['shift-jis', 'shift_jis'],\n ['shift_jis', 'shift_jis'],\n ['sjis', 'shift_jis'],\n ['windows-31j', 'shift_jis'],\n ['x-sjis', 'shift_jis'],\n ['cseuckr', 'euc-kr'],\n ['csksc56011987', 'euc-kr'],\n ['euc-kr', 'euc-kr'],\n ['iso-ir-149', 'euc-kr'],\n ['korean', 'euc-kr'],\n ['ks_c_5601-1987', 'euc-kr'],\n ['ks_c_5601-1989', 'euc-kr'],\n ['ksc5601', 'euc-kr'],\n ['ksc_5601', 'euc-kr'],\n ['windows-949', 'euc-kr'],\n ['utf-16be', 'utf-16be'],\n ['utf-16le', 'utf-16le'],\n ['utf-16', 'utf-16le']\n]);\n\n// Unfortunately, String.prototype.trim also removes non-ascii whitespace,\n// so we have to do this manually\nfunction trimAsciiWhitespace(label) {\n var s = 0;\n var e = label.length;\n while (s < e && (\n label[s] === '\\u0009' ||\n label[s] === '\\u000a' ||\n label[s] === '\\u000c' ||\n label[s] === '\\u000d' ||\n label[s] === '\\u0020')) {\n s++;\n }\n while (e > s && (\n label[e - 1] === '\\u0009' ||\n label[e - 1] === '\\u000a' ||\n label[e - 1] === '\\u000c' ||\n label[e - 1] === '\\u000d' ||\n label[e - 1] === '\\u0020')) {\n e--;\n }\n return label.slice(s, e);\n}\n\nfunction getEncodingFromLabel(label) {\n const enc = encodings.get(label);\n if (enc !== undefined) return enc;\n return encodings.get(trimAsciiWhitespace(label.toLowerCase()));\n}\n\nclass TextEncoder {\n constructor() {\n this[kEncoder] = true;\n }\n\n get encoding() {\n validateEncoder(this);\n return 'utf-8';\n }\n\n encode(input = '') {\n validateEncoder(this);\n return encodeUtf8String(`${input}`);\n }\n\n [inspect](depth, opts) {\n validateEncoder(this);\n if (typeof depth === 'number' && depth < 0)\n return opts.stylize('[Object]', 'special');\n var ctor = getConstructorOf(this);\n var obj = Object.create({\n constructor: ctor === null ? TextEncoder : ctor\n });\n obj.encoding = this.encoding;\n // Lazy to avoid circular dependency\n return require('util').inspect(obj, opts);\n }\n}\n\nObject.defineProperties(\n TextEncoder.prototype, {\n 'encode': { enumerable: true },\n 'encoding': { enumerable: true },\n [Symbol.toStringTag]: {\n configurable: true,\n value: 'TextEncoder'\n } });\n\nconst { hasConverter, TextDecoder } =\n process.binding('config').hasIntl ?\n makeTextDecoderICU() :\n makeTextDecoderJS();\n\nfunction hasTextDecoder(encoding = 'utf-8') {\n validateArgument(encoding, 'string', 'encoding', 'string');\n return hasConverter(getEncodingFromLabel(encoding));\n}\n\nfunction makeTextDecoderICU() {\n const {\n decode: _decode,\n getConverter,\n hasConverter\n } = process.binding('icu');\n\n class TextDecoder {\n constructor(encoding = 'utf-8', options = {}) {\n encoding = `${encoding}`;\n validateArgument(options, 'object', 'options', 'Object');\n\n const enc = getEncodingFromLabel(encoding);\n if (enc === undefined)\n throw new ERR_ENCODING_NOT_SUPPORTED(encoding);\n\n var flags = 0;\n if (options !== null) {\n flags |= options.fatal ? CONVERTER_FLAGS_FATAL : 0;\n flags |= options.ignoreBOM ? CONVERTER_FLAGS_IGNORE_BOM : 0;\n }\n\n const handle = getConverter(enc, flags);\n if (handle === undefined)\n throw new ERR_ENCODING_NOT_SUPPORTED(encoding);\n\n this[kDecoder] = true;\n this[kHandle] = handle;\n this[kFlags] = flags;\n this[kEncoding] = enc;\n }\n\n\n decode(input = empty, options = {}) {\n validateDecoder(this);\n if (isArrayBuffer(input)) {\n input = lazyBuffer().from(input);\n } else if (!isArrayBufferView(input)) {\n throw new ERR_INVALID_ARG_TYPE('input',\n ['ArrayBuffer', 'ArrayBufferView'],\n input);\n }\n validateArgument(options, 'object', 'options', 'Object');\n\n var flags = 0;\n if (options !== null)\n flags |= options.stream ? 0 : CONVERTER_FLAGS_FLUSH;\n\n const ret = _decode(this[kHandle], input, flags);\n if (typeof ret === 'number') {\n const err = new ERR_ENCODING_INVALID_ENCODED_DATA(this.encoding);\n err.errno = ret;\n throw err;\n }\n return ret.toString('ucs2');\n }\n }\n\n return { hasConverter, TextDecoder };\n}\n\nfunction makeTextDecoderJS() {\n var StringDecoder;\n function lazyStringDecoder() {\n if (StringDecoder === undefined)\n ({ StringDecoder } = require('string_decoder'));\n return StringDecoder;\n }\n\n const kBOMSeen = Symbol('BOM seen');\n\n function hasConverter(encoding) {\n return encoding === 'utf-8' || encoding === 'utf-16le';\n }\n\n class TextDecoder {\n constructor(encoding = 'utf-8', options = {}) {\n encoding = `${encoding}`;\n validateArgument(options, 'object', 'options', 'Object');\n\n const enc = getEncodingFromLabel(encoding);\n if (enc === undefined || !hasConverter(enc))\n throw new ERR_ENCODING_NOT_SUPPORTED(encoding);\n\n var flags = 0;\n if (options !== null) {\n if (options.fatal) {\n throw new ERR_NO_ICU('\"fatal\" option');\n }\n flags |= options.ignoreBOM ? CONVERTER_FLAGS_IGNORE_BOM : 0;\n }\n\n this[kDecoder] = true;\n // StringDecoder will normalize WHATWG encoding to Node.js encoding.\n this[kHandle] = new (lazyStringDecoder())(enc);\n this[kFlags] = flags;\n this[kEncoding] = enc;\n this[kBOMSeen] = false;\n }\n\n decode(input = empty, options = {}) {\n validateDecoder(this);\n if (isArrayBuffer(input)) {\n input = lazyBuffer().from(input);\n } else if (isArrayBufferView(input)) {\n input = lazyBuffer().from(input.buffer, input.byteOffset,\n input.byteLength);\n } else {\n throw new ERR_INVALID_ARG_TYPE('input',\n ['ArrayBuffer', 'ArrayBufferView'],\n input);\n }\n validateArgument(options, 'object', 'options', 'Object');\n\n if (this[kFlags] & CONVERTER_FLAGS_FLUSH) {\n this[kBOMSeen] = false;\n }\n\n if (options !== null && options.stream) {\n this[kFlags] &= ~CONVERTER_FLAGS_FLUSH;\n } else {\n this[kFlags] |= CONVERTER_FLAGS_FLUSH;\n }\n\n if (!this[kBOMSeen] && !(this[kFlags] & CONVERTER_FLAGS_IGNORE_BOM)) {\n if (this[kEncoding] === 'utf-8') {\n if (input.length >= 3 &&\n input[0] === 0xEF && input[1] === 0xBB && input[2] === 0xBF) {\n input = input.slice(3);\n }\n } else if (this[kEncoding] === 'utf-16le') {\n if (input.length >= 2 && input[0] === 0xFF && input[1] === 0xFE) {\n input = input.slice(2);\n }\n }\n this[kBOMSeen] = true;\n }\n\n if (this[kFlags] & CONVERTER_FLAGS_FLUSH) {\n return this[kHandle].end(input);\n }\n\n return this[kHandle].write(input);\n }\n }\n\n return { hasConverter, TextDecoder };\n}\n\n// Mix in some shared properties.\n{\n Object.defineProperties(\n TextDecoder.prototype,\n Object.getOwnPropertyDescriptors({\n get encoding() {\n validateDecoder(this);\n return this[kEncoding];\n },\n\n get fatal() {\n validateDecoder(this);\n return (this[kFlags] & CONVERTER_FLAGS_FATAL) === CONVERTER_FLAGS_FATAL;\n },\n\n get ignoreBOM() {\n validateDecoder(this);\n return (this[kFlags] & CONVERTER_FLAGS_IGNORE_BOM) ===\n CONVERTER_FLAGS_IGNORE_BOM;\n },\n\n [inspect](depth, opts) {\n validateDecoder(this);\n if (typeof depth === 'number' && depth < 0)\n return opts.stylize('[Object]', 'special');\n var ctor = getConstructorOf(this);\n var obj = Object.create({\n constructor: ctor === null ? TextDecoder : ctor\n });\n obj.encoding = this.encoding;\n obj.fatal = this.fatal;\n obj.ignoreBOM = this.ignoreBOM;\n if (opts.showHidden) {\n obj[kFlags] = this[kFlags];\n obj[kHandle] = this[kHandle];\n }\n // Lazy to avoid circular dependency\n return require('util').inspect(obj, opts);\n }\n }));\n Object.defineProperties(TextDecoder.prototype, {\n decode: { enumerable: true },\n [inspect]: { enumerable: false },\n [Symbol.toStringTag]: {\n configurable: true,\n value: 'TextDecoder'\n }\n });\n}\n\nmodule.exports = {\n getEncodingFromLabel,\n hasTextDecoder,\n TextDecoder,\n TextEncoder\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 15874,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 15872,
"count": 1
},
{
"startOffset": 9751,
"endOffset": 9776,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "lazyBuffer",
"ranges": [
{
"startOffset": 845,
"endOffset": 954,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateEncoder",
"ranges": [
{
"startOffset": 956,
"endOffset": 1081,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateDecoder",
"ranges": [
{
"startOffset": 1083,
"endOffset": 1208,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateArgument",
"ranges": [
{
"startOffset": 1210,
"endOffset": 1377,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "trimAsciiWhitespace",
"ranges": [
{
"startOffset": 8118,
"endOffset": 8600,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getEncodingFromLabel",
"ranges": [
{
"startOffset": 8602,
"endOffset": 8781,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "TextEncoder",
"ranges": [
{
"startOffset": 8805,
"endOffset": 8851,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get encoding",
"ranges": [
{
"startOffset": 8855,
"endOffset": 8922,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "encode",
"ranges": [
{
"startOffset": 8926,
"endOffset": 9018,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 9022,
"endOffset": 9428,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "hasTextDecoder",
"ranges": [
{
"startOffset": 9779,
"endOffset": 9943,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeTextDecoderICU",
"ranges": [
{
"startOffset": 9945,
"endOffset": 11683,
"count": 1
},
{
"startOffset": 11681,
"endOffset": 11682,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "TextDecoder",
"ranges": [
{
"startOffset": 10100,
"endOffset": 10827,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "decode",
"ranges": [
{
"startOffset": 10834,
"endOffset": 11636,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeTextDecoderJS",
"ranges": [
{
"startOffset": 11685,
"endOffset": 14361,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get encoding",
"ranges": [
{
"startOffset": 14498,
"endOffset": 14585,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get fatal",
"ranges": [
{
"startOffset": 14594,
"endOffset": 14727,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get ignoreBOM",
"ranges": [
{
"startOffset": 14736,
"endOffset": 14898,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Object.defineProperties.Object.getOwnPropertyDescriptors",
"ranges": [
{
"startOffset": 14907,
"endOffset": 15548,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/errors.js",
"source": "(function (exports, require, module, process) {/* eslint node-core/documented-errors: \"error\" */\n/* eslint node-core/alphabetize-errors: \"error\" */\n/* eslint node-core/prefer-util-format-errors: \"error\" */\n\n'use strict';\n\n// The whole point behind this internal module is to allow Node.js to no\n// longer be forced to treat every error message change as a semver-major\n// change. The NodeError classes here all expose a `code` property whose\n// value statically and permanently identifies the error. While the error\n// message may change, the code should not.\n\nconst kCode = Symbol('code');\nconst kInfo = Symbol('info');\nconst messages = new Map();\nconst codes = {};\n\nconst {\n errmap,\n UV_EAI_MEMORY,\n UV_EAI_NODATA,\n UV_EAI_NONAME\n} = process.binding('uv');\nconst { kMaxLength } = process.binding('buffer');\nconst { defineProperty } = Object;\n\n// Lazily loaded\nlet util;\nlet assert;\n\nlet internalUtil = null;\nfunction lazyInternalUtil() {\n if (!internalUtil) {\n internalUtil = require('internal/util');\n }\n return internalUtil;\n}\n\nlet buffer;\nfunction lazyBuffer() {\n if (buffer === undefined)\n buffer = require('buffer').Buffer;\n return buffer;\n}\n\n// A specialized Error that includes an additional info property with\n// additional information about the error condition.\n// It has the properties present in a UVException but with a custom error\n// message followed by the uv error code and uv error message.\n// It also has its own error code with the original uv error context put into\n// `err.info`.\n// The context passed into this error must have .code, .syscall and .message,\n// and may have .path and .dest.\nclass SystemError extends Error {\n constructor(key, context) {\n const prefix = getMessage(key, []);\n let message = `${prefix}: ${context.syscall} returned ` +\n `${context.code} (${context.message})`;\n\n if (context.path !== undefined)\n message += ` ${context.path}`;\n if (context.dest !== undefined)\n message += ` => ${context.dest}`;\n\n super(message);\n Object.defineProperty(this, kInfo, {\n configurable: false,\n enumerable: false,\n value: context\n });\n Object.defineProperty(this, kCode, {\n configurable: true,\n enumerable: false,\n value: key,\n writable: true\n });\n }\n\n get name() {\n return `SystemError [${this[kCode]}]`;\n }\n\n set name(value) {\n defineProperty(this, 'name', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n\n get code() {\n return this[kCode];\n }\n\n set code(value) {\n defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n\n get info() {\n return this[kInfo];\n }\n\n get errno() {\n return this[kInfo].errno;\n }\n\n set errno(val) {\n this[kInfo].errno = val;\n }\n\n get syscall() {\n return this[kInfo].syscall;\n }\n\n set syscall(val) {\n this[kInfo].syscall = val;\n }\n\n get path() {\n return this[kInfo].path !== undefined ?\n this[kInfo].path.toString() : undefined;\n }\n\n set path(val) {\n this[kInfo].path = val ?\n lazyBuffer().from(val.toString()) : undefined;\n }\n\n get dest() {\n return this[kInfo].path !== undefined ?\n this[kInfo].dest.toString() : undefined;\n }\n\n set dest(val) {\n this[kInfo].dest = val ?\n lazyBuffer().from(val.toString()) : undefined;\n }\n}\n\nfunction makeSystemErrorWithCode(key) {\n return class NodeError extends SystemError {\n constructor(ctx) {\n super(key, ctx);\n }\n };\n}\n\nfunction makeNodeErrorWithCode(Base, key) {\n return class NodeError extends Base {\n constructor(...args) {\n super(getMessage(key, args));\n }\n\n get name() {\n return `${super.name} [${key}]`;\n }\n\n set name(value) {\n defineProperty(this, 'name', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n\n get code() {\n return key;\n }\n\n set code(value) {\n defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n };\n}\n\n// Utility function for registering the error codes. Only used here. Exported\n// *only* to allow for testing.\nfunction E(sym, val, def, ...otherClasses) {\n // Special case for SystemError that formats the error message differently\n // The SystemErrors only have SystemError as their base classes.\n messages.set(sym, val);\n if (def === SystemError) {\n def = makeSystemErrorWithCode(sym);\n } else {\n def = makeNodeErrorWithCode(def, sym);\n }\n\n if (otherClasses.length !== 0) {\n otherClasses.forEach((clazz) => {\n def[clazz.name] = makeNodeErrorWithCode(clazz, sym);\n });\n }\n codes[sym] = def;\n}\n\nfunction getMessage(key, args) {\n const msg = messages.get(key);\n\n if (util === undefined) util = require('util');\n if (assert === undefined) assert = require('assert');\n\n if (typeof msg === 'function') {\n assert(\n msg.length <= args.length, // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${msg.length}).`\n );\n return msg.apply(null, args);\n }\n\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${expectedLength}).`\n );\n if (args.length === 0)\n return msg;\n\n args.unshift(msg);\n return util.format.apply(null, args);\n}\n\n/**\n * This creates an error compatible with errors produced in the C++\n * function UVException using a context object with data assembled in C++.\n * The goal is to migrate them to ERR_* errors later when compatibility is\n * not a concern.\n *\n * @param {Object} ctx\n * @returns {Error}\n */\nfunction uvException(ctx) {\n const [ code, uvmsg ] = errmap.get(ctx.errno);\n let message = `${code}: ${uvmsg}, ${ctx.syscall}`;\n\n let path;\n let dest;\n if (ctx.path) {\n path = ctx.path.toString();\n message += ` '${path}'`;\n }\n if (ctx.dest) {\n dest = ctx.dest.toString();\n message += ` -> '${dest}'`;\n }\n\n // Pass the message to the constructor instead of setting it on the object\n // to make sure it is the same as the one created in C++\n // eslint-disable-next-line no-restricted-syntax\n const err = new Error(message);\n\n for (const prop of Object.keys(ctx)) {\n if (prop === 'message' || prop === 'path' || prop === 'dest') {\n continue;\n }\n err[prop] = ctx[prop];\n }\n\n err.code = code;\n if (path) {\n err.path = path;\n }\n if (dest) {\n err.dest = dest;\n }\n\n Error.captureStackTrace(err, uvException);\n return err;\n}\n\n/**\n * This used to be util._errnoException().\n *\n * @param {number} err - A libuv error number\n * @param {string} syscall\n * @param {string} [original]\n * @returns {Error}\n */\nfunction errnoException(err, syscall, original) {\n // TODO(joyeecheung): We have to use the type-checked\n // getSystemErrorName(err) to guard against invalid arguments from users.\n // This can be replaced with [ code ] = errmap.get(err) when this method\n // is no longer exposed to user land.\n if (util === undefined) util = require('util');\n const code = util.getSystemErrorName(err);\n const message = original ?\n `${syscall} ${code} ${original}` : `${syscall} ${code}`;\n\n // eslint-disable-next-line no-restricted-syntax\n const ex = new Error(message);\n // TODO(joyeecheung): errno is supposed to err, like in uvException\n ex.code = ex.errno = code;\n ex.syscall = syscall;\n\n Error.captureStackTrace(ex, errnoException);\n return ex;\n}\n\n/**\n * This used to be util._exceptionWithHostPort().\n *\n * @param {number} err - A libuv error number\n * @param {string} syscall\n * @param {string} address\n * @param {number} [port]\n * @param {string} [additional]\n * @returns {Error}\n */\nfunction exceptionWithHostPort(err, syscall, address, port, additional) {\n // TODO(joyeecheung): We have to use the type-checked\n // getSystemErrorName(err) to guard against invalid arguments from users.\n // This can be replaced with [ code ] = errmap.get(err) when this method\n // is no longer exposed to user land.\n if (util === undefined) util = require('util');\n const code = util.getSystemErrorName(err);\n let details = '';\n if (port && port > 0) {\n details = ` ${address}:${port}`;\n } else if (address) {\n details = ` ${address}`;\n }\n if (additional) {\n details += ` - Local (${additional})`;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n const ex = new Error(`${syscall} ${code}${details}`);\n // TODO(joyeecheung): errno is supposed to err, like in uvException\n ex.code = ex.errno = code;\n ex.syscall = syscall;\n ex.address = address;\n if (port) {\n ex.port = port;\n }\n\n Error.captureStackTrace(ex, exceptionWithHostPort);\n return ex;\n}\n\n/**\n * @param {number|string} code - A libuv error number or a c-ares error code\n * @param {string} syscall\n * @param {string} [hostname]\n * @returns {Error}\n */\nfunction dnsException(code, syscall, hostname) {\n // If `code` is of type number, it is a libuv error number, else it is a\n // c-ares error code.\n if (typeof code === 'number') {\n // FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass\n // the true error to the user. ENOTFOUND is not even a proper POSIX error!\n if (code === UV_EAI_MEMORY ||\n code === UV_EAI_NODATA ||\n code === UV_EAI_NONAME) {\n code = 'ENOTFOUND'; // Fabricated error name.\n } else {\n code = lazyInternalUtil().getSystemErrorName(code);\n }\n }\n const message = `${syscall} ${code}${hostname ? ` ${hostname}` : ''}`;\n // eslint-disable-next-line no-restricted-syntax\n const ex = new Error(message);\n // TODO(joyeecheung): errno is supposed to be a number / err, like in\n // uvException.\n ex.errno = code;\n ex.code = code;\n ex.syscall = syscall;\n if (hostname) {\n ex.hostname = hostname;\n }\n Error.captureStackTrace(ex, dnsException);\n return ex;\n}\n\nlet maxStack_ErrorName;\nlet maxStack_ErrorMessage;\n/**\n * Returns true if `err.name` and `err.message` are equal to engine-specific\n * values indicating max call stack size has been exceeded.\n * \"Maximum call stack size exceeded\" in V8.\n *\n * @param {Error} err\n * @returns {boolean}\n */\nfunction isStackOverflowError(err) {\n if (maxStack_ErrorMessage === undefined) {\n try {\n function overflowStack() { overflowStack(); }\n overflowStack();\n } catch (err) {\n maxStack_ErrorMessage = err.message;\n maxStack_ErrorName = err.name;\n }\n }\n\n return err.name === maxStack_ErrorName &&\n err.message === maxStack_ErrorMessage;\n}\n\nfunction oneOf(expected, thing) {\n assert(typeof thing === 'string', '`thing` has to be of type string');\n if (Array.isArray(expected)) {\n const len = expected.length;\n assert(len > 0,\n 'At least one expected value needs to be specified');\n expected = expected.map((i) => String(i));\n if (len > 2) {\n return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +\n expected[len - 1];\n } else if (len === 2) {\n return `one of ${thing} ${expected[0]} or ${expected[1]}`;\n } else {\n return `of ${thing} ${expected[0]}`;\n }\n } else {\n return `of ${thing} ${String(expected)}`;\n }\n}\n\nmodule.exports = {\n dnsException,\n errnoException,\n exceptionWithHostPort,\n uvException,\n isStackOverflowError,\n getMessage,\n SystemError,\n codes,\n E // This is exported only to facilitate testing.\n};\n\n// To declare an error message, use the E(sym, val, def) function above. The sym\n// must be an upper case string. The val can be either a function or a string.\n// The def must be an error class.\n// The return value of the function must be a string.\n// Examples:\n// E('EXAMPLE_KEY1', 'This is the error value', Error);\n// E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`, RangeError);\n//\n// Once an error code has been assigned, the code itself MUST NOT change and\n// any given error code must never be reused to identify a different error.\n//\n// Any error code added here should also be added to the documentation\n//\n// Note: Please try to keep these in alphabetical order\n//\n// Note: Node.js specific errors must begin with the prefix ERR_\n\nE('ERR_AMBIGUOUS_ARGUMENT', 'The \"%s\" argument is ambiguous. %s', TypeError);\nE('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError);\nE('ERR_ASSERTION', '%s', Error);\nE('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError);\nE('ERR_ASYNC_TYPE', 'Invalid name for async \"type\": %s', TypeError);\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n // Using a default argument here is important so the argument is not counted\n // towards `Function#length`.\n (name = undefined) => {\n if (name) {\n return `\"${name}\" is outside of buffer bounds`;\n }\n return 'Attempt to write outside buffer bounds';\n }, RangeError);\nE('ERR_BUFFER_TOO_LARGE',\n `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`,\n RangeError);\nE('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals', Error);\nE('ERR_CHILD_CLOSED_BEFORE_REPLY',\n 'Child closed before reply received', Error);\nE('ERR_CHILD_PROCESS_IPC_REQUIRED',\n \"Forked processes must have an IPC channel, missing value 'ipc' in %s\",\n Error);\nE('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded',\n RangeError);\nE('ERR_CONSOLE_WRITABLE_STREAM',\n 'Console expects a writable stream instance for %s', TypeError);\nE('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s', Error);\nE('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED',\n 'Custom engines not supported by this OpenSSL', Error);\nE('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s', TypeError);\nE('ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY',\n 'Public key is not valid for specified curve', Error);\nE('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine \"%s\" was not found', Error);\nE('ERR_CRYPTO_FIPS_FORCED',\n 'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error);\nE('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.',\n Error);\nE('ERR_CRYPTO_HASH_DIGEST_NO_UTF16', 'hash.digest() does not support UTF-16',\n Error);\nE('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error);\nE('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error);\nE('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError);\nE('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error);\n// TODO(bnoordhuis) Decapitalize: s/PBKDF2 Error/PBKDF2 error/\nE('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 Error', Error);\nE('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error);\nE('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error);\n// Switch to TypeError. The current implementation does not seem right.\nE('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error);\nE('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH',\n 'Input buffers must have the same length', RangeError);\nE('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: \"%s\" [%s]',\n Error);\nE('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE',\n 'A callback was registered through ' +\n 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' +\n 'exclusive with using the `domain` module',\n Error);\nE('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE',\n 'The `domain` module is in use, which is mutually exclusive with calling ' +\n 'process.setUncaughtExceptionCaptureCallback()',\n Error);\nE('ERR_ENCODING_INVALID_ENCODED_DATA',\n 'The encoded data was not valid for encoding %s', TypeError);\nE('ERR_ENCODING_NOT_SUPPORTED', 'The \"%s\" encoding is not supported',\n RangeError);\nE('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value', Error);\nE('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than possible Buffer: ' +\n `${kMaxLength} bytes`,\n RangeError);\nE('ERR_FS_INVALID_SYMLINK_TYPE',\n 'Symlink type must be one of \"dir\", \"file\", or \"junction\". Received \"%s\"',\n Error); // Switch to TypeError. The current implementation does not seem right\nE('ERR_HTTP2_ALTSVC_INVALID_ORIGIN',\n 'HTTP/2 ALTSVC frames require a valid origin', TypeError);\nE('ERR_HTTP2_ALTSVC_LENGTH',\n 'HTTP/2 ALTSVC frames are limited to 16382 bytes', TypeError);\nE('ERR_HTTP2_CONNECT_AUTHORITY',\n ':authority header is required for CONNECT requests', Error);\nE('ERR_HTTP2_CONNECT_PATH',\n 'The :path header is forbidden for CONNECT requests', Error);\nE('ERR_HTTP2_CONNECT_SCHEME',\n 'The :scheme header is forbidden for CONNECT requests', Error);\nE('ERR_HTTP2_GOAWAY_SESSION',\n 'New streams cannot be created after receiving a GOAWAY', Error);\nE('ERR_HTTP2_HEADERS_AFTER_RESPOND',\n 'Cannot specify additional headers after response initiated', Error);\nE('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error);\nE('ERR_HTTP2_HEADER_SINGLE_VALUE',\n 'Header field \"%s\" must only have a single value', TypeError);\nE('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED',\n 'Informational status codes cannot be used', RangeError);\nE('ERR_HTTP2_INVALID_CONNECTION_HEADERS',\n 'HTTP/1 Connection specific headers are forbidden: \"%s\"', TypeError);\nE('ERR_HTTP2_INVALID_HEADER_VALUE',\n 'Invalid value \"%s\" for header \"%s\"', TypeError);\nE('ERR_HTTP2_INVALID_INFO_STATUS',\n 'Invalid informational status code: %s', RangeError);\nE('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH',\n 'Packed settings length must be a multiple of six', RangeError);\nE('ERR_HTTP2_INVALID_PSEUDOHEADER',\n '\"%s\" is an invalid pseudoheader or is used incorrectly', TypeError);\nE('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error);\nE('ERR_HTTP2_INVALID_SETTING_VALUE',\n 'Invalid value for setting \"%s\": %s', TypeError, RangeError);\nE('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error);\nE('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK',\n 'Maximum number of pending settings acknowledgements', Error);\nE('ERR_HTTP2_NESTED_PUSH',\n 'A push stream cannot initiate another push stream.', Error);\nE('ERR_HTTP2_NO_SOCKET_MANIPULATION',\n 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)',\n Error);\nE('ERR_HTTP2_OUT_OF_STREAMS',\n 'No stream ID is available because maximum stream ID has been reached',\n Error);\nE('ERR_HTTP2_PAYLOAD_FORBIDDEN',\n 'Responses with %s status must not have a payload', Error);\nE('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error);\nE('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError);\nE('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',\n 'Cannot set HTTP/2 pseudo-headers', TypeError);\nE('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error);\nE('ERR_HTTP2_SEND_FILE', 'Directories cannot be sent', Error);\nE('ERR_HTTP2_SEND_FILE_NOSEEK',\n 'Offset or length can only be specified for regular files', Error);\nE('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error);\nE('ERR_HTTP2_SETTINGS_CANCEL', 'HTTP2 session settings canceled', Error);\nE('ERR_HTTP2_SOCKET_BOUND',\n 'The socket is already bound to an Http2Session', Error);\nE('ERR_HTTP2_STATUS_101',\n 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2', Error);\nE('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s', RangeError);\nE('ERR_HTTP2_STREAM_CANCEL', 'The pending stream has been canceled', Error);\nE('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s', Error);\nE('ERR_HTTP2_STREAM_SELF_DEPENDENCY',\n 'A stream cannot depend on itself', Error);\nE('ERR_HTTP2_TRAILERS_ALREADY_SENT',\n 'Trailing headers have already been sent', Error);\nE('ERR_HTTP2_TRAILERS_NOT_READY',\n 'Trailing headers cannot be sent until after the wantTrailers event is ' +\n 'emitted', Error);\nE('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol \"%s\" is unsupported.', Error);\nE('ERR_HTTP_HEADERS_SENT',\n 'Cannot %s headers after they are sent to the client', Error);\nE('ERR_HTTP_INVALID_HEADER_VALUE',\n 'Invalid value \"%s\" for header \"%s\"', TypeError);\nE('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s', RangeError);\nE('ERR_HTTP_TRAILER_INVALID',\n 'Trailers are invalid with this transfer encoding', Error);\nE('ERR_INDEX_OUT_OF_RANGE', 'Index out of range', RangeError);\nE('ERR_INSPECTOR_ALREADY_CONNECTED', '%s is already connected', Error);\nE('ERR_INSPECTOR_CLOSED', 'Session was closed', Error);\nE('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error);\nE('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error);\nE('ERR_INVALID_ADDRESS_FAMILY', 'Invalid address family: %s', RangeError);\nE('ERR_INVALID_ARG_TYPE',\n (name, expected, actual) => {\n assert(typeof name === 'string', \"'name' must be a string\");\n\n // determiner: 'must be' or 'must not be'\n let determiner;\n if (typeof expected === 'string' && expected.startsWith('not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n let msg;\n if (name.endsWith(' argument')) {\n // For cases like 'first argument'\n msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;\n } else {\n const type = name.includes('.') ? 'property' : 'argument';\n msg = `The \"${name}\" ${type} ${determiner} ${oneOf(expected, 'type')}`;\n }\n\n // TODO(BridgeAR): Improve the output by showing `null` and similar.\n msg += `. Received type ${typeof actual}`;\n return msg;\n }, TypeError);\nE('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => {\n let inspected = util.inspect(value);\n if (inspected.length > 128) {\n inspected = `${inspected.slice(0, 128)}...`;\n }\n return `The argument '${name}' ${reason}. Received ${inspected}`;\n}, TypeError, RangeError);\nE('ERR_INVALID_ARRAY_LENGTH',\n (name, len, actual) => {\n return `The array \"${name}\" (length ${actual}) must be of length ${len}.`;\n }, TypeError);\nE('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError);\nE('ERR_INVALID_BUFFER_SIZE',\n 'Buffer size must be a multiple of %s', RangeError);\nE('ERR_INVALID_CALLBACK', 'Callback must be a function', TypeError);\nE('ERR_INVALID_CHAR',\n // Using a default argument here is important so the argument is not counted\n // towards `Function#length`.\n (name, field = undefined) => {\n let msg = `Invalid character in ${name}`;\n if (field !== undefined) {\n msg += ` [\"${field}\"]`;\n }\n return msg;\n }, TypeError);\nE('ERR_INVALID_CURSOR_POS',\n 'Cannot set cursor row without setting its column', TypeError);\nE('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', TypeError);\nE('ERR_INVALID_FD',\n '\"fd\" must be a positive integer: %s', RangeError);\nE('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError);\nE('ERR_INVALID_FILE_URL_HOST',\n 'File URL host must be \"localhost\" or empty on %s', TypeError);\nE('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError);\nE('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError);\nE('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token [\"%s\"]', TypeError);\nE('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError);\nE('ERR_INVALID_OPT_VALUE', (name, value) =>\n `The value \"${String(value)}\" is invalid for option \"${name}\"`,\n TypeError,\n RangeError);\nE('ERR_INVALID_OPT_VALUE_ENCODING',\n 'The value \"%s\" is invalid for option \"encoding\"', TypeError);\nE('ERR_INVALID_PERFORMANCE_MARK',\n 'The \"%s\" performance mark has not been set', Error);\nE('ERR_INVALID_PROTOCOL',\n 'Protocol \"%s\" not supported. Expected \"%s\"',\n TypeError);\nE('ERR_INVALID_REPL_EVAL_CONFIG',\n 'Cannot specify both \"breakEvalOnSigint\" and \"eval\" for REPL', TypeError);\nE('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => {\n return `Expected a valid ${input} to be returned for the \"${prop}\" from the` +\n ` \"${name}\" function but got ${value}.`;\n}, TypeError);\nE('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => {\n let type;\n if (value && value.constructor && value.constructor.name) {\n type = `instance of ${value.constructor.name}`;\n } else {\n type = `type ${typeof value}`;\n }\n return `Expected ${input} to be returned for the \"${prop}\" from the` +\n ` \"${name}\" function but got ${type}.`;\n}, TypeError);\nE('ERR_INVALID_RETURN_VALUE', (input, name, value) => {\n let type;\n if (value && value.constructor && value.constructor.name) {\n type = `instance of ${value.constructor.name}`;\n } else {\n type = `type ${typeof value}`;\n }\n return `Expected ${input} to be returned from the \"${name}\"` +\n ` function but got ${type}.`;\n}, TypeError);\nE('ERR_INVALID_SYNC_FORK_INPUT',\n 'Asynchronous forks do not support Buffer, Uint8Array or string input: %s',\n TypeError);\nE('ERR_INVALID_THIS', 'Value of \"this\" must be of type %s', TypeError);\nE('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple', TypeError);\nE('ERR_INVALID_URI', 'URI malformed', URIError);\nE('ERR_INVALID_URL', 'Invalid URL: %s', TypeError);\nE('ERR_INVALID_URL_SCHEME',\n (expected) => `The URL must be ${oneOf(expected, 'scheme')}`, TypeError);\nE('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error);\nE('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error);\nE('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error);\nE('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error);\nE('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error);\nE('ERR_MISSING_ARGS',\n (...args) => {\n assert(args.length > 0, 'At least one arg needs to be specified');\n let msg = 'The ';\n const len = args.length;\n args = args.map((a) => `\"${a}\"`);\n switch (len) {\n case 1:\n msg += `${args[0]} argument`;\n break;\n case 2:\n msg += `${args[0]} and ${args[1]} arguments`;\n break;\n default:\n msg += args.slice(0, len - 1).join(', ');\n msg += `, and ${args[len - 1]} arguments`;\n break;\n }\n return `${msg} must be specified`;\n }, TypeError);\nE('ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK',\n 'The ES Module loader may not return a format of \\'dynamic\\' when no ' +\n 'dynamicInstantiate function was provided', Error);\nE('ERR_MISSING_MODULE', 'Cannot find module %s', Error);\nE('ERR_MODULE_RESOLUTION_LEGACY',\n '%s not found by import in %s.' +\n ' Legacy behavior in require() would have found it at %s',\n Error);\nE('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error);\nE('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function', TypeError);\nE('ERR_NAPI_INVALID_DATAVIEW_ARGS',\n 'byte_offset + byte_length should be less than or equal to the size in ' +\n 'bytes of the array passed in',\n RangeError);\nE('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT',\n 'start offset of %s should be a multiple of %s', RangeError);\nE('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH',\n 'Invalid typed array length', RangeError);\nE('ERR_NO_CRYPTO',\n 'Node.js is not compiled with OpenSSL crypto support', Error);\nE('ERR_NO_ICU',\n '%s is not supported on Node.js compiled without ICU', TypeError);\nE('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported', Error);\nE('ERR_OUT_OF_RANGE',\n (name, range, value) => {\n let msg = `The value of \"${name}\" is out of range.`;\n if (range !== undefined) msg += ` It must be ${range}.`;\n msg += ` Received ${value}`;\n return msg;\n }, RangeError);\nE('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s', Error);\nE('ERR_SCRIPT_EXECUTION_INTERRUPTED',\n 'Script execution was interrupted by `SIGINT`.', Error);\nE('ERR_SERVER_ALREADY_LISTEN',\n 'Listen method has been called more than once without closing.', Error);\nE('ERR_SERVER_NOT_RUNNING', 'Server is not running.', Error);\nE('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error);\nE('ERR_SOCKET_BAD_BUFFER_SIZE',\n 'Buffer size must be a positive integer', TypeError);\nE('ERR_SOCKET_BAD_PORT',\n 'Port should be > 0 and < 65536. Received %s.', RangeError);\nE('ERR_SOCKET_BAD_TYPE',\n 'Bad socket type specified. Valid types are: udp4, udp6', TypeError);\nE('ERR_SOCKET_BUFFER_SIZE',\n 'Could not get or set buffer size',\n SystemError);\nE('ERR_SOCKET_CANNOT_SEND', 'Unable to send data', Error);\nE('ERR_SOCKET_CLOSED', 'Socket is closed', Error);\nE('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error);\nE('ERR_STDERR_CLOSE', 'process.stderr cannot be closed', Error);\nE('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed', Error);\nE('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error);\nE('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error);\nE('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\nE('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error);\nE('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error);\nE('ERR_STREAM_UNSHIFT_AFTER_END_EVENT',\n 'stream.unshift() after end event', Error);\nE('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error);\nE('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error);\nE('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError);\nE('ERR_TLS_CERT_ALTNAME_INVALID',\n 'Hostname/IP does not match certificate\\'s altnames: %s', Error);\nE('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error);\nE('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error);\nE('ERR_TLS_RENEGOTIATE', 'Attempt to renegotiate TLS session failed', Error);\nE('ERR_TLS_RENEGOTIATION_DISABLED',\n 'TLS session renegotiation disabled for this socket', Error);\n\n// This should probably be a `TypeError`.\nE('ERR_TLS_REQUIRED_SERVER_NAME',\n '\"servername\" is required parameter for Server.addContext', Error);\nE('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error);\nE('ERR_TLS_SNI_FROM_SERVER',\n 'Cannot issue SNI from a TLS server-side socket', Error);\nE('ERR_TRACE_EVENTS_CATEGORY_REQUIRED',\n 'At least one category is required', TypeError);\nE('ERR_TRACE_EVENTS_UNAVAILABLE', 'Trace events are unavailable', Error);\nE('ERR_TRANSFORM_ALREADY_TRANSFORMING',\n 'Calling transform done when still transforming', Error);\n\n// This should probably be a `RangeError`.\nE('ERR_TRANSFORM_WITH_LENGTH_0',\n 'Calling transform done when writableState.length != 0', Error);\nE('ERR_TTY_INIT_FAILED', 'TTY initialization failed', SystemError);\nE('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',\n '`process.setupUncaughtExceptionCapture()` was called while a capture ' +\n 'callback was already active',\n Error);\nE('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters', TypeError);\nE('ERR_UNHANDLED_ERROR',\n // Using a default argument here is important so the argument is not counted\n // towards `Function#length`.\n (err = undefined) => {\n const msg = 'Unhandled error.';\n if (err === undefined) return msg;\n return `${msg} (${err})`;\n }, Error);\nE('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError);\n\n// This should probably be a `TypeError`.\nE('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension: %s', Error);\nE('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError);\nE('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError);\nE('ERR_UNKNOWN_STDIN_TYPE', 'Unknown stdin file type', Error);\n\n// This should probably be a `TypeError`.\nE('ERR_UNKNOWN_STREAM_TYPE', 'Unknown stream file type', Error);\nE('ERR_V8BREAKITERATOR',\n 'Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl',\n Error);\n\n// This should probably be a `TypeError`.\nE('ERR_VALID_PERFORMANCE_ENTRY_TYPE',\n 'At least one valid performance entry type is required', Error);\nE('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error);\nE('ERR_VM_MODULE_DIFFERENT_CONTEXT',\n 'Linked modules must use the same context', Error);\nE('ERR_VM_MODULE_LINKING_ERRORED',\n 'Linking has already failed for the provided module', Error);\nE('ERR_VM_MODULE_NOT_LINKED',\n 'Module must be linked before it can be instantiated', Error);\nE('ERR_VM_MODULE_NOT_MODULE',\n 'Provided module is not an instance of Module', Error);\nE('ERR_VM_MODULE_STATUS', 'Module status %s', Error);\nE('ERR_WORKER_PATH',\n 'The worker script filename must be an absolute path or a relative ' +\n 'path starting with \\'./\\' or \\'../\\'. Received \"%s\"',\n TypeError);\nE('ERR_WORKER_UNSERIALIZABLE_ERROR',\n 'Serializing an uncaught exception failed', Error);\nE('ERR_WORKER_UNSUPPORTED_EXTENSION',\n 'The worker script extension must be \".js\" or \".mjs\". Received \"%s\"',\n TypeError);\nE('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error);\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 32331,
"count": 1
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 32329,
"count": 1
}
],
"isBlockCoverage": false
},
{
"functionName": "lazyInternalUtil",
"ranges": [
{
"startOffset": 914,
"endOffset": 1040,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lazyBuffer",
"ranges": [
{
"startOffset": 1054,
"endOffset": 1163,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "SystemError",
"ranges": [
{
"startOffset": 1665,
"endOffset": 2288,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get name",
"ranges": [
{
"startOffset": 2292,
"endOffset": 2351,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set name",
"ranges": [
{
"startOffset": 2355,
"endOffset": 2503,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get code",
"ranges": [
{
"startOffset": 2507,
"endOffset": 2547,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set code",
"ranges": [
{
"startOffset": 2551,
"endOffset": 2699,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get info",
"ranges": [
{
"startOffset": 2703,
"endOffset": 2743,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get errno",
"ranges": [
{
"startOffset": 2747,
"endOffset": 2794,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set errno",
"ranges": [
{
"startOffset": 2798,
"endOffset": 2847,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get syscall",
"ranges": [
{
"startOffset": 2851,
"endOffset": 2902,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set syscall",
"ranges": [
{
"startOffset": 2906,
"endOffset": 2959,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get path",
"ranges": [
{
"startOffset": 2963,
"endOffset": 3070,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set path",
"ranges": [
{
"startOffset": 3074,
"endOffset": 3175,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get dest",
"ranges": [
{
"startOffset": 3179,
"endOffset": 3286,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set dest",
"ranges": [
{
"startOffset": 3290,
"endOffset": 3391,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeSystemErrorWithCode",
"ranges": [
{
"startOffset": 3395,
"endOffset": 3540,
"count": 3
},
{
"startOffset": 3538,
"endOffset": 3539,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NodeError",
"ranges": [
{
"startOffset": 3486,
"endOffset": 3533,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeNodeErrorWithCode",
"ranges": [
{
"startOffset": 3542,
"endOffset": 4142,
"count": 192
},
{
"startOffset": 4140,
"endOffset": 4141,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NodeError",
"ranges": [
{
"startOffset": 3630,
"endOffset": 3694,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get name",
"ranges": [
{
"startOffset": 3700,
"endOffset": 3757,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set name",
"ranges": [
{
"startOffset": 3763,
"endOffset": 3925,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get code",
"ranges": [
{
"startOffset": 3931,
"endOffset": 3967,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set code",
"ranges": [
{
"startOffset": 3973,
"endOffset": 4135,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 4254,
"endOffset": 4762,
"count": 192
},
{
"startOffset": 4496,
"endOffset": 4541,
"count": 3
},
{
"startOffset": 4541,
"endOffset": 4595,
"count": 189
},
{
"startOffset": 4630,
"endOffset": 4740,
"count": 3
}
],
"isBlockCoverage": true
},
{
"functionName": "E.otherClasses.forEach",
"ranges": [
{
"startOffset": 4657,
"endOffset": 4734,
"count": 3
}
],
"isBlockCoverage": true
},
{
"functionName": "getMessage",
"ranges": [
{
"startOffset": 4764,
"endOffset": 5582,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "uvException",
"ranges": [
{
"startOffset": 5874,
"endOffset": 6742,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "errnoException",
"ranges": [
{
"startOffset": 6921,
"endOffset": 7673,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "exceptionWithHostPort",
"ranges": [
{
"startOffset": 7914,
"endOffset": 8899,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "dnsException",
"ranges": [
{
"startOffset": 9063,
"endOffset": 10055,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isStackOverflowError",
"ranges": [
{
"startOffset": 10345,
"endOffset": 10716,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "oneOf",
"ranges": [
{
"startOffset": 10718,
"endOffset": 11370,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 12768,
"endOffset": 12924,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 20500,
"endOffset": 21327,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 21368,
"endOffset": 21603,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 21661,
"endOffset": 21768,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 22133,
"endOffset": 22296,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 23031,
"endOffset": 23112,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 23565,
"endOffset": 23729,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 23782,
"endOffset": 24113,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 24157,
"endOffset": 24464,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 24876,
"endOffset": 24936,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "args",
"ranges": [
{
"startOffset": 25327,
"endOffset": 25850,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 26993,
"endOffset": 27189,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "E",
"ranges": [
{
"startOffset": 30495,
"endOffset": 30626,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/fixed_queue.js",
"source": "(function (exports, require, module, process) {'use strict';\n\n// Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two.\nconst kSize = 2048;\nconst kMask = kSize - 1;\n\n// The FixedQueue is implemented as a singly-linked list of fixed-size\n// circular buffers. It looks something like this:\n//\n// head tail\n// | |\n// v v\n// +-----------+ <-----\\ +-----------+ <------\\ +-----------+\n// | [null] | \\----- | next | \\------- | next |\n// +-----------+ +-----------+ +-----------+\n// | item | <-- bottom | item | <-- bottom | [empty] |\n// | item | | item | | [empty] |\n// | item | | item | | [empty] |\n// | item | | item | | [empty] |\n// | item | | item | bottom --> | item |\n// | item | | item | | item |\n// | ... | | ... | | ... |\n// | item | | item | | item |\n// | item | | item | | item |\n// | [empty] | <-- top | item | | item |\n// | [empty] | | item | | item |\n// | [empty] | | [empty] | <-- top top --> | [empty] |\n// +-----------+ +-----------+ +-----------+\n//\n// Or, if there is only one circular buffer, it looks something\n// like either of these:\n//\n// head tail head tail\n// | | | |\n// v v v v\n// +-----------+ +-----------+\n// | [null] | | [null] |\n// +-----------+ +-----------+\n// | [empty] | | item |\n// | [empty] | | item |\n// | item | <-- bottom top --> | [empty] |\n// | item | | [empty] |\n// | [empty] | <-- top bottom --> | item |\n// | [empty] | | item |\n// +-----------+ +-----------+\n//\n// Adding a value means moving `top` forward by one, removing means\n// moving `bottom` forward by one. After reaching the end, the queue\n// wraps around.\n//\n// When `top === bottom` the current queue is empty and when\n// `top + 1 === bottom` it's full. This wastes a single space of storage\n// but allows much quicker checks.\n\nconst FixedCircularBuffer = class FixedCircularBuffer {\n constructor() {\n this.bottom = 0;\n this.top = 0;\n this.list = new Array(kSize);\n this.next = null;\n }\n\n isEmpty() {\n return this.top === this.bottom;\n }\n\n isFull() {\n return ((this.top + 1) & kMask) === this.bottom;\n }\n\n push(data) {\n this.list[this.top] = data;\n this.top = (this.top + 1) & kMask;\n }\n\n shift() {\n const nextItem = this.list[this.bottom];\n if (nextItem === undefined)\n return null;\n this.list[this.bottom] = undefined;\n this.bottom = (this.bottom + 1) & kMask;\n return nextItem;\n }\n};\n\nmodule.exports = class FixedQueue {\n constructor() {\n this.head = this.tail = new FixedCircularBuffer();\n }\n\n isEmpty() {\n return this.head.isEmpty();\n }\n\n push(data) {\n if (this.head.isFull()) {\n // Head is full: Creates a new queue, sets the old queue's `.next` to it,\n // and sets it as the new main queue.\n this.head = this.head.next = new FixedCircularBuffer();\n }\n this.head.push(data);\n }\n\n shift() {\n const { tail } = this;\n const next = tail.shift();\n if (tail.isEmpty() && tail.next !== null) {\n // If there is another queue, it forms the new tail.\n this.tail = tail.next;\n }\n return next;\n }\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4228,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4226,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "FixedCircularBuffer",
"ranges": [
{
"startOffset": 2999,
"endOffset": 3113,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "isEmpty",
"ranges": [
{
"startOffset": 3117,
"endOffset": 3169,
"count": 10
},
{
"startOffset": 3165,
"endOffset": 3168,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "isFull",
"ranges": [
{
"startOffset": 3173,
"endOffset": 3240,
"count": 3
},
{
"startOffset": 3236,
"endOffset": 3239,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "push",
"ranges": [
{
"startOffset": 3244,
"endOffset": 3331,
"count": 3
}
],
"isBlockCoverage": true
},
{
"functionName": "shift",
"ranges": [
{
"startOffset": 3335,
"endOffset": 3550,
"count": 5
},
{
"startOffset": 3428,
"endOffset": 3440,
"count": 2
},
{
"startOffset": 3440,
"endOffset": 3546,
"count": 3
},
{
"startOffset": 3546,
"endOffset": 3549,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "FixedQueue",
"ranges": [
{
"startOffset": 3593,
"endOffset": 3667,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "isEmpty",
"ranges": [
{
"startOffset": 3671,
"endOffset": 3718,
"count": 5
},
{
"startOffset": 3714,
"endOffset": 3717,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "push",
"ranges": [
{
"startOffset": 3722,
"endOffset": 3986,
"count": 3
},
{
"startOffset": 3763,
"endOffset": 3956,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "shift",
"ranges": [
{
"startOffset": 3990,
"endOffset": 4220,
"count": 5
},
{
"startOffset": 4104,
"endOffset": 4199,
"count": 0
},
{
"startOffset": 4216,
"endOffset": 4219,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/fs/read_file_context.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { Buffer } = require('buffer');\nconst { FSReqWrap, close, read } = process.binding('fs');\n\nconst kReadFileBufferLength = 8 * 1024;\n\nfunction readFileAfterRead(err, bytesRead) {\n const context = this.context;\n\n if (err)\n return context.close(err);\n\n if (bytesRead === 0)\n return context.close();\n\n context.pos += bytesRead;\n\n if (context.size !== 0) {\n if (context.pos === context.size)\n context.close();\n else\n context.read();\n } else {\n // unknown size, just read until we don't get bytes.\n context.buffers.push(context.buffer.slice(0, bytesRead));\n context.read();\n }\n}\n\nfunction readFileAfterClose(err) {\n const context = this.context;\n const callback = context.callback;\n let buffer = null;\n\n if (context.err || err)\n return callback(context.err || err);\n\n try {\n if (context.size === 0)\n buffer = Buffer.concat(context.buffers, context.pos);\n else if (context.pos < context.size)\n buffer = context.buffer.slice(0, context.pos);\n else\n buffer = context.buffer;\n\n if (context.encoding)\n buffer = buffer.toString(context.encoding);\n } catch (err) {\n return callback(err);\n }\n\n callback(null, buffer);\n}\n\nclass ReadFileContext {\n constructor(callback, encoding) {\n this.fd = undefined;\n this.isUserFd = undefined;\n this.size = undefined;\n this.callback = callback;\n this.buffers = null;\n this.buffer = null;\n this.pos = 0;\n this.encoding = encoding;\n this.err = null;\n }\n\n read() {\n let buffer;\n let offset;\n let length;\n\n if (this.size === 0) {\n buffer = this.buffer = Buffer.allocUnsafeSlow(kReadFileBufferLength);\n offset = 0;\n length = kReadFileBufferLength;\n } else {\n buffer = this.buffer;\n offset = this.pos;\n length = Math.min(kReadFileBufferLength, this.size - this.pos);\n }\n\n const req = new FSReqWrap();\n req.oncomplete = readFileAfterRead;\n req.context = this;\n\n read(this.fd, buffer, offset, length, -1, req);\n }\n\n close(err) {\n const req = new FSReqWrap();\n req.oncomplete = readFileAfterClose;\n req.context = this;\n this.err = err;\n\n if (this.isUserFd) {\n process.nextTick(function tick() {\n req.oncomplete(null);\n });\n return;\n }\n\n close(this.fd, req);\n }\n}\n\nmodule.exports = ReadFileContext;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2402,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2400,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "readFileAfterRead",
"ranges": [
{
"startOffset": 200,
"endOffset": 677,
"count": 1
},
{
"startOffset": 293,
"endOffset": 319,
"count": 0
},
{
"startOffset": 348,
"endOffset": 371,
"count": 0
},
{
"startOffset": 490,
"endOffset": 521,
"count": 0
},
{
"startOffset": 525,
"endOffset": 675,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "readFileAfterClose",
"ranges": [
{
"startOffset": 679,
"endOffset": 1256,
"count": 1
},
{
"startOffset": 835,
"endOffset": 871,
"count": 0
},
{
"startOffset": 915,
"endOffset": 968,
"count": 0
},
{
"startOffset": 1016,
"endOffset": 1062,
"count": 0
},
{
"startOffset": 1136,
"endOffset": 1179,
"count": 0
},
{
"startOffset": 1184,
"endOffset": 1227,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "ReadFileContext",
"ranges": [
{
"startOffset": 1284,
"endOffset": 1552,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "read",
"ranges": [
{
"startOffset": 1556,
"endOffset": 2069,
"count": 1
},
{
"startOffset": 1639,
"endOffset": 1778,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "close",
"ranges": [
{
"startOffset": 2073,
"endOffset": 2360,
"count": 1
},
{
"startOffset": 2228,
"endOffset": 2330,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tick",
"ranges": [
{
"startOffset": 2253,
"endOffset": 2308,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/fs/streams.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n FSReqWrap,\n writeBuffers\n} = process.binding('fs');\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_OUT_OF_RANGE\n} = require('internal/errors').codes;\nconst { Buffer } = require('buffer');\nconst {\n copyObject,\n getOptions,\n} = require('internal/fs/utils');\nconst { Readable, Writable } = require('stream');\nconst { getPathFromURL } = require('internal/url');\nconst util = require('util');\n\nlet fs;\nfunction lazyFs() {\n if (fs === undefined)\n fs = require('fs');\n return fs;\n}\n\nconst kMinPoolSpace = 128;\n\nlet pool;\n// It can happen that we expect to read a large chunk of data, and reserve\n// a large chunk of the pool accordingly, but the read() call only filled\n// a portion of it. If a concurrently executing read() then uses the same pool,\n// the \"reserved\" portion cannot be used, so we allow it to be re-used as a\n// new pool later.\nconst poolFragments = [];\n\nfunction allocNewPool(poolSize) {\n if (poolFragments.length > 0)\n pool = poolFragments.pop();\n else\n pool = Buffer.allocUnsafe(poolSize);\n pool.used = 0;\n}\n\nfunction ReadStream(path, options) {\n if (!(this instanceof ReadStream))\n return new ReadStream(path, options);\n\n // a little bit bigger buffer and water marks by default\n options = copyObject(getOptions(options, {}));\n if (options.highWaterMark === undefined)\n options.highWaterMark = 64 * 1024;\n\n // for backwards compat do not emit close on destroy.\n options.emitClose = false;\n\n Readable.call(this, options);\n\n // path will be ignored when fd is specified, so it can be falsy\n this.path = getPathFromURL(path);\n this.fd = options.fd === undefined ? null : options.fd;\n this.flags = options.flags === undefined ? 'r' : options.flags;\n this.mode = options.mode === undefined ? 0o666 : options.mode;\n\n this.start = options.start;\n this.end = options.end;\n this.autoClose = options.autoClose === undefined ? true : options.autoClose;\n this.pos = undefined;\n this.bytesRead = 0;\n this.closed = false;\n\n if (this.start !== undefined) {\n if (typeof this.start !== 'number' || Number.isNaN(this.start)) {\n throw new ERR_INVALID_ARG_TYPE('start', 'number', this.start);\n }\n if (this.end === undefined) {\n this.end = Infinity;\n } else if (typeof this.end !== 'number' || Number.isNaN(this.end)) {\n throw new ERR_INVALID_ARG_TYPE('end', 'number', this.end);\n }\n\n if (this.start > this.end) {\n const errVal = `{start: ${this.start}, end: ${this.end}}`;\n throw new ERR_OUT_OF_RANGE('start', '<= \"end\"', errVal);\n }\n\n this.pos = this.start;\n }\n\n // Backwards compatibility: Make sure `end` is a number regardless of `start`.\n // TODO(addaleax): Make the above typecheck not depend on `start` instead.\n // (That is a semver-major change).\n if (typeof this.end !== 'number')\n this.end = Infinity;\n else if (Number.isNaN(this.end))\n throw new ERR_INVALID_ARG_TYPE('end', 'number', this.end);\n\n if (typeof this.fd !== 'number')\n this.open();\n\n this.on('end', function() {\n if (this.autoClose) {\n this.destroy();\n }\n });\n}\nutil.inherits(ReadStream, Readable);\n\nReadStream.prototype.open = function() {\n lazyFs().open(this.path, this.flags, this.mode, (er, fd) => {\n if (er) {\n if (this.autoClose) {\n this.destroy();\n }\n this.emit('error', er);\n return;\n }\n\n this.fd = fd;\n this.emit('open', fd);\n this.emit('ready');\n // start the flow of data.\n this.read();\n });\n};\n\nReadStream.prototype._read = function(n) {\n if (typeof this.fd !== 'number') {\n return this.once('open', function() {\n this._read(n);\n });\n }\n\n if (this.destroyed)\n return;\n\n if (!pool || pool.length - pool.used < kMinPoolSpace) {\n // discard the old pool.\n allocNewPool(this.readableHighWaterMark);\n }\n\n // Grab another reference to the pool in the case that while we're\n // in the thread pool another read() finishes up the pool, and\n // allocates a new one.\n const thisPool = pool;\n let toRead = Math.min(pool.length - pool.used, n);\n const start = pool.used;\n\n if (this.pos !== undefined)\n toRead = Math.min(this.end - this.pos + 1, toRead);\n else\n toRead = Math.min(this.end - this.bytesRead + 1, toRead);\n\n // already read everything we were supposed to read!\n // treat as EOF.\n if (toRead <= 0)\n return this.push(null);\n\n // the actual read.\n lazyFs().read(this.fd, pool, pool.used, toRead, this.pos, (er, bytesRead) => {\n if (er) {\n if (this.autoClose) {\n this.destroy();\n }\n this.emit('error', er);\n } else {\n let b = null;\n // Now that we know how much data we have actually read, re-wind the\n // 'used' field if we can, and otherwise allow the remainder of our\n // reservation to be used as a new pool later.\n if (start + toRead === thisPool.used && thisPool === pool)\n thisPool.used += bytesRead - toRead;\n else if (toRead - bytesRead > kMinPoolSpace)\n poolFragments.push(thisPool.slice(start + bytesRead, start + toRead));\n\n if (bytesRead > 0) {\n this.bytesRead += bytesRead;\n b = thisPool.slice(start, start + bytesRead);\n }\n\n this.push(b);\n }\n });\n\n // move the pool positions, and internal position for reading.\n if (this.pos !== undefined)\n this.pos += toRead;\n pool.used += toRead;\n};\n\nReadStream.prototype._destroy = function(err, cb) {\n const isOpen = typeof this.fd !== 'number';\n if (isOpen) {\n this.once('open', closeFsStream.bind(null, this, cb, err));\n return;\n }\n\n closeFsStream(this, cb, err);\n this.fd = null;\n};\n\nfunction closeFsStream(stream, cb, err) {\n lazyFs().close(stream.fd, (er) => {\n er = er || err;\n cb(er);\n stream.closed = true;\n if (!er)\n stream.emit('close');\n });\n}\n\nReadStream.prototype.close = function(cb) {\n this.destroy(null, cb);\n};\n\nfunction WriteStream(path, options) {\n if (!(this instanceof WriteStream))\n return new WriteStream(path, options);\n\n options = copyObject(getOptions(options, {}));\n\n // for backwards compat do not emit close on destroy.\n options.emitClose = false;\n\n Writable.call(this, options);\n\n // path will be ignored when fd is specified, so it can be falsy\n this.path = getPathFromURL(path);\n this.fd = options.fd === undefined ? null : options.fd;\n this.flags = options.flags === undefined ? 'w' : options.flags;\n this.mode = options.mode === undefined ? 0o666 : options.mode;\n\n this.start = options.start;\n this.autoClose = options.autoClose === undefined ? true : !!options.autoClose;\n this.pos = undefined;\n this.bytesWritten = 0;\n this.closed = false;\n\n if (this.start !== undefined) {\n if (typeof this.start !== 'number') {\n throw new ERR_INVALID_ARG_TYPE('start', 'number', this.start);\n }\n if (this.start < 0) {\n const errVal = `{start: ${this.start}}`;\n throw new ERR_OUT_OF_RANGE('start', '>= 0', errVal);\n }\n\n this.pos = this.start;\n }\n\n if (options.encoding)\n this.setDefaultEncoding(options.encoding);\n\n if (typeof this.fd !== 'number')\n this.open();\n}\nutil.inherits(WriteStream, Writable);\n\nWriteStream.prototype._final = function(callback) {\n if (this.autoClose) {\n this.destroy();\n }\n\n callback();\n};\n\nWriteStream.prototype.open = function() {\n lazyFs().open(this.path, this.flags, this.mode, (er, fd) => {\n if (er) {\n if (this.autoClose) {\n this.destroy();\n }\n this.emit('error', er);\n return;\n }\n\n this.fd = fd;\n this.emit('open', fd);\n this.emit('ready');\n });\n};\n\n\nWriteStream.prototype._write = function(data, encoding, cb) {\n if (!(data instanceof Buffer)) {\n const err = new ERR_INVALID_ARG_TYPE('data', 'Buffer', data);\n return this.emit('error', err);\n }\n\n if (typeof this.fd !== 'number') {\n return this.once('open', function() {\n this._write(data, encoding, cb);\n });\n }\n\n lazyFs().write(this.fd, data, 0, data.length, this.pos, (er, bytes) => {\n if (er) {\n if (this.autoClose) {\n this.destroy();\n }\n return cb(er);\n }\n this.bytesWritten += bytes;\n cb();\n });\n\n if (this.pos !== undefined)\n this.pos += data.length;\n};\n\n\nfunction writev(fd, chunks, position, callback) {\n function wrapper(err, written) {\n // Retain a reference to chunks so that they can't be GC'ed too soon.\n callback(err, written || 0, chunks);\n }\n\n const req = new FSReqWrap();\n req.oncomplete = wrapper;\n writeBuffers(fd, chunks, position, req);\n}\n\n\nWriteStream.prototype._writev = function(data, cb) {\n if (typeof this.fd !== 'number') {\n return this.once('open', function() {\n this._writev(data, cb);\n });\n }\n\n const self = this;\n const len = data.length;\n const chunks = new Array(len);\n let size = 0;\n\n for (var i = 0; i < len; i++) {\n const chunk = data[i].chunk;\n\n chunks[i] = chunk;\n size += chunk.length;\n }\n\n writev(this.fd, chunks, this.pos, function(er, bytes) {\n if (er) {\n self.destroy();\n return cb(er);\n }\n self.bytesWritten += bytes;\n cb();\n });\n\n if (this.pos !== undefined)\n this.pos += size;\n};\n\n\nWriteStream.prototype._destroy = ReadStream.prototype._destroy;\nWriteStream.prototype.close = function(cb) {\n if (cb) {\n if (this.closed) {\n process.nextTick(cb);\n return;\n } else {\n this.on('close', cb);\n }\n }\n\n // If we are not autoClosing, we should call\n // destroy on 'finish'.\n if (!this.autoClose) {\n this.on('finish', this.destroy.bind(this));\n }\n\n // we use end() instead of destroy() because of\n // https://github.com/nodejs/node/issues/2006\n this.end();\n};\n\n// There is no shutdown() for files.\nWriteStream.prototype.destroySoon = WriteStream.prototype.end;\n\nmodule.exports = {\n ReadStream,\n WriteStream\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 9781,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 9779,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "lazyFs",
"ranges": [
{
"startOffset": 463,
"endOffset": 545,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "allocNewPool",
"ranges": [
{
"startOffset": 936,
"endOffset": 1100,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadStream",
"ranges": [
{
"startOffset": 1102,
"endOffset": 3112,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadStream.open",
"ranges": [
{
"startOffset": 3179,
"endOffset": 3505,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadStream._read",
"ranges": [
{
"startOffset": 3537,
"endOffset": 5367,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadStream._destroy",
"ranges": [
{
"startOffset": 5402,
"endOffset": 5616,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "closeFsStream",
"ranges": [
{
"startOffset": 5619,
"endOffset": 5805,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "ReadStream.close",
"ranges": [
{
"startOffset": 5836,
"endOffset": 5878,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream",
"ranges": [
{
"startOffset": 5881,
"endOffset": 7094,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream._final",
"ranges": [
{
"startOffset": 7165,
"endOffset": 7250,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream.open",
"ranges": [
{
"startOffset": 7282,
"endOffset": 7560,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream._write",
"ranges": [
{
"startOffset": 7595,
"endOffset": 8184,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writev",
"ranges": [
{
"startOffset": 8188,
"endOffset": 8496,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream._writev",
"ranges": [
{
"startOffset": 8531,
"endOffset": 9117,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "WriteStream.close",
"ranges": [
{
"startOffset": 9215,
"endOffset": 9623,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/fs/utils.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { Buffer, kMaxLength } = require('buffer');\nconst {\n ERR_FS_INVALID_SYMLINK_TYPE,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_INVALID_OPT_VALUE,\n ERR_INVALID_OPT_VALUE_ENCODING,\n ERR_OUT_OF_RANGE\n} = require('internal/errors').codes;\nconst { isUint8Array } = require('internal/util/types');\nconst pathModule = require('path');\nconst util = require('util');\n\nconst {\n O_APPEND,\n O_CREAT,\n O_EXCL,\n O_RDONLY,\n O_RDWR,\n O_SYNC,\n O_TRUNC,\n O_WRONLY,\n S_IFBLK,\n S_IFCHR,\n S_IFDIR,\n S_IFIFO,\n S_IFLNK,\n S_IFMT,\n S_IFREG,\n S_IFSOCK,\n UV_FS_SYMLINK_DIR,\n UV_FS_SYMLINK_JUNCTION\n} = process.binding('constants').fs;\n\nconst isWindows = process.platform === 'win32';\n\nfunction assertEncoding(encoding) {\n if (encoding && !Buffer.isEncoding(encoding)) {\n throw new ERR_INVALID_OPT_VALUE_ENCODING(encoding);\n }\n}\n\nfunction copyObject(source) {\n var target = {};\n for (var key in source)\n target[key] = source[key];\n return target;\n}\n\nfunction getOptions(options, defaultOptions) {\n if (options === null || options === undefined ||\n typeof options === 'function') {\n return defaultOptions;\n }\n\n if (typeof options === 'string') {\n defaultOptions = util._extend({}, defaultOptions);\n defaultOptions.encoding = options;\n options = defaultOptions;\n } else if (typeof options !== 'object') {\n throw new ERR_INVALID_ARG_TYPE('options', ['string', 'Object'], options);\n }\n\n if (options.encoding !== 'buffer')\n assertEncoding(options.encoding);\n return options;\n}\n\n// Check if the path contains null types if it is a string nor Uint8Array,\n// otherwise return silently.\nfunction nullCheck(path, propName, throwError = true) {\n const pathIsString = typeof path === 'string';\n const pathIsUint8Array = isUint8Array(path);\n\n // We can only perform meaningful checks on strings and Uint8Arrays.\n if (!pathIsString && !pathIsUint8Array) {\n return;\n }\n\n if (pathIsString && path.indexOf('\\u0000') === -1) {\n return;\n } else if (pathIsUint8Array && path.indexOf(0) === -1) {\n return;\n }\n\n const err = new ERR_INVALID_ARG_VALUE(\n propName,\n path,\n 'must be a string or Uint8Array without null bytes'\n );\n\n if (throwError) {\n Error.captureStackTrace(err, nullCheck);\n throw err;\n }\n return err;\n}\n\nfunction preprocessSymlinkDestination(path, type, linkPath) {\n if (!isWindows) {\n // No preprocessing is needed on Unix.\n return path;\n } else if (type === 'junction') {\n // Junctions paths need to be absolute and \\\\?\\-prefixed.\n // A relative target is relative to the link's parent directory.\n path = pathModule.resolve(linkPath, '..', path);\n return pathModule.toNamespacedPath(path);\n } else {\n // Windows symlinks don't tolerate forward slashes.\n return ('' + path).replace(/\\//g, '\\\\');\n }\n}\n\nfunction dateFromNumeric(num) {\n return new Date(Number(num) + 0.5);\n}\n\n// Constructor for file stats.\nfunction Stats(\n dev,\n mode,\n nlink,\n uid,\n gid,\n rdev,\n blksize,\n ino,\n size,\n blocks,\n atim_msec,\n mtim_msec,\n ctim_msec,\n birthtim_msec\n) {\n this.dev = dev;\n this.mode = mode;\n this.nlink = nlink;\n this.uid = uid;\n this.gid = gid;\n this.rdev = rdev;\n this.blksize = blksize;\n this.ino = ino;\n this.size = size;\n this.blocks = blocks;\n this.atimeMs = atim_msec;\n this.mtimeMs = mtim_msec;\n this.ctimeMs = ctim_msec;\n this.birthtimeMs = birthtim_msec;\n this.atime = dateFromNumeric(atim_msec);\n this.mtime = dateFromNumeric(mtim_msec);\n this.ctime = dateFromNumeric(ctim_msec);\n this.birthtime = dateFromNumeric(birthtim_msec);\n}\n\nStats.prototype._checkModeProperty = function(property) {\n if (isWindows && (property === S_IFIFO || property === S_IFBLK ||\n property === S_IFSOCK)) {\n return false; // Some types are not available on Windows\n }\n if (typeof this.mode === 'bigint') { // eslint-disable-line valid-typeof\n return (this.mode & BigInt(S_IFMT)) === BigInt(property);\n }\n return (this.mode & S_IFMT) === property;\n};\n\nStats.prototype.isDirectory = function() {\n return this._checkModeProperty(S_IFDIR);\n};\n\nStats.prototype.isFile = function() {\n return this._checkModeProperty(S_IFREG);\n};\n\nStats.prototype.isBlockDevice = function() {\n return this._checkModeProperty(S_IFBLK);\n};\n\nStats.prototype.isCharacterDevice = function() {\n return this._checkModeProperty(S_IFCHR);\n};\n\nStats.prototype.isSymbolicLink = function() {\n return this._checkModeProperty(S_IFLNK);\n};\n\nStats.prototype.isFIFO = function() {\n return this._checkModeProperty(S_IFIFO);\n};\n\nStats.prototype.isSocket = function() {\n return this._checkModeProperty(S_IFSOCK);\n};\n\nfunction getStatsFromBinding(stats, offset = 0) {\n return new Stats(stats[0 + offset], stats[1 + offset], stats[2 + offset],\n stats[3 + offset], stats[4 + offset], stats[5 + offset],\n isWindows ? undefined : stats[6 + offset], // blksize\n stats[7 + offset], stats[8 + offset],\n isWindows ? undefined : stats[9 + offset], // blocks\n stats[10 + offset], stats[11 + offset],\n stats[12 + offset], stats[13 + offset]);\n}\n\nfunction stringToFlags(flags) {\n if (typeof flags === 'number') {\n return flags;\n }\n\n switch (flags) {\n case 'r' : return O_RDONLY;\n case 'rs' : // Fall through.\n case 'sr' : return O_RDONLY | O_SYNC;\n case 'r+' : return O_RDWR;\n case 'rs+' : // Fall through.\n case 'sr+' : return O_RDWR | O_SYNC;\n\n case 'w' : return O_TRUNC | O_CREAT | O_WRONLY;\n case 'wx' : // Fall through.\n case 'xw' : return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL;\n\n case 'w+' : return O_TRUNC | O_CREAT | O_RDWR;\n case 'wx+': // Fall through.\n case 'xw+': return O_TRUNC | O_CREAT | O_RDWR | O_EXCL;\n\n case 'a' : return O_APPEND | O_CREAT | O_WRONLY;\n case 'ax' : // Fall through.\n case 'xa' : return O_APPEND | O_CREAT | O_WRONLY | O_EXCL;\n case 'as' : // Fall through.\n case 'sa' : return O_APPEND | O_CREAT | O_WRONLY | O_SYNC;\n\n case 'a+' : return O_APPEND | O_CREAT | O_RDWR;\n case 'ax+': // Fall through.\n case 'xa+': return O_APPEND | O_CREAT | O_RDWR | O_EXCL;\n case 'as+': // Fall through.\n case 'sa+': return O_APPEND | O_CREAT | O_RDWR | O_SYNC;\n }\n\n throw new ERR_INVALID_OPT_VALUE('flags', flags);\n}\n\nfunction stringToSymlinkType(type) {\n let flags = 0;\n if (typeof type === 'string') {\n switch (type) {\n case 'dir':\n flags |= UV_FS_SYMLINK_DIR;\n break;\n case 'junction':\n flags |= UV_FS_SYMLINK_JUNCTION;\n break;\n case 'file':\n break;\n default:\n const err = new ERR_FS_INVALID_SYMLINK_TYPE(type);\n Error.captureStackTrace(err, stringToSymlinkType);\n throw err;\n }\n }\n return flags;\n}\n\n// converts Date or number to a fractional UNIX timestamp\nfunction toUnixTimestamp(time, name = 'time') {\n // eslint-disable-next-line eqeqeq\n if (typeof time === 'string' && +time == time) {\n return +time;\n }\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n }\n return time;\n }\n if (util.isDate(time)) {\n // convert to 123.456 UNIX timestamp\n return time.getTime() / 1000;\n }\n throw new ERR_INVALID_ARG_TYPE(name, ['Date', 'Time in seconds'], time);\n}\n\nfunction validateBuffer(buffer) {\n if (!isUint8Array(buffer)) {\n const err = new ERR_INVALID_ARG_TYPE('buffer',\n ['Buffer', 'Uint8Array'], buffer);\n Error.captureStackTrace(err, validateBuffer);\n throw err;\n }\n}\n\nfunction validateOffsetLengthRead(offset, length, bufferLength) {\n let err;\n\n if (offset < 0 || offset >= bufferLength) {\n err = new ERR_OUT_OF_RANGE('offset', `>= 0 && <= ${bufferLength}`, offset);\n } else if (length < 0 || offset + length > bufferLength) {\n err = new ERR_OUT_OF_RANGE('length',\n `>= 0 && <= ${bufferLength - offset}`, length);\n }\n\n if (err !== undefined) {\n Error.captureStackTrace(err, validateOffsetLengthRead);\n throw err;\n }\n}\n\nfunction validateOffsetLengthWrite(offset, length, byteLength) {\n let err;\n\n if (offset > byteLength) {\n err = new ERR_OUT_OF_RANGE('offset', `<= ${byteLength}`, offset);\n } else {\n const max = byteLength > kMaxLength ? kMaxLength : byteLength;\n if (length > max - offset) {\n err = new ERR_OUT_OF_RANGE('length', `<= ${max - offset}`, length);\n }\n }\n\n if (err !== undefined) {\n Error.captureStackTrace(err, validateOffsetLengthWrite);\n throw err;\n }\n}\n\nfunction validatePath(path, propName = 'path') {\n let err;\n\n if (typeof path !== 'string' && !isUint8Array(path)) {\n err = new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);\n } else {\n err = nullCheck(path, propName, false);\n }\n\n if (err !== undefined) {\n Error.captureStackTrace(err, validatePath);\n throw err;\n }\n}\n\nmodule.exports = {\n assertEncoding,\n copyObject,\n getOptions,\n nullCheck,\n preprocessSymlinkDestination,\n realpathCacheKey: Symbol('realpathCacheKey'),\n getStatsFromBinding,\n stringToFlags,\n stringToSymlinkType,\n Stats,\n toUnixTimestamp,\n validateBuffer,\n validateOffsetLengthRead,\n validateOffsetLengthWrite,\n validatePath\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 9299,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 9297,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "assertEncoding",
"ranges": [
{
"startOffset": 757,
"endOffset": 904,
"count": 4
},
{
"startOffset": 808,
"endOffset": 839,
"count": 1
},
{
"startOffset": 841,
"endOffset": 902,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "copyObject",
"ranges": [
{
"startOffset": 906,
"endOffset": 1030,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getOptions",
"ranges": [
{
"startOffset": 1032,
"endOffset": 1583,
"count": 5
},
{
"startOffset": 1167,
"endOffset": 1199,
"count": 1
},
{
"startOffset": 1195,
"endOffset": 1199,
"count": 0
},
{
"startOffset": 1199,
"endOffset": 1236,
"count": 4
},
{
"startOffset": 1236,
"endOffset": 1365,
"count": 1
},
{
"startOffset": 1365,
"endOffset": 1487,
"count": 3
},
{
"startOffset": 1404,
"endOffset": 1487,
"count": 0
},
{
"startOffset": 1487,
"endOffset": 1581,
"count": 4
},
{
"startOffset": 1581,
"endOffset": 1582,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "nullCheck",
"ranges": [
{
"startOffset": 1690,
"endOffset": 2344,
"count": 5
},
{
"startOffset": 1934,
"endOffset": 1954,
"count": 0
},
{
"startOffset": 1956,
"endOffset": 1973,
"count": 0
},
{
"startOffset": 2041,
"endOffset": 2343,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "preprocessSymlinkDestination",
"ranges": [
{
"startOffset": 2346,
"endOffset": 2871,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "dateFromNumeric",
"ranges": [
{
"startOffset": 2873,
"endOffset": 2944,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats",
"ranges": [
{
"startOffset": 2977,
"endOffset": 3639,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats._checkModeProperty",
"ranges": [
{
"startOffset": 3678,
"endOffset": 4050,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isDirectory",
"ranges": [
{
"startOffset": 4083,
"endOffset": 4140,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isFile",
"ranges": [
{
"startOffset": 4168,
"endOffset": 4225,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isBlockDevice",
"ranges": [
{
"startOffset": 4260,
"endOffset": 4317,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isCharacterDevice",
"ranges": [
{
"startOffset": 4356,
"endOffset": 4413,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isSymbolicLink",
"ranges": [
{
"startOffset": 4449,
"endOffset": 4506,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isFIFO",
"ranges": [
{
"startOffset": 4534,
"endOffset": 4591,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Stats.isSocket",
"ranges": [
{
"startOffset": 4621,
"endOffset": 4679,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getStatsFromBinding",
"ranges": [
{
"startOffset": 4682,
"endOffset": 5208,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "stringToFlags",
"ranges": [
{
"startOffset": 5210,
"endOffset": 6369,
"count": 2
},
{
"startOffset": 5275,
"endOffset": 5298,
"count": 0
},
{
"startOffset": 5350,
"endOffset": 5366,
"count": 0
},
{
"startOffset": 5388,
"endOffset": 5473,
"count": 0
},
{
"startOffset": 5495,
"endOffset": 5600,
"count": 0
},
{
"startOffset": 5622,
"endOffset": 5747,
"count": 0
},
{
"startOffset": 5769,
"endOffset": 5894,
"count": 0
},
{
"startOffset": 5916,
"endOffset": 5990,
"count": 0
},
{
"startOffset": 6012,
"endOffset": 6139,
"count": 0
},
{
"startOffset": 6161,
"endOffset": 6233,
"count": 0
},
{
"startOffset": 6255,
"endOffset": 6368,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "stringToSymlinkType",
"ranges": [
{
"startOffset": 6371,
"endOffset": 6840,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toUnixTimestamp",
"ranges": [
{
"startOffset": 6900,
"endOffset": 7350,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateBuffer",
"ranges": [
{
"startOffset": 7352,
"endOffset": 7614,
"count": 1
},
{
"startOffset": 7415,
"endOffset": 7612,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateOffsetLengthRead",
"ranges": [
{
"startOffset": 7616,
"endOffset": 8113,
"count": 1
},
{
"startOffset": 7738,
"endOffset": 7823,
"count": 0
},
{
"startOffset": 7879,
"endOffset": 8004,
"count": 0
},
{
"startOffset": 8031,
"endOffset": 8111,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateOffsetLengthWrite",
"ranges": [
{
"startOffset": 8115,
"endOffset": 8595,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validatePath",
"ranges": [
{
"startOffset": 8597,
"endOffset": 8951,
"count": 5
},
{
"startOffset": 8689,
"endOffset": 8711,
"count": 0
},
{
"startOffset": 8713,
"endOffset": 8799,
"count": 0
},
{
"startOffset": 8881,
"endOffset": 8949,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/inspector_async_hook.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst inspector = process.binding('inspector');\n\nif (!inspector || !inspector.asyncTaskScheduled) {\n exports.setup = function() {};\n return;\n}\n\nlet hook;\nlet config;\n\nfunction lazyHookCreation() {\n const { createHook } = require('async_hooks');\n config = process.binding('config');\n\n hook = createHook({\n init(asyncId, type, triggerAsyncId, resource) {\n // It's difficult to tell which tasks will be recurring and which won't,\n // therefore we mark all tasks as recurring. Based on the discussion\n // in https://github.com/nodejs/node/pull/13870#discussion_r124515293,\n // this should be fine as long as we call asyncTaskCanceled() too.\n const recurring = true;\n if (type === 'PROMISE')\n this.promiseIds.add(asyncId);\n else\n inspector.asyncTaskScheduled(type, asyncId, recurring);\n },\n\n before(asyncId) {\n if (this.promiseIds.has(asyncId))\n return;\n inspector.asyncTaskStarted(asyncId);\n },\n\n after(asyncId) {\n if (this.promiseIds.has(asyncId))\n return;\n inspector.asyncTaskFinished(asyncId);\n },\n\n destroy(asyncId) {\n if (this.promiseIds.has(asyncId))\n return this.promiseIds.delete(asyncId);\n inspector.asyncTaskCanceled(asyncId);\n },\n });\n\n hook.promiseIds = new Set();\n}\n\nfunction enable() {\n if (hook === undefined) lazyHookCreation();\n if (config.bits < 64) {\n // V8 Inspector stores task ids as (void*) pointers.\n // async_hooks store ids as 64bit numbers.\n // As a result, we cannot reliably translate async_hook ids to V8 async_task\n // ids on 32bit platforms.\n process.emitWarning(\n 'Warning: Async stack traces in debugger are not available ' +\n `on ${config.bits}bit platforms. The feature is disabled.`,\n {\n code: 'INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE',\n });\n } else {\n hook.enable();\n }\n}\n\nfunction disable() {\n if (hook === undefined) lazyHookCreation();\n hook.disable();\n}\n\nexports.setup = function() {\n inspector.registerAsyncHook(enable, disable);\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2116,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2114,
"count": 1
},
{
"startOffset": 160,
"endOffset": 206,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "exports.setup",
"ranges": [
{
"startOffset": 180,
"endOffset": 193,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lazyHookCreation",
"ranges": [
{
"startOffset": 231,
"endOffset": 1359,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "enable",
"ranges": [
{
"startOffset": 1361,
"endOffset": 1942,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "disable",
"ranges": [
{
"startOffset": 1944,
"endOffset": 2030,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "exports.setup",
"ranges": [
{
"startOffset": 2048,
"endOffset": 2110,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/linkedlist.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nfunction init(list) {\n list._idleNext = list;\n list._idlePrev = list;\n}\n\n// Show the most idle item.\nfunction peek(list) {\n if (list._idlePrev === list) return null;\n return list._idlePrev;\n}\n\n// Remove an item from its list.\nfunction remove(item) {\n if (item._idleNext) {\n item._idleNext._idlePrev = item._idlePrev;\n }\n\n if (item._idlePrev) {\n item._idlePrev._idleNext = item._idleNext;\n }\n\n item._idleNext = null;\n item._idlePrev = null;\n}\n\n// Remove an item from its list and place at the end.\nfunction append(list, item) {\n if (item._idleNext || item._idlePrev) {\n remove(item);\n }\n\n // Items are linked with _idleNext -> (older) and _idlePrev -> (newer).\n // Note: This linkage (next being older) may seem counter-intuitive at first.\n item._idleNext = list._idleNext;\n item._idlePrev = list;\n\n // The list _idleNext points to tail (newest) and _idlePrev to head (oldest).\n list._idleNext._idlePrev = item;\n list._idleNext = item;\n}\n\nfunction isEmpty(list) {\n return list._idleNext === list;\n}\n\nmodule.exports = {\n init,\n peek,\n remove,\n append,\n isEmpty\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1163,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1161,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "init",
"ranges": [
{
"startOffset": 62,
"endOffset": 135,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "peek",
"ranges": [
{
"startOffset": 165,
"endOffset": 257,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "remove",
"ranges": [
{
"startOffset": 292,
"endOffset": 519,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "append",
"ranges": [
{
"startOffset": 575,
"endOffset": 1027,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isEmpty",
"ranges": [
{
"startOffset": 1029,
"endOffset": 1089,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/modules/cjs/helpers.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;\n\nconst {\n CHAR_LINE_FEED,\n CHAR_CARRIAGE_RETURN,\n CHAR_EXCLAMATION_MARK,\n CHAR_HASH,\n} = require('internal/constants');\n\n// Invoke with makeRequireFunction(module) where |module| is the Module object\n// to use as the context for the require() function.\nfunction makeRequireFunction(mod) {\n const Module = mod.constructor;\n\n function require(path) {\n try {\n exports.requireDepth += 1;\n return mod.require(path);\n } finally {\n exports.requireDepth -= 1;\n }\n }\n\n function resolve(request, options) {\n if (typeof request !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('request', 'string', request);\n }\n return Module._resolveFilename(request, mod, false, options);\n }\n\n require.resolve = resolve;\n\n function paths(request) {\n if (typeof request !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('request', 'string', request);\n }\n return Module._resolveLookupPaths(request, mod, true);\n }\n\n resolve.paths = paths;\n\n require.main = process.mainModule;\n\n // Enable support to add extra extension types.\n require.extensions = Module._extensions;\n\n require.cache = Module._cache;\n\n return require;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n * because the buffer-to-string conversion in `fs.readFileSync()`\n * translates it to FEFF, the UTF-16 BOM.\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Find end of shebang line and slice it off\n */\nfunction stripShebang(content) {\n // Remove shebang\n var contLen = content.length;\n if (contLen >= 2) {\n if (content.charCodeAt(0) === CHAR_HASH &&\n content.charCodeAt(1) === CHAR_EXCLAMATION_MARK) {\n if (contLen === 2) {\n // Exact match\n content = '';\n } else {\n // Find end of shebang line and slice it off\n var i = 2;\n for (; i < contLen; ++i) {\n var code = content.charCodeAt(i);\n if (code === CHAR_LINE_FEED || code === CHAR_CARRIAGE_RETURN)\n break;\n }\n if (i === contLen)\n content = '';\n else {\n // Note that this actually includes the newline character(s) in the\n // new output. This duplicates the behavior of the regular expression\n // that was previously used to replace the shebang line\n content = content.slice(i);\n }\n }\n }\n }\n return content;\n}\n\nconst builtinLibs = [\n 'assert', 'async_hooks', 'buffer', 'child_process', 'cluster', 'crypto',\n 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'http2', 'https', 'net',\n 'os', 'path', 'perf_hooks', 'punycode', 'querystring', 'readline', 'repl',\n 'stream', 'string_decoder', 'tls', 'trace_events', 'tty', 'url', 'util',\n 'v8', 'vm', 'zlib'\n];\n\nif (process.binding('config').experimentalWorker) {\n builtinLibs.push('worker_threads');\n builtinLibs.sort();\n}\n\nif (typeof process.binding('inspector').open === 'function') {\n builtinLibs.push('inspector');\n builtinLibs.sort();\n}\n\nfunction addBuiltinLibsToObject(object) {\n // Make built-in modules available directly (loaded lazily).\n builtinLibs.forEach((name) => {\n // Goals of this mechanism are:\n // - Lazy loading of built-in modules\n // - Having all built-in modules available as non-enumerable properties\n // - Allowing the user to re-assign these variables as if there were no\n // pre-existing globals with the same name.\n\n const setReal = (val) => {\n // Deleting the property before re-assigning it disables the\n // getter/setter mechanism.\n delete object[name];\n object[name] = val;\n };\n\n Object.defineProperty(object, name, {\n get: () => {\n const lib = require(name);\n\n // Disable the current getter/setter and set up a new\n // non-enumerable property.\n delete object[name];\n Object.defineProperty(object, name, {\n get: () => lib,\n set: setReal,\n configurable: true,\n enumerable: false\n });\n\n return lib;\n },\n set: setReal,\n configurable: true,\n enumerable: false\n });\n });\n}\n\nmodule.exports = exports = {\n addBuiltinLibsToObject,\n builtinLibs,\n makeRequireFunction,\n requireDepth: 0,\n stripBOM,\n stripShebang\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4436,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4434,
"count": 1
},
{
"startOffset": 2984,
"endOffset": 3047,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "makeRequireFunction",
"ranges": [
{
"startOffset": 386,
"endOffset": 1288,
"count": 2
},
{
"startOffset": 1286,
"endOffset": 1287,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "require",
"ranges": [
{
"startOffset": 459,
"endOffset": 617,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "resolve",
"ranges": [
{
"startOffset": 621,
"endOffset": 840,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "paths",
"ranges": [
{
"startOffset": 874,
"endOffset": 1075,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "stripBOM",
"ranges": [
{
"startOffset": 1473,
"endOffset": 1599,
"count": 1
},
{
"startOffset": 1542,
"endOffset": 1579,
"count": 0
},
{
"startOffset": 1597,
"endOffset": 1598,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "stripShebang",
"ranges": [
{
"startOffset": 1654,
"endOffset": 2581,
"count": 2
},
{
"startOffset": 1805,
"endOffset": 1863,
"count": 0
},
{
"startOffset": 1865,
"endOffset": 2557,
"count": 0
},
{
"startOffset": 2579,
"endOffset": 2580,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "addBuiltinLibsToObject",
"ranges": [
{
"startOffset": 3170,
"endOffset": 4288,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/modules/cjs/loader.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst { NativeModule } = require('internal/bootstrap/loaders');\nconst util = require('util');\nconst vm = require('vm');\nconst assert = require('assert').ok;\nconst fs = require('fs');\nconst internalFS = require('internal/fs/utils');\nconst path = require('path');\nconst {\n internalModuleReadJSON,\n internalModuleStat\n} = process.binding('fs');\nconst { safeGetenv } = process.binding('util');\nconst {\n makeRequireFunction,\n requireDepth,\n stripBOM,\n stripShebang\n} = require('internal/modules/cjs/helpers');\nconst preserveSymlinks = !!process.binding('config').preserveSymlinks;\nconst preserveSymlinksMain = !!process.binding('config').preserveSymlinksMain;\nconst experimentalModules = !!process.binding('config').experimentalModules;\n\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_REQUIRE_ESM\n} = require('internal/errors').codes;\n\nmodule.exports = Module;\n\nlet asyncESM;\nlet ModuleJob;\nlet createDynamicModule;\nlet getURLFromFilePath;\nlet decorateErrorStack;\n\nfunction lazyLoadESM() {\n asyncESM = require('internal/process/esm_loader');\n ModuleJob = require('internal/modules/esm/module_job');\n createDynamicModule = require(\n 'internal/modules/esm/create_dynamic_module');\n decorateErrorStack = require('internal/util').decorateErrorStack;\n getURLFromFilePath = require('internal/url').getURLFromFilePath;\n}\n\nconst {\n CHAR_UPPERCASE_A,\n CHAR_LOWERCASE_A,\n CHAR_UPPERCASE_Z,\n CHAR_LOWERCASE_Z,\n CHAR_FORWARD_SLASH,\n CHAR_BACKWARD_SLASH,\n CHAR_COLON,\n CHAR_DOT,\n CHAR_UNDERSCORE,\n CHAR_0,\n CHAR_9,\n} = require('internal/constants');\n\nfunction stat(filename) {\n filename = path.toNamespacedPath(filename);\n const cache = stat.cache;\n if (cache !== null) {\n const result = cache.get(filename);\n if (result !== undefined) return result;\n }\n const result = internalModuleStat(filename);\n if (cache !== null) cache.set(filename, result);\n return result;\n}\nstat.cache = null;\n\nfunction updateChildren(parent, child, scan) {\n var children = parent && parent.children;\n if (children && !(scan && children.includes(child)))\n children.push(child);\n}\n\nfunction Module(id, parent) {\n this.id = id;\n this.exports = {};\n this.parent = parent;\n updateChildren(parent, this, false);\n this.filename = null;\n this.loaded = false;\n this.children = [];\n}\n\nconst builtinModules = Object.keys(NativeModule._source)\n .filter(NativeModule.nonInternalExists);\n\nObject.freeze(builtinModules);\nModule.builtinModules = builtinModules;\n\nModule._cache = Object.create(null);\nModule._pathCache = Object.create(null);\nModule._extensions = Object.create(null);\nvar modulePaths = [];\nModule.globalPaths = [];\n\nModule.wrap = function(script) {\n return Module.wrapper[0] + script + Module.wrapper[1];\n};\n\nModule.wrapper = [\n '(function (exports, require, module, __filename, __dirname) { ',\n '\\n});'\n];\n\nconst debug = util.debuglog('module');\n\nModule._debug = util.deprecate(debug, 'Module._debug is deprecated.',\n 'DEP0077');\n\n// given a module name, and a list of paths to test, returns the first\n// matching file in the following precedence.\n//\n// require(\"a.<ext>\")\n// -> a.<ext>\n//\n// require(\"a\")\n// -> a\n// -> a.<ext>\n// -> a/index.<ext>\n\n// check if the directory is a package.json dir\nconst packageMainCache = Object.create(null);\n\nfunction readPackage(requestPath) {\n const entry = packageMainCache[requestPath];\n if (entry)\n return entry;\n\n const jsonPath = path.resolve(requestPath, 'package.json');\n const json = internalModuleReadJSON(path.toNamespacedPath(jsonPath));\n\n if (json === undefined) {\n return false;\n }\n\n try {\n return packageMainCache[requestPath] = JSON.parse(json).main;\n } catch (e) {\n e.path = jsonPath;\n e.message = 'Error parsing ' + jsonPath + ': ' + e.message;\n throw e;\n }\n}\n\nfunction tryPackage(requestPath, exts, isMain) {\n var pkg = readPackage(requestPath);\n\n if (!pkg) return false;\n\n var filename = path.resolve(requestPath, pkg);\n return tryFile(filename, isMain) ||\n tryExtensions(filename, exts, isMain) ||\n tryExtensions(path.resolve(filename, 'index'), exts, isMain);\n}\n\n// In order to minimize unnecessary lstat() calls,\n// this cache is a list of known-real paths.\n// Set to an empty Map to reset.\nconst realpathCache = new Map();\n\n// check if the file exists and is not a directory\n// if using --preserve-symlinks and isMain is false,\n// keep symlinks intact, otherwise resolve to the\n// absolute realpath.\nfunction tryFile(requestPath, isMain) {\n const rc = stat(requestPath);\n if (preserveSymlinks && !isMain) {\n return rc === 0 && path.resolve(requestPath);\n }\n return rc === 0 && toRealPath(requestPath);\n}\n\nfunction toRealPath(requestPath) {\n return fs.realpathSync(requestPath, {\n [internalFS.realpathCacheKey]: realpathCache\n });\n}\n\n// given a path, check if the file exists with any of the set extensions\nfunction tryExtensions(p, exts, isMain) {\n for (var i = 0; i < exts.length; i++) {\n const filename = tryFile(p + exts[i], isMain);\n\n if (filename) {\n return filename;\n }\n }\n return false;\n}\n\nvar warned = false;\nModule._findPath = function(request, paths, isMain) {\n if (path.isAbsolute(request)) {\n paths = [''];\n } else if (!paths || paths.length === 0) {\n return false;\n }\n\n var cacheKey = request + '\\x00' +\n (paths.length === 1 ? paths[0] : paths.join('\\x00'));\n var entry = Module._pathCache[cacheKey];\n if (entry)\n return entry;\n\n var exts;\n var trailingSlash = request.length > 0 &&\n request.charCodeAt(request.length - 1) === CHAR_FORWARD_SLASH;\n if (!trailingSlash) {\n trailingSlash = /(?:^|\\/)\\.?\\.$/.test(request);\n }\n\n // For each path\n for (var i = 0; i < paths.length; i++) {\n // Don't search further if path doesn't exist\n const curPath = paths[i];\n if (curPath && stat(curPath) < 1) continue;\n var basePath = path.resolve(curPath, request);\n var filename;\n\n var rc = stat(basePath);\n if (!trailingSlash) {\n if (rc === 0) { // File.\n if (!isMain) {\n if (preserveSymlinks) {\n filename = path.resolve(basePath);\n } else {\n filename = toRealPath(basePath);\n }\n } else if (preserveSymlinksMain) {\n // For the main module, we use the preserveSymlinksMain flag instead\n // mainly for backward compatibility, as the preserveSymlinks flag\n // historically has not applied to the main module. Most likely this\n // was intended to keep .bin/ binaries working, as following those\n // symlinks is usually required for the imports in the corresponding\n // files to resolve; that said, in some use cases following symlinks\n // causes bigger problems which is why the preserveSymlinksMain option\n // is needed.\n filename = path.resolve(basePath);\n } else {\n filename = toRealPath(basePath);\n }\n }\n\n if (!filename) {\n // try it with each of the extensions\n if (exts === undefined)\n exts = Object.keys(Module._extensions);\n filename = tryExtensions(basePath, exts, isMain);\n }\n }\n\n if (!filename && rc === 1) { // Directory.\n // try it with each of the extensions at \"index\"\n if (exts === undefined)\n exts = Object.keys(Module._extensions);\n filename = tryPackage(basePath, exts, isMain);\n if (!filename) {\n filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);\n }\n }\n\n if (filename) {\n // Warn once if '.' resolved outside the module dir\n if (request === '.' && i > 0) {\n if (!warned) {\n warned = true;\n process.emitWarning(\n 'warning: require(\\'.\\') resolved outside the package ' +\n 'directory. This functionality is deprecated and will be removed ' +\n 'soon.',\n 'DeprecationWarning', 'DEP0019');\n }\n }\n\n Module._pathCache[cacheKey] = filename;\n return filename;\n }\n }\n return false;\n};\n\n// 'node_modules' character codes reversed\nvar nmChars = [ 115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110 ];\nvar nmLen = nmChars.length;\nif (process.platform === 'win32') {\n // 'from' is the __dirname of the module.\n Module._nodeModulePaths = function(from) {\n // guarantee that 'from' is absolute.\n from = path.resolve(from);\n\n // note: this approach *only* works when the path is guaranteed\n // to be absolute. Doing a fully-edge-case-correct path.split\n // that works on both Windows and Posix is non-trivial.\n\n // return root node_modules when path is 'D:\\\\'.\n // path.resolve will make sure from.length >=3 in Windows.\n if (from.charCodeAt(from.length - 1) === CHAR_BACKWARD_SLASH &&\n from.charCodeAt(from.length - 2) === CHAR_COLON)\n return [from + 'node_modules'];\n\n const paths = [];\n var p = 0;\n var last = from.length;\n for (var i = from.length - 1; i >= 0; --i) {\n const code = from.charCodeAt(i);\n // The path segment separator check ('\\' and '/') was used to get\n // node_modules path for every path segment.\n // Use colon as an extra condition since we can get node_modules\n // path for drive root like 'C:\\node_modules' and don't need to\n // parse drive name.\n if (code === CHAR_BACKWARD_SLASH ||\n code === CHAR_FORWARD_SLASH ||\n code === CHAR_COLON) {\n if (p !== nmLen)\n paths.push(from.slice(0, last) + '\\\\node_modules');\n last = i;\n p = 0;\n } else if (p !== -1) {\n if (nmChars[p] === code) {\n ++p;\n } else {\n p = -1;\n }\n }\n }\n\n return paths;\n };\n} else { // posix\n // 'from' is the __dirname of the module.\n Module._nodeModulePaths = function(from) {\n // guarantee that 'from' is absolute.\n from = path.resolve(from);\n // Return early not only to avoid unnecessary work, but to *avoid* returning\n // an array of two items for a root: [ '//node_modules', '/node_modules' ]\n if (from === '/')\n return ['/node_modules'];\n\n // note: this approach *only* works when the path is guaranteed\n // to be absolute. Doing a fully-edge-case-correct path.split\n // that works on both Windows and Posix is non-trivial.\n const paths = [];\n var p = 0;\n var last = from.length;\n for (var i = from.length - 1; i >= 0; --i) {\n const code = from.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n if (p !== nmLen)\n paths.push(from.slice(0, last) + '/node_modules');\n last = i;\n p = 0;\n } else if (p !== -1) {\n if (nmChars[p] === code) {\n ++p;\n } else {\n p = -1;\n }\n }\n }\n\n // Append /node_modules to handle root paths.\n paths.push('/node_modules');\n\n return paths;\n };\n}\n\n\n// 'index.' character codes\nvar indexChars = [ 105, 110, 100, 101, 120, 46 ];\nvar indexLen = indexChars.length;\nModule._resolveLookupPaths = function(request, parent, newReturn) {\n if (NativeModule.nonInternalExists(request)) {\n debug('looking for %j in []', request);\n return (newReturn ? null : [request, []]);\n }\n\n // Check for relative path\n if (request.length < 2 ||\n request.charCodeAt(0) !== CHAR_DOT ||\n (request.charCodeAt(1) !== CHAR_DOT &&\n request.charCodeAt(1) !== CHAR_FORWARD_SLASH)) {\n var paths = modulePaths;\n if (parent) {\n if (!parent.paths)\n paths = parent.paths = [];\n else\n paths = parent.paths.concat(paths);\n }\n\n // Maintain backwards compat with certain broken uses of require('.')\n // by putting the module's directory in front of the lookup paths.\n if (request === '.') {\n if (parent && parent.filename) {\n paths.unshift(path.dirname(parent.filename));\n } else {\n paths.unshift(path.resolve(request));\n }\n }\n\n debug('looking for %j in %j', request, paths);\n return (newReturn ? (paths.length > 0 ? paths : null) : [request, paths]);\n }\n\n // with --eval, parent.id is not set and parent.filename is null\n if (!parent || !parent.id || !parent.filename) {\n // make require('./path/to/foo') work - normally the path is taken\n // from realpath(__filename) but with eval there is no filename\n var mainPaths = ['.'].concat(Module._nodeModulePaths('.'), modulePaths);\n\n debug('looking for %j in %j', request, mainPaths);\n return (newReturn ? mainPaths : [request, mainPaths]);\n }\n\n // Is the parent an index module?\n // We can assume the parent has a valid extension,\n // as it already has been accepted as a module.\n const base = path.basename(parent.filename);\n var parentIdPath;\n if (base.length > indexLen) {\n var i = 0;\n for (; i < indexLen; ++i) {\n if (indexChars[i] !== base.charCodeAt(i))\n break;\n }\n if (i === indexLen) {\n // We matched 'index.', let's validate the rest\n for (; i < base.length; ++i) {\n const code = base.charCodeAt(i);\n if (code !== CHAR_UNDERSCORE &&\n (code < CHAR_0 || code > CHAR_9) &&\n (code < CHAR_UPPERCASE_A || code > CHAR_UPPERCASE_Z) &&\n (code < CHAR_LOWERCASE_A || code > CHAR_LOWERCASE_Z))\n break;\n }\n if (i === base.length) {\n // Is an index module\n parentIdPath = parent.id;\n } else {\n // Not an index module\n parentIdPath = path.dirname(parent.id);\n }\n } else {\n // Not an index module\n parentIdPath = path.dirname(parent.id);\n }\n } else {\n // Not an index module\n parentIdPath = path.dirname(parent.id);\n }\n var id = path.resolve(parentIdPath, request);\n\n // make sure require('./path') and require('path') get distinct ids, even\n // when called from the toplevel js file\n if (parentIdPath === '.' && id.indexOf('/') === -1) {\n id = './' + id;\n }\n\n debug('RELATIVE: requested: %s set ID to: %s from %s', request, id,\n parent.id);\n\n var parentDir = [path.dirname(parent.filename)];\n debug('looking for %j in %j', id, parentDir);\n return (newReturn ? parentDir : [id, parentDir]);\n};\n\n// Check the cache for the requested file.\n// 1. If a module already exists in the cache: return its exports object.\n// 2. If the module is native: call `NativeModule.require()` with the\n// filename and return the result.\n// 3. Otherwise, create a new module for the file and save it to the cache.\n// Then have it load the file contents before returning its exports\n// object.\nModule._load = function(request, parent, isMain) {\n if (parent) {\n debug('Module._load REQUEST %s parent: %s', request, parent.id);\n }\n\n var filename = Module._resolveFilename(request, parent, isMain);\n\n var cachedModule = Module._cache[filename];\n if (cachedModule) {\n updateChildren(parent, cachedModule, true);\n return cachedModule.exports;\n }\n\n if (NativeModule.nonInternalExists(filename)) {\n debug('load native module %s', request);\n return NativeModule.require(filename);\n }\n\n // Don't call updateChildren(), Module constructor already does.\n var module = new Module(filename, parent);\n\n if (isMain) {\n process.mainModule = module;\n module.id = '.';\n }\n\n Module._cache[filename] = module;\n\n tryModuleLoad(module, filename);\n\n return module.exports;\n};\n\nfunction tryModuleLoad(module, filename) {\n var threw = true;\n try {\n module.load(filename);\n threw = false;\n } finally {\n if (threw) {\n delete Module._cache[filename];\n }\n }\n}\n\nModule._resolveFilename = function(request, parent, isMain, options) {\n if (NativeModule.nonInternalExists(request)) {\n return request;\n }\n\n var paths;\n\n if (typeof options === 'object' && options !== null &&\n Array.isArray(options.paths)) {\n const fakeParent = new Module('', null);\n\n paths = [];\n\n for (var i = 0; i < options.paths.length; i++) {\n const path = options.paths[i];\n fakeParent.paths = Module._nodeModulePaths(path);\n const lookupPaths = Module._resolveLookupPaths(request, fakeParent, true);\n\n if (!paths.includes(path))\n paths.push(path);\n\n for (var j = 0; j < lookupPaths.length; j++) {\n if (!paths.includes(lookupPaths[j]))\n paths.push(lookupPaths[j]);\n }\n }\n } else {\n paths = Module._resolveLookupPaths(request, parent, true);\n }\n\n // look up the filename first, since that's the cache key.\n var filename = Module._findPath(request, paths, isMain);\n if (!filename) {\n // eslint-disable-next-line no-restricted-syntax\n var err = new Error(`Cannot find module '${request}'`);\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n return filename;\n};\n\n\n// Given a file name, pass it to the proper extension handler.\nModule.prototype.load = function(filename) {\n debug('load %j for module %j', filename, this.id);\n\n assert(!this.loaded);\n this.filename = filename;\n this.paths = Module._nodeModulePaths(path.dirname(filename));\n\n var extension = path.extname(filename) || '.js';\n if (!Module._extensions[extension]) extension = '.js';\n Module._extensions[extension](this, filename);\n this.loaded = true;\n\n if (experimentalModules) {\n if (asyncESM === undefined) lazyLoadESM();\n const ESMLoader = asyncESM.ESMLoader;\n const url = getURLFromFilePath(filename);\n const urlString = `${url}`;\n const exports = this.exports;\n if (ESMLoader.moduleMap.has(urlString) !== true) {\n ESMLoader.moduleMap.set(\n urlString,\n new ModuleJob(ESMLoader, url, async () => {\n const ctx = createDynamicModule(\n ['default'], url);\n ctx.reflect.exports.default.set(exports);\n return ctx;\n })\n );\n } else {\n const job = ESMLoader.moduleMap.get(urlString);\n if (job.reflect)\n job.reflect.exports.default.set(exports);\n }\n }\n};\n\n\n// Loads a module at the given file path. Returns that module's\n// `exports` property.\nModule.prototype.require = function(id) {\n if (typeof id !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('id', 'string', id);\n }\n if (id === '') {\n throw new ERR_INVALID_ARG_VALUE('id', id,\n 'must be a non-empty string');\n }\n return Module._load(id, this, /* isMain */ false);\n};\n\n\n// Resolved path to process.argv[1] will be lazily placed here\n// (needed for setting breakpoint when called with --inspect-brk)\nvar resolvedArgv;\n\n\n// Run the file contents in the correct scope or sandbox. Expose\n// the correct helper variables (require, module, exports) to\n// the file.\n// Returns exception, if any.\nModule.prototype._compile = function(content, filename) {\n\n content = stripShebang(content);\n\n // create wrapper function\n var wrapper = Module.wrap(content);\n\n var compiledWrapper = vm.runInThisContext(wrapper, {\n filename: filename,\n lineOffset: 0,\n displayErrors: true\n });\n\n var inspectorWrapper = null;\n if (process._breakFirstLine && process._eval == null) {\n if (!resolvedArgv) {\n // we enter the repl if we're not given a filename argument.\n if (process.argv[1]) {\n resolvedArgv = Module._resolveFilename(process.argv[1], null, false);\n } else {\n resolvedArgv = 'repl';\n }\n }\n\n // Set breakpoint on module start\n if (filename === resolvedArgv) {\n delete process._breakFirstLine;\n inspectorWrapper = process.binding('inspector').callAndPauseOnStart;\n }\n }\n var dirname = path.dirname(filename);\n var require = makeRequireFunction(this);\n var depth = requireDepth;\n if (depth === 0) stat.cache = new Map();\n var result;\n if (inspectorWrapper) {\n result = inspectorWrapper(compiledWrapper, this.exports, this.exports,\n require, this, filename, dirname);\n } else {\n result = compiledWrapper.call(this.exports, this.exports, require, this,\n filename, dirname);\n }\n if (depth === 0) stat.cache = null;\n return result;\n};\n\n\n// Native extension for .js\nModule._extensions['.js'] = function(module, filename) {\n var content = fs.readFileSync(filename, 'utf8');\n module._compile(stripBOM(content), filename);\n};\n\n\n// Native extension for .json\nModule._extensions['.json'] = function(module, filename) {\n var content = fs.readFileSync(filename, 'utf8');\n try {\n module.exports = JSON.parse(stripBOM(content));\n } catch (err) {\n err.message = filename + ': ' + err.message;\n throw err;\n }\n};\n\n\n// Native extension for .node\nModule._extensions['.node'] = function(module, filename) {\n return process.dlopen(module, path.toNamespacedPath(filename));\n};\n\nif (experimentalModules) {\n if (asyncESM === undefined) lazyLoadESM();\n Module._extensions['.mjs'] = function(module, filename) {\n throw new ERR_REQUIRE_ESM(filename);\n };\n}\n\n// bootstrap main module.\nModule.runMain = function() {\n // Load the main module--the command line argument.\n if (experimentalModules) {\n if (asyncESM === undefined) lazyLoadESM();\n asyncESM.loaderPromise.then((loader) => {\n return loader.import(getURLFromFilePath(process.argv[1]).pathname);\n })\n .catch((e) => {\n decorateErrorStack(e);\n console.error(e);\n process.exit(1);\n });\n } else {\n Module._load(process.argv[1], null, true);\n }\n // Handle any nextTicks added in the first tick of the program\n process._tickCallback();\n};\n\nModule._initPaths = function() {\n const isWindows = process.platform === 'win32';\n\n var homeDir;\n var nodePath;\n if (isWindows) {\n homeDir = process.env.USERPROFILE;\n nodePath = process.env.NODE_PATH;\n } else {\n homeDir = safeGetenv('HOME');\n nodePath = safeGetenv('NODE_PATH');\n }\n\n // $PREFIX/lib/node, where $PREFIX is the root of the Node.js installation.\n var prefixDir;\n // process.execPath is $PREFIX/bin/node except on Windows where it is\n // $PREFIX\\node.exe.\n if (isWindows) {\n prefixDir = path.resolve(process.execPath, '..');\n } else {\n prefixDir = path.resolve(process.execPath, '..', '..');\n }\n var paths = [path.resolve(prefixDir, 'lib', 'node')];\n\n if (homeDir) {\n paths.unshift(path.resolve(homeDir, '.node_libraries'));\n paths.unshift(path.resolve(homeDir, '.node_modules'));\n }\n\n if (nodePath) {\n paths = nodePath.split(path.delimiter).filter(function pathsFilterCB(path) {\n return !!path;\n }).concat(paths);\n }\n\n modulePaths = paths;\n\n // clone as a shallow copy, for introspection.\n Module.globalPaths = modulePaths.slice(0);\n};\n\nModule._preloadModules = function(requests) {\n if (!Array.isArray(requests))\n return;\n\n // Preloaded modules have a dummy parent module which is deemed to exist\n // in the current working directory. This seeds the search path for\n // preloaded modules.\n var parent = new Module('internal/preload', null);\n try {\n parent.paths = Module._nodeModulePaths(process.cwd());\n } catch (e) {\n if (e.code !== 'ENOENT') {\n throw e;\n }\n }\n for (var n = 0; n < requests.length; n++)\n parent.require(requests[n]);\n};\n\nModule._initPaths();\n\n// Backwards compatibility\nModule.Module = Module;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 24269,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 24267,
"count": 1
},
{
"startOffset": 9436,
"endOffset": 10920,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "lazyLoadESM",
"ranges": [
{
"startOffset": 2178,
"endOffset": 2534,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "stat",
"ranges": [
{
"startOffset": 2770,
"endOffset": 3099,
"count": 1
},
{
"startOffset": 2892,
"endOffset": 2982,
"count": 0
},
{
"startOffset": 3052,
"endOffset": 3080,
"count": 0
},
{
"startOffset": 3097,
"endOffset": 3098,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "updateChildren",
"ranges": [
{
"startOffset": 3120,
"endOffset": 3293,
"count": 2
},
{
"startOffset": 3191,
"endOffset": 3209,
"count": 0
},
{
"startOffset": 3226,
"endOffset": 3264,
"count": 0
},
{
"startOffset": 3270,
"endOffset": 3291,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module",
"ranges": [
{
"startOffset": 3295,
"endOffset": 3495,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "Module.wrap",
"ranges": [
{
"startOffset": 3852,
"endOffset": 3929,
"count": 1
},
{
"startOffset": 3927,
"endOffset": 3928,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "readPackage",
"ranges": [
{
"startOffset": 4508,
"endOffset": 5004,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "tryPackage",
"ranges": [
{
"startOffset": 5006,
"endOffset": 5330,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "tryFile",
"ranges": [
{
"startOffset": 5671,
"endOffset": 5881,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toRealPath",
"ranges": [
{
"startOffset": 5883,
"endOffset": 6014,
"count": 1
},
{
"startOffset": 6012,
"endOffset": 6013,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tryExtensions",
"ranges": [
{
"startOffset": 6089,
"endOffset": 6295,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._findPath",
"ranges": [
{
"startOffset": 6336,
"endOffset": 9251,
"count": 1
},
{
"startOffset": 6426,
"endOffset": 6489,
"count": 0
},
{
"startOffset": 6574,
"endOffset": 6594,
"count": 0
},
{
"startOffset": 6657,
"endOffset": 6670,
"count": 0
},
{
"startOffset": 7034,
"endOffset": 7054,
"count": 0
},
{
"startOffset": 7056,
"endOffset": 7065,
"count": 0
},
{
"startOffset": 7244,
"endOffset": 7412,
"count": 0
},
{
"startOffset": 7444,
"endOffset": 8076,
"count": 0
},
{
"startOffset": 8167,
"endOffset": 8362,
"count": 0
},
{
"startOffset": 8388,
"endOffset": 8399,
"count": 0
},
{
"startOffset": 8401,
"endOffset": 8721,
"count": 0
},
{
"startOffset": 8827,
"endOffset": 8835,
"count": 0
},
{
"startOffset": 8837,
"endOffset": 9153,
"count": 0
},
{
"startOffset": 9223,
"endOffset": 9250,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._nodeModulePaths",
"ranges": [
{
"startOffset": 9510,
"endOffset": 10917,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._nodeModulePaths",
"ranges": [
{
"startOffset": 11009,
"endOffset": 12066,
"count": 2
},
{
"startOffset": 11287,
"endOffset": 11312,
"count": 0
},
{
"startOffset": 11621,
"endOffset": 11959,
"count": 134
},
{
"startOffset": 11701,
"endOffset": 11829,
"count": 16
},
{
"startOffset": 11829,
"endOffset": 11953,
"count": 118
},
{
"startOffset": 11849,
"endOffset": 11953,
"count": 22
},
{
"startOffset": 11884,
"endOffset": 11910,
"count": 6
},
{
"startOffset": 11910,
"endOffset": 11945,
"count": 16
},
{
"startOffset": 12062,
"endOffset": 12065,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._resolveLookupPaths",
"ranges": [
{
"startOffset": 12213,
"endOffset": 15326,
"count": 1
},
{
"startOffset": 12299,
"endOffset": 12395,
"count": 0
},
{
"startOffset": 12495,
"endOffset": 12595,
"count": 0
},
{
"startOffset": 12644,
"endOffset": 12766,
"count": 0
},
{
"startOffset": 12938,
"endOffset": 13107,
"count": 0
},
{
"startOffset": 13210,
"endOffset": 13216,
"count": 0
},
{
"startOffset": 13218,
"endOffset": 13236,
"count": 0
},
{
"startOffset": 13238,
"endOffset": 13338,
"count": 0
},
{
"startOffset": 13339,
"endOffset": 13358,
"count": 0
},
{
"startOffset": 13360,
"endOffset": 15054,
"count": 0
},
{
"startOffset": 15056,
"endOffset": 15304,
"count": 0
},
{
"startOffset": 15305,
"endOffset": 15322,
"count": 0
},
{
"startOffset": 15324,
"endOffset": 15325,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._load",
"ranges": [
{
"startOffset": 15731,
"endOffset": 16509,
"count": 1
},
{
"startOffset": 15781,
"endOffset": 15855,
"count": 0
},
{
"startOffset": 15991,
"endOffset": 16077,
"count": 0
},
{
"startOffset": 16127,
"endOffset": 16220,
"count": 0
},
{
"startOffset": 16507,
"endOffset": 16508,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "tryModuleLoad",
"ranges": [
{
"startOffset": 16512,
"endOffset": 16709,
"count": 1
},
{
"startOffset": 16658,
"endOffset": 16703,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._resolveFilename",
"ranges": [
{
"startOffset": 16737,
"endOffset": 17871,
"count": 1
},
{
"startOffset": 16829,
"endOffset": 16854,
"count": 0
},
{
"startOffset": 16904,
"endOffset": 16923,
"count": 0
},
{
"startOffset": 16924,
"endOffset": 16961,
"count": 0
},
{
"startOffset": 16963,
"endOffset": 17469,
"count": 0
},
{
"startOffset": 17682,
"endOffset": 17850,
"count": 0
},
{
"startOffset": 17869,
"endOffset": 17870,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module.load",
"ranges": [
{
"startOffset": 17962,
"endOffset": 19040,
"count": 1
},
{
"startOffset": 18195,
"endOffset": 18203,
"count": 0
},
{
"startOffset": 18243,
"endOffset": 18261,
"count": 0
},
{
"startOffset": 18395,
"endOffset": 18409,
"count": 0
},
{
"startOffset": 18617,
"endOffset": 18894,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "ESMLoader.moduleMap.set.ModuleJob",
"ranges": [
{
"startOffset": 18707,
"endOffset": 18878,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module.require",
"ranges": [
{
"startOffset": 19158,
"endOffset": 19455,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._compile",
"ranges": [
{
"startOffset": 19806,
"endOffset": 21153,
"count": 1
},
{
"startOffset": 20131,
"endOffset": 20155,
"count": 0
},
{
"startOffset": 20157,
"endOffset": 20616,
"count": 0
},
{
"startOffset": 20809,
"endOffset": 20954,
"count": 0
},
{
"startOffset": 21151,
"endOffset": 21152,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._extensions..js",
"ranges": [
{
"startOffset": 21213,
"endOffset": 21342,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "Module._extensions..json",
"ranges": [
{
"startOffset": 21406,
"endOffset": 21633,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._extensions..node",
"ranges": [
{
"startOffset": 21697,
"endOffset": 21793,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._extensions..mjs",
"ranges": [
{
"startOffset": 21899,
"endOffset": 21972,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module.runMain",
"ranges": [
{
"startOffset": 22020,
"endOffset": 22549,
"count": 1
},
{
"startOffset": 22148,
"endOffset": 22162,
"count": 0
},
{
"startOffset": 22397,
"endOffset": 22455,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "asyncESM.loaderPromise.then",
"ranges": [
{
"startOffset": 22195,
"endOffset": 22288,
"count": 1
},
{
"startOffset": 22282,
"endOffset": 22287,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "asyncESM.loaderPromise.then.catch",
"ranges": [
{
"startOffset": 22301,
"endOffset": 22391,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._initPaths",
"ranges": [
{
"startOffset": 22572,
"endOffset": 23656,
"count": 1
},
{
"startOffset": 22684,
"endOffset": 22766,
"count": 0
},
{
"startOffset": 23060,
"endOffset": 23119,
"count": 0
},
{
"startOffset": 23406,
"endOffset": 23535,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "pathsFilterCB",
"ranges": [
{
"startOffset": 23458,
"endOffset": 23515,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Module._preloadModules",
"ranges": [
{
"startOffset": 23684,
"endOffset": 24189,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/modules/esm/create_dynamic_module.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { internalBinding } = require('internal/bootstrap/loaders');\nconst { ModuleWrap } = internalBinding('module_wrap');\nconst debug = require('util').debuglog('esm');\nconst ArrayJoin = Function.call.bind(Array.prototype.join);\nconst ArrayMap = Function.call.bind(Array.prototype.map);\n\nconst createDynamicModule = (exports, url = '', evaluate) => {\n debug(\n `creating ESM facade for ${url} with exports: ${ArrayJoin(exports, ', ')}`\n );\n const names = ArrayMap(exports, (name) => `${name}`);\n // Create two modules: One whose exports are get- and set-able ('reflective'),\n // and one which re-exports all of these but additionally may\n // run an executor function once everything is set up.\n const src = `\n export let executor;\n ${ArrayJoin(ArrayMap(names, (name) => `export let $${name};`), '\\n')}\n /* This function is implicitly returned as the module's completion value */\n (() => ({\n setExecutor: fn => executor = fn,\n reflect: {\n exports: { ${\n ArrayJoin(ArrayMap(names, (name) => `\n ${name}: {\n get: () => $${name},\n set: v => $${name} = v\n }`), ', \\n')}\n }\n }\n }));`;\n const reflectiveModule = new ModuleWrap(src, `cjs-facade:${url}`);\n reflectiveModule.instantiate();\n const { setExecutor, reflect } = reflectiveModule.evaluate(-1, false)();\n // public exposed ESM\n const reexports = `\n import {\n executor,\n ${ArrayMap(names, (name) => `$${name}`)}\n } from \"\";\n export {\n ${ArrayJoin(ArrayMap(names, (name) => `$${name} as ${name}`), ', ')}\n }\n if (typeof executor === \"function\") {\n // add await to this later if top level await comes along\n executor()\n }`;\n if (typeof evaluate === 'function') {\n setExecutor(() => evaluate(reflect));\n }\n const module = new ModuleWrap(reexports, `${url}`);\n module.link(async () => reflectiveModule);\n module.instantiate();\n reflect.namespace = module.namespace();\n return {\n module,\n reflect,\n };\n};\n\nmodule.exports = createDynamicModule;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2062,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2060,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "createDynamicModule",
"ranges": [
{
"startOffset": 378,
"endOffset": 2017,
"count": 1
},
{
"startOffset": 2015,
"endOffset": 2016,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "ArrayMap",
"ranges": [
{
"startOffset": 540,
"endOffset": 559,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ArrayMap",
"ranges": [
{
"startOffset": 833,
"endOffset": 865,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ArrayMap",
"ranges": [
{
"startOffset": 1066,
"endOffset": 1171,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ArrayMap",
"ranges": [
{
"startOffset": 1477,
"endOffset": 1497,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ArrayMap",
"ranges": [
{
"startOffset": 1556,
"endOffset": 1587,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setExecutor",
"ranges": [
{
"startOffset": 1780,
"endOffset": 1803,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "module.link",
"ranges": [
{
"startOffset": 1878,
"endOffset": 1906,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/modules/esm/default_resolve.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { URL } = require('url');\nconst CJSmodule = require('internal/modules/cjs/loader');\nconst internalFS = require('internal/fs/utils');\nconst { NativeModule, internalBinding } = require('internal/bootstrap/loaders');\nconst { extname } = require('path');\nconst { realpathSync } = require('fs');\nconst preserveSymlinks = !!process.binding('config').preserveSymlinks;\nconst preserveSymlinksMain = !!process.binding('config').preserveSymlinksMain;\nconst {\n ERR_MISSING_MODULE,\n ERR_MODULE_RESOLUTION_LEGACY,\n ERR_UNKNOWN_FILE_EXTENSION\n} = require('internal/errors').codes;\nconst { resolve: moduleWrapResolve } = internalBinding('module_wrap');\nconst StringStartsWith = Function.call.bind(String.prototype.startsWith);\nconst { getURLFromFilePath, getPathFromURL } = require('internal/url');\n\nconst realpathCache = new Map();\n\nfunction search(target, base) {\n if (base === undefined) {\n // We cannot search without a base.\n throw new ERR_MISSING_MODULE(target);\n }\n try {\n return moduleWrapResolve(target, base);\n } catch (e) {\n e.stack; // cause V8 to generate stack before rethrow\n let error = e;\n try {\n const questionedBase = new URL(base);\n const tmpMod = new CJSmodule(questionedBase.pathname, null);\n tmpMod.paths = CJSmodule._nodeModulePaths(\n new URL('./', questionedBase).pathname);\n const found = CJSmodule._resolveFilename(target, tmpMod);\n error = new ERR_MODULE_RESOLUTION_LEGACY(target, base, found);\n } catch (problemChecking) {\n // ignore\n }\n throw error;\n }\n}\n\nconst extensionFormatMap = {\n '__proto__': null,\n '.mjs': 'esm',\n '.json': 'json',\n '.node': 'addon',\n '.js': 'cjs'\n};\n\nfunction resolve(specifier, parentURL) {\n if (NativeModule.nonInternalExists(specifier)) {\n return {\n url: specifier,\n format: 'builtin'\n };\n }\n\n let url;\n try {\n url = search(specifier,\n parentURL || getURLFromFilePath(`${process.cwd()}/`).href);\n } catch (e) {\n if (typeof e.message === 'string' &&\n StringStartsWith(e.message, 'Cannot find module'))\n e.code = 'MODULE_NOT_FOUND';\n throw e;\n }\n\n const isMain = parentURL === undefined;\n\n if (isMain ? !preserveSymlinksMain : !preserveSymlinks) {\n const real = realpathSync(getPathFromURL(url), {\n [internalFS.realpathCacheKey]: realpathCache\n });\n const old = url;\n url = getURLFromFilePath(real);\n url.search = old.search;\n url.hash = old.hash;\n }\n\n const ext = extname(url.pathname);\n\n let format = extensionFormatMap[ext];\n if (!format) {\n if (isMain)\n format = 'cjs';\n else\n throw new ERR_UNKNOWN_FILE_EXTENSION(url.pathname);\n }\n\n return { url: `${url}`, format };\n}\n\nmodule.exports = resolve;\n// exported for tests\nmodule.exports.search = search;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2851,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2849,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "search",
"ranges": [
{
"startOffset": 890,
"endOffset": 1609,
"count": 2
},
{
"startOffset": 948,
"endOffset": 1035,
"count": 0
},
{
"startOffset": 1087,
"endOffset": 1608,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "resolve",
"ranges": [
{
"startOffset": 1736,
"endOffset": 2765,
"count": 2
},
{
"startOffset": 1826,
"endOffset": 1897,
"count": 0
},
{
"startOffset": 1973,
"endOffset": 2020,
"count": 1
},
{
"startOffset": 2027,
"endOffset": 2190,
"count": 0
},
{
"startOffset": 2248,
"endOffset": 2271,
"count": 1
},
{
"startOffset": 2272,
"endOffset": 2291,
"count": 1
},
{
"startOffset": 2616,
"endOffset": 2726,
"count": 0
},
{
"startOffset": 2763,
"endOffset": 2764,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/modules/esm/loader.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_RETURN_PROPERTY,\n ERR_INVALID_RETURN_PROPERTY_VALUE,\n ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK,\n ERR_UNKNOWN_MODULE_FORMAT\n} = require('internal/errors').codes;\nconst { URL } = require('url');\nconst ModuleMap = require('internal/modules/esm/module_map');\nconst ModuleJob = require('internal/modules/esm/module_job');\nconst defaultResolve = require('internal/modules/esm/default_resolve');\nconst createDynamicModule = require(\n 'internal/modules/esm/create_dynamic_module');\nconst translators = require('internal/modules/esm/translators');\n\nconst FunctionBind = Function.call.bind(Function.prototype.bind);\n\nconst debug = require('util').debuglog('esm');\n\n/* A Loader instance is used as the main entry point for loading ES modules.\n * Currently, this is a singleton -- there is only one used for loading\n * the main module and everything in its dependency graph. */\nclass Loader {\n constructor() {\n // methods which translate input code or other information\n // into es modules\n this.translators = translators;\n\n // registry of loaded modules, akin to `require.cache`\n this.moduleMap = new ModuleMap();\n\n // The resolver has the signature\n // (specifier : string, parentURL : string, defaultResolve)\n // -> Promise<{ url : string, format: string }>\n // where defaultResolve is ModuleRequest.resolve (having the same\n // signature itself).\n // If `.format` on the returned value is 'dynamic', .dynamicInstantiate\n // will be used as described below.\n this._resolve = defaultResolve;\n // This hook is only called when resolve(...).format is 'dynamic' and\n // has the signature\n // (url : string) -> Promise<{ exports: { ... }, execute: function }>\n // Where `exports` is an object whose property names define the exported\n // names of the generated module. `execute` is a function that receives\n // an object with the same keys as `exports`, whose values are get/set\n // functions for the actual exported values.\n this._dynamicInstantiate = undefined;\n }\n\n async resolve(specifier, parentURL) {\n const isMain = parentURL === undefined;\n if (!isMain && typeof parentURL !== 'string')\n throw new ERR_INVALID_ARG_TYPE('parentURL', 'string', parentURL);\n\n const resolved = await this._resolve(specifier, parentURL, defaultResolve);\n\n if (typeof resolved !== 'object')\n throw new ERR_INVALID_RETURN_VALUE(\n 'object', 'loader resolve', resolved\n );\n\n const { url, format } = resolved;\n\n if (typeof url !== 'string')\n throw new ERR_INVALID_RETURN_PROPERTY_VALUE(\n 'string', 'loader resolve', 'url', url\n );\n\n if (typeof format !== 'string')\n throw new ERR_INVALID_RETURN_PROPERTY_VALUE(\n 'string', 'loader resolve', 'format', format\n );\n\n if (format === 'builtin')\n return { url: `node:${url}`, format };\n\n if (this._resolve !== defaultResolve) {\n try {\n new URL(url);\n } catch (e) {\n throw new ERR_INVALID_RETURN_PROPERTY(\n 'url', 'loader resolve', 'url', url\n );\n }\n }\n\n if (format !== 'dynamic' && !url.startsWith('file:'))\n throw new ERR_INVALID_RETURN_PROPERTY(\n 'file: url', 'loader resolve', 'url', url\n );\n\n return { url, format };\n }\n\n async import(specifier, parent) {\n const job = await this.getModuleJob(specifier, parent);\n const module = await job.run();\n return module.namespace();\n }\n\n hook({ resolve, dynamicInstantiate }) {\n // Use .bind() to avoid giving access to the Loader instance when called.\n if (resolve !== undefined)\n this._resolve = FunctionBind(resolve, null);\n if (dynamicInstantiate !== undefined)\n this._dynamicInstantiate = FunctionBind(dynamicInstantiate, null);\n }\n\n async getModuleJob(specifier, parentURL) {\n const { url, format } = await this.resolve(specifier, parentURL);\n let job = this.moduleMap.get(url);\n if (job !== undefined)\n return job;\n\n let loaderInstance;\n if (format === 'dynamic') {\n if (typeof this._dynamicInstantiate !== 'function')\n throw new ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK();\n\n loaderInstance = async (url) => {\n debug(`Translating dynamic ${url}`);\n const { exports, execute } = await this._dynamicInstantiate(url);\n return createDynamicModule(exports, url, (reflect) => {\n debug(`Loading dynamic ${url}`);\n execute(reflect.exports);\n });\n };\n } else {\n if (!translators.has(format))\n throw new ERR_UNKNOWN_MODULE_FORMAT(format);\n\n loaderInstance = translators.get(format);\n }\n\n job = new ModuleJob(this, url, loaderInstance, parentURL === undefined);\n this.moduleMap.set(url, job);\n return job;\n }\n}\n\nObject.setPrototypeOf(Loader.prototype, null);\n\nmodule.exports = Loader;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4962,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4960,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "Loader",
"ranges": [
{
"startOffset": 1019,
"endOffset": 2163,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "resolve",
"ranges": [
{
"startOffset": 2167,
"endOffset": 3405,
"count": 4
},
{
"startOffset": 2265,
"endOffset": 2297,
"count": 1
},
{
"startOffset": 2305,
"endOffset": 2370,
"count": 0
},
{
"startOffset": 2370,
"endOffset": 2497,
"count": 2
},
{
"startOffset": 2497,
"endOffset": 2586,
"count": 0
},
{
"startOffset": 2586,
"endOffset": 2666,
"count": 2
},
{
"startOffset": 2666,
"endOffset": 2766,
"count": 0
},
{
"startOffset": 2766,
"endOffset": 2810,
"count": 2
},
{
"startOffset": 2810,
"endOffset": 2916,
"count": 0
},
{
"startOffset": 2916,
"endOffset": 2954,
"count": 2
},
{
"startOffset": 2954,
"endOffset": 2992,
"count": 0
},
{
"startOffset": 2992,
"endOffset": 3036,
"count": 2
},
{
"startOffset": 3036,
"endOffset": 3209,
"count": 0
},
{
"startOffset": 3209,
"endOffset": 3267,
"count": 2
},
{
"startOffset": 3275,
"endOffset": 3372,
"count": 0
},
{
"startOffset": 3372,
"endOffset": 3401,
"count": 2
},
{
"startOffset": 3401,
"endOffset": 3404,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "import",
"ranges": [
{
"startOffset": 3409,
"endOffset": 3573,
"count": 6
},
{
"startOffset": 3502,
"endOffset": 3569,
"count": 2
},
{
"startOffset": 3569,
"endOffset": 3572,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "hook",
"ranges": [
{
"startOffset": 3577,
"endOffset": 3895,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getModuleJob",
"ranges": [
{
"startOffset": 3899,
"endOffset": 4881,
"count": 4
},
{
"startOffset": 4011,
"endOffset": 4084,
"count": 2
},
{
"startOffset": 4084,
"endOffset": 4095,
"count": 0
},
{
"startOffset": 4095,
"endOffset": 4151,
"count": 2
},
{
"startOffset": 4151,
"endOffset": 4598,
"count": 0
},
{
"startOffset": 4598,
"endOffset": 4749,
"count": 2
},
{
"startOffset": 4650,
"endOffset": 4694,
"count": 0
},
{
"startOffset": 4749,
"endOffset": 4877,
"count": 2
},
{
"startOffset": 4877,
"endOffset": 4880,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "loaderInstance",
"ranges": [
{
"startOffset": 4293,
"endOffset": 4591,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/modules/esm/module_job.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { internalBinding } = require('internal/bootstrap/loaders');\nconst { ModuleWrap } = internalBinding('module_wrap');\nconst { SafeSet, SafePromise } = require('internal/safe_globals');\nconst { decorateErrorStack } = require('internal/util');\nconst assert = require('assert');\nconst resolvedPromise = SafePromise.resolve();\n\n/* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of\n * its dependencies, over time. */\nclass ModuleJob {\n // `loader` is the Loader instance used for loading dependencies.\n // `moduleProvider` is a function\n constructor(loader, url, moduleProvider, isMain) {\n this.loader = loader;\n this.isMain = isMain;\n\n // This is a Promise<{ module, reflect }>, whose fields will be copied\n // onto `this` by `link()` below once it has been resolved.\n this.modulePromise = moduleProvider(url, isMain);\n this.module = undefined;\n this.reflect = undefined;\n\n // Wait for the ModuleWrap instance being linked with all dependencies.\n const link = async () => {\n ({ module: this.module,\n reflect: this.reflect } = await this.modulePromise);\n assert(this.module instanceof ModuleWrap);\n\n const dependencyJobs = [];\n const promises = this.module.link(async (specifier) => {\n const jobPromise = this.loader.getModuleJob(specifier, url);\n dependencyJobs.push(jobPromise);\n return (await (await jobPromise).modulePromise).module;\n });\n\n if (promises !== undefined)\n await SafePromise.all(promises);\n\n return SafePromise.all(dependencyJobs);\n };\n // Promise for the list of all dependencyJobs.\n this.linked = link();\n\n // instantiated == deep dependency jobs wrappers instantiated,\n // module wrapper instantiated\n this.instantiated = undefined;\n }\n\n async instantiate() {\n if (!this.instantiated) {\n return this.instantiated = this._instantiate();\n }\n await this.instantiated;\n return this.module;\n }\n\n // This method instantiates the module associated with this job and its\n // entire dependency graph, i.e. creates all the module namespaces and the\n // exported/imported variables.\n async _instantiate() {\n const jobsInGraph = new SafeSet();\n\n const addJobsToDependencyGraph = async (moduleJob) => {\n if (jobsInGraph.has(moduleJob)) {\n return;\n }\n jobsInGraph.add(moduleJob);\n const dependencyJobs = await moduleJob.linked;\n return Promise.all(dependencyJobs.map(addJobsToDependencyGraph));\n };\n await addJobsToDependencyGraph(this);\n try {\n if (this.isMain && process._breakFirstLine) {\n delete process._breakFirstLine;\n const initWrapper = process.binding('inspector').callAndPauseOnStart;\n initWrapper(this.module.instantiate, this.module);\n } else {\n this.module.instantiate();\n }\n } catch (e) {\n decorateErrorStack(e);\n throw e;\n }\n for (const dependencyJob of jobsInGraph) {\n // Calling `this.module.instantiate()` instantiates not only the\n // ModuleWrap in this module, but all modules in the graph.\n dependencyJob.instantiated = resolvedPromise;\n }\n return this.module;\n }\n\n async run() {\n const module = await this.instantiate();\n module.evaluate(-1, false);\n return module;\n }\n}\nObject.setPrototypeOf(ModuleJob.prototype, null);\nmodule.exports = ModuleJob;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3451,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3449,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ModuleJob",
"ranges": [
{
"startOffset": 625,
"endOffset": 1859,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "link",
"ranges": [
{
"startOffset": 1075,
"endOffset": 1639,
"count": 5
},
{
"startOffset": 1178,
"endOffset": 1554,
"count": 2
},
{
"startOffset": 1554,
"endOffset": 1586,
"count": 1
},
{
"startOffset": 1586,
"endOffset": 1633,
"count": 2
},
{
"startOffset": 1633,
"endOffset": 1638,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "promises.module.link",
"ranges": [
{
"startOffset": 1304,
"endOffset": 1508,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "instantiate",
"ranges": [
{
"startOffset": 1863,
"endOffset": 2031,
"count": 2
},
{
"startOffset": 1968,
"endOffset": 2030,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "_instantiate",
"ranges": [
{
"startOffset": 2220,
"endOffset": 3249,
"count": 4
},
{
"startOffset": 2614,
"endOffset": 2647,
"count": 2
},
{
"startOffset": 2647,
"endOffset": 2673,
"count": 1
},
{
"startOffset": 2675,
"endOffset": 2861,
"count": 0
},
{
"startOffset": 2861,
"endOffset": 2918,
"count": 2
},
{
"startOffset": 2918,
"endOffset": 2979,
"count": 0
},
{
"startOffset": 2979,
"endOffset": 3245,
"count": 2
},
{
"startOffset": 3245,
"endOffset": 3248,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "addJobsToDependencyGraph",
"ranges": [
{
"startOffset": 2320,
"endOffset": 2571,
"count": 4
},
{
"startOffset": 2381,
"endOffset": 2406,
"count": 0
},
{
"startOffset": 2406,
"endOffset": 2565,
"count": 2
},
{
"startOffset": 2565,
"endOffset": 2570,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "run",
"ranges": [
{
"startOffset": 3253,
"endOffset": 3366,
"count": 4
},
{
"startOffset": 3311,
"endOffset": 3362,
"count": 2
},
{
"startOffset": 3362,
"endOffset": 3365,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/modules/esm/module_map.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst ModuleJob = require('internal/modules/esm/module_job');\nconst { SafeMap } = require('internal/safe_globals');\nconst debug = require('util').debuglog('esm');\nconst { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;\n\n// Tracks the state of the loader-level module cache\nclass ModuleMap extends SafeMap {\n get(url) {\n if (typeof url !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('url', 'string', url);\n }\n return super.get(url);\n }\n set(url, job) {\n if (typeof url !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('url', 'string', url);\n }\n if (job instanceof ModuleJob !== true) {\n throw new ERR_INVALID_ARG_TYPE('job', 'ModuleJob', job);\n }\n debug(`Storing ${url} in ModuleMap`);\n return super.set(url, job);\n }\n has(url) {\n if (typeof url !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('url', 'string', url);\n }\n return super.has(url);\n }\n}\nmodule.exports = ModuleMap;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1015,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1013,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "ModuleMap",
"ranges": [
{
"startOffset": 346,
"endOffset": 346,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 382,
"endOffset": 524,
"count": 3
},
{
"startOffset": 426,
"endOffset": 493,
"count": 0
},
{
"startOffset": 520,
"endOffset": 523,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 527,
"endOffset": 835,
"count": 2
},
{
"startOffset": 576,
"endOffset": 643,
"count": 0
},
{
"startOffset": 687,
"endOffset": 757,
"count": 0
},
{
"startOffset": 831,
"endOffset": 834,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "has",
"ranges": [
{
"startOffset": 838,
"endOffset": 980,
"count": 1
},
{
"startOffset": 882,
"endOffset": 949,
"count": 0
},
{
"startOffset": 976,
"endOffset": 979,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/modules/esm/translators.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { NativeModule, internalBinding } = require('internal/bootstrap/loaders');\nconst { ModuleWrap } = internalBinding('module_wrap');\nconst {\n stripShebang,\n stripBOM\n} = require('internal/modules/cjs/helpers');\nconst CJSModule = require('internal/modules/cjs/loader');\nconst internalURLModule = require('internal/url');\nconst createDynamicModule = require(\n 'internal/modules/esm/create_dynamic_module');\nconst fs = require('fs');\nconst { _makeLong } = require('path');\nconst { SafeMap } = require('internal/safe_globals');\nconst { URL } = require('url');\nconst { debuglog, promisify } = require('util');\nconst readFileAsync = promisify(fs.readFile);\nconst readFileSync = fs.readFileSync;\nconst StringReplace = Function.call.bind(String.prototype.replace);\nconst JsonParse = JSON.parse;\n\nconst debug = debuglog('esm');\n\nconst translators = new SafeMap();\nmodule.exports = translators;\n\n// Strategy for loading a standard JavaScript module\ntranslators.set('esm', async (url) => {\n const source = `${await readFileAsync(new URL(url))}`;\n debug(`Translating StandardModule ${url}`);\n return {\n module: new ModuleWrap(stripShebang(source), url),\n reflect: undefined\n };\n});\n\n// Strategy for loading a node-style CommonJS module\nconst isWindows = process.platform === 'win32';\nconst winSepRegEx = /\\//g;\ntranslators.set('cjs', async (url, isMain) => {\n debug(`Translating CJSModule ${url}`);\n const pathname = internalURLModule.getPathFromURL(new URL(url));\n const module = CJSModule._cache[\n isWindows ? StringReplace(pathname, winSepRegEx, '\\\\') : pathname];\n if (module && module.loaded) {\n const ctx = createDynamicModule(['default'], url);\n ctx.reflect.exports.default.set(module.exports);\n return ctx;\n }\n return createDynamicModule(['default'], url, () => {\n debug(`Loading CJSModule ${url}`);\n // we don't care about the return val of _load here because Module#load\n // will handle it for us by checking the loader registry and filling the\n // exports like above\n CJSModule._load(pathname, undefined, isMain);\n });\n});\n\n// Strategy for loading a node builtin CommonJS module that isn't\n// through normal resolution\ntranslators.set('builtin', async (url) => {\n debug(`Translating BuiltinModule ${url}`);\n // slice 'node:' scheme\n const id = url.slice(5);\n NativeModule.require(id);\n const module = NativeModule.getCached(id);\n return createDynamicModule(\n [...module.exportKeys, 'default'], url, (reflect) => {\n debug(`Loading BuiltinModule ${url}`);\n module.reflect = reflect;\n for (const key of module.exportKeys)\n reflect.exports[key].set(module.exports[key]);\n reflect.exports.default.set(module.exports);\n });\n});\n\n// Strategy for loading a node native module\ntranslators.set('addon', async (url) => {\n debug(`Translating NativeModule ${url}`);\n return createDynamicModule(['default'], url, (reflect) => {\n debug(`Loading NativeModule ${url}`);\n const module = { exports: {} };\n const pathname = internalURLModule.getPathFromURL(new URL(url));\n process.dlopen(module, _makeLong(pathname));\n reflect.exports.default.set(module.exports);\n });\n});\n\n// Strategy for loading a JSON file\ntranslators.set('json', async (url) => {\n debug(`Translating JSONModule ${url}`);\n return createDynamicModule(['default'], url, (reflect) => {\n debug(`Loading JSONModule ${url}`);\n const pathname = internalURLModule.getPathFromURL(new URL(url));\n const content = readFileSync(pathname, 'utf8');\n try {\n const exports = JsonParse(stripBOM(content));\n reflect.exports.default.set(exports);\n } catch (err) {\n err.message = pathname + ': ' + err.message;\n throw err;\n }\n });\n});\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3778,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3776,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "translators.set",
"ranges": [
{
"startOffset": 1030,
"endOffset": 1245,
"count": 2
},
{
"startOffset": 1100,
"endOffset": 1243,
"count": 1
},
{
"startOffset": 1243,
"endOffset": 1244,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "translators.set",
"ranges": [
{
"startOffset": 1400,
"endOffset": 2131,
"count": 1
},
{
"startOffset": 1582,
"endOffset": 1626,
"count": 0
},
{
"startOffset": 1653,
"endOffset": 1669,
"count": 0
},
{
"startOffset": 1671,
"endOffset": 1800,
"count": 0
},
{
"startOffset": 2129,
"endOffset": 2130,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "createDynamicModule",
"ranges": [
{
"startOffset": 1848,
"endOffset": 2127,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "translators.set",
"ranges": [
{
"startOffset": 2257,
"endOffset": 2769,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "translators.set",
"ranges": [
{
"startOffset": 2843,
"endOffset": 3218,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "translators.set",
"ranges": [
{
"startOffset": 3282,
"endOffset": 3771,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/net.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst Buffer = require('buffer').Buffer;\nconst { isIPv6 } = process.binding('cares_wrap');\nconst { writeBuffer } = process.binding('fs');\nconst errors = require('internal/errors');\n\nconst octet = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';\nconst re = new RegExp(`^${octet}[.]${octet}[.]${octet}[.]${octet}$`);\n\nfunction isIPv4(s) {\n return re.test(s);\n}\n\nfunction isIP(s) {\n if (isIPv4(s)) return 4;\n if (isIPv6(s)) return 6;\n return 0;\n}\n\n// Check that the port number is not NaN when coerced to a number,\n// is an integer and that it falls within the legal range of port numbers.\nfunction isLegalPort(port) {\n if ((typeof port !== 'number' && typeof port !== 'string') ||\n (typeof port === 'string' && port.trim().length === 0))\n return false;\n return +port === (+port >>> 0) && port <= 0xFFFF;\n}\n\nfunction makeSyncWrite(fd) {\n return function(chunk, enc, cb) {\n if (enc !== 'buffer')\n chunk = Buffer.from(chunk, enc);\n\n this._handle.bytesWritten += chunk.length;\n\n const ctx = {};\n writeBuffer(fd, chunk, 0, chunk.length, null, undefined, ctx);\n if (ctx.errno !== undefined) {\n const ex = errors.uvException(ctx);\n // Legacy: net writes have .code === .errno, whereas writeBuffer gives the\n // raw errno number in .errno.\n ex.errno = ex.code;\n return cb(ex);\n }\n cb();\n };\n}\n\nmodule.exports = {\n isIP,\n isIPv4,\n isIPv6,\n isLegalPort,\n makeSyncWrite,\n normalizedArgsSymbol: Symbol('normalizedArgs')\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1555,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1553,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "isIPv4",
"ranges": [
{
"startOffset": 385,
"endOffset": 428,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isIP",
"ranges": [
{
"startOffset": 430,
"endOffset": 516,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isLegalPort",
"ranges": [
{
"startOffset": 660,
"endOffset": 886,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "makeSyncWrite",
"ranges": [
{
"startOffset": 888,
"endOffset": 1418,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/process/esm_loader.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { internalBinding } = require('internal/bootstrap/loaders');\nconst {\n setImportModuleDynamicallyCallback,\n setInitializeImportMetaObjectCallback\n} = internalBinding('module_wrap');\n\nconst { getURLFromFilePath } = require('internal/url');\nconst Loader = require('internal/modules/esm/loader');\nconst path = require('path');\nconst { URL } = require('url');\nconst {\n initImportMetaMap,\n wrapToModuleMap\n} = require('internal/vm/source_text_module');\n\nfunction normalizeReferrerURL(referrer) {\n if (typeof referrer === 'string' && path.isAbsolute(referrer)) {\n return getURLFromFilePath(referrer).href;\n }\n return new URL(referrer).href;\n}\n\nfunction initializeImportMetaObject(wrap, meta) {\n const vmModule = wrapToModuleMap.get(wrap);\n if (vmModule === undefined) {\n // This ModuleWrap belongs to the Loader.\n meta.url = wrap.url;\n } else {\n const initializeImportMeta = initImportMetaMap.get(vmModule);\n if (initializeImportMeta !== undefined) {\n // This ModuleWrap belongs to vm.SourceTextModule,\n // initializer callback was provided.\n initializeImportMeta(meta, vmModule);\n }\n }\n}\n\nlet loaderResolve;\nexports.loaderPromise = new Promise((resolve, reject) => {\n loaderResolve = resolve;\n});\n\nexports.ESMLoader = undefined;\n\nexports.setup = function() {\n setInitializeImportMetaObjectCallback(initializeImportMetaObject);\n\n let ESMLoader = new Loader();\n const loaderPromise = (async () => {\n const userLoader = process.binding('config').userLoader;\n if (userLoader) {\n const hooks = await ESMLoader.import(\n userLoader, getURLFromFilePath(`${process.cwd()}/`).href);\n ESMLoader = new Loader();\n ESMLoader.hook(hooks);\n exports.ESMLoader = ESMLoader;\n }\n return ESMLoader;\n })();\n loaderResolve(loaderPromise);\n\n setImportModuleDynamicallyCallback(async (referrer, specifier) => {\n const loader = await loaderPromise;\n return loader.import(specifier, normalizeReferrerURL(referrer));\n });\n\n exports.ESMLoader = ESMLoader;\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2094,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2092,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "normalizeReferrerURL",
"ranges": [
{
"startOffset": 520,
"endOffset": 713,
"count": 1
},
{
"startOffset": 674,
"endOffset": 712,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "initializeImportMetaObject",
"ranges": [
{
"startOffset": 715,
"endOffset": 1193,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "exports.loaderPromise.Promise",
"ranges": [
{
"startOffset": 1250,
"endOffset": 1301,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "exports.setup",
"ranges": [
{
"startOffset": 1353,
"endOffset": 2088,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "loaderPromise",
"ranges": [
{
"startOffset": 1493,
"endOffset": 1830,
"count": 1
},
{
"startOffset": 1588,
"endOffset": 1804,
"count": 0
},
{
"startOffset": 1826,
"endOffset": 1829,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "setImportModuleDynamicallyCallback",
"ranges": [
{
"startOffset": 1905,
"endOffset": 2050,
"count": 2
},
{
"startOffset": 1977,
"endOffset": 2046,
"count": 1
},
{
"startOffset": 2046,
"endOffset": 2049,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/process/main_thread_only.js",
"source": "(function (exports, require, module, process) {'use strict';\n\n// This file contains process bootstrappers that can only be\n// run in the main thread\n\nconst {\n errnoException\n} = require('internal/errors');\n\nconst {\n setupProcessStdio,\n getMainThreadStdio\n} = require('internal/process/stdio');\n\nconst assert = require('assert').strict;\n\nfunction setupStdio() {\n setupProcessStdio(getMainThreadStdio());\n}\n\n// Non-POSIX platforms like Windows don't have certain methods.\n// Workers also lack these methods since they change process-global state.\nfunction setupProcessMethods(_chdir, _umask, _initgroups, _setegid,\n _seteuid, _setgid, _setuid, _setgroups) {\n if (_setgid !== undefined) {\n setupPosixMethods(_initgroups, _setegid, _seteuid,\n _setgid, _setuid, _setgroups);\n }\n\n process.chdir = function chdir(...args) {\n return _chdir(...args);\n };\n\n process.umask = function umask(...args) {\n return _umask(...args);\n };\n}\n\nfunction setupPosixMethods(_initgroups, _setegid, _seteuid,\n _setgid, _setuid, _setgroups) {\n\n process.initgroups = function initgroups(...args) {\n return _initgroups(...args);\n };\n\n process.setegid = function setegid(...args) {\n return _setegid(...args);\n };\n\n process.seteuid = function seteuid(...args) {\n return _seteuid(...args);\n };\n\n process.setgid = function setgid(...args) {\n return _setgid(...args);\n };\n\n process.setuid = function setuid(...args) {\n return _setuid(...args);\n };\n\n process.setgroups = function setgroups(...args) {\n return _setgroups(...args);\n };\n}\n\n// Worker threads don't receive signals.\nfunction setupSignalHandlers() {\n const constants = process.binding('constants').os.signals;\n const signalWraps = Object.create(null);\n let Signal;\n\n function isSignal(event) {\n return typeof event === 'string' && constants[event] !== undefined;\n }\n\n // Detect presence of a listener for the special signal types\n process.on('newListener', function(type) {\n if (isSignal(type) && signalWraps[type] === undefined) {\n if (Signal === undefined)\n Signal = process.binding('signal_wrap').Signal;\n const wrap = new Signal();\n\n wrap.unref();\n\n wrap.onsignal = process.emit.bind(process, type, type);\n\n const signum = constants[type];\n const err = wrap.start(signum);\n if (err) {\n wrap.close();\n throw errnoException(err, 'uv_signal_start');\n }\n\n signalWraps[type] = wrap;\n }\n });\n\n process.on('removeListener', function(type) {\n if (signalWraps[type] !== undefined && this.listenerCount(type) === 0) {\n signalWraps[type].close();\n delete signalWraps[type];\n }\n });\n}\n\nfunction setupChildProcessIpcChannel() {\n // If we were spawned with env NODE_CHANNEL_FD then load that up and\n // start parsing data from that stream.\n if (process.env.NODE_CHANNEL_FD) {\n const fd = parseInt(process.env.NODE_CHANNEL_FD, 10);\n assert(fd >= 0);\n\n // Make sure it's not accidentally inherited by child processes.\n delete process.env.NODE_CHANNEL_FD;\n\n require('child_process')._forkChild(fd);\n assert(process.send);\n }\n}\n\nmodule.exports = {\n setupStdio,\n setupProcessMethods,\n setupSignalHandlers,\n setupChildProcessIpcChannel\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3303,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3301,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupStdio",
"ranges": [
{
"startOffset": 340,
"endOffset": 408,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupProcessMethods",
"ranges": [
{
"startOffset": 549,
"endOffset": 988,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "chdir",
"ranges": [
{
"startOffset": 850,
"endOffset": 907,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "umask",
"ranges": [
{
"startOffset": 928,
"endOffset": 985,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupPosixMethods",
"ranges": [
{
"startOffset": 990,
"endOffset": 1623,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "initgroups",
"ranges": [
{
"startOffset": 1133,
"endOffset": 1200,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setegid",
"ranges": [
{
"startOffset": 1223,
"endOffset": 1284,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "seteuid",
"ranges": [
{
"startOffset": 1307,
"endOffset": 1368,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setgid",
"ranges": [
{
"startOffset": 1390,
"endOffset": 1449,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setuid",
"ranges": [
{
"startOffset": 1471,
"endOffset": 1530,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setgroups",
"ranges": [
{
"startOffset": 1555,
"endOffset": 1620,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupSignalHandlers",
"ranges": [
{
"startOffset": 1666,
"endOffset": 2726,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "isSignal",
"ranges": [
{
"startOffset": 1820,
"endOffset": 1922,
"count": 2
},
{
"startOffset": 1918,
"endOffset": 1921,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 2016,
"endOffset": 2519,
"count": 2
},
{
"startOffset": 2056,
"endOffset": 2090,
"count": 0
},
{
"startOffset": 2092,
"endOffset": 2515,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 2554,
"endOffset": 2722,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupChildProcessIpcChannel",
"ranges": [
{
"startOffset": 2728,
"endOffset": 3185,
"count": 1
},
{
"startOffset": 2917,
"endOffset": 3183,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/process/next_tick.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nexports.setup = setupNextTick;\n\nfunction setupNextTick(_setupNextTick, _setupPromises) {\n const {\n getDefaultTriggerAsyncId,\n newAsyncId,\n initHooksExist,\n destroyHooksExist,\n emitInit,\n emitBefore,\n emitAfter,\n emitDestroy,\n symbols: { async_id_symbol, trigger_async_id_symbol }\n } = require('internal/async_hooks');\n const emitPromiseRejectionWarnings =\n require('internal/process/promises').setup(_setupPromises);\n const { ERR_INVALID_CALLBACK } = require('internal/errors').codes;\n const FixedQueue = require('internal/fixed_queue');\n\n // tickInfo is used so that the C++ code in src/node.cc can\n // have easy access to our nextTick state, and avoid unnecessary\n // calls into JS land.\n // runMicrotasks is used to run V8's micro task queue.\n const [\n tickInfo,\n runMicrotasks\n ] = _setupNextTick(_tickCallback);\n\n // *Must* match Environment::TickInfo::Fields in src/env.h.\n const kHasScheduled = 0;\n const kHasPromiseRejections = 1;\n\n const queue = new FixedQueue();\n\n process.nextTick = nextTick;\n // Needs to be accessible from beyond this scope.\n process._tickCallback = _tickCallback;\n\n function _tickCallback() {\n let tock;\n do {\n while (tock = queue.shift()) {\n const asyncId = tock[async_id_symbol];\n emitBefore(asyncId, tock[trigger_async_id_symbol]);\n // emitDestroy() places the async_id_symbol into an asynchronous queue\n // that calls the destroy callback in the future. It's called before\n // calling tock.callback so destroy will be called even if the callback\n // throws an exception that is handled by 'uncaughtException' or a\n // domain.\n // TODO(trevnorris): This is a bit of a hack. It relies on the fact\n // that nextTick() doesn't allow the event loop to proceed, but if\n // any async hooks are enabled during the callback's execution then\n // this tock's after hook will be called, but not its destroy hook.\n if (destroyHooksExist())\n emitDestroy(asyncId);\n\n const callback = tock.callback;\n if (tock.args === undefined)\n callback();\n else\n Reflect.apply(callback, undefined, tock.args);\n\n emitAfter(asyncId);\n }\n tickInfo[kHasScheduled] = 0;\n runMicrotasks();\n } while (!queue.isEmpty() || emitPromiseRejectionWarnings());\n tickInfo[kHasPromiseRejections] = 0;\n }\n\n class TickObject {\n constructor(callback, args, triggerAsyncId) {\n // this must be set to null first to avoid function tracking\n // on the hidden class, revisit in V8 versions after 6.2\n this.callback = null;\n this.callback = callback;\n this.args = args;\n\n const asyncId = newAsyncId();\n this[async_id_symbol] = asyncId;\n this[trigger_async_id_symbol] = triggerAsyncId;\n\n if (initHooksExist()) {\n emitInit(asyncId,\n 'TickObject',\n triggerAsyncId,\n this);\n }\n }\n }\n\n // `nextTick()` will not enqueue any callback when the process is about to\n // exit since the callback would not have a chance to be executed.\n function nextTick(callback) {\n if (typeof callback !== 'function')\n throw new ERR_INVALID_CALLBACK();\n\n if (process._exiting)\n return;\n\n var args;\n switch (arguments.length) {\n case 1: break;\n case 2: args = [arguments[1]]; break;\n case 3: args = [arguments[1], arguments[2]]; break;\n case 4: args = [arguments[1], arguments[2], arguments[3]]; break;\n default:\n args = new Array(arguments.length - 1);\n for (var i = 1; i < arguments.length; i++)\n args[i - 1] = arguments[i];\n }\n\n if (queue.isEmpty())\n tickInfo[kHasScheduled] = 1;\n queue.push(new TickObject(callback, args, getDefaultTriggerAsyncId()));\n }\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3908,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3906,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupNextTick",
"ranges": [
{
"startOffset": 94,
"endOffset": 3903,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "_tickCallback",
"ranges": [
{
"startOffset": 1214,
"endOffset": 2481,
"count": 2
},
{
"startOffset": 1299,
"endOffset": 2312,
"count": 3
},
{
"startOffset": 2084,
"endOffset": 2105,
"count": 0
},
{
"startOffset": 2194,
"endOffset": 2205,
"count": 1
},
{
"startOffset": 2205,
"endOffset": 2275,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "TickObject",
"ranges": [
{
"startOffset": 2508,
"endOffset": 3056,
"count": 3
},
{
"startOffset": 2927,
"endOffset": 3050,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "nextTick",
"ranges": [
{
"startOffset": 3210,
"endOffset": 3901,
"count": 3
},
{
"startOffset": 3286,
"endOffset": 3319,
"count": 0
},
{
"startOffset": 3353,
"endOffset": 3360,
"count": 0
},
{
"startOffset": 3414,
"endOffset": 3428,
"count": 1
},
{
"startOffset": 3428,
"endOffset": 3609,
"count": 0
},
{
"startOffset": 3609,
"endOffset": 3754,
"count": 2
},
{
"startOffset": 3727,
"endOffset": 3754,
"count": 8
},
{
"startOffset": 3754,
"endOffset": 3760,
"count": 2
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/process/per_thread.js",
"source": "(function (exports, require, module, process) {'use strict';\n\n// This files contains process bootstrappers that can be\n// run when setting up each thread, including the main\n// thread and the worker threads.\n\nconst {\n errnoException,\n codes: {\n ERR_ASSERTION,\n ERR_CPU_USAGE,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARRAY_LENGTH,\n ERR_INVALID_OPT_VALUE,\n ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET,\n ERR_UNKNOWN_SIGNAL\n }\n} = require('internal/errors');\nconst util = require('util');\nconst constants = process.binding('constants').os.signals;\nconst { deprecate } = require('internal/util');\n\nfunction setupAssert() {\n process.assert = deprecate(\n function(x, msg) {\n if (!x) throw new ERR_ASSERTION(msg || 'assertion error');\n },\n 'process.assert() is deprecated. Please use the `assert` module instead.',\n 'DEP0100');\n}\n\n// Set up the process.cpuUsage() function.\nfunction setupCpuUsage(_cpuUsage) {\n // Create the argument array that will be passed to the native function.\n const cpuValues = new Float64Array(2);\n\n // Replace the native function with the JS version that calls the native\n // function.\n process.cpuUsage = function cpuUsage(prevValue) {\n // If a previous value was passed in, ensure it has the correct shape.\n if (prevValue) {\n if (!previousValueIsValid(prevValue.user)) {\n if (typeof prevValue !== 'object')\n throw new ERR_INVALID_ARG_TYPE('prevValue', 'object', prevValue);\n\n if (typeof prevValue.user !== 'number') {\n throw new ERR_INVALID_ARG_TYPE('prevValue.user',\n 'number', prevValue.user);\n }\n throw new ERR_INVALID_OPT_VALUE.RangeError('prevValue.user',\n prevValue.user);\n }\n\n if (!previousValueIsValid(prevValue.system)) {\n if (typeof prevValue.system !== 'number') {\n throw new ERR_INVALID_ARG_TYPE('prevValue.system',\n 'number', prevValue.system);\n }\n throw new ERR_INVALID_OPT_VALUE.RangeError('prevValue.system',\n prevValue.system);\n }\n }\n\n // Call the native function to get the current values.\n const errmsg = _cpuUsage(cpuValues);\n if (errmsg) {\n throw new ERR_CPU_USAGE(errmsg);\n }\n\n // If a previous value was passed in, return diff of current from previous.\n if (prevValue) {\n return {\n user: cpuValues[0] - prevValue.user,\n system: cpuValues[1] - prevValue.system\n };\n }\n\n // If no previous value passed in, return current value.\n return {\n user: cpuValues[0],\n system: cpuValues[1]\n };\n };\n\n // Ensure that a previously passed in value is valid. Currently, the native\n // implementation always returns numbers <= Number.MAX_SAFE_INTEGER.\n function previousValueIsValid(num) {\n return Number.isFinite(num) &&\n num <= Number.MAX_SAFE_INTEGER &&\n num >= 0;\n }\n}\n\n// The 3 entries filled in by the original process.hrtime contains\n// the upper/lower 32 bits of the second part of the value,\n// and the remaining nanoseconds of the value.\nfunction setupHrtime(_hrtime, _hrtimeBigInt) {\n const hrValues = new Uint32Array(3);\n\n process.hrtime = function hrtime(time) {\n _hrtime(hrValues);\n\n if (time !== undefined) {\n if (!Array.isArray(time)) {\n throw new ERR_INVALID_ARG_TYPE('time', 'Array', time);\n }\n if (time.length !== 2) {\n throw new ERR_INVALID_ARRAY_LENGTH('time', 2, time.length);\n }\n\n const sec = (hrValues[0] * 0x100000000 + hrValues[1]) - time[0];\n const nsec = hrValues[2] - time[1];\n const needsBorrow = nsec < 0;\n return [needsBorrow ? sec - 1 : sec, needsBorrow ? nsec + 1e9 : nsec];\n }\n\n return [\n hrValues[0] * 0x100000000 + hrValues[1],\n hrValues[2]\n ];\n };\n\n // Use a BigUint64Array in the closure because V8 does not have an API for\n // creating a BigInt out of a uint64_t yet.\n const hrBigintValues = new BigUint64Array(1);\n process.hrtime.bigint = function() {\n _hrtimeBigInt(hrBigintValues);\n return hrBigintValues[0];\n };\n}\n\nfunction setupMemoryUsage(_memoryUsage) {\n const memValues = new Float64Array(4);\n\n process.memoryUsage = function memoryUsage() {\n _memoryUsage(memValues);\n return {\n rss: memValues[0],\n heapTotal: memValues[1],\n heapUsed: memValues[2],\n external: memValues[3]\n };\n };\n}\n\nfunction setupConfig(_source) {\n // NativeModule._source\n // used for `process.config`, but not a real module\n const config = _source.config;\n delete _source.config;\n\n process.config = JSON.parse(config, function(key, value) {\n if (value === 'true') return true;\n if (value === 'false') return false;\n return value;\n });\n}\n\n\nfunction setupKillAndExit() {\n\n process.exit = function(code) {\n if (code || code === 0)\n process.exitCode = code;\n\n if (!process._exiting) {\n process._exiting = true;\n process.emit('exit', process.exitCode || 0);\n }\n process.reallyExit(process.exitCode || 0);\n };\n\n process.kill = function(pid, sig) {\n var err;\n\n // eslint-disable-next-line eqeqeq\n if (pid != (pid | 0)) {\n throw new ERR_INVALID_ARG_TYPE('pid', 'number', pid);\n }\n\n // preserve null signal\n if (sig === (sig | 0)) {\n err = process._kill(pid, sig);\n } else {\n sig = sig || 'SIGTERM';\n if (constants[sig]) {\n err = process._kill(pid, constants[sig]);\n } else {\n throw new ERR_UNKNOWN_SIGNAL(sig);\n }\n }\n\n if (err)\n throw errnoException(err, 'kill');\n\n return true;\n };\n}\n\nfunction setupRawDebug(_rawDebug) {\n process._rawDebug = function() {\n _rawDebug(util.format.apply(null, arguments));\n };\n}\n\n\nfunction setupUncaughtExceptionCapture(exceptionHandlerState,\n shouldAbortOnUncaughtToggle) {\n // shouldAbortOnUncaughtToggle is a typed array for faster\n // communication with JS.\n\n process.setUncaughtExceptionCaptureCallback = function(fn) {\n if (fn === null) {\n exceptionHandlerState.captureFn = fn;\n shouldAbortOnUncaughtToggle[0] = 1;\n return;\n }\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'null'], fn);\n }\n if (exceptionHandlerState.captureFn !== null) {\n throw new ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET();\n }\n exceptionHandlerState.captureFn = fn;\n shouldAbortOnUncaughtToggle[0] = 0;\n };\n\n process.hasUncaughtExceptionCaptureCallback = function() {\n return exceptionHandlerState.captureFn !== null;\n };\n}\n\nmodule.exports = {\n setupAssert,\n setupCpuUsage,\n setupHrtime,\n setupMemoryUsage,\n setupConfig,\n setupKillAndExit,\n setupRawDebug,\n setupUncaughtExceptionCapture\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 6855,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 6853,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupAssert",
"ranges": [
{
"startOffset": 612,
"endOffset": 858,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 671,
"endOffset": 760,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupCpuUsage",
"ranges": [
{
"startOffset": 903,
"endOffset": 3017,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "cpuUsage",
"ranges": [
{
"startOffset": 1167,
"endOffset": 2726,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "previousValueIsValid",
"ranges": [
{
"startOffset": 2880,
"endOffset": 3015,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupHrtime",
"ranges": [
{
"startOffset": 3193,
"endOffset": 4195,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "hrtime",
"ranges": [
{
"startOffset": 3299,
"endOffset": 3911,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "process.hrtime.bigint",
"ranges": [
{
"startOffset": 4111,
"endOffset": 4192,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupMemoryUsage",
"ranges": [
{
"startOffset": 4197,
"endOffset": 4500,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "memoryUsage",
"ranges": [
{
"startOffset": 4305,
"endOffset": 4497,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupConfig",
"ranges": [
{
"startOffset": 4502,
"endOffset": 4839,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 4711,
"endOffset": 4835,
"count": 70
},
{
"startOffset": 4760,
"endOffset": 4772,
"count": 10
},
{
"startOffset": 4772,
"endOffset": 4800,
"count": 60
},
{
"startOffset": 4800,
"endOffset": 4813,
"count": 17
},
{
"startOffset": 4813,
"endOffset": 4831,
"count": 43
},
{
"startOffset": 4831,
"endOffset": 4834,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "setupKillAndExit",
"ranges": [
{
"startOffset": 4842,
"endOffset": 5689,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "process.exit",
"ranges": [
{
"startOffset": 4890,
"endOffset": 5134,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "process.kill",
"ranges": [
{
"startOffset": 5154,
"endOffset": 5686,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupRawDebug",
"ranges": [
{
"startOffset": 5691,
"endOffset": 5819,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "process._rawDebug",
"ranges": [
{
"startOffset": 5749,
"endOffset": 5816,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupUncaughtExceptionCapture",
"ranges": [
{
"startOffset": 5822,
"endOffset": 6676,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "process.setUncaughtExceptionCaptureCallback",
"ranges": [
{
"startOffset": 6092,
"endOffset": 6553,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "process.hasUncaughtExceptionCaptureCallback",
"ranges": [
{
"startOffset": 6604,
"endOffset": 6673,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/process/promises.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { safeToString } = process.binding('util');\n\nconst maybeUnhandledPromises = new WeakMap();\nconst pendingUnhandledRejections = [];\nconst asyncHandledRejections = [];\nlet lastPromiseId = 0;\n\nexports.setup = setupPromises;\n\nfunction setupPromises(_setupPromises) {\n _setupPromises(unhandledRejection, handledRejection);\n return emitPromiseRejectionWarnings;\n}\n\nfunction unhandledRejection(promise, reason) {\n maybeUnhandledPromises.set(promise, {\n reason,\n uid: ++lastPromiseId,\n warned: false\n });\n pendingUnhandledRejections.push(promise);\n return true;\n}\n\nfunction handledRejection(promise) {\n const promiseInfo = maybeUnhandledPromises.get(promise);\n if (promiseInfo !== undefined) {\n maybeUnhandledPromises.delete(promise);\n if (promiseInfo.warned) {\n const { uid } = promiseInfo;\n // Generate the warning object early to get a good stack trace.\n // eslint-disable-next-line no-restricted-syntax\n const warning = new Error('Promise rejection was handled ' +\n `asynchronously (rejection id: ${uid})`);\n warning.name = 'PromiseRejectionHandledWarning';\n warning.id = uid;\n asyncHandledRejections.push({ promise, warning });\n return true;\n }\n }\n return false;\n}\n\nconst unhandledRejectionErrName = 'UnhandledPromiseRejectionWarning';\nfunction emitWarning(uid, reason) {\n try {\n if (reason instanceof Error) {\n process.emitWarning(reason.stack, unhandledRejectionErrName);\n } else {\n process.emitWarning(safeToString(reason), unhandledRejectionErrName);\n }\n } catch (e) {\n // ignored\n }\n\n // eslint-disable-next-line no-restricted-syntax\n const warning = new Error(\n 'Unhandled promise rejection. This error originated either by ' +\n 'throwing inside of an async function without a catch block, ' +\n 'or by rejecting a promise which was not handled with .catch(). ' +\n `(rejection id: ${uid})`\n );\n warning.name = unhandledRejectionErrName;\n try {\n if (reason instanceof Error) {\n warning.stack = reason.stack;\n }\n } catch (err) {\n // ignored\n }\n process.emitWarning(warning);\n emitDeprecationWarning();\n}\n\nlet deprecationWarned = false;\nfunction emitDeprecationWarning() {\n if (!deprecationWarned) {\n deprecationWarned = true;\n process.emitWarning(\n 'Unhandled promise rejections are deprecated. In the future, ' +\n 'promise rejections that are not handled will terminate the ' +\n 'Node.js process with a non-zero exit code.',\n 'DeprecationWarning', 'DEP0018');\n }\n}\n\nfunction emitPromiseRejectionWarnings() {\n while (asyncHandledRejections.length > 0) {\n const { promise, warning } = asyncHandledRejections.shift();\n if (!process.emit('rejectionHandled', promise)) {\n process.emitWarning(warning);\n }\n }\n\n let hadListeners = false;\n let len = pendingUnhandledRejections.length;\n while (len--) {\n const promise = pendingUnhandledRejections.shift();\n const promiseInfo = maybeUnhandledPromises.get(promise);\n if (promiseInfo !== undefined) {\n promiseInfo.warned = true;\n const { reason, uid } = promiseInfo;\n if (!process.emit('unhandledRejection', reason, promise)) {\n emitWarning(uid, reason);\n } else {\n hadListeners = true;\n }\n }\n }\n return hadListeners || pendingUnhandledRejections.length !== 0;\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3432,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3430,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupPromises",
"ranges": [
{
"startOffset": 289,
"endOffset": 426,
"count": 1
},
{
"startOffset": 424,
"endOffset": 425,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "unhandledRejection",
"ranges": [
{
"startOffset": 428,
"endOffset": 637,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "handledRejection",
"ranges": [
{
"startOffset": 639,
"endOffset": 1327,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitWarning",
"ranges": [
{
"startOffset": 1399,
"endOffset": 2229,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitDeprecationWarning",
"ranges": [
{
"startOffset": 2262,
"endOffset": 2619,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitPromiseRejectionWarnings",
"ranges": [
{
"startOffset": 2621,
"endOffset": 3427,
"count": 2
},
{
"startOffset": 2707,
"endOffset": 2873,
"count": 0
},
{
"startOffset": 2966,
"endOffset": 3359,
"count": 0
},
{
"startOffset": 3425,
"endOffset": 3426,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/process/stdio.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n ERR_STDERR_CLOSE,\n ERR_STDOUT_CLOSE,\n ERR_UNKNOWN_STDIN_TYPE,\n ERR_UNKNOWN_STREAM_TYPE\n} = require('internal/errors').codes;\n\nexports.setupProcessStdio = setupProcessStdio;\nexports.getMainThreadStdio = getMainThreadStdio;\n\nfunction getMainThreadStdio() {\n var stdin;\n var stdout;\n var stderr;\n\n function getStdout() {\n if (stdout) return stdout;\n stdout = createWritableStdioStream(1);\n stdout.destroySoon = stdout.destroy;\n stdout._destroy = function(er, cb) {\n // Avoid errors if we already emitted\n er = er || new ERR_STDOUT_CLOSE();\n cb(er);\n };\n if (stdout.isTTY) {\n process.on('SIGWINCH', () => stdout._refreshSize());\n }\n return stdout;\n }\n\n function getStderr() {\n if (stderr) return stderr;\n stderr = createWritableStdioStream(2);\n stderr.destroySoon = stderr.destroy;\n stderr._destroy = function(er, cb) {\n // Avoid errors if we already emitted\n er = er || new ERR_STDERR_CLOSE();\n cb(er);\n };\n if (stderr.isTTY) {\n process.on('SIGWINCH', () => stderr._refreshSize());\n }\n return stderr;\n }\n\n function getStdin() {\n if (stdin) return stdin;\n const tty_wrap = process.binding('tty_wrap');\n const fd = 0;\n\n switch (tty_wrap.guessHandleType(fd)) {\n case 'TTY':\n var tty = require('tty');\n stdin = new tty.ReadStream(fd, {\n highWaterMark: 0,\n readable: true,\n writable: false\n });\n break;\n\n case 'FILE':\n var fs = require('fs');\n stdin = new fs.ReadStream(null, { fd: fd, autoClose: false });\n break;\n\n case 'PIPE':\n case 'TCP':\n var net = require('net');\n\n // It could be that process has been started with an IPC channel\n // sitting on fd=0, in such case the pipe for this fd is already\n // present and creating a new one will lead to the assertion failure\n // in libuv.\n if (process.channel && process.channel.fd === fd) {\n stdin = new net.Socket({\n handle: process.channel,\n readable: true,\n writable: false,\n manualStart: true\n });\n } else {\n stdin = new net.Socket({\n fd: fd,\n readable: true,\n writable: false,\n manualStart: true\n });\n }\n // Make sure the stdin can't be `.end()`-ed\n stdin._writableState.ended = true;\n break;\n\n default:\n // Probably an error on in uv_guess_handle()\n throw new ERR_UNKNOWN_STDIN_TYPE();\n }\n\n // For supporting legacy API we put the FD here.\n stdin.fd = fd;\n\n // stdin starts out life in a paused state, but node doesn't\n // know yet. Explicitly to readStop() it to put it in the\n // not-reading state.\n if (stdin._handle && stdin._handle.readStop) {\n stdin._handle.reading = false;\n stdin._readableState.reading = false;\n stdin._handle.readStop();\n }\n\n // If the user calls stdin.pause(), then we need to stop reading\n // once the stream implementation does so (one nextTick later),\n // so that the process can close down.\n stdin.on('pause', () => {\n process.nextTick(onpause);\n });\n\n function onpause() {\n if (!stdin._handle)\n return;\n if (stdin._handle.reading && !stdin._readableState.flowing) {\n stdin._readableState.reading = false;\n stdin._handle.reading = false;\n stdin._handle.readStop();\n }\n }\n\n return stdin;\n }\n\n return {\n getStdout,\n getStderr,\n getStdin\n };\n}\n\nfunction setupProcessStdio({ getStdout, getStdin, getStderr }) {\n Object.defineProperty(process, 'stdout', {\n configurable: true,\n enumerable: true,\n get: getStdout\n });\n\n Object.defineProperty(process, 'stderr', {\n configurable: true,\n enumerable: true,\n get: getStderr\n });\n\n Object.defineProperty(process, 'stdin', {\n configurable: true,\n enumerable: true,\n get: getStdin\n });\n\n process.openStdin = function() {\n process.stdin.resume();\n return process.stdin;\n };\n}\n\nfunction createWritableStdioStream(fd) {\n var stream;\n const tty_wrap = process.binding('tty_wrap');\n\n // Note stream._type is used for test-module-load-list.js\n\n switch (tty_wrap.guessHandleType(fd)) {\n case 'TTY':\n var tty = require('tty');\n stream = new tty.WriteStream(fd);\n stream._type = 'tty';\n break;\n\n case 'FILE':\n const SyncWriteStream = require('internal/fs/sync_write_stream');\n stream = new SyncWriteStream(fd, { autoClose: false });\n stream._type = 'fs';\n break;\n\n case 'PIPE':\n case 'TCP':\n var net = require('net');\n\n // If fd is already being used for the IPC channel, libuv will return\n // an error when trying to use it again. In that case, create the socket\n // using the existing handle instead of the fd.\n if (process.channel && process.channel.fd === fd) {\n stream = new net.Socket({\n handle: process.channel,\n readable: false,\n writable: true\n });\n } else {\n stream = new net.Socket({\n fd,\n readable: false,\n writable: true\n });\n }\n\n stream._type = 'pipe';\n break;\n\n default:\n // Probably an error on in uv_guess_handle()\n throw new ERR_UNKNOWN_STREAM_TYPE();\n }\n\n // For supporting legacy API we put the FD here.\n stream.fd = fd;\n\n stream._isStdio = true;\n\n return stream;\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 5560,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 5558,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "getMainThreadStdio",
"ranges": [
{
"startOffset": 298,
"endOffset": 3641,
"count": 1
},
{
"startOffset": 3639,
"endOffset": 3640,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getStdout",
"ranges": [
{
"startOffset": 374,
"endOffset": 770,
"count": 1
},
{
"startOffset": 413,
"endOffset": 427,
"count": 0
},
{
"startOffset": 681,
"endOffset": 747,
"count": 0
},
{
"startOffset": 766,
"endOffset": 769,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "stdout._destroy",
"ranges": [
{
"startOffset": 534,
"endOffset": 657,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "process.on",
"ranges": [
{
"startOffset": 712,
"endOffset": 739,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getStderr",
"ranges": [
{
"startOffset": 774,
"endOffset": 1170,
"count": 1
},
{
"startOffset": 813,
"endOffset": 827,
"count": 0
},
{
"startOffset": 1081,
"endOffset": 1147,
"count": 0
},
{
"startOffset": 1166,
"endOffset": 1169,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "stderr._destroy",
"ranges": [
{
"startOffset": 934,
"endOffset": 1057,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "process.on",
"ranges": [
{
"startOffset": 1112,
"endOffset": 1139,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getStdin",
"ranges": [
{
"startOffset": 1174,
"endOffset": 3579,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupProcessStdio",
"ranges": [
{
"startOffset": 3643,
"endOffset": 4152,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "process.openStdin",
"ranges": [
{
"startOffset": 4079,
"endOffset": 4149,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createWritableStdioStream",
"ranges": [
{
"startOffset": 4154,
"endOffset": 5555,
"count": 2
},
{
"startOffset": 4365,
"endOffset": 4687,
"count": 0
},
{
"startOffset": 4984,
"endOffset": 5012,
"count": 0
},
{
"startOffset": 5014,
"endOffset": 5156,
"count": 0
},
{
"startOffset": 5326,
"endOffset": 5438,
"count": 0
},
{
"startOffset": 5553,
"endOffset": 5554,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/process/warning.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst config = process.binding('config');\nconst prefix = `(${process.release.name}:${process.pid}) `;\nconst { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;\n\nexports.setup = setupProcessWarnings;\n\nvar cachedFd;\nvar acquiringFd = false;\nfunction nop() {}\n\n// Lazily loaded\nvar fs = null;\n\nfunction writeOut(message) {\n if (console && typeof console.error === 'function')\n return console.error(message);\n process._rawDebug(message);\n}\n\nfunction onClose(fd) {\n return function() {\n if (fs === null) fs = require('fs');\n fs.close(fd, nop);\n };\n}\n\nfunction onOpen(cb) {\n return function(err, fd) {\n acquiringFd = false;\n if (fd !== undefined) {\n cachedFd = fd;\n process.on('exit', onClose(fd));\n }\n cb(err, fd);\n process.emit('_node_warning_fd_acquired', err, fd);\n };\n}\n\nfunction onAcquired(message) {\n // make a best effort attempt at writing the message\n // to the fd. Errors are ignored at this point.\n return function(err, fd) {\n if (err)\n return writeOut(message);\n if (fs === null) fs = require('fs');\n fs.appendFile(fd, `${message}\\n`, nop);\n };\n}\n\nfunction acquireFd(cb) {\n if (cachedFd === undefined && !acquiringFd) {\n acquiringFd = true;\n if (fs === null) fs = require('fs');\n fs.open(config.warningFile, 'a', onOpen(cb));\n } else if (cachedFd !== undefined && !acquiringFd) {\n cb(null, cachedFd);\n } else {\n process.once('_node_warning_fd_acquired', cb);\n }\n}\n\nfunction output(message) {\n if (typeof config.warningFile === 'string') {\n acquireFd(onAcquired(message));\n return;\n }\n writeOut(message);\n}\n\nfunction doEmitWarning(warning) {\n return function() {\n process.emit('warning', warning);\n };\n}\n\nfunction setupProcessWarnings() {\n if (!process.noProcessWarnings && process.env.NODE_NO_WARNINGS !== '1') {\n process.on('warning', (warning) => {\n if (!(warning instanceof Error)) return;\n const isDeprecation = warning.name === 'DeprecationWarning';\n if (isDeprecation && process.noDeprecation) return;\n const trace = process.traceProcessWarnings ||\n (isDeprecation && process.traceDeprecation);\n var msg = prefix;\n if (warning.code)\n msg += `[${warning.code}] `;\n if (trace && warning.stack) {\n msg += `${warning.stack}`;\n } else {\n const toString =\n typeof warning.toString === 'function' ?\n warning.toString : Error.prototype.toString;\n msg += `${toString.apply(warning)}`;\n }\n if (typeof warning.detail === 'string') {\n msg += `\\n${warning.detail}`;\n }\n output(msg);\n });\n }\n\n // process.emitWarning(error)\n // process.emitWarning(str[, type[, code]][, ctor])\n // process.emitWarning(str[, options])\n process.emitWarning = function(warning, type, code, ctor, now) {\n var detail;\n if (type !== null && typeof type === 'object' && !Array.isArray(type)) {\n ctor = type.ctor;\n code = type.code;\n if (typeof type.detail === 'string')\n detail = type.detail;\n type = type.type || 'Warning';\n } else if (typeof type === 'function') {\n ctor = type;\n code = undefined;\n type = 'Warning';\n }\n if (typeof code === 'function') {\n ctor = code;\n code = undefined;\n }\n if (code !== undefined && typeof code !== 'string')\n throw new ERR_INVALID_ARG_TYPE('code', 'string', code);\n if (type !== undefined && typeof type !== 'string')\n throw new ERR_INVALID_ARG_TYPE('type', 'string', type);\n if (warning === undefined || typeof warning === 'string') {\n // eslint-disable-next-line no-restricted-syntax\n warning = new Error(warning);\n warning.name = String(type || 'Warning');\n if (code !== undefined) warning.code = code;\n if (detail !== undefined) warning.detail = detail;\n Error.captureStackTrace(warning, ctor || process.emitWarning);\n }\n if (!(warning instanceof Error)) {\n throw new ERR_INVALID_ARG_TYPE('warning', ['Error', 'string'], warning);\n }\n if (warning.name === 'DeprecationWarning') {\n if (process.noDeprecation)\n return;\n if (process.throwDeprecation)\n throw warning;\n }\n if (now) process.emit('warning', warning);\n else process.nextTick(doEmitWarning(warning));\n };\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4364,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4362,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "nop",
"ranges": [
{
"startOffset": 310,
"endOffset": 327,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeOut",
"ranges": [
{
"startOffset": 362,
"endOffset": 511,
"count": 1
},
{
"startOffset": 479,
"endOffset": 510,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "onClose",
"ranges": [
{
"startOffset": 513,
"endOffset": 628,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onOpen",
"ranges": [
{
"startOffset": 630,
"endOffset": 879,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onAcquired",
"ranges": [
{
"startOffset": 881,
"endOffset": 1182,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "acquireFd",
"ranges": [
{
"startOffset": 1184,
"endOffset": 1518,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "output",
"ranges": [
{
"startOffset": 1520,
"endOffset": 1669,
"count": 1
},
{
"startOffset": 1593,
"endOffset": 1646,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "doEmitWarning",
"ranges": [
{
"startOffset": 1671,
"endOffset": 1771,
"count": 1
},
{
"startOffset": 1769,
"endOffset": 1770,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1714,
"endOffset": 1768,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "setupProcessWarnings",
"ranges": [
{
"startOffset": 1773,
"endOffset": 4359,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "process.on",
"ranges": [
{
"startOffset": 1909,
"endOffset": 2688,
"count": 1
},
{
"startOffset": 1963,
"endOffset": 1970,
"count": 0
},
{
"startOffset": 2062,
"endOffset": 2086,
"count": 0
},
{
"startOffset": 2088,
"endOffset": 2095,
"count": 0
},
{
"startOffset": 2183,
"endOffset": 2210,
"count": 0
},
{
"startOffset": 2269,
"endOffset": 2297,
"count": 0
},
{
"startOffset": 2314,
"endOffset": 2330,
"count": 0
},
{
"startOffset": 2332,
"endOffset": 2376,
"count": 0
},
{
"startOffset": 2489,
"endOffset": 2515,
"count": 0
},
{
"startOffset": 2616,
"endOffset": 2663,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "process.emitWarning",
"ranges": [
{
"startOffset": 2847,
"endOffset": 4356,
"count": 1
},
{
"startOffset": 2956,
"endOffset": 2979,
"count": 0
},
{
"startOffset": 2981,
"endOffset": 3146,
"count": 0
},
{
"startOffset": 3184,
"endOffset": 3258,
"count": 0
},
{
"startOffset": 3295,
"endOffset": 3345,
"count": 0
},
{
"startOffset": 3373,
"endOffset": 3400,
"count": 0
},
{
"startOffset": 3408,
"endOffset": 3463,
"count": 0
},
{
"startOffset": 3526,
"endOffset": 3581,
"count": 0
},
{
"startOffset": 3770,
"endOffset": 3782,
"count": 0
},
{
"startOffset": 3815,
"endOffset": 3835,
"count": 0
},
{
"startOffset": 3868,
"endOffset": 3892,
"count": 0
},
{
"startOffset": 4005,
"endOffset": 4091,
"count": 0
},
{
"startOffset": 4139,
"endOffset": 4254,
"count": 0
},
{
"startOffset": 4268,
"endOffset": 4301,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/querystring.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst hexTable = new Array(256);\nfor (var i = 0; i < 256; ++i)\n hexTable[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();\n\nconst isHexTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 32 - 47\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63\n 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 64 - 79\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 - 95\n 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 96 - 111\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 112 - 127\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 128 ...\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // ... 256\n];\n\nmodule.exports = {\n hexTable,\n isHexTable\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 1190,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 1188,
"count": 1
},
{
"startOffset": 127,
"endOffset": 200,
"count": 256
},
{
"startOffset": 156,
"endOffset": 161,
"count": 16
},
{
"startOffset": 162,
"endOffset": 166,
"count": 240
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/safe_globals.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst copyProps = (unsafe, safe) => {\n for (const key of [...Object.getOwnPropertyNames(unsafe),\n ...Object.getOwnPropertySymbols(unsafe)\n ]) {\n if (!Object.getOwnPropertyDescriptor(safe, key)) {\n Object.defineProperty(\n safe,\n key,\n Object.getOwnPropertyDescriptor(unsafe, key));\n }\n }\n};\nconst makeSafe = (unsafe, safe) => {\n copyProps(unsafe.prototype, safe.prototype);\n copyProps(unsafe, safe);\n Object.setPrototypeOf(safe.prototype, null);\n Object.freeze(safe.prototype);\n Object.freeze(safe);\n return safe;\n};\n\nexports.SafeMap = makeSafe(Map, class SafeMap extends Map {});\nexports.SafeSet = makeSafe(Set, class SafeSet extends Set {});\nexports.SafePromise = makeSafe(Promise, class SafePromise extends Promise {});\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 849,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 847,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "copyProps",
"ranges": [
{
"startOffset": 80,
"endOffset": 405,
"count": 6
},
{
"startOffset": 226,
"endOffset": 403,
"count": 46
},
{
"startOffset": 281,
"endOffset": 399,
"count": 34
}
],
"isBlockCoverage": true
},
{
"functionName": "makeSafe",
"ranges": [
{
"startOffset": 424,
"endOffset": 637,
"count": 3
},
{
"startOffset": 635,
"endOffset": 636,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "SafeMap",
"ranges": [
{
"startOffset": 672,
"endOffset": 672,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "SafeSet",
"ranges": [
{
"startOffset": 735,
"endOffset": 735,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "SafePromise",
"ranges": [
{
"startOffset": 806,
"endOffset": 806,
"count": 7
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/stream_base_commons.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { Buffer } = require('buffer');\nconst errors = require('internal/errors');\nconst { WriteWrap } = process.binding('stream_wrap');\n\nconst errnoException = errors.errnoException;\n\nfunction handleWriteReq(req, data, encoding) {\n const { handle } = req;\n\n switch (encoding) {\n case 'buffer':\n return handle.writeBuffer(req, data);\n case 'latin1':\n case 'binary':\n return handle.writeLatin1String(req, data);\n case 'utf8':\n case 'utf-8':\n return handle.writeUtf8String(req, data);\n case 'ascii':\n return handle.writeAsciiString(req, data);\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return handle.writeUcs2String(req, data);\n default:\n return handle.writeBuffer(req, Buffer.from(data, encoding));\n }\n}\n\nfunction createWriteWrap(handle, oncomplete) {\n var req = new WriteWrap();\n\n req.handle = handle;\n req.oncomplete = oncomplete;\n req.async = false;\n\n return req;\n}\n\nfunction writevGeneric(self, req, data, cb) {\n var allBuffers = data.allBuffers;\n var chunks;\n var i;\n if (allBuffers) {\n chunks = data;\n for (i = 0; i < data.length; i++)\n data[i] = data[i].chunk;\n } else {\n chunks = new Array(data.length << 1);\n for (i = 0; i < data.length; i++) {\n var entry = data[i];\n chunks[i * 2] = entry.chunk;\n chunks[i * 2 + 1] = entry.encoding;\n }\n }\n var err = req.handle.writev(req, chunks, allBuffers);\n\n // Retain chunks\n if (err === 0) req._chunks = chunks;\n\n afterWriteDispatched(self, req, err, cb);\n}\n\nfunction writeGeneric(self, req, data, encoding, cb) {\n var err = handleWriteReq(req, data, encoding);\n\n afterWriteDispatched(self, req, err, cb);\n}\n\nfunction afterWriteDispatched(self, req, err, cb) {\n if (err !== 0)\n return self.destroy(errnoException(err, 'write', req.error), cb);\n\n if (!req.async) {\n cb();\n } else {\n req.callback = cb;\n }\n}\n\nmodule.exports = {\n createWriteWrap,\n writevGeneric,\n writeGeneric\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2046,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2044,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "handleWriteReq",
"ranges": [
{
"startOffset": 245,
"endOffset": 851,
"count": 2
},
{
"startOffset": 345,
"endOffset": 422,
"count": 0
},
{
"startOffset": 427,
"endOffset": 496,
"count": 0
},
{
"startOffset": 574,
"endOffset": 658,
"count": 0
},
{
"startOffset": 663,
"endOffset": 676,
"count": 0
},
{
"startOffset": 681,
"endOffset": 696,
"count": 0
},
{
"startOffset": 701,
"endOffset": 850,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "createWriteWrap",
"ranges": [
{
"startOffset": 853,
"endOffset": 1021,
"count": 2
},
{
"startOffset": 1019,
"endOffset": 1020,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "writevGeneric",
"ranges": [
{
"startOffset": 1023,
"endOffset": 1604,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeGeneric",
"ranges": [
{
"startOffset": 1606,
"endOffset": 1756,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "afterWriteDispatched",
"ranges": [
{
"startOffset": 1758,
"endOffset": 1967,
"count": 2
},
{
"startOffset": 1831,
"endOffset": 1896,
"count": 0
},
{
"startOffset": 1931,
"endOffset": 1965,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/streams/buffer_list.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { Buffer } = require('buffer');\nconst { inspect } = require('util');\n\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\n\nmodule.exports = class BufferList {\n constructor() {\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n push(v) {\n const entry = { data: v, next: null };\n if (this.length > 0)\n this.tail.next = entry;\n else\n this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n\n unshift(v) {\n const entry = { data: v, next: this.head };\n if (this.length === 0)\n this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n\n shift() {\n if (this.length === 0)\n return;\n const ret = this.head.data;\n if (this.length === 1)\n this.head = this.tail = null;\n else\n this.head = this.head.next;\n --this.length;\n return ret;\n }\n\n clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n\n join(s) {\n if (this.length === 0)\n return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next)\n ret += s + p.data;\n return ret;\n }\n\n concat(n) {\n if (this.length === 0)\n return Buffer.alloc(0);\n const ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n\n first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n const str = p.data;\n const nb = (n > str.length ? str.length : n);\n if (nb === str.length)\n ret += str;\n else\n ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n _getBuffer(n) {\n const ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n const buf = p.data;\n const nb = (n > buf.length ? buf.length : n);\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n [inspect.custom]() {\n const obj = inspect({ length: this.length });\n return `${this.constructor.name} ${obj}`;\n }\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3648,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3646,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "copyBuffer",
"ranges": [
{
"startOffset": 138,
"endOffset": 233,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "BufferList",
"ranges": [
{
"startOffset": 273,
"endOffset": 357,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "push",
"ranges": [
{
"startOffset": 361,
"endOffset": 548,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "unshift",
"ranges": [
{
"startOffset": 552,
"endOffset": 710,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "shift",
"ranges": [
{
"startOffset": 714,
"endOffset": 941,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "clear",
"ranges": [
{
"startOffset": 945,
"endOffset": 1013,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "join",
"ranges": [
{
"startOffset": 1017,
"endOffset": 1188,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "concat",
"ranges": [
{
"startOffset": 1192,
"endOffset": 1463,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "consume",
"ranges": [
{
"startOffset": 1547,
"endOffset": 2025,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "first",
"ranges": [
{
"startOffset": 2029,
"endOffset": 2069,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "_getString",
"ranges": [
{
"startOffset": 2144,
"endOffset": 2798,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "_getBuffer",
"ranges": [
{
"startOffset": 2868,
"endOffset": 3516,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "module.exports",
"ranges": [
{
"startOffset": 3520,
"endOffset": 3640,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/streams/destroy.js",
"source": "(function (exports, require, module, process) {'use strict';\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n const readableDestroyed = this._readableState &&\n this._readableState.destroyed;\n const writableDestroyed = this._writableState &&\n this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err &&\n (!this._writableState || !this._writableState.errorEmitted)) {\n process.nextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, (err) => {\n if (!cb && err) {\n process.nextTick(emitErrorAndCloseNT, this, err);\n if (this._writableState) {\n this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose)\n return;\n if (self._readableState && !self._readableState.emitClose)\n return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy,\n undestroy\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2293,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2291,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "destroy",
"ranges": [
{
"startOffset": 124,
"endOffset": 1326,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitErrorAndCloseNT",
"ranges": [
{
"startOffset": 1328,
"endOffset": 1418,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitCloseNT",
"ranges": [
{
"startOffset": 1420,
"endOffset": 1618,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "undestroy",
"ranges": [
{
"startOffset": 1620,
"endOffset": 2178,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "emitErrorNT",
"ranges": [
{
"startOffset": 2180,
"endOffset": 2242,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/streams/end-of-stream.js",
"source": "(function (exports, require, module, process) {// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nconst {\n ERR_STREAM_PREMATURE_CLOSE\n} = require('internal/errors').codes;\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction once(callback) {\n let called = false;\n return function(err) {\n if (called) return;\n called = true;\n callback.call(this, err);\n };\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n\n callback = once(callback || noop);\n\n const ws = stream._writableState;\n const rs = stream._readableState;\n let readable = opts.readable || (opts.readable !== false && stream.readable);\n let writable = opts.writable || (opts.writable !== false && stream.writable);\n\n const onlegacyfinish = () => {\n if (!stream.writable) onfinish();\n };\n\n const onfinish = () => {\n writable = false;\n if (!readable) callback.call(stream);\n };\n\n const onend = () => {\n readable = false;\n if (!writable) callback.call(stream);\n };\n\n const onerror = (err) => {\n callback.call(stream, err);\n };\n\n const onclose = () => {\n if (readable && !(rs && rs.ended)) {\n return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());\n }\n if (writable && !(ws && ws.ended)) {\n return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());\n }\n };\n\n const onrequest = () => {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();\n else stream.on('request', onrequest);\n } else if (writable && !ws) { // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n\n return function() {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2606,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2604,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "noop",
"ranges": [
{
"startOffset": 260,
"endOffset": 278,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isRequest",
"ranges": [
{
"startOffset": 280,
"endOffset": 375,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "once",
"ranges": [
{
"startOffset": 377,
"endOffset": 529,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "eos",
"ranges": [
{
"startOffset": 531,
"endOffset": 2578,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/streams/legacy.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst EE = require('events');\nconst util = require('util');\n\nfunction Stream() {\n EE.call(this);\n}\nutil.inherits(Stream, EE);\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === false && source.pause) {\n source.pause();\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\nmodule.exports = Stream;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2039,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2037,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "Stream",
"ranges": [
{
"startOffset": 123,
"endOffset": 161,
"count": 4
}
],
"isBlockCoverage": true
},
{
"functionName": "Stream.pipe",
"ranges": [
{
"startOffset": 214,
"endOffset": 2007,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/streams/pipeline.js",
"source": "(function (exports, require, module, process) {// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nlet eos;\n\nconst {\n ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED\n} = require('internal/errors').codes;\n\nfunction once(callback) {\n let called = false;\n return function(err) {\n if (called) return;\n called = true;\n callback(err);\n };\n}\n\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n\n let closed = false;\n stream.on('close', () => {\n closed = true;\n });\n\n if (eos === undefined) eos = require('internal/streams/end-of-stream');\n eos(stream, { readable: reading, writable: writing }, (err) => {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n\n let destroyed = false;\n return (err) => {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\n\nfunction call(fn) {\n fn();\n}\n\nfunction pipe(from, to) {\n return from.pipe(to);\n}\n\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\n\nfunction pipeline(...streams) {\n const callback = popCallback(streams);\n\n if (Array.isArray(streams[0])) streams = streams[0];\n\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n let error;\n const destroys = streams.map(function(stream, i) {\n const reading = i < streams.length - 1;\n const writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n\n return streams.reduce(pipe);\n}\n\nmodule.exports = pipeline;\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2252,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2250,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "once",
"ranges": [
{
"startOffset": 275,
"endOffset": 416,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "noop",
"ranges": [
{
"startOffset": 418,
"endOffset": 521,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isRequest",
"ranges": [
{
"startOffset": 523,
"endOffset": 618,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "destroyer",
"ranges": [
{
"startOffset": 620,
"endOffset": 1365,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "call",
"ranges": [
{
"startOffset": 1367,
"endOffset": 1396,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "pipe",
"ranges": [
{
"startOffset": 1398,
"endOffset": 1449,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "popCallback",
"ranges": [
{
"startOffset": 1451,
"endOffset": 1614,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "pipeline",
"ranges": [
{
"startOffset": 1616,
"endOffset": 2219,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/streams/state.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { ERR_INVALID_OPT_VALUE } = require('internal/errors').codes;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark :\n isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!Number.isInteger(hwm) || hwm < 0) {\n const name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 753,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 751,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "highWaterMarkFrom",
"ranges": [
{
"startOffset": 131,
"endOffset": 298,
"count": 4
},
{
"startOffset": 229,
"endOffset": 252,
"count": 0
},
{
"startOffset": 289,
"endOffset": 295,
"count": 0
},
{
"startOffset": 296,
"endOffset": 297,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getHighWaterMark",
"ranges": [
{
"startOffset": 300,
"endOffset": 706,
"count": 4
},
{
"startOffset": 447,
"endOffset": 640,
"count": 0
},
{
"startOffset": 687,
"endOffset": 691,
"count": 0
},
{
"startOffset": 704,
"endOffset": 705,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/timers.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n getDefaultTriggerAsyncId,\n newAsyncId,\n initHooksExist,\n emitInit\n} = require('internal/async_hooks');\n// Symbols for storing async id state.\nconst async_id_symbol = Symbol('asyncId');\nconst trigger_async_id_symbol = Symbol('triggerId');\n\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_CALLBACK,\n ERR_OUT_OF_RANGE\n} = require('internal/errors').codes;\n\n// Timeout values > TIMEOUT_MAX are set to 1.\nconst TIMEOUT_MAX = 2 ** 31 - 1;\n\nconst unrefedSymbol = Symbol('unrefed');\n\nmodule.exports = {\n TIMEOUT_MAX,\n kTimeout: Symbol('timeout'), // For hiding Timeouts on other internals.\n async_id_symbol,\n trigger_async_id_symbol,\n Timeout,\n initAsyncResource,\n setUnrefTimeout,\n validateTimerDuration\n};\n\nvar timers;\nfunction getTimers() {\n if (timers === undefined) {\n timers = require('timers');\n }\n return timers;\n}\n\nfunction initAsyncResource(resource, type) {\n const asyncId = resource[async_id_symbol] = newAsyncId();\n const triggerAsyncId =\n resource[trigger_async_id_symbol] = getDefaultTriggerAsyncId();\n if (initHooksExist())\n emitInit(asyncId, type, triggerAsyncId, resource);\n}\n\n// Timer constructor function.\n// The entire prototype is defined in lib/timers.js\nfunction Timeout(callback, after, args, isRepeat, isUnrefed) {\n after *= 1; // coalesce to number or NaN\n if (!(after >= 1 && after <= TIMEOUT_MAX)) {\n if (after > TIMEOUT_MAX) {\n process.emitWarning(`${after} does not fit into` +\n ' a 32-bit signed integer.' +\n '\\nTimeout duration was set to 1.',\n 'TimeoutOverflowWarning');\n }\n after = 1; // schedule on next tick, follows browser behavior\n }\n\n this._called = false;\n this._idleTimeout = after;\n this._idlePrev = this;\n this._idleNext = this;\n this._idleStart = null;\n // this must be set to null first to avoid function tracking\n // on the hidden class, revisit in V8 versions after 6.2\n this._onTimeout = null;\n this._onTimeout = callback;\n this._timerArgs = args;\n this._repeat = isRepeat ? after : null;\n this._destroyed = false;\n\n this[unrefedSymbol] = isUnrefed;\n\n initAsyncResource(this, 'Timeout');\n}\n\nTimeout.prototype.refresh = function() {\n if (this._handle) {\n // Would be more ideal with uv_timer_again(), however that API does not\n // cause libuv's sorted timers data structure (a binary heap at the time\n // of writing) to re-sort itself. This causes ordering inconsistencies.\n this._handle.start(this._idleTimeout);\n } else if (this[unrefedSymbol]) {\n getTimers()._unrefActive(this);\n } else {\n getTimers().active(this);\n }\n\n return this;\n};\n\nfunction setUnrefTimeout(callback, after, arg1, arg2, arg3) {\n // Type checking identical to setTimeout()\n if (typeof callback !== 'function') {\n throw new ERR_INVALID_CALLBACK();\n }\n\n let i, args;\n switch (arguments.length) {\n // fast cases\n case 1:\n case 2:\n break;\n case 3:\n args = [arg1];\n break;\n case 4:\n args = [arg1, arg2];\n break;\n default:\n args = [arg1, arg2, arg3];\n for (i = 5; i < arguments.length; i++) {\n // extend array dynamically, makes .apply run much faster in v6.0.0\n args[i - 2] = arguments[i];\n }\n break;\n }\n\n const timer = new Timeout(callback, after, args, false, true);\n getTimers()._unrefActive(timer);\n\n return timer;\n}\n\n// Type checking used by timers.enroll() and Socket#setTimeout()\nfunction validateTimerDuration(msecs) {\n if (typeof msecs !== 'number') {\n throw new ERR_INVALID_ARG_TYPE('msecs', 'number', msecs);\n }\n\n if (msecs < 0 || !isFinite(msecs)) {\n throw new ERR_OUT_OF_RANGE('msecs', 'a non-negative finite number', msecs);\n }\n\n // Ensure that msecs fits into signed int32\n if (msecs > TIMEOUT_MAX) {\n process.emitWarning(`${msecs} does not fit into a 32-bit signed integer.` +\n `\\nTimer duration was truncated to ${TIMEOUT_MAX}.`,\n 'TimeoutOverflowWarning');\n return TIMEOUT_MAX;\n }\n\n return msecs;\n}\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 4112,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 4110,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "getTimers",
"ranges": [
{
"startOffset": 795,
"endOffset": 902,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "initAsyncResource",
"ranges": [
{
"startOffset": 904,
"endOffset": 1182,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Timeout",
"ranges": [
{
"startOffset": 1267,
"endOffset": 2234,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Timeout.refresh",
"ranges": [
{
"startOffset": 2264,
"endOffset": 2705,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setUnrefTimeout",
"ranges": [
{
"startOffset": 2708,
"endOffset": 3445,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateTimerDuration",
"ranges": [
{
"startOffset": 3512,
"endOffset": 4107,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/url.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst util = require('util');\nconst {\n hexTable,\n isHexTable\n} = require('internal/querystring');\n\nconst { getConstructorOf, removeColors } = require('internal/util');\nconst {\n ERR_ARG_NOT_ITERABLE,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_CALLBACK,\n ERR_INVALID_FILE_URL_HOST,\n ERR_INVALID_FILE_URL_PATH,\n ERR_INVALID_THIS,\n ERR_INVALID_TUPLE,\n ERR_INVALID_URL,\n ERR_INVALID_URL_SCHEME,\n ERR_MISSING_ARGS\n} = require('internal/errors').codes;\nconst {\n CHAR_PERCENT,\n CHAR_PLUS,\n CHAR_AMPERSAND,\n CHAR_EQUAL,\n CHAR_LOWERCASE_A,\n CHAR_LOWERCASE_Z,\n} = require('internal/constants');\n\n// Lazy loaded for startup performance.\nlet querystring;\n\nconst { platform } = process;\nconst isWindows = platform === 'win32';\n\nconst {\n domainToASCII: _domainToASCII,\n domainToUnicode: _domainToUnicode,\n encodeAuth,\n toUSVString: _toUSVString,\n parse: _parse,\n setURLConstructor,\n URL_FLAGS_CANNOT_BE_BASE,\n URL_FLAGS_HAS_FRAGMENT,\n URL_FLAGS_HAS_HOST,\n URL_FLAGS_HAS_PASSWORD,\n URL_FLAGS_HAS_PATH,\n URL_FLAGS_HAS_QUERY,\n URL_FLAGS_HAS_USERNAME,\n URL_FLAGS_IS_DEFAULT_SCHEME_PORT,\n URL_FLAGS_SPECIAL,\n kFragment,\n kHost,\n kHostname,\n kPathStart,\n kPort,\n kQuery,\n kSchemeStart\n} = process.binding('url');\n\nconst context = Symbol('context');\nconst cannotBeBase = Symbol('cannot-be-base');\nconst cannotHaveUsernamePasswordPort =\n Symbol('cannot-have-username-password-port');\nconst special = Symbol('special');\nconst searchParams = Symbol('query');\nconst kFormat = Symbol('format');\n\n// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object\nconst IteratorPrototype = Object.getPrototypeOf(\n Object.getPrototypeOf([][Symbol.iterator]())\n);\n\nconst unpairedSurrogateRe =\n /(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])/;\nfunction toUSVString(val) {\n const str = `${val}`;\n // As of V8 5.5, `str.search()` (and `unpairedSurrogateRe[@@search]()`) are\n // slower than `unpairedSurrogateRe.exec()`.\n const match = unpairedSurrogateRe.exec(str);\n if (!match)\n return str;\n return _toUSVString(str, match.index);\n}\n\n// Refs: https://html.spec.whatwg.org/multipage/browsers.html#concept-origin-opaque\nconst kOpaqueOrigin = 'null';\n\n// Refs: https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin\nfunction serializeTupleOrigin(scheme, host, port) {\n return `${scheme}//${host}${port === null ? '' : `:${port}`}`;\n}\n\n// This class provides the internal state of a URL object. An instance of this\n// class is stored in every URL object and is accessed internally by setters\n// and getters. It roughly corresponds to the concept of a URL record in the\n// URL Standard, with a few differences. It is also the object transported to\n// the C++ binding.\n// Refs: https://url.spec.whatwg.org/#concept-url\nclass URLContext {\n constructor() {\n this.flags = 0;\n this.scheme = ':';\n this.username = '';\n this.password = '';\n this.host = null;\n this.port = null;\n this.path = [];\n this.query = null;\n this.fragment = null;\n }\n}\n\nclass URLSearchParams {\n // URL Standard says the default value is '', but as undefined and '' have\n // the same result, undefined is used to prevent unnecessary parsing.\n // Default parameter is necessary to keep URLSearchParams.length === 0 in\n // accordance with Web IDL spec.\n constructor(init = undefined) {\n if (init === null || init === undefined) {\n this[searchParams] = [];\n } else if (typeof init === 'object' || typeof init === 'function') {\n const method = init[Symbol.iterator];\n if (method === this[Symbol.iterator]) {\n // While the spec does not have this branch, we can use it as a\n // shortcut to avoid having to go through the costly generic iterator.\n const childParams = init[searchParams];\n this[searchParams] = childParams.slice();\n } else if (method !== null && method !== undefined) {\n if (typeof method !== 'function') {\n throw new ERR_ARG_NOT_ITERABLE('Query pairs');\n }\n\n // sequence<sequence<USVString>>\n // Note: per spec we have to first exhaust the lists then process them\n const pairs = [];\n for (const pair of init) {\n if ((typeof pair !== 'object' && typeof pair !== 'function') ||\n pair === null ||\n typeof pair[Symbol.iterator] !== 'function') {\n throw new ERR_INVALID_TUPLE('Each query pair', '[name, value]');\n }\n const convertedPair = [];\n for (const element of pair)\n convertedPair.push(toUSVString(element));\n pairs.push(convertedPair);\n }\n\n this[searchParams] = [];\n for (const pair of pairs) {\n if (pair.length !== 2) {\n throw new ERR_INVALID_TUPLE('Each query pair', '[name, value]');\n }\n this[searchParams].push(pair[0], pair[1]);\n }\n } else {\n // record<USVString, USVString>\n // Need to use reflection APIs for full spec compliance.\n this[searchParams] = [];\n const keys = Reflect.ownKeys(init);\n for (var i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = Reflect.getOwnPropertyDescriptor(init, key);\n if (desc !== undefined && desc.enumerable) {\n const typedKey = toUSVString(key);\n const typedValue = toUSVString(init[key]);\n this[searchParams].push(typedKey, typedValue);\n }\n }\n }\n } else {\n // USVString\n init = toUSVString(init);\n if (init[0] === '?') init = init.slice(1);\n initSearchParams(this, init);\n }\n\n // \"associated url object\"\n this[context] = null;\n }\n\n [util.inspect.custom](recurseTimes, ctx) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n\n if (typeof recurseTimes === 'number' && recurseTimes < 0)\n return ctx.stylize('[Object]', 'special');\n\n var separator = ', ';\n var innerOpts = util._extend({}, ctx);\n if (recurseTimes !== null) {\n innerOpts.depth = recurseTimes - 1;\n }\n var innerInspect = (v) => util.inspect(v, innerOpts);\n\n var list = this[searchParams];\n var output = [];\n for (var i = 0; i < list.length; i += 2)\n output.push(`${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`);\n\n var length = output.reduce(\n (prev, cur) => prev + removeColors(cur).length + separator.length,\n -separator.length\n );\n if (length > ctx.breakLength) {\n return `${this.constructor.name} {\\n ${output.join(',\\n ')} }`;\n } else if (output.length) {\n return `${this.constructor.name} { ${output.join(separator)} }`;\n } else {\n return `${this.constructor.name} {}`;\n }\n }\n}\n\nfunction onParseComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n var ctx = this[context];\n ctx.flags = flags;\n ctx.scheme = protocol;\n ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';\n ctx.password = (flags & URL_FLAGS_HAS_PASSWORD) !== 0 ? password : '';\n ctx.port = port;\n ctx.path = (flags & URL_FLAGS_HAS_PATH) !== 0 ? path : [];\n ctx.query = query;\n ctx.fragment = fragment;\n ctx.host = host;\n if (!this[searchParams]) { // invoked from URL constructor\n this[searchParams] = new URLSearchParams();\n this[searchParams][context] = this;\n }\n initSearchParams(this[searchParams], query);\n}\n\nfunction onParseError(flags, input) {\n const error = new ERR_INVALID_URL(input);\n error.input = input;\n throw error;\n}\n\n// Reused by URL constructor and URL#href setter.\nfunction parse(url, input, base) {\n const base_context = base ? base[context] : undefined;\n url[context] = new URLContext();\n _parse(input.trim(), -1, base_context, undefined,\n onParseComplete.bind(url), onParseError);\n}\n\nfunction onParseProtocolComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n const ctx = this[context];\n if ((flags & URL_FLAGS_SPECIAL) !== 0) {\n ctx.flags |= URL_FLAGS_SPECIAL;\n } else {\n ctx.flags &= ~URL_FLAGS_SPECIAL;\n }\n ctx.scheme = protocol;\n ctx.port = port;\n}\n\nfunction onParseHostnameComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n const ctx = this[context];\n if ((flags & URL_FLAGS_HAS_HOST) !== 0) {\n ctx.host = host;\n ctx.flags |= URL_FLAGS_HAS_HOST;\n } else {\n ctx.host = null;\n ctx.flags &= ~URL_FLAGS_HAS_HOST;\n }\n}\n\nfunction onParsePortComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n this[context].port = port;\n}\n\nfunction onParseHostComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n onParseHostnameComplete.apply(this, arguments);\n if (port !== null || ((flags & URL_FLAGS_IS_DEFAULT_SCHEME_PORT) !== 0))\n onParsePortComplete.apply(this, arguments);\n}\n\nfunction onParsePathComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n const ctx = this[context];\n if ((flags & URL_FLAGS_HAS_PATH) !== 0) {\n ctx.path = path;\n ctx.flags |= URL_FLAGS_HAS_PATH;\n } else {\n ctx.path = [];\n ctx.flags &= ~URL_FLAGS_HAS_PATH;\n }\n\n // The C++ binding may set host to empty string.\n if ((flags & URL_FLAGS_HAS_HOST) !== 0) {\n ctx.host = host;\n ctx.flags |= URL_FLAGS_HAS_HOST;\n }\n}\n\nfunction onParseSearchComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n this[context].query = query;\n}\n\nfunction onParseHashComplete(flags, protocol, username, password,\n host, port, path, query, fragment) {\n this[context].fragment = fragment;\n}\n\nclass URL {\n constructor(input, base) {\n // toUSVString is not needed.\n input = `${input}`;\n if (base !== undefined) {\n base = new URL(base);\n }\n parse(this, input, base);\n }\n\n get [special]() {\n return (this[context].flags & URL_FLAGS_SPECIAL) !== 0;\n }\n\n get [cannotBeBase]() {\n return (this[context].flags & URL_FLAGS_CANNOT_BE_BASE) !== 0;\n }\n\n // https://url.spec.whatwg.org/#cannot-have-a-username-password-port\n get [cannotHaveUsernamePasswordPort]() {\n const { host, scheme } = this[context];\n return ((host == null || host === '') ||\n this[cannotBeBase] ||\n scheme === 'file:');\n }\n\n [util.inspect.custom](depth, opts) {\n if (this == null ||\n Object.getPrototypeOf(this[context]) !== URLContext.prototype) {\n throw new ERR_INVALID_THIS('URL');\n }\n\n if (typeof depth === 'number' && depth < 0)\n return opts.stylize('[Object]', 'special');\n\n var ctor = getConstructorOf(this);\n\n var obj = Object.create({\n constructor: ctor === null ? URL : ctor\n });\n\n obj.href = this.href;\n obj.origin = this.origin;\n obj.protocol = this.protocol;\n obj.username = this.username;\n obj.password = this.password;\n obj.host = this.host;\n obj.hostname = this.hostname;\n obj.port = this.port;\n obj.pathname = this.pathname;\n obj.search = this.search;\n obj.searchParams = this.searchParams;\n obj.hash = this.hash;\n\n if (opts.showHidden) {\n obj.cannotBeBase = this[cannotBeBase];\n obj.special = this[special];\n obj[context] = this[context];\n }\n\n return util.inspect(obj, opts);\n }\n}\n\nObject.defineProperties(URL.prototype, {\n [kFormat]: {\n enumerable: false,\n configurable: false,\n // eslint-disable-next-line func-name-matching\n value: function format(options) {\n if (options && typeof options !== 'object')\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n options = util._extend({\n fragment: true,\n unicode: false,\n search: true,\n auth: true\n }, options);\n const ctx = this[context];\n var ret = ctx.scheme;\n if (ctx.host !== null) {\n ret += '//';\n const has_username = ctx.username !== '';\n const has_password = ctx.password !== '';\n if (options.auth && (has_username || has_password)) {\n if (has_username)\n ret += ctx.username;\n if (has_password)\n ret += `:${ctx.password}`;\n ret += '@';\n }\n ret += options.unicode ?\n domainToUnicode(this.hostname) : this.hostname;\n if (ctx.port !== null)\n ret += `:${ctx.port}`;\n } else if (ctx.scheme === 'file:') {\n ret += '//';\n }\n if (this.pathname)\n ret += this.pathname;\n if (options.search && ctx.query !== null)\n ret += `?${ctx.query}`;\n if (options.fragment && ctx.fragment !== null)\n ret += `#${ctx.fragment}`;\n return ret;\n }\n },\n [Symbol.toStringTag]: {\n configurable: true,\n value: 'URL'\n },\n toString: {\n // https://heycam.github.io/webidl/#es-stringifier\n writable: true,\n enumerable: true,\n configurable: true,\n // eslint-disable-next-line func-name-matching\n value: function toString() {\n return this[kFormat]({});\n }\n },\n href: {\n enumerable: true,\n configurable: true,\n get() {\n return this[kFormat]({});\n },\n set(input) {\n // toUSVString is not needed.\n input = `${input}`;\n parse(this, input);\n }\n },\n origin: { // readonly\n enumerable: true,\n configurable: true,\n get() {\n // Refs: https://url.spec.whatwg.org/#concept-url-origin\n const ctx = this[context];\n switch (ctx.scheme) {\n case 'blob:':\n if (ctx.path.length > 0) {\n try {\n return (new URL(ctx.path[0])).origin;\n } catch (err) {\n // fall through... do nothing\n }\n }\n return kOpaqueOrigin;\n case 'ftp:':\n case 'gopher:':\n case 'http:':\n case 'https:':\n case 'ws:':\n case 'wss:':\n return serializeTupleOrigin(ctx.scheme, ctx.host, ctx.port);\n }\n return kOpaqueOrigin;\n }\n },\n protocol: {\n enumerable: true,\n configurable: true,\n get() {\n return this[context].scheme;\n },\n set(scheme) {\n // toUSVString is not needed.\n scheme = `${scheme}`;\n if (scheme.length === 0)\n return;\n const ctx = this[context];\n if (ctx.scheme === 'file:' &&\n (ctx.host === '' || ctx.host === null)) {\n return;\n }\n _parse(scheme, kSchemeStart, null, ctx,\n onParseProtocolComplete.bind(this));\n }\n },\n username: {\n enumerable: true,\n configurable: true,\n get() {\n return this[context].username;\n },\n set(username) {\n // toUSVString is not needed.\n username = `${username}`;\n if (this[cannotHaveUsernamePasswordPort])\n return;\n const ctx = this[context];\n if (username === '') {\n ctx.username = '';\n ctx.flags &= ~URL_FLAGS_HAS_USERNAME;\n return;\n }\n ctx.username = encodeAuth(username);\n ctx.flags |= URL_FLAGS_HAS_USERNAME;\n }\n },\n password: {\n enumerable: true,\n configurable: true,\n get() {\n return this[context].password;\n },\n set(password) {\n // toUSVString is not needed.\n password = `${password}`;\n if (this[cannotHaveUsernamePasswordPort])\n return;\n const ctx = this[context];\n if (password === '') {\n ctx.password = '';\n ctx.flags &= ~URL_FLAGS_HAS_PASSWORD;\n return;\n }\n ctx.password = encodeAuth(password);\n ctx.flags |= URL_FLAGS_HAS_PASSWORD;\n }\n },\n host: {\n enumerable: true,\n configurable: true,\n get() {\n const ctx = this[context];\n var ret = ctx.host || '';\n if (ctx.port !== null)\n ret += `:${ctx.port}`;\n return ret;\n },\n set(host) {\n const ctx = this[context];\n // toUSVString is not needed.\n host = `${host}`;\n if (this[cannotBeBase]) {\n // Cannot set the host if cannot-be-base is set\n return;\n }\n _parse(host, kHost, null, ctx, onParseHostComplete.bind(this));\n }\n },\n hostname: {\n enumerable: true,\n configurable: true,\n get() {\n return this[context].host || '';\n },\n set(host) {\n const ctx = this[context];\n // toUSVString is not needed.\n host = `${host}`;\n if (this[cannotBeBase]) {\n // Cannot set the host if cannot-be-base is set\n return;\n }\n _parse(host, kHostname, null, ctx, onParseHostnameComplete.bind(this));\n }\n },\n port: {\n enumerable: true,\n configurable: true,\n get() {\n const port = this[context].port;\n return port === null ? '' : String(port);\n },\n set(port) {\n // toUSVString is not needed.\n port = `${port}`;\n if (this[cannotHaveUsernamePasswordPort])\n return;\n const ctx = this[context];\n if (port === '') {\n ctx.port = null;\n return;\n }\n _parse(port, kPort, null, ctx, onParsePortComplete.bind(this));\n }\n },\n pathname: {\n enumerable: true,\n configurable: true,\n get() {\n const ctx = this[context];\n if (this[cannotBeBase])\n return ctx.path[0];\n if (ctx.path.length === 0)\n return '';\n return `/${ctx.path.join('/')}`;\n },\n set(path) {\n // toUSVString is not needed.\n path = `${path}`;\n if (this[cannotBeBase])\n return;\n _parse(path, kPathStart, null, this[context],\n onParsePathComplete.bind(this));\n }\n },\n search: {\n enumerable: true,\n configurable: true,\n get() {\n const { query } = this[context];\n if (query === null || query === '')\n return '';\n return `?${query}`;\n },\n set(search) {\n const ctx = this[context];\n search = toUSVString(search);\n if (search === '') {\n ctx.query = null;\n ctx.flags &= ~URL_FLAGS_HAS_QUERY;\n } else {\n if (search[0] === '?') search = search.slice(1);\n ctx.query = '';\n ctx.flags |= URL_FLAGS_HAS_QUERY;\n if (search) {\n _parse(search, kQuery, null, ctx, onParseSearchComplete.bind(this));\n }\n }\n initSearchParams(this[searchParams], search);\n }\n },\n searchParams: { // readonly\n enumerable: true,\n configurable: true,\n get() {\n return this[searchParams];\n }\n },\n hash: {\n enumerable: true,\n configurable: true,\n get() {\n const { fragment } = this[context];\n if (fragment === null || fragment === '')\n return '';\n return `#${fragment}`;\n },\n set(hash) {\n const ctx = this[context];\n // toUSVString is not needed.\n hash = `${hash}`;\n if (!hash) {\n ctx.fragment = null;\n ctx.flags &= ~URL_FLAGS_HAS_FRAGMENT;\n return;\n }\n if (hash[0] === '#') hash = hash.slice(1);\n ctx.fragment = '';\n ctx.flags |= URL_FLAGS_HAS_FRAGMENT;\n _parse(hash, kFragment, null, ctx, onParseHashComplete.bind(this));\n }\n },\n toJSON: {\n writable: true,\n enumerable: true,\n configurable: true,\n // eslint-disable-next-line func-name-matching\n value: function toJSON() {\n return this[kFormat]({});\n }\n }\n});\n\nfunction update(url, params) {\n if (!url)\n return;\n\n const ctx = url[context];\n const serializedParams = params.toString();\n if (serializedParams) {\n ctx.query = serializedParams;\n ctx.flags |= URL_FLAGS_HAS_QUERY;\n } else {\n ctx.query = null;\n ctx.flags &= ~URL_FLAGS_HAS_QUERY;\n }\n}\n\nfunction initSearchParams(url, init) {\n if (!init) {\n url[searchParams] = [];\n return;\n }\n url[searchParams] = parseParams(init);\n}\n\n// application/x-www-form-urlencoded parser\n// Ref: https://url.spec.whatwg.org/#concept-urlencoded-parser\nfunction parseParams(qs) {\n const out = [];\n var pairStart = 0;\n var lastPos = 0;\n var seenSep = false;\n var buf = '';\n var encoded = false;\n var encodeCheck = 0;\n var i;\n for (i = 0; i < qs.length; ++i) {\n const code = qs.charCodeAt(i);\n\n // Try matching key/value pair separator\n if (code === CHAR_AMPERSAND) {\n if (pairStart === i) {\n // We saw an empty substring between pair separators\n lastPos = pairStart = i + 1;\n continue;\n }\n\n if (lastPos < i)\n buf += qs.slice(lastPos, i);\n if (encoded)\n buf = querystring.unescape(buf);\n out.push(buf);\n\n // If `buf` is the key, add an empty value.\n if (!seenSep)\n out.push('');\n\n seenSep = false;\n buf = '';\n encoded = false;\n encodeCheck = 0;\n lastPos = pairStart = i + 1;\n continue;\n }\n\n // Try matching key/value separator (e.g. '=') if we haven't already\n if (!seenSep && code === CHAR_EQUAL) {\n // Key/value separator match!\n if (lastPos < i)\n buf += qs.slice(lastPos, i);\n if (encoded)\n buf = querystring.unescape(buf);\n out.push(buf);\n\n seenSep = true;\n buf = '';\n encoded = false;\n encodeCheck = 0;\n lastPos = i + 1;\n continue;\n }\n\n // Handle + and percent decoding.\n if (code === CHAR_PLUS) {\n if (lastPos < i)\n buf += qs.slice(lastPos, i);\n buf += ' ';\n lastPos = i + 1;\n } else if (!encoded) {\n // Try to match an (valid) encoded byte (once) to minimize unnecessary\n // calls to string decoding functions\n if (code === CHAR_PERCENT) {\n encodeCheck = 1;\n } else if (encodeCheck > 0) {\n // eslint-disable-next-line no-extra-boolean-cast\n if (!!isHexTable[code]) {\n if (++encodeCheck === 3) {\n querystring = require('querystring');\n encoded = true;\n }\n } else {\n encodeCheck = 0;\n }\n }\n }\n }\n\n // Deal with any leftover key or value data\n\n // There is a trailing &. No more processing is needed.\n if (pairStart === i)\n return out;\n\n if (lastPos < i)\n buf += qs.slice(lastPos, i);\n if (encoded)\n buf = querystring.unescape(buf);\n out.push(buf);\n\n // If `buf` is the key, add an empty value.\n if (!seenSep)\n out.push('');\n\n return out;\n}\n\n// Adapted from querystring's implementation.\n// Ref: https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer\nconst noEscape = [\n/*\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F\n*/\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 - 0x1F\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, // 0x20 - 0x2F\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 0x30 - 0x3F\n 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 0x4F\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50 - 0x5F\n 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 0x6F\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 // 0x70 - 0x7F\n];\n\n// Special version of hexTable that uses `+` for U+0020 SPACE.\nconst paramHexTable = hexTable.slice();\nparamHexTable[0x20] = '+';\n\nfunction encodeStr(str, noEscapeTable, hexTable) {\n const len = str.length;\n if (len === 0)\n return '';\n\n var out = '';\n var lastPos = 0;\n\n for (var i = 0; i < len; i++) {\n var c = str.charCodeAt(i);\n\n // ASCII\n if (c < 0x80) {\n if (noEscapeTable[c] === 1)\n continue;\n if (lastPos < i)\n out += str.slice(lastPos, i);\n lastPos = i + 1;\n out += hexTable[c];\n continue;\n }\n\n if (lastPos < i)\n out += str.slice(lastPos, i);\n\n // Multi-byte characters ...\n if (c < 0x800) {\n lastPos = i + 1;\n out += hexTable[0xC0 | (c >> 6)] +\n hexTable[0x80 | (c & 0x3F)];\n continue;\n }\n if (c < 0xD800 || c >= 0xE000) {\n lastPos = i + 1;\n out += hexTable[0xE0 | (c >> 12)] +\n hexTable[0x80 | ((c >> 6) & 0x3F)] +\n hexTable[0x80 | (c & 0x3F)];\n continue;\n }\n // Surrogate pair\n ++i;\n var c2;\n if (i < len)\n c2 = str.charCodeAt(i) & 0x3FF;\n else {\n // This branch should never happen because all URLSearchParams entries\n // should already be converted to USVString. But, included for\n // completion's sake anyway.\n c2 = 0;\n }\n lastPos = i + 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | c2);\n out += hexTable[0xF0 | (c >> 18)] +\n hexTable[0x80 | ((c >> 12) & 0x3F)] +\n hexTable[0x80 | ((c >> 6) & 0x3F)] +\n hexTable[0x80 | (c & 0x3F)];\n }\n if (lastPos === 0)\n return str;\n if (lastPos < len)\n return out + str.slice(lastPos);\n return out;\n}\n\n// application/x-www-form-urlencoded serializer\n// Ref: https://url.spec.whatwg.org/#concept-urlencoded-serializer\nfunction serializeParams(array) {\n const len = array.length;\n if (len === 0)\n return '';\n\n const firstEncodedParam = encodeStr(array[0], noEscape, paramHexTable);\n const firstEncodedValue = encodeStr(array[1], noEscape, paramHexTable);\n let output = `${firstEncodedParam}=${firstEncodedValue}`;\n\n for (var i = 2; i < len; i += 2) {\n const encodedParam = encodeStr(array[i], noEscape, paramHexTable);\n const encodedValue = encodeStr(array[i + 1], noEscape, paramHexTable);\n output += `&${encodedParam}=${encodedValue}`;\n }\n\n return output;\n}\n\n// Mainly to mitigate func-name-matching ESLint rule\nfunction defineIDLClass(proto, classStr, obj) {\n // https://heycam.github.io/webidl/#dfn-class-string\n Object.defineProperty(proto, Symbol.toStringTag, {\n writable: false,\n enumerable: false,\n configurable: true,\n value: classStr\n });\n\n // https://heycam.github.io/webidl/#es-operations\n for (const key of Object.keys(obj)) {\n Object.defineProperty(proto, key, {\n writable: true,\n enumerable: true,\n configurable: true,\n value: obj[key]\n });\n }\n for (const key of Object.getOwnPropertySymbols(obj)) {\n Object.defineProperty(proto, key, {\n writable: true,\n enumerable: false,\n configurable: true,\n value: obj[key]\n });\n }\n}\n\n// for merge sort\nfunction merge(out, start, mid, end, lBuffer, rBuffer) {\n const sizeLeft = mid - start;\n const sizeRight = end - mid;\n var l, r, o;\n\n for (l = 0; l < sizeLeft; l++)\n lBuffer[l] = out[start + l];\n for (r = 0; r < sizeRight; r++)\n rBuffer[r] = out[mid + r];\n\n l = 0;\n r = 0;\n o = start;\n while (l < sizeLeft && r < sizeRight) {\n if (lBuffer[l] <= rBuffer[r]) {\n out[o++] = lBuffer[l++];\n out[o++] = lBuffer[l++];\n } else {\n out[o++] = rBuffer[r++];\n out[o++] = rBuffer[r++];\n }\n }\n while (l < sizeLeft)\n out[o++] = lBuffer[l++];\n while (r < sizeRight)\n out[o++] = rBuffer[r++];\n}\n\ndefineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {\n append(name, value) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('name', 'value');\n }\n\n name = toUSVString(name);\n value = toUSVString(value);\n this[searchParams].push(name, value);\n update(this[context], this);\n },\n\n delete(name) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 1) {\n throw new ERR_MISSING_ARGS('name');\n }\n\n const list = this[searchParams];\n name = toUSVString(name);\n for (var i = 0; i < list.length;) {\n const cur = list[i];\n if (cur === name) {\n list.splice(i, 2);\n } else {\n i += 2;\n }\n }\n update(this[context], this);\n },\n\n get(name) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 1) {\n throw new ERR_MISSING_ARGS('name');\n }\n\n const list = this[searchParams];\n name = toUSVString(name);\n for (var i = 0; i < list.length; i += 2) {\n if (list[i] === name) {\n return list[i + 1];\n }\n }\n return null;\n },\n\n getAll(name) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 1) {\n throw new ERR_MISSING_ARGS('name');\n }\n\n const list = this[searchParams];\n const values = [];\n name = toUSVString(name);\n for (var i = 0; i < list.length; i += 2) {\n if (list[i] === name) {\n values.push(list[i + 1]);\n }\n }\n return values;\n },\n\n has(name) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 1) {\n throw new ERR_MISSING_ARGS('name');\n }\n\n const list = this[searchParams];\n name = toUSVString(name);\n for (var i = 0; i < list.length; i += 2) {\n if (list[i] === name) {\n return true;\n }\n }\n return false;\n },\n\n set(name, value) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('name', 'value');\n }\n\n const list = this[searchParams];\n name = toUSVString(name);\n value = toUSVString(value);\n\n // If there are any name-value pairs whose name is `name`, in `list`, set\n // the value of the first such name-value pair to `value` and remove the\n // others.\n var found = false;\n for (var i = 0; i < list.length;) {\n const cur = list[i];\n if (cur === name) {\n if (!found) {\n list[i + 1] = value;\n found = true;\n i += 2;\n } else {\n list.splice(i, 2);\n }\n } else {\n i += 2;\n }\n }\n\n // Otherwise, append a new name-value pair whose name is `name` and value\n // is `value`, to `list`.\n if (!found) {\n list.push(name, value);\n }\n\n update(this[context], this);\n },\n\n sort() {\n const a = this[searchParams];\n const len = a.length;\n\n if (len <= 2) {\n // Nothing needs to be done.\n } else if (len < 100) {\n // 100 is found through testing.\n // Simple stable in-place insertion sort\n // Derived from v8/src/js/array.js\n for (var i = 2; i < len; i += 2) {\n var curKey = a[i];\n var curVal = a[i + 1];\n var j;\n for (j = i - 2; j >= 0; j -= 2) {\n if (a[j] > curKey) {\n a[j + 2] = a[j];\n a[j + 3] = a[j + 1];\n } else {\n break;\n }\n }\n a[j + 2] = curKey;\n a[j + 3] = curVal;\n }\n } else {\n // Bottom-up iterative stable merge sort\n const lBuffer = new Array(len);\n const rBuffer = new Array(len);\n for (var step = 2; step < len; step *= 2) {\n for (var start = 0; start < len - 2; start += 2 * step) {\n var mid = start + step;\n var end = mid + step;\n end = end < len ? end : len;\n if (mid > end)\n continue;\n merge(a, start, mid, end, lBuffer, rBuffer);\n }\n }\n }\n\n update(this[context], this);\n },\n\n // https://heycam.github.io/webidl/#es-iterators\n // Define entries here rather than [Symbol.iterator] as the function name\n // must be set to `entries`.\n entries() {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n\n return createSearchParamsIterator(this, 'key+value');\n },\n\n forEach(callback, thisArg = undefined) {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n if (typeof callback !== 'function') {\n throw new ERR_INVALID_CALLBACK();\n }\n\n let list = this[searchParams];\n\n var i = 0;\n while (i < list.length) {\n const key = list[i];\n const value = list[i + 1];\n callback.call(thisArg, value, key, this);\n // in case the URL object's `search` is updated\n list = this[searchParams];\n i += 2;\n }\n },\n\n // https://heycam.github.io/webidl/#es-iterable\n keys() {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n\n return createSearchParamsIterator(this, 'key');\n },\n\n values() {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n\n return createSearchParamsIterator(this, 'value');\n },\n\n // https://heycam.github.io/webidl/#es-stringifier\n // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\n toString() {\n if (!this || !this[searchParams] || this[searchParams][searchParams]) {\n throw new ERR_INVALID_THIS('URLSearchParams');\n }\n\n return serializeParams(this[searchParams]);\n }\n});\n\n// https://heycam.github.io/webidl/#es-iterable-entries\nObject.defineProperty(URLSearchParams.prototype, Symbol.iterator, {\n writable: true,\n configurable: true,\n value: URLSearchParams.prototype.entries\n});\n\n// https://heycam.github.io/webidl/#dfn-default-iterator-object\nfunction createSearchParamsIterator(target, kind) {\n const iterator = Object.create(URLSearchParamsIteratorPrototype);\n iterator[context] = {\n target,\n kind,\n index: 0\n };\n return iterator;\n}\n\n// https://heycam.github.io/webidl/#dfn-iterator-prototype-object\nconst URLSearchParamsIteratorPrototype = Object.create(IteratorPrototype);\n\ndefineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {\n next() {\n if (!this ||\n Object.getPrototypeOf(this) !== URLSearchParamsIteratorPrototype) {\n throw new ERR_INVALID_THIS('URLSearchParamsIterator');\n }\n\n const {\n target,\n kind,\n index\n } = this[context];\n const values = target[searchParams];\n const len = values.length;\n if (index >= len) {\n return {\n value: undefined,\n done: true\n };\n }\n\n const name = values[index];\n const value = values[index + 1];\n this[context].index = index + 2;\n\n let result;\n if (kind === 'key') {\n result = name;\n } else if (kind === 'value') {\n result = value;\n } else {\n result = [name, value];\n }\n\n return {\n value: result,\n done: false\n };\n },\n [util.inspect.custom](recurseTimes, ctx) {\n if (this == null || this[context] == null || this[context].target == null)\n throw new ERR_INVALID_THIS('URLSearchParamsIterator');\n\n if (typeof recurseTimes === 'number' && recurseTimes < 0)\n return ctx.stylize('[Object]', 'special');\n\n const innerOpts = util._extend({}, ctx);\n if (recurseTimes !== null) {\n innerOpts.depth = recurseTimes - 1;\n }\n const {\n target,\n kind,\n index\n } = this[context];\n const output = target[searchParams].slice(index).reduce((prev, cur, i) => {\n const key = i % 2 === 0;\n if (kind === 'key' && key) {\n prev.push(cur);\n } else if (kind === 'value' && !key) {\n prev.push(cur);\n } else if (kind === 'key+value' && !key) {\n prev.push([target[searchParams][index + i - 1], cur]);\n }\n return prev;\n }, []);\n const breakLn = util.inspect(output, innerOpts).includes('\\n');\n const outputStrs = output.map((p) => util.inspect(p, innerOpts));\n let outputStr;\n if (breakLn) {\n outputStr = `\\n ${outputStrs.join(',\\n ')}`;\n } else {\n outputStr = ` ${outputStrs.join(', ')}`;\n }\n return `${this[Symbol.toStringTag]} {${outputStr} }`;\n }\n});\n\nfunction domainToASCII(domain) {\n if (arguments.length < 1)\n throw new ERR_MISSING_ARGS('domain');\n\n // toUSVString is not needed.\n return _domainToASCII(`${domain}`);\n}\n\nfunction domainToUnicode(domain) {\n if (arguments.length < 1)\n throw new ERR_MISSING_ARGS('domain');\n\n // toUSVString is not needed.\n return _domainToUnicode(`${domain}`);\n}\n\n// Utility function that converts a URL object into an ordinary\n// options object as expected by the http.request and https.request\n// APIs.\nfunction urlToOptions(url) {\n var options = {\n protocol: url.protocol,\n hostname: url.hostname.startsWith('[') ?\n url.hostname.slice(1, -1) :\n url.hostname,\n hash: url.hash,\n search: url.search,\n pathname: url.pathname,\n path: `${url.pathname}${url.search}`,\n href: url.href\n };\n if (url.port !== '') {\n options.port = Number(url.port);\n }\n if (url.username || url.password) {\n options.auth = `${url.username}:${url.password}`;\n }\n return options;\n}\n\nfunction getPathFromURLWin32(url) {\n var hostname = url.hostname;\n var pathname = url.pathname;\n for (var n = 0; n < pathname.length; n++) {\n if (pathname[n] === '%') {\n var third = pathname.codePointAt(n + 2) | 0x20;\n if ((pathname[n + 1] === '2' && third === 102) || // 2f 2F /\n (pathname[n + 1] === '5' && third === 99)) { // 5c 5C \\\n throw new ERR_INVALID_FILE_URL_PATH(\n 'must not include encoded \\\\ or / characters'\n );\n }\n }\n }\n pathname = decodeURIComponent(pathname);\n if (hostname !== '') {\n // If hostname is set, then we have a UNC path\n // Pass the hostname through domainToUnicode just in case\n // it is an IDN using punycode encoding. We do not need to worry\n // about percent encoding because the URL parser will have\n // already taken care of that for us. Note that this only\n // causes IDNs with an appropriate `xn--` prefix to be decoded.\n return `//${domainToUnicode(hostname)}${pathname}`;\n } else {\n // Otherwise, it's a local path that requires a drive letter\n var letter = pathname.codePointAt(1) | 0x20;\n var sep = pathname[2];\n if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z || // a..z A..Z\n (sep !== ':')) {\n throw new ERR_INVALID_FILE_URL_PATH('must be absolute');\n }\n return pathname.slice(1);\n }\n}\n\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n throw new ERR_INVALID_FILE_URL_HOST(platform);\n }\n var pathname = url.pathname;\n for (var n = 0; n < pathname.length; n++) {\n if (pathname[n] === '%') {\n var third = pathname.codePointAt(n + 2) | 0x20;\n if (pathname[n + 1] === '2' && third === 102) {\n throw new ERR_INVALID_FILE_URL_PATH(\n 'must not include encoded / characters'\n );\n }\n }\n }\n return decodeURIComponent(pathname);\n}\n\nfunction getPathFromURL(path) {\n if (path == null || !path[searchParams] ||\n !path[searchParams][searchParams]) {\n return path;\n }\n if (path.protocol !== 'file:')\n throw new ERR_INVALID_URL_SCHEME('file');\n return isWindows ? getPathFromURLWin32(path) : getPathFromURLPosix(path);\n}\n\n// We percent-encode % character when converting from file path to URL,\n// as this is the only character that won't be percent encoded by\n// default URL percent encoding when pathname is set.\nconst percentRegEx = /%/g;\nfunction getURLFromFilePath(filepath) {\n const tmp = new URL('file://');\n if (filepath.includes('%'))\n filepath = filepath.replace(percentRegEx, '%25');\n tmp.pathname = filepath;\n return tmp;\n}\n\nfunction NativeURL(ctx) {\n this[context] = ctx;\n}\nNativeURL.prototype = URL.prototype;\n\nfunction constructUrl(flags, protocol, username, password,\n host, port, path, query, fragment) {\n var ctx = new URLContext();\n ctx.flags = flags;\n ctx.scheme = protocol;\n ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';\n ctx.password = (flags & URL_FLAGS_HAS_PASSWORD) !== 0 ? password : '';\n ctx.port = port;\n ctx.path = (flags & URL_FLAGS_HAS_PATH) !== 0 ? path : [];\n ctx.query = query;\n ctx.fragment = fragment;\n ctx.host = host;\n const url = new NativeURL(ctx);\n url[searchParams] = new URLSearchParams();\n url[searchParams][context] = url;\n initSearchParams(url[searchParams], query);\n return url;\n}\nsetURLConstructor(constructUrl);\n\nmodule.exports = {\n toUSVString,\n getPathFromURL,\n getURLFromFilePath,\n URL,\n URLSearchParams,\n domainToASCII,\n domainToUnicode,\n urlToOptions,\n formatSymbol: kFormat,\n searchParamsSymbol: searchParams,\n encodeStr\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 40335,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 40333,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "toUSVString",
"ranges": [
{
"startOffset": 1841,
"endOffset": 2137,
"count": 2
},
{
"startOffset": 2094,
"endOffset": 2136,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "serializeTupleOrigin",
"ranges": [
{
"startOffset": 2349,
"endOffset": 2467,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "URLContext",
"ranges": [
{
"startOffset": 2871,
"endOffset": 3094,
"count": 10
}
],
"isBlockCoverage": true
},
{
"functionName": "URLSearchParams",
"ranges": [
{
"startOffset": 3384,
"endOffset": 5752,
"count": 10
},
{
"startOffset": 3499,
"endOffset": 5690,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 5756,
"endOffset": 6850,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParseComplete",
"ranges": [
{
"startOffset": 6854,
"endOffset": 7545,
"count": 8
},
{
"startOffset": 7107,
"endOffset": 7117,
"count": 0
},
{
"startOffset": 7180,
"endOffset": 7190,
"count": 0
},
{
"startOffset": 7271,
"endOffset": 7275,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "onParseError",
"ranges": [
{
"startOffset": 7547,
"endOffset": 7668,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "parse",
"ranges": [
{
"startOffset": 7720,
"endOffset": 7951,
"count": 8
},
{
"startOffset": 7783,
"endOffset": 7798,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "onParseProtocolComplete",
"ranges": [
{
"startOffset": 7953,
"endOffset": 8298,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParseHostnameComplete",
"ranges": [
{
"startOffset": 8300,
"endOffset": 8646,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParsePortComplete",
"ranges": [
{
"startOffset": 8648,
"endOffset": 8810,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParseHostComplete",
"ranges": [
{
"startOffset": 8812,
"endOffset": 9118,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParsePathComplete",
"ranges": [
{
"startOffset": 9120,
"endOffset": 9614,
"count": 6
},
{
"startOffset": 9386,
"endOffset": 9454,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "onParseSearchComplete",
"ranges": [
{
"startOffset": 9616,
"endOffset": 9784,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onParseHashComplete",
"ranges": [
{
"startOffset": 9786,
"endOffset": 9956,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "URL",
"ranges": [
{
"startOffset": 9972,
"endOffset": 10154,
"count": 8
},
{
"startOffset": 10085,
"endOffset": 10120,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 10158,
"endOffset": 10239,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 10243,
"endOffset": 10336,
"count": 25
},
{
"startOffset": 10332,
"endOffset": 10335,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 10411,
"endOffset": 10611,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 10615,
"endOffset": 11587,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "format",
"ranges": [
{
"startOffset": 11757,
"endOffset": 12951,
"count": 6
},
{
"startOffset": 11842,
"endOffset": 11903,
"count": 0
},
{
"startOffset": 12316,
"endOffset": 12477,
"count": 0
},
{
"startOffset": 12509,
"endOffset": 12551,
"count": 0
},
{
"startOffset": 12610,
"endOffset": 12632,
"count": 0
},
{
"startOffset": 12640,
"endOffset": 12704,
"count": 0
},
{
"startOffset": 12816,
"endOffset": 12839,
"count": 0
},
{
"startOffset": 12901,
"endOffset": 12927,
"count": 0
},
{
"startOffset": 12945,
"endOffset": 12950,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "toString",
"ranges": [
{
"startOffset": 13226,
"endOffset": 13285,
"count": 4
},
{
"startOffset": 13279,
"endOffset": 13284,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 13351,
"endOffset": 13396,
"count": 2
},
{
"startOffset": 13390,
"endOffset": 13395,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 13402,
"endOffset": 13508,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 13589,
"endOffset": 14223,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 14293,
"endOffset": 14341,
"count": 4
},
{
"startOffset": 14335,
"endOffset": 14340,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 14347,
"endOffset": 14718,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 14788,
"endOffset": 14838,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 14844,
"endOffset": 15242,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 15312,
"endOffset": 15362,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 15368,
"endOffset": 15766,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 15832,
"endOffset": 15988,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 15994,
"endOffset": 16286,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 16356,
"endOffset": 16408,
"count": 10
},
{
"startOffset": 16402,
"endOffset": 16407,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 16414,
"endOffset": 16714,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 16780,
"endOffset": 16880,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 16886,
"endOffset": 17204,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 17274,
"endOffset": 17469,
"count": 19
},
{
"startOffset": 17353,
"endOffset": 17372,
"count": 0
},
{
"startOffset": 17414,
"endOffset": 17424,
"count": 0
},
{
"startOffset": 17463,
"endOffset": 17468,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 17475,
"endOffset": 17696,
"count": 6
},
{
"startOffset": 17585,
"endOffset": 17592,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 17764,
"endOffset": 17903,
"count": 2
},
{
"startOffset": 17836,
"endOffset": 17851,
"count": 0
},
{
"startOffset": 17871,
"endOffset": 17902,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 17909,
"endOffset": 18402,
"count": 2
},
{
"startOffset": 18095,
"endOffset": 18344,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 18489,
"endOffset": 18535,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 18601,
"endOffset": 18752,
"count": 2
},
{
"startOffset": 18679,
"endOffset": 18697,
"count": 0
},
{
"startOffset": 18717,
"endOffset": 18751,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 18758,
"endOffset": 19177,
"count": 2
},
{
"startOffset": 18972,
"endOffset": 19176,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "toJSON",
"ranges": [
{
"startOffset": 19323,
"endOffset": 19380,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "update",
"ranges": [
{
"startOffset": 19390,
"endOffset": 19695,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "initSearchParams",
"ranges": [
{
"startOffset": 19697,
"endOffset": 19837,
"count": 12
},
{
"startOffset": 19790,
"endOffset": 19836,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "parseParams",
"ranges": [
{
"startOffset": 19946,
"endOffset": 22301,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "encodeStr",
"ranges": [
{
"startOffset": 23150,
"endOffset": 24704,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "serializeParams",
"ranges": [
{
"startOffset": 24821,
"endOffset": 25381,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "defineIDLClass",
"ranges": [
{
"startOffset": 25436,
"endOffset": 26130,
"count": 2
},
{
"startOffset": 25777,
"endOffset": 25924,
"count": 13
},
{
"startOffset": 25980,
"endOffset": 26128,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "merge",
"ranges": [
{
"startOffset": 26150,
"endOffset": 26780,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "append",
"ranges": [
{
"startOffset": 26847,
"endOffset": 27234,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "delete",
"ranges": [
{
"startOffset": 27239,
"endOffset": 27738,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 27743,
"endOffset": 28177,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getAll",
"ranges": [
{
"startOffset": 28182,
"endOffset": 28650,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "has",
"ranges": [
{
"startOffset": 28655,
"endOffset": 29083,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "set",
"ranges": [
{
"startOffset": 29088,
"endOffset": 30114,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "sort",
"ranges": [
{
"startOffset": 30119,
"endOffset": 31290,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "entries",
"ranges": [
{
"startOffset": 31453,
"endOffset": 31662,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "forEach",
"ranges": [
{
"startOffset": 31667,
"endOffset": 32231,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "keys",
"ranges": [
{
"startOffset": 32286,
"endOffset": 32486,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "values",
"ranges": [
{
"startOffset": 32491,
"endOffset": 32695,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toString",
"ranges": [
{
"startOffset": 32828,
"endOffset": 33028,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createSearchParamsIterator",
"ranges": [
{
"startOffset": 33310,
"endOffset": 33514,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "next",
"ranges": [
{
"startOffset": 33739,
"endOffset": 34493,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "defineIDLClass",
"ranges": [
{
"startOffset": 34497,
"endOffset": 35738,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "domainToASCII",
"ranges": [
{
"startOffset": 35744,
"endOffset": 35919,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "domainToUnicode",
"ranges": [
{
"startOffset": 35921,
"endOffset": 36100,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "urlToOptions",
"ranges": [
{
"startOffset": 36243,
"endOffset": 36736,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getPathFromURLWin32",
"ranges": [
{
"startOffset": 36738,
"endOffset": 38092,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getPathFromURLPosix",
"ranges": [
{
"startOffset": 38094,
"endOffset": 38594,
"count": 4
},
{
"startOffset": 38157,
"endOffset": 38213,
"count": 0
},
{
"startOffset": 38289,
"endOffset": 38553,
"count": 316
},
{
"startOffset": 38320,
"endOffset": 38549,
"count": 0
},
{
"startOffset": 38592,
"endOffset": 38593,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getPathFromURL",
"ranges": [
{
"startOffset": 38596,
"endOffset": 38893,
"count": 8
},
{
"startOffset": 38670,
"endOffset": 38712,
"count": 4
},
{
"startOffset": 38714,
"endOffset": 38736,
"count": 4
},
{
"startOffset": 38732,
"endOffset": 38736,
"count": 0
},
{
"startOffset": 38736,
"endOffset": 38774,
"count": 4
},
{
"startOffset": 38774,
"endOffset": 38815,
"count": 0
},
{
"startOffset": 38815,
"endOffset": 38835,
"count": 4
},
{
"startOffset": 38835,
"endOffset": 38862,
"count": 0
},
{
"startOffset": 38863,
"endOffset": 38890,
"count": 4
},
{
"startOffset": 38891,
"endOffset": 38892,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getURLFromFilePath",
"ranges": [
{
"startOffset": 39114,
"endOffset": 39314,
"count": 6
},
{
"startOffset": 39222,
"endOffset": 39271,
"count": 0
},
{
"startOffset": 39312,
"endOffset": 39313,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "NativeURL",
"ranges": [
{
"startOffset": 39316,
"endOffset": 39366,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "constructUrl",
"ranges": [
{
"startOffset": 39405,
"endOffset": 40068,
"count": 2
},
{
"startOffset": 39655,
"endOffset": 39665,
"count": 0
},
{
"startOffset": 39728,
"endOffset": 39738,
"count": 0
},
{
"startOffset": 39819,
"endOffset": 39823,
"count": 0
},
{
"startOffset": 40066,
"endOffset": 40067,
"count": 0
}
],
"isBlockCoverage": true
}
]
},
{
"url": "internal/util.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_NO_CRYPTO,\n ERR_UNKNOWN_SIGNAL\n} = require('internal/errors').codes;\nconst { signals } = process.binding('constants').os;\n\nconst {\n getHiddenValue,\n setHiddenValue,\n arrow_message_private_symbol: kArrowMessagePrivateSymbolIndex,\n decorated_private_symbol: kDecoratedPrivateSymbolIndex\n} = process.binding('util');\nconst { errmap } = process.binding('uv');\n\nconst noCrypto = !process.versions.openssl;\n\nconst experimentalWarnings = new Set();\n\nconst colorRegExp = /\\u001b\\[\\d\\d?m/g; // eslint-disable-line no-control-regex\n\nfunction removeColors(str) {\n return str.replace(colorRegExp, '');\n}\n\nfunction isError(e) {\n return objectToString(e) === '[object Error]' || e instanceof Error;\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n// Keep a list of deprecation codes that have been warned on so we only warn on\n// each one once.\nconst codesWarned = {};\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nfunction deprecate(fn, msg, code) {\n if (process.noDeprecation === true) {\n return fn;\n }\n\n if (code !== undefined && typeof code !== 'string')\n throw new ERR_INVALID_ARG_TYPE('code', 'string', code);\n\n let warned = false;\n function deprecated(...args) {\n if (!warned) {\n warned = true;\n if (code !== undefined) {\n if (!codesWarned[code]) {\n process.emitWarning(msg, 'DeprecationWarning', code, deprecated);\n codesWarned[code] = true;\n }\n } else {\n process.emitWarning(msg, 'DeprecationWarning', deprecated);\n }\n }\n if (new.target) {\n return Reflect.construct(fn, args, new.target);\n }\n return fn.apply(this, args);\n }\n\n // The wrapper will keep the same prototype as fn to maintain prototype chain\n Object.setPrototypeOf(deprecated, fn);\n if (fn.prototype) {\n // Setting this (rather than using Object.setPrototype, as above) ensures\n // that calling the unwrapped constructor gives an instanceof the wrapped\n // constructor.\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\nfunction decorateErrorStack(err) {\n if (!(isError(err) && err.stack) ||\n getHiddenValue(err, kDecoratedPrivateSymbolIndex) === true)\n return;\n\n const arrow = getHiddenValue(err, kArrowMessagePrivateSymbolIndex);\n\n if (arrow) {\n err.stack = arrow + err.stack;\n setHiddenValue(err, kDecoratedPrivateSymbolIndex, true);\n }\n}\n\nfunction assertCrypto() {\n if (noCrypto)\n throw new ERR_NO_CRYPTO();\n}\n\n// Return undefined if there is no match.\n// Move the \"slow cases\" to a separate function to make sure this function gets\n// inlined properly. That prioritizes the common case.\nfunction normalizeEncoding(enc) {\n if (enc == null || enc === 'utf8' || enc === 'utf-8') return 'utf8';\n return slowCases(enc);\n}\n\nfunction slowCases(enc) {\n switch (enc.length) {\n case 4:\n if (enc === 'UTF8') return 'utf8';\n if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le';\n enc = `${enc}`.toLowerCase();\n if (enc === 'utf8') return 'utf8';\n if (enc === 'ucs2') return 'utf16le';\n break;\n case 3:\n if (enc === 'hex' || enc === 'HEX' || `${enc}`.toLowerCase() === 'hex')\n return 'hex';\n break;\n case 5:\n if (enc === 'ascii') return 'ascii';\n if (enc === 'ucs-2') return 'utf16le';\n if (enc === 'UTF-8') return 'utf8';\n if (enc === 'ASCII') return 'ascii';\n if (enc === 'UCS-2') return 'utf16le';\n enc = `${enc}`.toLowerCase();\n if (enc === 'utf-8') return 'utf8';\n if (enc === 'ascii') return 'ascii';\n if (enc === 'ucs-2') return 'utf16le';\n break;\n case 6:\n if (enc === 'base64') return 'base64';\n if (enc === 'latin1' || enc === 'binary') return 'latin1';\n if (enc === 'BASE64') return 'base64';\n if (enc === 'LATIN1' || enc === 'BINARY') return 'latin1';\n enc = `${enc}`.toLowerCase();\n if (enc === 'base64') return 'base64';\n if (enc === 'latin1' || enc === 'binary') return 'latin1';\n break;\n case 7:\n if (enc === 'utf16le' || enc === 'UTF16LE' ||\n `${enc}`.toLowerCase() === 'utf16le')\n return 'utf16le';\n break;\n case 8:\n if (enc === 'utf-16le' || enc === 'UTF-16LE' ||\n `${enc}`.toLowerCase() === 'utf-16le')\n return 'utf16le';\n break;\n default:\n if (enc === '') return 'utf8';\n }\n}\n\nfunction emitExperimentalWarning(feature) {\n if (experimentalWarnings.has(feature)) return;\n const msg = `${feature} is an experimental feature. This feature could ` +\n 'change at any time';\n experimentalWarnings.add(feature);\n process.emitWarning(msg, 'ExperimentalWarning');\n}\n\nfunction filterDuplicateStrings(items, low) {\n const map = new Map();\n for (var i = 0; i < items.length; i++) {\n const item = items[i];\n const key = item.toLowerCase();\n if (low) {\n map.set(key, key);\n } else {\n map.set(key, item);\n }\n }\n return Array.from(map.values()).sort();\n}\n\nfunction cachedResult(fn) {\n let result;\n return () => {\n if (result === undefined)\n result = fn();\n return result.slice();\n };\n}\n\n// Useful for Wrapping an ES6 Class with a constructor Function that\n// does not require the new keyword. For instance:\n// class A { constructor(x) {this.x = x;}}\n// const B = createClassWrapper(A);\n// B() instanceof A // true\n// B() instanceof B // true\nfunction createClassWrapper(type) {\n function fn(...args) {\n return Reflect.construct(type, args, new.target || type);\n }\n // Mask the wrapper function name and length values\n Object.defineProperties(fn, {\n name: { value: type.name },\n length: { value: type.length }\n });\n Object.setPrototypeOf(fn, type);\n fn.prototype = type.prototype;\n return fn;\n}\n\nlet signalsToNamesMapping;\nfunction getSignalsToNamesMapping() {\n if (signalsToNamesMapping !== undefined)\n return signalsToNamesMapping;\n\n signalsToNamesMapping = Object.create(null);\n for (var key in signals) {\n signalsToNamesMapping[signals[key]] = key;\n }\n\n return signalsToNamesMapping;\n}\n\nfunction convertToValidSignal(signal) {\n if (typeof signal === 'number' && getSignalsToNamesMapping()[signal])\n return signal;\n\n if (typeof signal === 'string') {\n const signalName = signals[signal.toUpperCase()];\n if (signalName) return signalName;\n }\n\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}\n\nfunction getConstructorOf(obj) {\n while (obj) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, 'constructor');\n if (descriptor !== undefined &&\n typeof descriptor.value === 'function' &&\n descriptor.value.name !== '') {\n return descriptor.value;\n }\n\n obj = Object.getPrototypeOf(obj);\n }\n\n return null;\n}\n\nfunction getSystemErrorName(err) {\n const entry = errmap.get(err);\n return entry ? entry[0] : `Unknown system error ${err}`;\n}\n\nconst kCustomPromisifiedSymbol = Symbol('util.promisify.custom');\nconst kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs');\n\nfunction promisify(original) {\n if (typeof original !== 'function')\n throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);\n\n if (original[kCustomPromisifiedSymbol]) {\n const fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('util.promisify.custom', 'Function', fn);\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n // Names to create an object from in case the callback receives multiple\n // arguments, e.g. ['stdout', 'stderr'] for child_process.exec.\n const argumentNames = original[kCustomPromisifyArgsSymbol];\n\n function fn(...args) {\n return new Promise((resolve, reject) => {\n original.call(this, ...args, (err, ...values) => {\n if (err) {\n return reject(err);\n }\n if (argumentNames !== undefined && values.length > 1) {\n const obj = {};\n for (var i = 0; i < argumentNames.length; i++)\n obj[argumentNames[i]] = values[i];\n resolve(obj);\n } else {\n resolve(values[0]);\n }\n });\n });\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n Object.getOwnPropertyDescriptors(original)\n );\n}\n\npromisify.custom = kCustomPromisifiedSymbol;\n\n// The build-in Array#join is slower in v8 6.0\nfunction join(output, separator) {\n let str = '';\n if (output.length !== 0) {\n for (var i = 0; i < output.length - 1; i++) {\n // It is faster not to use a template string here\n str += output[i];\n str += separator;\n }\n str += output[i];\n }\n return str;\n}\n\n// As of V8 6.6, depending on the size of the array, this is anywhere\n// between 1.5-10x faster than the two-arg version of Array#splice()\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nconst kNodeModulesRE = /^(.*)[\\\\/]node_modules[\\\\/]/;\n\nlet getStructuredStack;\n\nfunction isInsideNodeModules() {\n if (getStructuredStack === undefined) {\n // Lazy-load to avoid a circular dependency.\n const { runInNewContext } = require('vm');\n // Use `runInNewContext()` to get something tamper-proof and\n // side-effect-free. Since this is currently only used for a deprecated API,\n // the perf implications should be okay.\n getStructuredStack = runInNewContext(`(function() {\n Error.prepareStackTrace = function(err, trace) {\n err.stack = trace;\n };\n Error.stackTraceLimit = Infinity;\n\n return function structuredStack() {\n return new Error().stack;\n };\n })()`, {}, { filename: 'structured-stack' });\n }\n\n const stack = getStructuredStack();\n\n // Iterate over all stack frames and look for the first one not coming\n // from inside Node.js itself:\n if (Array.isArray(stack)) {\n for (const frame of stack) {\n const filename = frame.getFileName();\n // If a filename does not start with / or contain \\,\n // it's likely from Node.js core.\n if (!/^\\/|\\\\/.test(filename))\n continue;\n return kNodeModulesRE.test(filename);\n }\n }\n return false;\n}\n\n\nmodule.exports = {\n assertCrypto,\n cachedResult,\n convertToValidSignal,\n createClassWrapper,\n decorateErrorStack,\n deprecate,\n emitExperimentalWarning,\n filterDuplicateStrings,\n getConstructorOf,\n getSystemErrorName,\n isError,\n isInsideNodeModules,\n join,\n normalizeEncoding,\n objectToString,\n promisify,\n spliceOne,\n removeColors,\n\n // Symbol used to customize promisify conversion\n customPromisifyArgs: kCustomPromisifyArgsSymbol,\n\n // Symbol used to provide a custom inspect function for an object as an\n // alternative to using 'inspect'\n customInspectSymbol: Symbol('util.inspect.custom'),\n\n // Used by the buffer module to capture an internal reference to the\n // default isEncoding implementation, just in case userland overrides it.\n kIsEncodingSymbol: Symbol('kIsEncodingSymbol'),\n kExpandStackSymbol: Symbol('kExpandStackSymbol')\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 11425,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 11423,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "removeColors",
"ranges": [
{
"startOffset": 628,
"endOffset": 697,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isError",
"ranges": [
{
"startOffset": 699,
"endOffset": 793,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "objectToString",
"ranges": [
{
"startOffset": 795,
"endOffset": 869,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "deprecate",
"ranges": [
{
"startOffset": 1147,
"endOffset": 2245,
"count": 16
},
{
"startOffset": 1221,
"endOffset": 1241,
"count": 0
},
{
"startOffset": 1301,
"endOffset": 1356,
"count": 0
},
{
"startOffset": 1999,
"endOffset": 2221,
"count": 14
},
{
"startOffset": 2243,
"endOffset": 2244,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "deprecated",
"ranges": [
{
"startOffset": 1382,
"endOffset": 1856,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "decorateErrorStack",
"ranges": [
{
"startOffset": 2247,
"endOffset": 2586,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "assertCrypto",
"ranges": [
{
"startOffset": 2588,
"endOffset": 2662,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "normalizeEncoding",
"ranges": [
{
"startOffset": 2841,
"endOffset": 2972,
"count": 1
},
{
"startOffset": 2911,
"endOffset": 2929,
"count": 0
},
{
"startOffset": 2945,
"endOffset": 2971,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "slowCases",
"ranges": [
{
"startOffset": 2974,
"endOffset": 4554,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitExperimentalWarning",
"ranges": [
{
"startOffset": 4556,
"endOffset": 4844,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "filterDuplicateStrings",
"ranges": [
{
"startOffset": 4846,
"endOffset": 5155,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "cachedResult",
"ranges": [
{
"startOffset": 5157,
"endOffset": 5300,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createClassWrapper",
"ranges": [
{
"startOffset": 5565,
"endOffset": 5933,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getSignalsToNamesMapping",
"ranges": [
{
"startOffset": 5962,
"endOffset": 6239,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "convertToValidSignal",
"ranges": [
{
"startOffset": 6241,
"endOffset": 6548,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getConstructorOf",
"ranges": [
{
"startOffset": 6550,
"endOffset": 6898,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "getSystemErrorName",
"ranges": [
{
"startOffset": 6900,
"endOffset": 7028,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "promisify",
"ranges": [
{
"startOffset": 7163,
"endOffset": 8656,
"count": 1
},
{
"startOffset": 7236,
"endOffset": 7301,
"count": 0
},
{
"startOffset": 7345,
"endOffset": 7675,
"count": 0
},
{
"startOffset": 8654,
"endOffset": 8655,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "fn",
"ranges": [
{
"startOffset": 7883,
"endOffset": 8364,
"count": 1
},
{
"startOffset": 8360,
"endOffset": 8363,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "Promise",
"ranges": [
{
"startOffset": 7929,
"endOffset": 8358,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "original.call.values",
"ranges": [
{
"startOffset": 7987,
"endOffset": 8350,
"count": 1
},
{
"startOffset": 8026,
"endOffset": 8067,
"count": 0
},
{
"startOffset": 8108,
"endOffset": 8128,
"count": 0
},
{
"startOffset": 8130,
"endOffset": 8295,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "join",
"ranges": [
{
"startOffset": 8751,
"endOffset": 9032,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "spliceOne",
"ranges": [
{
"startOffset": 9173,
"endOffset": 9300,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isInsideNodeModules",
"ranges": [
{
"startOffset": 9382,
"endOffset": 10548,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/util/types.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst ReflectApply = Reflect.apply;\n\n// This function is borrowed from the function with the same name on V8 Extras'\n// `utils` object. V8 implements Reflect.apply very efficiently in conjunction\n// with the spread syntax, such that no additional special case is needed for\n// function calls w/o arguments.\n// Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156\nfunction uncurryThis(func) {\n return (thisArg, ...args) => ReflectApply(func, thisArg, args);\n}\n\nconst TypedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);\n\nconst TypedArrayProto_toStringTag =\n uncurryThis(\n Object.getOwnPropertyDescriptor(TypedArrayPrototype,\n Symbol.toStringTag).get);\n\n// Cached to make sure no userland code can tamper with it.\nconst isArrayBufferView = ArrayBuffer.isView;\n\nfunction isTypedArray(value) {\n return TypedArrayProto_toStringTag(value) !== undefined;\n}\n\nfunction isUint8Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Uint8Array';\n}\n\nfunction isUint8ClampedArray(value) {\n return TypedArrayProto_toStringTag(value) === 'Uint8ClampedArray';\n}\n\nfunction isUint16Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Uint16Array';\n}\n\nfunction isUint32Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Uint32Array';\n}\n\nfunction isInt8Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Int8Array';\n}\n\nfunction isInt16Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Int16Array';\n}\n\nfunction isInt32Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Int32Array';\n}\n\nfunction isFloat32Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Float32Array';\n}\n\nfunction isFloat64Array(value) {\n return TypedArrayProto_toStringTag(value) === 'Float64Array';\n}\n\nfunction isBigInt64Array(value) {\n return TypedArrayProto_toStringTag(value) === 'BigInt64Array';\n}\n\nfunction isBigUint64Array(value) {\n return TypedArrayProto_toStringTag(value) === 'BigUint64Array';\n}\n\nmodule.exports = {\n isArrayBufferView,\n isTypedArray,\n isUint8Array,\n isUint8ClampedArray,\n isUint16Array,\n isUint32Array,\n isInt8Array,\n isInt16Array,\n isInt32Array,\n isFloat32Array,\n isFloat64Array,\n isBigInt64Array,\n isBigUint64Array\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 2378,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 2376,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "uncurryThis",
"ranges": [
{
"startOffset": 478,
"endOffset": 574,
"count": 1
},
{
"startOffset": 572,
"endOffset": 573,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "args",
"ranges": [
{
"startOffset": 516,
"endOffset": 571,
"count": 8
}
],
"isBlockCoverage": true
},
{
"functionName": "isTypedArray",
"ranges": [
{
"startOffset": 934,
"endOffset": 1025,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isUint8Array",
"ranges": [
{
"startOffset": 1027,
"endOffset": 1121,
"count": 8
},
{
"startOffset": 1119,
"endOffset": 1120,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "isUint8ClampedArray",
"ranges": [
{
"startOffset": 1123,
"endOffset": 1231,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isUint16Array",
"ranges": [
{
"startOffset": 1233,
"endOffset": 1329,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isUint32Array",
"ranges": [
{
"startOffset": 1331,
"endOffset": 1427,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isInt8Array",
"ranges": [
{
"startOffset": 1429,
"endOffset": 1521,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isInt16Array",
"ranges": [
{
"startOffset": 1523,
"endOffset": 1617,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isInt32Array",
"ranges": [
{
"startOffset": 1619,
"endOffset": 1713,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isFloat32Array",
"ranges": [
{
"startOffset": 1715,
"endOffset": 1813,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isFloat64Array",
"ranges": [
{
"startOffset": 1815,
"endOffset": 1913,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isBigInt64Array",
"ranges": [
{
"startOffset": 1915,
"endOffset": 2015,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "isBigUint64Array",
"ranges": [
{
"startOffset": 2017,
"endOffset": 2119,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/validators.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_OUT_OF_RANGE\n} = require('internal/errors').codes;\n\nfunction isInt32(value) {\n return value === (value | 0);\n}\n\nfunction isUint32(value) {\n return value === (value >>> 0);\n}\n\nconst octalReg = /^[0-7]+$/;\nconst modeDesc = 'must be a 32-bit unsigned integer or an octal string';\n\n/**\n * Validate values that will be converted into mode_t (the S_* constants).\n * Only valid numbers and octal strings are allowed. They could be converted\n * to 32-bit unsigned integers or non-negative signed integers in the C++\n * land, but any value higher than 0o777 will result in platform-specific\n * behaviors.\n *\n * @param {*} value Values to be validated\n * @param {string} name Name of the argument\n * @param {number} def If specified, will be returned for invalid values\n * @returns {number}\n */\nfunction validateMode(value, name, def) {\n if (isUint32(value)) {\n return value;\n }\n\n if (typeof value === 'number') {\n if (!Number.isInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value);\n } else {\n // 2 ** 32 === 4294967296\n throw new ERR_OUT_OF_RANGE(name, '>= 0 && < 4294967296', value);\n }\n }\n\n if (typeof value === 'string') {\n if (!octalReg.test(value)) {\n throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);\n }\n const parsed = parseInt(value, 8);\n return parsed;\n }\n\n // TODO(BridgeAR): Only return `def` in case `value == null`\n if (def !== undefined) {\n return def;\n }\n\n throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);\n}\n\nfunction validateInteger(value, name) {\n let err;\n\n if (typeof value !== 'number')\n err = new ERR_INVALID_ARG_TYPE(name, 'number', value);\n else if (!Number.isSafeInteger(value))\n err = new ERR_OUT_OF_RANGE(name, 'an integer', value);\n\n if (err) {\n Error.captureStackTrace(err, validateInteger);\n throw err;\n }\n\n return value;\n}\n\nfunction validateInt32(value, name, min = -2147483648, max = 2147483647) {\n // The defaults for min and max correspond to the limits of 32-bit integers.\n if (!isInt32(value)) {\n let err;\n if (typeof value !== 'number') {\n err = new ERR_INVALID_ARG_TYPE(name, 'number', value);\n } else if (!Number.isInteger(value)) {\n err = new ERR_OUT_OF_RANGE(name, 'an integer', value);\n } else {\n err = new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n Error.captureStackTrace(err, validateInt32);\n throw err;\n } else if (value < min || value > max) {\n const err = new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n Error.captureStackTrace(err, validateInt32);\n throw err;\n }\n\n return value;\n}\n\nfunction validateUint32(value, name, positive) {\n if (!isUint32(value)) {\n let err;\n if (typeof value !== 'number') {\n err = new ERR_INVALID_ARG_TYPE(name, 'number', value);\n } else if (!Number.isInteger(value)) {\n err = new ERR_OUT_OF_RANGE(name, 'an integer', value);\n } else {\n const min = positive ? 1 : 0;\n // 2 ** 32 === 4294967296\n err = new ERR_OUT_OF_RANGE(name, `>= ${min} && < 4294967296`, value);\n }\n Error.captureStackTrace(err, validateUint32);\n throw err;\n } else if (positive && value === 0) {\n const err = new ERR_OUT_OF_RANGE(name, '>= 1 && < 4294967296', value);\n Error.captureStackTrace(err, validateUint32);\n throw err;\n }\n\n return value;\n}\n\nfunction validateString(value, name) {\n if (typeof value !== 'string')\n throw new ERR_INVALID_ARG_TYPE(name, 'string', value);\n}\n\nmodule.exports = {\n isInt32,\n isUint32,\n validateMode,\n validateInteger,\n validateInt32,\n validateUint32,\n validateString\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 3730,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 3728,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "isInt32",
"ranges": [
{
"startOffset": 177,
"endOffset": 236,
"count": 2
},
{
"startOffset": 234,
"endOffset": 235,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "isUint32",
"ranges": [
{
"startOffset": 238,
"endOffset": 300,
"count": 5
},
{
"startOffset": 298,
"endOffset": 299,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateMode",
"ranges": [
{
"startOffset": 912,
"endOffset": 1630,
"count": 1
},
{
"startOffset": 996,
"endOffset": 1629,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateInteger",
"ranges": [
{
"startOffset": 1632,
"endOffset": 1978,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateInt32",
"ranges": [
{
"startOffset": 1980,
"endOffset": 2736,
"count": 2
},
{
"startOffset": 2157,
"endOffset": 2533,
"count": 0
},
{
"startOffset": 2571,
"endOffset": 2717,
"count": 0
},
{
"startOffset": 2734,
"endOffset": 2735,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateUint32",
"ranges": [
{
"startOffset": 2738,
"endOffset": 3458,
"count": 2
},
{
"startOffset": 2811,
"endOffset": 3259,
"count": 0
},
{
"startOffset": 3278,
"endOffset": 3292,
"count": 0
},
{
"startOffset": 3294,
"endOffset": 3439,
"count": 0
},
{
"startOffset": 3456,
"endOffset": 3457,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "validateString",
"ranges": [
{
"startOffset": 3460,
"endOffset": 3592,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "internal/vm/source_text_module.js",
"source": "(function (exports, require, module, process) {'use strict';\n\nconst { internalBinding } = require('internal/bootstrap/loaders');\nconst { URL } = require('internal/url');\nconst { isContext } = process.binding('contextify');\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_OUT_OF_RANGE,\n ERR_VM_MODULE_ALREADY_LINKED,\n ERR_VM_MODULE_DIFFERENT_CONTEXT,\n ERR_VM_MODULE_LINKING_ERRORED,\n ERR_VM_MODULE_NOT_LINKED,\n ERR_VM_MODULE_NOT_MODULE,\n ERR_VM_MODULE_STATUS\n} = require('internal/errors').codes;\nconst {\n getConstructorOf,\n customInspectSymbol,\n emitExperimentalWarning\n} = require('internal/util');\nconst { SafePromise } = require('internal/safe_globals');\n\nconst {\n ModuleWrap,\n kUninstantiated,\n kInstantiating,\n kInstantiated,\n kEvaluating,\n kEvaluated,\n kErrored,\n} = internalBinding('module_wrap');\n\nconst STATUS_MAP = {\n [kUninstantiated]: 'uninstantiated',\n [kInstantiating]: 'instantiating',\n [kInstantiated]: 'instantiated',\n [kEvaluating]: 'evaluating',\n [kEvaluated]: 'evaluated',\n [kErrored]: 'errored',\n};\n\nlet globalModuleId = 0;\nconst perContextModuleId = new WeakMap();\nconst wrapMap = new WeakMap();\nconst dependencyCacheMap = new WeakMap();\nconst linkingStatusMap = new WeakMap();\n// vm.SourceTextModule -> function\nconst initImportMetaMap = new WeakMap();\n// ModuleWrap -> vm.SourceTextModule\nconst wrapToModuleMap = new WeakMap();\nconst defaultModuleName = 'vm:module';\n\n// TODO(devsnek): figure out AbstractModule class or protocol\nclass SourceTextModule {\n constructor(src, options = {}) {\n emitExperimentalWarning('vm.SourceTextModule');\n\n if (typeof src !== 'string')\n throw new ERR_INVALID_ARG_TYPE('src', 'string', src);\n if (typeof options !== 'object' || options === null)\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n\n const {\n context,\n lineOffset = 0,\n columnOffset = 0,\n initializeImportMeta\n } = options;\n\n if (context !== undefined) {\n if (typeof context !== 'object' || context === null) {\n throw new ERR_INVALID_ARG_TYPE('options.context', 'Object', context);\n }\n if (!isContext(context)) {\n throw new ERR_INVALID_ARG_TYPE('options.context', 'vm.Context',\n context);\n }\n }\n\n let { url } = options;\n if (url !== undefined) {\n if (typeof url !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('options.url', 'string', url);\n }\n url = new URL(url).href;\n } else if (context === undefined) {\n url = `${defaultModuleName}(${globalModuleId++})`;\n } else if (perContextModuleId.has(context)) {\n const curId = perContextModuleId.get(context);\n url = `${defaultModuleName}(${curId})`;\n perContextModuleId.set(context, curId + 1);\n } else {\n url = `${defaultModuleName}(0)`;\n perContextModuleId.set(context, 1);\n }\n\n validateInteger(lineOffset, 'options.lineOffset');\n validateInteger(columnOffset, 'options.columnOffset');\n\n if (initializeImportMeta !== undefined) {\n if (typeof initializeImportMeta === 'function') {\n initImportMetaMap.set(this, initializeImportMeta);\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'options.initializeImportMeta', 'function', initializeImportMeta);\n }\n }\n\n const wrap = new ModuleWrap(src, url, context, lineOffset, columnOffset);\n wrapMap.set(this, wrap);\n linkingStatusMap.set(this, 'unlinked');\n wrapToModuleMap.set(wrap, this);\n\n Object.defineProperties(this, {\n url: { value: url, enumerable: true },\n context: { value: context, enumerable: true },\n });\n }\n\n get linkingStatus() {\n return linkingStatusMap.get(this);\n }\n\n get status() {\n return STATUS_MAP[wrapMap.get(this).getStatus()];\n }\n\n get namespace() {\n const wrap = wrapMap.get(this);\n if (wrap.getStatus() < kInstantiated)\n throw new ERR_VM_MODULE_STATUS(\n 'must not be uninstantiated or instantiating'\n );\n return wrap.namespace();\n }\n\n get dependencySpecifiers() {\n let deps = dependencyCacheMap.get(this);\n if (deps !== undefined)\n return deps;\n\n deps = wrapMap.get(this).getStaticDependencySpecifiers();\n Object.freeze(deps);\n dependencyCacheMap.set(this, deps);\n return deps;\n }\n\n get error() {\n const wrap = wrapMap.get(this);\n if (wrap.getStatus() !== kErrored)\n throw new ERR_VM_MODULE_STATUS('must be errored');\n return wrap.getError();\n }\n\n async link(linker) {\n if (typeof linker !== 'function')\n throw new ERR_INVALID_ARG_TYPE('linker', 'function', linker);\n if (linkingStatusMap.get(this) !== 'unlinked')\n throw new ERR_VM_MODULE_ALREADY_LINKED();\n const wrap = wrapMap.get(this);\n if (wrap.getStatus() !== kUninstantiated)\n throw new ERR_VM_MODULE_STATUS('must be uninstantiated');\n\n linkingStatusMap.set(this, 'linking');\n\n const promises = wrap.link(async (specifier) => {\n const m = await linker(specifier, this);\n if (!m || !wrapMap.has(m))\n throw new ERR_VM_MODULE_NOT_MODULE();\n if (m.context !== this.context)\n throw new ERR_VM_MODULE_DIFFERENT_CONTEXT();\n const childLinkingStatus = linkingStatusMap.get(m);\n if (childLinkingStatus === 'errored')\n throw new ERR_VM_MODULE_LINKING_ERRORED();\n if (childLinkingStatus === 'unlinked')\n await m.link(linker);\n return wrapMap.get(m);\n });\n\n try {\n if (promises !== undefined)\n await SafePromise.all(promises);\n linkingStatusMap.set(this, 'linked');\n } catch (err) {\n linkingStatusMap.set(this, 'errored');\n throw err;\n }\n }\n\n instantiate() {\n const wrap = wrapMap.get(this);\n const status = wrap.getStatus();\n if (status === kInstantiating || status === kEvaluating)\n throw new ERR_VM_MODULE_STATUS('must not be instantiating or evaluating');\n if (linkingStatusMap.get(this) !== 'linked')\n throw new ERR_VM_MODULE_NOT_LINKED();\n wrap.instantiate();\n }\n\n async evaluate(options = {}) {\n if (typeof options !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n let timeout = options.timeout;\n if (timeout === undefined) {\n timeout = -1;\n } else if (!Number.isInteger(timeout) || timeout <= 0) {\n throw new ERR_INVALID_ARG_TYPE('options.timeout', 'a positive integer',\n timeout);\n }\n\n const { breakOnSigint = false } = options;\n if (typeof breakOnSigint !== 'boolean') {\n throw new ERR_INVALID_ARG_TYPE('options.breakOnSigint', 'boolean',\n breakOnSigint);\n }\n\n const wrap = wrapMap.get(this);\n const status = wrap.getStatus();\n if (status !== kInstantiated &&\n status !== kEvaluated &&\n status !== kErrored) {\n throw new ERR_VM_MODULE_STATUS(\n 'must be one of instantiated, evaluated, and errored'\n );\n }\n const result = wrap.evaluate(timeout, breakOnSigint);\n return { result, __proto__: null };\n }\n\n [customInspectSymbol](depth, options) {\n let ctor = getConstructorOf(this);\n ctor = ctor === null ? SourceTextModule : ctor;\n\n if (typeof depth === 'number' && depth < 0)\n return options.stylize(`[${ctor.name}]`, 'special');\n\n const o = Object.create({ constructor: ctor });\n o.status = this.status;\n o.linkingStatus = this.linkingStatus;\n o.url = this.url;\n o.context = this.context;\n return require('util').inspect(o, options);\n }\n}\n\nfunction validateInteger(prop, propName) {\n if (!Number.isInteger(prop)) {\n throw new ERR_INVALID_ARG_TYPE(propName, 'integer', prop);\n }\n if ((prop >> 0) !== prop) {\n throw new ERR_OUT_OF_RANGE(propName, '32-bit integer', prop);\n }\n}\n\nmodule.exports = {\n SourceTextModule,\n initImportMetaMap,\n wrapToModuleMap\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 7854,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 7852,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "SourceTextModule",
"ranges": [
{
"startOffset": 1493,
"endOffset": 3621,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get linkingStatus",
"ranges": [
{
"startOffset": 3625,
"endOffset": 3689,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get status",
"ranges": [
{
"startOffset": 3693,
"endOffset": 3765,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get namespace",
"ranges": [
{
"startOffset": 3769,
"endOffset": 3998,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get dependencySpecifiers",
"ranges": [
{
"startOffset": 4002,
"endOffset": 4271,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get error",
"ranges": [
{
"startOffset": 4275,
"endOffset": 4452,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "link",
"ranges": [
{
"startOffset": 4456,
"endOffset": 5630,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "instantiate",
"ranges": [
{
"startOffset": 5634,
"endOffset": 5985,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "evaluate",
"ranges": [
{
"startOffset": 5989,
"endOffset": 7050,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 7054,
"endOffset": 7519,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "validateInteger",
"ranges": [
{
"startOffset": 7523,
"endOffset": 7767,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "net.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst EventEmitter = require('events');\nconst stream = require('stream');\nconst util = require('util');\nconst internalUtil = require('internal/util');\nconst {\n isIP,\n isIPv4,\n isIPv6,\n isLegalPort,\n normalizedArgsSymbol,\n makeSyncWrite\n} = require('internal/net');\nconst assert = require('assert');\nconst {\n UV_EADDRINUSE,\n UV_EINVAL,\n UV_EOF\n} = process.binding('uv');\n\nconst { Buffer } = require('buffer');\nconst TTYWrap = process.binding('tty_wrap');\nconst { ShutdownWrap } = process.binding('stream_wrap');\nconst {\n TCP,\n TCPConnectWrap,\n constants: TCPConstants\n} = process.binding('tcp_wrap');\nconst {\n Pipe,\n PipeConnectWrap,\n constants: PipeConstants\n} = process.binding('pipe_wrap');\nconst {\n newAsyncId,\n defaultTriggerAsyncIdScope,\n symbols: { async_id_symbol }\n} = require('internal/async_hooks');\nconst {\n createWriteWrap,\n writevGeneric,\n writeGeneric\n} = require('internal/stream_base_commons');\nconst errors = require('internal/errors');\nconst {\n ERR_INVALID_ADDRESS_FAMILY,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_FD_TYPE,\n ERR_INVALID_IP_ADDRESS,\n ERR_INVALID_OPT_VALUE,\n ERR_SERVER_ALREADY_LISTEN,\n ERR_SERVER_NOT_RUNNING,\n ERR_SOCKET_BAD_PORT,\n ERR_SOCKET_CLOSED\n} = errors.codes;\nconst { validateInt32, validateString } = require('internal/validators');\nconst kLastWriteQueueSize = Symbol('lastWriteQueueSize');\n\n// Lazy loaded to improve startup performance.\nlet cluster;\nlet dns;\n\nconst { errnoException, exceptionWithHostPort } = errors;\n\nconst {\n kTimeout,\n setUnrefTimeout,\n validateTimerDuration\n} = require('internal/timers');\n\nfunction noop() {}\n\nfunction createHandle(fd, is_server) {\n validateInt32(fd, 'fd', 0);\n const type = TTYWrap.guessHandleType(fd);\n if (type === 'PIPE') {\n return new Pipe(\n is_server ? PipeConstants.SERVER : PipeConstants.SOCKET\n );\n }\n\n if (type === 'TCP') {\n return new TCP(\n is_server ? TCPConstants.SERVER : TCPConstants.SOCKET\n );\n }\n\n throw new ERR_INVALID_FD_TYPE(type);\n}\n\n\nfunction getNewAsyncId(handle) {\n return (!handle || typeof handle.getAsyncId !== 'function') ?\n newAsyncId() : handle.getAsyncId();\n}\n\n\nconst debug = util.debuglog('net');\n\nfunction isPipeName(s) {\n return typeof s === 'string' && toNumber(s) === false;\n}\n\nfunction createServer(options, connectionListener) {\n return new Server(options, connectionListener);\n}\n\n\n// Target API:\n//\n// var s = net.connect({port: 80, host: 'google.com'}, function() {\n// ...\n// });\n//\n// There are various forms:\n//\n// connect(options, [cb])\n// connect(port, [host], [cb])\n// connect(path, [cb]);\n//\nfunction connect(...args) {\n var normalized = normalizeArgs(args);\n var options = normalized[0];\n debug('createConnection', normalized);\n var socket = new Socket(options);\n\n if (options.timeout) {\n socket.setTimeout(options.timeout);\n }\n\n return Socket.prototype.connect.call(socket, normalized);\n}\n\n\n// Returns an array [options, cb], where options is an object,\n// cb is either a function or null.\n// Used to normalize arguments of Socket.prototype.connect() and\n// Server.prototype.listen(). Possible combinations of parameters:\n// (options[...][, cb])\n// (path[...][, cb])\n// ([port][, host][...][, cb])\n// For Socket.prototype.connect(), the [...] part is ignored\n// For Server.prototype.listen(), the [...] part is [, backlog]\n// but will not be handled here (handled in listen())\nfunction normalizeArgs(args) {\n var arr;\n\n if (args.length === 0) {\n arr = [{}, null];\n arr[normalizedArgsSymbol] = true;\n return arr;\n }\n\n const arg0 = args[0];\n var options = {};\n if (typeof arg0 === 'object' && arg0 !== null) {\n // (options[...][, cb])\n options = arg0;\n } else if (isPipeName(arg0)) {\n // (path[...][, cb])\n options.path = arg0;\n } else {\n // ([port][, host][...][, cb])\n options.port = arg0;\n if (args.length > 1 && typeof args[1] === 'string') {\n options.host = args[1];\n }\n }\n\n var cb = args[args.length - 1];\n if (typeof cb !== 'function')\n arr = [options, null];\n else\n arr = [options, cb];\n\n arr[normalizedArgsSymbol] = true;\n return arr;\n}\n\n\n// called when creating new Socket, or when re-using a closed Socket\nfunction initSocketHandle(self) {\n self._undestroy();\n self._sockname = null;\n\n // Handle creation may be deferred to bind() or connect() time.\n if (self._handle) {\n self._handle.owner = self;\n self._handle.onread = onread;\n self[async_id_symbol] = getNewAsyncId(self._handle);\n }\n}\n\n\nconst kBytesRead = Symbol('kBytesRead');\nconst kBytesWritten = Symbol('kBytesWritten');\n\n\nfunction Socket(options) {\n if (!(this instanceof Socket)) return new Socket(options);\n\n this.connecting = false;\n // Problem with this is that users can supply their own handle, that may not\n // have _handle.getAsyncId(). In this case an[async_id_symbol] should\n // probably be supplied by async_hooks.\n this[async_id_symbol] = -1;\n this._hadError = false;\n this._handle = null;\n this._parent = null;\n this._host = null;\n this[kLastWriteQueueSize] = 0;\n this[kTimeout] = null;\n\n if (typeof options === 'number')\n options = { fd: options }; // Legacy interface.\n else\n options = util._extend({}, options);\n\n options.readable = options.readable || false;\n options.writable = options.writable || false;\n const { allowHalfOpen } = options;\n\n // Prevent the \"no-half-open enforcer\" from being inherited from `Duplex`.\n options.allowHalfOpen = true;\n // For backwards compat do not emit close on destroy.\n options.emitClose = false;\n stream.Duplex.call(this, options);\n\n // Default to *not* allowing half open sockets.\n this.allowHalfOpen = Boolean(allowHalfOpen);\n\n if (options.handle) {\n this._handle = options.handle; // private\n this[async_id_symbol] = getNewAsyncId(this._handle);\n } else if (options.fd !== undefined) {\n const { fd } = options;\n let err;\n\n this._handle = createHandle(fd, false);\n\n err = this._handle.open(fd);\n if (err)\n throw errnoException(err, 'open');\n\n this[async_id_symbol] = this._handle.getAsyncId();\n // options.fd can be string (since it is user-defined),\n // so changing this to === would be semver-major\n // See: https://github.com/nodejs/node/pull/11513\n // eslint-disable-next-line eqeqeq\n if ((fd == 1 || fd == 2) &&\n (this._handle instanceof Pipe) &&\n process.platform === 'win32') {\n // Make stdout and stderr blocking on Windows\n err = this._handle.setBlocking(true);\n if (err)\n throw errnoException(err, 'setBlocking');\n\n this._writev = null;\n this._write = makeSyncWrite(fd);\n // makeSyncWrite adjusts this value like the original handle would, so\n // we need to let it do that by turning it into a writable, own property.\n Object.defineProperty(this._handle, 'bytesWritten', {\n value: 0, writable: true\n });\n }\n }\n\n // shut down the socket when we're finished with it.\n this.on('end', onReadableStreamEnd);\n\n initSocketHandle(this);\n\n this._pendingData = null;\n this._pendingEncoding = '';\n\n // handle strings directly\n this._writableState.decodeStrings = false;\n\n // if we have a handle, then start the flow of data into the\n // buffer. if not, then this will happen when we connect\n if (this._handle && options.readable !== false) {\n if (options.pauseOnCreate) {\n // stop the handle from reading and pause the stream\n this._handle.reading = false;\n this._handle.readStop();\n this.readableFlowing = false;\n } else if (!options.manualStart) {\n this.read(0);\n }\n }\n\n // Reserve properties\n this.server = null;\n this._server = null;\n\n // Used after `.destroy()`\n this[kBytesRead] = 0;\n this[kBytesWritten] = 0;\n}\nutil.inherits(Socket, stream.Duplex);\n\n// Refresh existing timeouts.\nSocket.prototype._unrefTimer = function _unrefTimer() {\n for (var s = this; s !== null; s = s._parent) {\n if (s[kTimeout])\n s[kTimeout].refresh();\n }\n};\n\n\nfunction shutdownSocket(self, callback) {\n var req = new ShutdownWrap();\n req.oncomplete = afterShutdown;\n req.handle = self._handle;\n req.callback = callback;\n return self._handle.shutdown(req);\n}\n\n// the user has called .end(), and all the bytes have been\n// sent out to the other side.\nSocket.prototype._final = function(cb) {\n // If still connecting - defer handling `_final` until 'connect' will happen\n if (this.connecting) {\n debug('_final: not yet connected');\n return this.once('connect', () => this._final(cb));\n }\n\n if (!this.readable || this._readableState.ended) {\n debug('_final: ended, destroy', this._readableState);\n cb();\n return this.destroy();\n }\n\n debug('_final: not ended, call shutdown()');\n\n // otherwise, just shutdown, or destroy() if not possible\n if (!this._handle || !this._handle.shutdown) {\n cb();\n return this.destroy();\n }\n\n var err = defaultTriggerAsyncIdScope(\n this[async_id_symbol], shutdownSocket, this, cb\n );\n\n if (err)\n return this.destroy(errnoException(err, 'shutdown'));\n};\n\n\nfunction afterShutdown(status, handle) {\n var self = handle.owner;\n\n debug('afterShutdown destroyed=%j', self.destroyed,\n self._readableState);\n\n this.callback();\n\n // callback may come after call to destroy.\n if (self.destroyed)\n return;\n\n if (self._readableState.ended) {\n debug('readableState ended, destroying');\n self.destroy();\n }\n}\n\n// Provide a better error message when we call end() as a result\n// of the other side sending a FIN. The standard 'write after end'\n// is overly vague, and makes it seem like the user's code is to blame.\nfunction writeAfterFIN(chunk, encoding, cb) {\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n var er = new Error('This socket has been ended by the other party');\n er.code = 'EPIPE';\n // TODO: defer error events consistently everywhere, not just the cb\n this.emit('error', er);\n if (typeof cb === 'function') {\n defaultTriggerAsyncIdScope(this[async_id_symbol], process.nextTick, cb, er);\n }\n}\n\nSocket.prototype.setTimeout = function(msecs, callback) {\n this.timeout = msecs;\n // Type checking identical to timers.enroll()\n msecs = validateTimerDuration(msecs);\n\n // Attempt to clear an existing timer in both cases -\n // even if it will be rescheduled we don't want to leak an existing timer.\n clearTimeout(this[kTimeout]);\n\n if (msecs === 0) {\n if (callback) {\n this.removeListener('timeout', callback);\n }\n } else {\n this[kTimeout] = setUnrefTimeout(this._onTimeout.bind(this), msecs);\n\n if (callback) {\n this.once('timeout', callback);\n }\n }\n return this;\n};\n\n\nSocket.prototype._onTimeout = function() {\n const handle = this._handle;\n const lastWriteQueueSize = this[kLastWriteQueueSize];\n if (lastWriteQueueSize > 0 && handle) {\n // `lastWriteQueueSize !== writeQueueSize` means there is\n // an active write in progress, so we suppress the timeout.\n const { writeQueueSize } = handle;\n if (lastWriteQueueSize !== writeQueueSize) {\n this[kLastWriteQueueSize] = writeQueueSize;\n this._unrefTimer();\n return;\n }\n }\n debug('_onTimeout');\n this.emit('timeout');\n};\n\n\nSocket.prototype.setNoDelay = function(enable) {\n if (!this._handle) {\n this.once('connect',\n enable ? this.setNoDelay : () => this.setNoDelay(enable));\n return this;\n }\n\n // backwards compatibility: assume true when `enable` is omitted\n if (this._handle.setNoDelay)\n this._handle.setNoDelay(enable === undefined ? true : !!enable);\n\n return this;\n};\n\n\nSocket.prototype.setKeepAlive = function(setting, msecs) {\n if (!this._handle) {\n this.once('connect', () => this.setKeepAlive(setting, msecs));\n return this;\n }\n\n if (this._handle.setKeepAlive)\n this._handle.setKeepAlive(setting, ~~(msecs / 1000));\n\n return this;\n};\n\n\nSocket.prototype.address = function() {\n return this._getsockname();\n};\n\n\nObject.defineProperty(Socket.prototype, '_connecting', {\n get: function() {\n return this.connecting;\n }\n});\n\n\nObject.defineProperty(Socket.prototype, 'readyState', {\n get: function() {\n if (this.connecting) {\n return 'opening';\n } else if (this.readable && this.writable) {\n return 'open';\n } else if (this.readable && !this.writable) {\n return 'readOnly';\n } else if (!this.readable && this.writable) {\n return 'writeOnly';\n } else {\n return 'closed';\n }\n }\n});\n\n\nObject.defineProperty(Socket.prototype, 'bufferSize', {\n get: function() {\n if (this._handle) {\n return this[kLastWriteQueueSize] + this.writableLength;\n }\n }\n});\n\n\n// Just call handle.readStart until we have enough in the buffer\nSocket.prototype._read = function(n) {\n debug('_read');\n\n if (this.connecting || !this._handle) {\n debug('_read wait for connection');\n this.once('connect', () => this._read(n));\n } else if (!this._handle.reading) {\n // not already reading, start the flow\n debug('Socket._read readStart');\n this._handle.reading = true;\n var err = this._handle.readStart();\n if (err)\n this.destroy(errnoException(err, 'read'));\n }\n};\n\n\nSocket.prototype.end = function(data, encoding, callback) {\n stream.Duplex.prototype.end.call(this, data, encoding, callback);\n ;\n return this;\n};\n\n\n// Called when the 'end' event is emitted.\nfunction onReadableStreamEnd() {\n if (!this.allowHalfOpen) {\n this.write = writeAfterFIN;\n if (this.writable)\n this.end();\n }\n maybeDestroy(this);\n}\n\n\n// Call whenever we set writable=false or readable=false\nfunction maybeDestroy(socket) {\n if (!socket.readable &&\n !socket.writable &&\n !socket.destroyed &&\n !socket.connecting &&\n !socket.writableLength) {\n socket.destroy();\n }\n}\n\n\nSocket.prototype.destroySoon = function() {\n if (this.writable)\n this.end();\n\n if (this._writableState.finished)\n this.destroy();\n else\n this.once('finish', this.destroy);\n};\n\n\nSocket.prototype._destroy = function(exception, cb) {\n debug('destroy');\n\n this.connecting = false;\n\n this.readable = this.writable = false;\n\n for (var s = this; s !== null; s = s._parent) {\n clearTimeout(s[kTimeout]);\n }\n\n debug('close');\n if (this._handle) {\n if (this !== process.stderr)\n debug('close handle');\n var isException = exception ? true : false;\n // `bytesRead` and `kBytesWritten` should be accessible after `.destroy()`\n this[kBytesRead] = this._handle.bytesRead;\n this[kBytesWritten] = this._handle.bytesWritten;\n\n this._handle.close(() => {\n debug('emit close');\n this.emit('close', isException);\n });\n this._handle.onread = noop;\n this._handle = null;\n this._sockname = null;\n }\n\n cb(exception);\n\n if (this._server) {\n ;\n debug('has server');\n this._server._connections--;\n if (this._server._emitCloseIfDrained) {\n this._server._emitCloseIfDrained();\n }\n }\n};\n\n\n// This function is called whenever the handle gets a\n// buffer, or when there's an error reading.\nfunction onread(nread, buffer) {\n var handle = this;\n var self = handle.owner;\n assert(handle === self._handle, 'handle != self._handle');\n\n self._unrefTimer();\n\n debug('onread', nread);\n\n if (nread > 0) {\n debug('got data');\n\n // read success.\n // In theory (and in practice) calling readStop right now\n // will prevent this from being called again until _read() gets\n // called again.\n\n // Optimization: emit the original buffer with end points\n var ret = self.push(buffer);\n\n if (handle.reading && !ret) {\n handle.reading = false;\n debug('readStop');\n var err = handle.readStop();\n if (err)\n self.destroy(errnoException(err, 'read'));\n }\n return;\n }\n\n // if we didn't get any bytes, that doesn't necessarily mean EOF.\n // wait for the next one.\n if (nread === 0) {\n debug('not any data, keep waiting');\n return;\n }\n\n // Error, possibly EOF.\n if (nread !== UV_EOF) {\n return self.destroy(errnoException(nread, 'read'));\n }\n\n debug('EOF');\n\n // push a null to signal the end of data.\n // Do it before `maybeDestroy` for correct order of events:\n // `end` -> `close`\n self.push(null);\n self.read(0);\n}\n\n\nSocket.prototype._getpeername = function() {\n if (!this._peername) {\n if (!this._handle || !this._handle.getpeername) {\n return {};\n }\n var out = {};\n var err = this._handle.getpeername(out);\n if (err) return {}; // FIXME(bnoordhuis) Throw?\n this._peername = out;\n }\n return this._peername;\n};\n\nfunction protoGetter(name, callback) {\n Object.defineProperty(Socket.prototype, name, {\n configurable: false,\n enumerable: true,\n get: callback\n });\n}\n\nprotoGetter('bytesRead', function bytesRead() {\n return this._handle ? this._handle.bytesRead : this[kBytesRead];\n});\n\nprotoGetter('remoteAddress', function remoteAddress() {\n return this._getpeername().address;\n});\n\nprotoGetter('remoteFamily', function remoteFamily() {\n return this._getpeername().family;\n});\n\nprotoGetter('remotePort', function remotePort() {\n return this._getpeername().port;\n});\n\n\nSocket.prototype._getsockname = function() {\n if (!this._handle || !this._handle.getsockname) {\n return {};\n }\n if (!this._sockname) {\n var out = {};\n var err = this._handle.getsockname(out);\n if (err) return {}; // FIXME(bnoordhuis) Throw?\n this._sockname = out;\n }\n return this._sockname;\n};\n\n\nprotoGetter('localAddress', function localAddress() {\n return this._getsockname().address;\n});\n\n\nprotoGetter('localPort', function localPort() {\n return this._getsockname().port;\n});\n\n\nSocket.prototype._writeGeneric = function(writev, data, encoding, cb) {\n // If we are still connecting, then buffer this for later.\n // The Writable logic will buffer up any more writes while\n // waiting for this one to be done.\n if (this.connecting) {\n this._pendingData = data;\n this._pendingEncoding = encoding;\n this.once('connect', function connect() {\n this._writeGeneric(writev, data, encoding, cb);\n });\n return;\n }\n this._pendingData = null;\n this._pendingEncoding = '';\n\n if (!this._handle) {\n this.destroy(new ERR_SOCKET_CLOSED(), cb);\n return false;\n }\n\n this._unrefTimer();\n\n var req = createWriteWrap(this._handle, afterWrite);\n if (writev)\n writevGeneric(this, req, data, cb);\n else\n writeGeneric(this, req, data, encoding, cb);\n if (req.async)\n this[kLastWriteQueueSize] = req.bytes;\n};\n\n\nSocket.prototype._writev = function(chunks, cb) {\n this._writeGeneric(true, chunks, '', cb);\n};\n\n\nSocket.prototype._write = function(data, encoding, cb) {\n this._writeGeneric(false, data, encoding, cb);\n};\n\n\n// Legacy alias. Having this is probably being overly cautious, but it doesn't\n// really hurt anyone either. This can probably be removed safely if desired.\nprotoGetter('_bytesDispatched', function _bytesDispatched() {\n return this._handle ? this._handle.bytesWritten : this[kBytesWritten];\n});\n\nprotoGetter('bytesWritten', function bytesWritten() {\n var bytes = this._bytesDispatched;\n const state = this._writableState;\n const data = this._pendingData;\n const encoding = this._pendingEncoding;\n\n if (!state)\n return undefined;\n\n this.writableBuffer.forEach(function(el) {\n if (el.chunk instanceof Buffer)\n bytes += el.chunk.length;\n else\n bytes += Buffer.byteLength(el.chunk, el.encoding);\n });\n\n if (Array.isArray(data)) {\n // was a writev, iterate over chunks to get total length\n for (var i = 0; i < data.length; i++) {\n const chunk = data[i];\n\n if (data.allBuffers || chunk instanceof Buffer)\n bytes += chunk.length;\n else\n bytes += Buffer.byteLength(chunk.chunk, chunk.encoding);\n }\n } else if (data) {\n // Writes are either a string or a Buffer.\n if (typeof data !== 'string')\n bytes += data.length;\n else\n bytes += Buffer.byteLength(data, encoding);\n }\n\n return bytes;\n});\n\n\nfunction afterWrite(status, handle, err) {\n var self = handle.owner;\n if (self !== process.stderr && self !== process.stdout)\n debug('afterWrite', status);\n\n if (this.async)\n self[kLastWriteQueueSize] = 0;\n\n // callback may come after call to destroy.\n if (self.destroyed) {\n debug('afterWrite destroyed');\n return;\n }\n\n if (status < 0) {\n var ex = errnoException(status, 'write', this.error);\n debug('write failure', ex);\n self.destroy(ex, this.callback);\n return;\n }\n\n self._unrefTimer();\n\n if (self !== process.stderr && self !== process.stdout)\n debug('afterWrite call cb');\n\n if (this.callback)\n this.callback.call(undefined);\n}\n\n\nfunction checkBindError(err, port, handle) {\n // EADDRINUSE may not be reported until we call listen() or connect().\n // To complicate matters, a failed bind() followed by listen() or connect()\n // will implicitly bind to a random port. Ergo, check that the socket is\n // bound to the expected port before calling listen() or connect().\n //\n // FIXME(bnoordhuis) Doesn't work for pipe handles, they don't have a\n // getsockname() method. Non-issue for now, the cluster module doesn't\n // really support pipes anyway.\n if (err === 0 && port > 0 && handle.getsockname) {\n var out = {};\n err = handle.getsockname(out);\n if (err === 0 && port !== out.port) {\n debug(`checkBindError, bound to ${out.port} instead of ${port}`);\n err = UV_EADDRINUSE;\n }\n }\n return err;\n}\n\n\nfunction internalConnect(\n self, address, port, addressType, localAddress, localPort) {\n // TODO return promise from Socket.prototype.connect which\n // wraps _connectReq.\n\n assert(self.connecting);\n\n var err;\n\n if (localAddress || localPort) {\n if (addressType === 4) {\n localAddress = localAddress || '0.0.0.0';\n err = self._handle.bind(localAddress, localPort);\n } else if (addressType === 6) {\n localAddress = localAddress || '::';\n err = self._handle.bind6(localAddress, localPort);\n } else {\n self.destroy(new ERR_INVALID_ADDRESS_FAMILY(addressType));\n return;\n }\n debug('binding to localAddress: %s and localPort: %d (addressType: %d)',\n localAddress, localPort, addressType);\n\n err = checkBindError(err, localPort, self._handle);\n if (err) {\n const ex = exceptionWithHostPort(err, 'bind', localAddress, localPort);\n self.destroy(ex);\n return;\n }\n }\n\n if (addressType === 6 || addressType === 4) {\n const req = new TCPConnectWrap();\n req.oncomplete = afterConnect;\n req.address = address;\n req.port = port;\n req.localAddress = localAddress;\n req.localPort = localPort;\n\n if (addressType === 4)\n err = self._handle.connect(req, address, port);\n else\n err = self._handle.connect6(req, address, port);\n } else {\n const req = new PipeConnectWrap();\n req.address = address;\n req.oncomplete = afterConnect;\n\n err = self._handle.connect(req, address, afterConnect);\n }\n\n if (err) {\n var sockname = self._getsockname();\n var details;\n\n if (sockname) {\n details = sockname.address + ':' + sockname.port;\n }\n\n const ex = exceptionWithHostPort(err, 'connect', address, port, details);\n self.destroy(ex);\n }\n}\n\n\nSocket.prototype.connect = function(...args) {\n let normalized;\n // If passed an array, it's treated as an array of arguments that have\n // already been normalized (so we don't normalize more than once). This has\n // been solved before in https://github.com/nodejs/node/pull/12342, but was\n // reverted as it had unintended side effects.\n if (Array.isArray(args[0]) && args[0][normalizedArgsSymbol]) {\n normalized = args[0];\n } else {\n normalized = normalizeArgs(args);\n }\n var options = normalized[0];\n var cb = normalized[1];\n\n if (this.write !== Socket.prototype.write)\n this.write = Socket.prototype.write;\n\n if (this.destroyed) {\n this._undestroy();\n this._handle = null;\n this._peername = null;\n this._sockname = null;\n }\n\n const { path } = options;\n var pipe = !!path;\n debug('pipe', pipe, path);\n\n if (!this._handle) {\n this._handle = pipe ?\n new Pipe(PipeConstants.SOCKET) :\n new TCP(TCPConstants.SOCKET);\n initSocketHandle(this);\n }\n\n if (cb !== null) {\n this.once('connect', cb);\n }\n\n this._unrefTimer();\n\n this.connecting = true;\n this.writable = true;\n\n if (pipe) {\n validateString(path, 'options.path');\n defaultTriggerAsyncIdScope(\n this[async_id_symbol], internalConnect, this, path\n );\n } else {\n lookupAndConnect(this, options);\n }\n return this;\n};\n\n\nfunction lookupAndConnect(self, options) {\n var { port, localAddress, localPort } = options;\n var host = options.host || 'localhost';\n\n if (localAddress && !isIP(localAddress)) {\n throw new ERR_INVALID_IP_ADDRESS(localAddress);\n }\n\n if (localPort && typeof localPort !== 'number') {\n throw new ERR_INVALID_ARG_TYPE('options.localPort', 'number', localPort);\n }\n\n if (typeof port !== 'undefined') {\n if (typeof port !== 'number' && typeof port !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('options.port',\n ['number', 'string'], port);\n }\n if (!isLegalPort(port)) {\n throw new ERR_SOCKET_BAD_PORT(port);\n }\n }\n port |= 0;\n\n // If host is an IP, skip performing a lookup\n var addressType = isIP(host);\n if (addressType) {\n defaultTriggerAsyncIdScope(self[async_id_symbol], process.nextTick, () => {\n if (self.connecting)\n defaultTriggerAsyncIdScope(\n self[async_id_symbol],\n internalConnect,\n self, host, port, addressType, localAddress, localPort\n );\n });\n return;\n }\n\n if (options.lookup && typeof options.lookup !== 'function')\n throw new ERR_INVALID_ARG_TYPE('options.lookup',\n 'Function', options.lookup);\n\n\n if (dns === undefined) dns = require('dns');\n var dnsopts = {\n family: options.family,\n hints: options.hints || 0\n };\n\n if (process.platform !== 'win32' &&\n dnsopts.family !== 4 &&\n dnsopts.family !== 6 &&\n dnsopts.hints === 0) {\n dnsopts.hints = dns.ADDRCONFIG;\n }\n\n debug('connect: find host', host);\n debug('connect: dns options', dnsopts);\n self._host = host;\n var lookup = options.lookup || dns.lookup;\n defaultTriggerAsyncIdScope(self[async_id_symbol], function() {\n lookup(host, dnsopts, function emitLookup(err, ip, addressType) {\n self.emit('lookup', err, ip, addressType, host);\n\n // It's possible we were destroyed while looking this up.\n // XXX it would be great if we could cancel the promise returned by\n // the look up.\n if (!self.connecting) return;\n\n if (err) {\n // net.createConnection() creates a net.Socket object and\n // immediately calls net.Socket.connect() on it (that's us).\n // There are no event listeners registered yet so defer the\n // error event to the next tick.\n err.host = options.host;\n err.port = options.port;\n err.message = err.message + ' ' + options.host + ':' + options.port;\n process.nextTick(connectErrorNT, self, err);\n } else if (addressType !== 4 && addressType !== 6) {\n err = new ERR_INVALID_ADDRESS_FAMILY(addressType);\n err.host = options.host;\n err.port = options.port;\n err.message = err.message + ' ' + options.host + ':' + options.port;\n process.nextTick(connectErrorNT, self, err);\n } else {\n self._unrefTimer();\n defaultTriggerAsyncIdScope(\n self[async_id_symbol],\n internalConnect,\n self, ip, port, addressType, localAddress, localPort\n );\n }\n });\n });\n}\n\n\nfunction connectErrorNT(self, err) {\n self.destroy(err);\n}\n\n\nSocket.prototype.ref = function() {\n if (!this._handle) {\n this.once('connect', this.ref);\n return this;\n }\n\n if (typeof this._handle.ref === 'function') {\n this._handle.ref();\n }\n\n return this;\n};\n\n\nSocket.prototype.unref = function() {\n if (!this._handle) {\n this.once('connect', this.unref);\n return this;\n }\n\n if (typeof this._handle.unref === 'function') {\n this._handle.unref();\n }\n\n return this;\n};\n\n\nfunction afterConnect(status, handle, req, readable, writable) {\n var self = handle.owner;\n\n // callback may come after call to destroy\n if (self.destroyed) {\n return;\n }\n\n // Update handle if it was wrapped\n // TODO(indutny): assert that the handle is actually an ancestor of old one\n handle = self._handle;\n\n debug('afterConnect');\n\n assert(self.connecting);\n self.connecting = false;\n self._sockname = null;\n\n if (status === 0) {\n self.readable = readable;\n if (!self._writableState.ended)\n self.writable = writable;\n self._unrefTimer();\n\n self.emit('connect');\n self.emit('ready');\n\n // start the first read, or get an immediate EOF.\n // this doesn't actually consume any bytes, because len=0.\n if (readable && !self.isPaused())\n self.read(0);\n\n } else {\n self.connecting = false;\n var details;\n if (req.localAddress && req.localPort) {\n details = req.localAddress + ':' + req.localPort;\n }\n var ex = exceptionWithHostPort(status,\n 'connect',\n req.address,\n req.port,\n details);\n if (details) {\n ex.localAddress = req.localAddress;\n ex.localPort = req.localPort;\n }\n self.destroy(ex);\n }\n}\n\n\nfunction Server(options, connectionListener) {\n if (!(this instanceof Server))\n return new Server(options, connectionListener);\n\n EventEmitter.call(this);\n\n if (typeof options === 'function') {\n connectionListener = options;\n options = {};\n this.on('connection', connectionListener);\n } else if (options == null || typeof options === 'object') {\n options = options || {};\n\n if (typeof connectionListener === 'function') {\n this.on('connection', connectionListener);\n }\n } else {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n this._connections = 0;\n\n Object.defineProperty(this, 'connections', {\n get: internalUtil.deprecate(() => {\n\n if (this._usingWorkers) {\n return null;\n }\n return this._connections;\n }, 'Server.connections property is deprecated. ' +\n 'Use Server.getConnections method instead.', 'DEP0020'),\n set: internalUtil.deprecate((val) => (this._connections = val),\n 'Server.connections property is deprecated.',\n 'DEP0020'),\n configurable: true, enumerable: false\n });\n\n this[async_id_symbol] = -1;\n this._handle = null;\n this._usingWorkers = false;\n this._workers = [];\n this._unref = false;\n\n this.allowHalfOpen = options.allowHalfOpen || false;\n this.pauseOnConnect = !!options.pauseOnConnect;\n}\nutil.inherits(Server, EventEmitter);\n\n\nfunction toNumber(x) { return (x = Number(x)) >= 0 ? x : false; }\n\n// Returns handle if it can be created, or error code if it can't\nfunction createServerHandle(address, port, addressType, fd) {\n var err = 0;\n // assign handle in listen, and clean up if bind or listen fails\n var handle;\n\n var isTCP = false;\n if (typeof fd === 'number' && fd >= 0) {\n try {\n handle = createHandle(fd, true);\n } catch (e) {\n // Not a fd we can listen on. This will trigger an error.\n debug('listen invalid fd=%d:', fd, e.message);\n return UV_EINVAL;\n }\n\n err = handle.open(fd);\n if (err)\n return err;\n\n handle.readable = true;\n handle.writable = true;\n assert(!address && !port);\n } else if (port === -1 && addressType === -1) {\n handle = new Pipe(PipeConstants.SERVER);\n if (process.platform === 'win32') {\n var instances = parseInt(process.env.NODE_PENDING_PIPE_INSTANCES);\n if (!Number.isNaN(instances)) {\n handle.setPendingInstances(instances);\n }\n }\n } else {\n handle = new TCP(TCPConstants.SERVER);\n isTCP = true;\n }\n\n if (address || port || isTCP) {\n debug('bind to', address || 'any');\n if (!address) {\n // Try binding to ipv6 first\n err = handle.bind6('::', port);\n if (err) {\n handle.close();\n // Fallback to ipv4\n return createServerHandle('0.0.0.0', port);\n }\n } else if (addressType === 6) {\n err = handle.bind6(address, port);\n } else {\n err = handle.bind(address, port);\n }\n }\n\n if (err) {\n handle.close();\n return err;\n }\n\n return handle;\n}\n\nfunction setupListenHandle(address, port, addressType, backlog, fd) {\n debug('setupListenHandle', address, port, addressType, backlog, fd);\n\n // If there is not yet a handle, we need to create one and bind.\n // In the case of a server sent via IPC, we don't need to do this.\n if (this._handle) {\n debug('setupListenHandle: have a handle already');\n } else {\n debug('setupListenHandle: create a handle');\n\n var rval = null;\n\n // Try to bind to the unspecified IPv6 address, see if IPv6 is available\n if (!address && typeof fd !== 'number') {\n rval = createServerHandle('::', port, 6, fd);\n\n if (typeof rval === 'number') {\n rval = null;\n address = '0.0.0.0';\n addressType = 4;\n } else {\n address = '::';\n addressType = 6;\n }\n }\n\n if (rval === null)\n rval = createServerHandle(address, port, addressType, fd);\n\n if (typeof rval === 'number') {\n var error = exceptionWithHostPort(rval, 'listen', address, port);\n process.nextTick(emitErrorNT, this, error);\n return;\n }\n this._handle = rval;\n }\n\n this[async_id_symbol] = getNewAsyncId(this._handle);\n this._handle.onconnection = onconnection;\n this._handle.owner = this;\n\n // Use a backlog of 512 entries. We pass 511 to the listen() call because\n // the kernel does: backlogsize = roundup_pow_of_two(backlogsize + 1);\n // which will thus give us a backlog of 512 entries.\n var err = this._handle.listen(backlog || 511);\n\n if (err) {\n var ex = exceptionWithHostPort(err, 'listen', address, port);\n this._handle.close();\n this._handle = null;\n defaultTriggerAsyncIdScope(this[async_id_symbol],\n process.nextTick,\n emitErrorNT,\n this,\n ex);\n return;\n }\n\n // generate connection key, this should be unique to the connection\n this._connectionKey = addressType + ':' + address + ':' + port;\n\n // unref the handle if the server was unref'ed prior to listening\n if (this._unref)\n this.unref();\n\n defaultTriggerAsyncIdScope(this[async_id_symbol],\n process.nextTick,\n emitListeningNT,\n this);\n}\n\nServer.prototype._listen2 = setupListenHandle; // legacy alias\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\n\nfunction emitListeningNT(self) {\n // ensure handle hasn't closed\n if (self._handle)\n self.emit('listening');\n}\n\n\nfunction listenInCluster(server, address, port, addressType,\n backlog, fd, exclusive) {\n exclusive = !!exclusive;\n\n if (cluster === undefined) cluster = require('cluster');\n\n if (cluster.isMaster || exclusive) {\n // Will create a new handle\n // _listen2 sets up the listened handle, it is still named like this\n // to avoid breaking code that wraps this method\n server._listen2(address, port, addressType, backlog, fd);\n return;\n }\n\n const serverQuery = {\n address: address,\n port: port,\n addressType: addressType,\n fd: fd,\n flags: 0\n };\n\n // Get the master's server handle, and listen on it\n cluster._getServer(server, serverQuery, listenOnMasterHandle);\n\n function listenOnMasterHandle(err, handle) {\n err = checkBindError(err, port, handle);\n\n if (err) {\n var ex = exceptionWithHostPort(err, 'bind', address, port);\n return server.emit('error', ex);\n }\n\n // Reuse master's server handle\n server._handle = handle;\n // _listen2 sets up the listened handle, it is still named like this\n // to avoid breaking code that wraps this method\n server._listen2(address, port, addressType, backlog, fd);\n }\n}\n\n\nServer.prototype.listen = function(...args) {\n var normalized = normalizeArgs(args);\n var options = normalized[0];\n var cb = normalized[1];\n\n if (this._handle) {\n throw new ERR_SERVER_ALREADY_LISTEN();\n }\n\n if (cb !== null) {\n this.once('listening', cb);\n }\n var backlogFromArgs =\n // (handle, backlog) or (path, backlog) or (port, backlog)\n toNumber(args.length > 1 && args[1]) ||\n toNumber(args.length > 2 && args[2]); // (port, host, backlog)\n\n options = options._handle || options.handle || options;\n // (handle[, backlog][, cb]) where handle is an object with a handle\n if (options instanceof TCP) {\n this._handle = options;\n this[async_id_symbol] = this._handle.getAsyncId();\n listenInCluster(this, null, -1, -1, backlogFromArgs);\n return this;\n }\n // (handle[, backlog][, cb]) where handle is an object with a fd\n if (typeof options.fd === 'number' && options.fd >= 0) {\n listenInCluster(this, null, null, null, backlogFromArgs, options.fd);\n return this;\n }\n\n // ([port][, host][, backlog][, cb]) where port is omitted,\n // that is, listen(), listen(null), listen(cb), or listen(null, cb)\n // or (options[, cb]) where options.port is explicitly set as undefined or\n // null, bind to an arbitrary unused port\n if (args.length === 0 || typeof args[0] === 'function' ||\n (typeof options.port === 'undefined' && 'port' in options) ||\n options.port === null) {\n options.port = 0;\n }\n // ([port][, host][, backlog][, cb]) where port is specified\n // or (options[, cb]) where options.port is specified\n // or if options.port is normalized as 0 before\n var backlog;\n if (typeof options.port === 'number' || typeof options.port === 'string') {\n if (!isLegalPort(options.port)) {\n throw new ERR_SOCKET_BAD_PORT(options.port);\n }\n backlog = options.backlog || backlogFromArgs;\n // start TCP server listening on host:port\n if (options.host) {\n lookupAndListen(this, options.port | 0, options.host, backlog,\n options.exclusive);\n } else { // Undefined host, listens on unspecified address\n // Default addressType 4 will be used to search for master server\n listenInCluster(this, null, options.port | 0, 4,\n backlog, undefined, options.exclusive);\n }\n return this;\n }\n\n // (path[, backlog][, cb]) or (options[, cb])\n // where path or options.path is a UNIX domain socket or Windows pipe\n if (options.path && isPipeName(options.path)) {\n var pipeName = this._pipeName = options.path;\n backlog = options.backlog || backlogFromArgs;\n listenInCluster(this, pipeName, -1, -1,\n backlog, undefined, options.exclusive);\n let mode = 0;\n if (options.readableAll === true)\n mode |= PipeConstants.UV_READABLE;\n if (options.writableAll === true)\n mode |= PipeConstants.UV_WRITABLE;\n if (mode !== 0) {\n const err = this._handle.fchmod(mode);\n if (err) {\n this._handle.close();\n this._handle = null;\n throw errnoException(err, 'uv_pipe_chmod');\n }\n }\n return this;\n }\n\n throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options));\n};\n\nfunction lookupAndListen(self, port, address, backlog, exclusive) {\n if (dns === undefined) dns = require('dns');\n dns.lookup(address, function doListen(err, ip, addressType) {\n if (err) {\n self.emit('error', err);\n } else {\n addressType = ip ? addressType : 4;\n listenInCluster(self, ip, port, addressType,\n backlog, undefined, exclusive);\n }\n });\n}\n\nObject.defineProperty(Server.prototype, 'listening', {\n get: function() {\n return !!this._handle;\n },\n configurable: true,\n enumerable: true\n});\n\nServer.prototype.address = function() {\n if (this._handle && this._handle.getsockname) {\n var out = {};\n var err = this._handle.getsockname(out);\n if (err) {\n throw errnoException(err, 'address');\n }\n return out;\n } else if (this._pipeName) {\n return this._pipeName;\n } else {\n return null;\n }\n};\n\nfunction onconnection(err, clientHandle) {\n var handle = this;\n var self = handle.owner;\n\n debug('onconnection');\n\n if (err) {\n self.emit('error', errnoException(err, 'accept'));\n return;\n }\n\n if (self.maxConnections && self._connections >= self.maxConnections) {\n clientHandle.close();\n return;\n }\n\n var socket = new Socket({\n handle: clientHandle,\n allowHalfOpen: self.allowHalfOpen,\n pauseOnCreate: self.pauseOnConnect,\n readable: true,\n writable: true\n });\n\n self._connections++;\n socket.server = self;\n socket._server = self;\n\n ;\n ;\n self.emit('connection', socket);\n}\n\n\nServer.prototype.getConnections = function(cb) {\n const self = this;\n\n function end(err, connections) {\n defaultTriggerAsyncIdScope(self[async_id_symbol],\n process.nextTick,\n cb,\n err,\n connections);\n }\n\n if (!this._usingWorkers) {\n end(null, this._connections);\n return this;\n }\n\n // Poll workers\n var left = this._workers.length;\n var total = this._connections;\n\n function oncount(err, count) {\n if (err) {\n left = -1;\n return end(err);\n }\n\n total += count;\n if (--left === 0) return end(null, total);\n }\n\n for (var n = 0; n < this._workers.length; n++) {\n this._workers[n].getConnections(oncount);\n }\n\n return this;\n};\n\n\nServer.prototype.close = function(cb) {\n if (typeof cb === 'function') {\n if (!this._handle) {\n this.once('close', function close() {\n cb(new ERR_SERVER_NOT_RUNNING());\n });\n } else {\n this.once('close', cb);\n }\n }\n\n if (this._handle) {\n this._handle.close();\n this._handle = null;\n }\n\n if (this._usingWorkers) {\n var left = this._workers.length;\n const onWorkerClose = () => {\n if (--left !== 0) return;\n\n this._connections = 0;\n this._emitCloseIfDrained();\n };\n\n // Increment connections to be sure that, even if all sockets will be closed\n // during polling of workers, `close` event will be emitted only once.\n this._connections++;\n\n // Poll workers\n for (var n = 0; n < this._workers.length; n++)\n this._workers[n].close(onWorkerClose);\n } else {\n this._emitCloseIfDrained();\n }\n\n return this;\n};\n\nServer.prototype._emitCloseIfDrained = function() {\n debug('SERVER _emitCloseIfDrained');\n\n if (this._handle || this._connections) {\n debug('SERVER handle? %j connections? %d',\n !!this._handle, this._connections);\n return;\n }\n\n defaultTriggerAsyncIdScope(this[async_id_symbol],\n process.nextTick,\n emitCloseNT,\n this);\n};\n\n\nfunction emitCloseNT(self) {\n debug('SERVER: emit close');\n self.emit('close');\n}\n\n\nServer.prototype.listenFD = internalUtil.deprecate(function(fd, type) {\n return this.listen({ fd: fd });\n}, 'Server.listenFD is deprecated. Use Server.listen({fd: <number>}) instead.',\n 'DEP0021');\n\nServer.prototype._setupWorker = function(socketList) {\n this._usingWorkers = true;\n this._workers.push(socketList);\n socketList.once('exit', (socketList) => {\n const index = this._workers.indexOf(socketList);\n this._workers.splice(index, 1);\n });\n};\n\nServer.prototype.ref = function() {\n this._unref = false;\n\n if (this._handle)\n this._handle.ref();\n\n return this;\n};\n\nServer.prototype.unref = function() {\n this._unref = true;\n\n if (this._handle)\n this._handle.unref();\n\n return this;\n};\n\nvar _setSimultaneousAccepts;\n\nif (process.platform === 'win32') {\n var simultaneousAccepts;\n\n _setSimultaneousAccepts = function(handle) {\n if (handle === undefined) {\n return;\n }\n\n if (simultaneousAccepts === undefined) {\n simultaneousAccepts = (process.env.NODE_MANY_ACCEPTS &&\n process.env.NODE_MANY_ACCEPTS !== '0');\n }\n\n if (handle._simultaneousAccepts !== simultaneousAccepts) {\n handle.setSimultaneousAccepts(simultaneousAccepts);\n handle._simultaneousAccepts = simultaneousAccepts;\n }\n };\n} else {\n _setSimultaneousAccepts = function() {};\n}\n\nmodule.exports = {\n _createServerHandle: createServerHandle,\n _normalizeArgs: normalizeArgs,\n _setSimultaneousAccepts,\n connect,\n createConnection: connect,\n createServer,\n isIP: isIP,\n isIPv4: isIPv4,\n isIPv6: isIPv6,\n Server,\n Socket,\n Stream: Socket, // Legacy naming\n};\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 46012,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "",
"ranges": [
{
"startOffset": 1,
"endOffset": 46010,
"count": 1
},
{
"startOffset": 45165,
"endOffset": 45668,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "noop",
"ranges": [
{
"startOffset": 2781,
"endOffset": 2799,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createHandle",
"ranges": [
{
"startOffset": 2801,
"endOffset": 3190,
"count": 2
},
{
"startOffset": 2976,
"endOffset": 2998,
"count": 0
},
{
"startOffset": 3028,
"endOffset": 3189,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "getNewAsyncId",
"ranges": [
{
"startOffset": 3193,
"endOffset": 3331,
"count": 2
},
{
"startOffset": 3288,
"endOffset": 3306,
"count": 0
},
{
"startOffset": 3329,
"endOffset": 3330,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "isPipeName",
"ranges": [
{
"startOffset": 3371,
"endOffset": 3454,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createServer",
"ranges": [
{
"startOffset": 3456,
"endOffset": 3560,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "connect",
"ranges": [
{
"startOffset": 3783,
"endOffset": 4091,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "normalizeArgs",
"ranges": [
{
"startOffset": 4586,
"endOffset": 5310,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "initSocketHandle",
"ranges": [
{
"startOffset": 5382,
"endOffset": 5678,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "Socket",
"ranges": [
{
"startOffset": 5771,
"endOffset": 8926,
"count": 2
},
{
"startOffset": 5831,
"endOffset": 5858,
"count": 0
},
{
"startOffset": 6301,
"endOffset": 6327,
"count": 0
},
{
"startOffset": 6484,
"endOffset": 6492,
"count": 0
},
{
"startOffset": 6884,
"endOffset": 6992,
"count": 0
},
{
"startOffset": 7169,
"endOffset": 7203,
"count": 0
},
{
"startOffset": 7483,
"endOffset": 7493,
"count": 1
},
{
"startOffset": 7578,
"endOffset": 8073,
"count": 0
},
{
"startOffset": 8508,
"endOffset": 8773,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "_unrefTimer",
"ranges": [
{
"startOffset": 9027,
"endOffset": 9157,
"count": 2
},
{
"startOffset": 9129,
"endOffset": 9151,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "shutdownSocket",
"ranges": [
{
"startOffset": 9161,
"endOffset": 9363,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._final",
"ranges": [
{
"startOffset": 9481,
"endOffset": 10221,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "afterShutdown",
"ranges": [
{
"startOffset": 10225,
"endOffset": 10586,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "writeAfterFIN",
"ranges": [
{
"startOffset": 10793,
"endOffset": 11284,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.setTimeout",
"ranges": [
{
"startOffset": 11316,
"endOffset": 11888,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._onTimeout",
"ranges": [
{
"startOffset": 11922,
"endOffset": 12426,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.setNoDelay",
"ranges": [
{
"startOffset": 12460,
"endOffset": 12806,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.setKeepAlive",
"ranges": [
{
"startOffset": 12842,
"endOffset": 13089,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.address",
"ranges": [
{
"startOffset": 13120,
"endOffset": 13164,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 13232,
"endOffset": 13276,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 13346,
"endOffset": 13676,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 13746,
"endOffset": 13854,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._read",
"ranges": [
{
"startOffset": 13951,
"endOffset": 14371,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.end",
"ranges": [
{
"startOffset": 14398,
"endOffset": 14523,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onReadableStreamEnd",
"ranges": [
{
"startOffset": 14570,
"endOffset": 14732,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "maybeDestroy",
"ranges": [
{
"startOffset": 14792,
"endOffset": 14990,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.destroySoon",
"ranges": [
{
"startOffset": 15024,
"endOffset": 15178,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._destroy",
"ranges": [
{
"startOffset": 15210,
"endOffset": 16138,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onread",
"ranges": [
{
"startOffset": 16241,
"endOffset": 17428,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._getpeername",
"ranges": [
{
"startOffset": 17463,
"endOffset": 17750,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "protoGetter",
"ranges": [
{
"startOffset": 17753,
"endOffset": 17914,
"count": 8
}
],
"isBlockCoverage": true
},
{
"functionName": "bytesRead",
"ranges": [
{
"startOffset": 17941,
"endOffset": 18032,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "remoteAddress",
"ranges": [
{
"startOffset": 18065,
"endOffset": 18131,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "remoteFamily",
"ranges": [
{
"startOffset": 18163,
"endOffset": 18227,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "remotePort",
"ranges": [
{
"startOffset": 18257,
"endOffset": 18317,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._getsockname",
"ranges": [
{
"startOffset": 18354,
"endOffset": 18635,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "localAddress",
"ranges": [
{
"startOffset": 18667,
"endOffset": 18732,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "localPort",
"ranges": [
{
"startOffset": 18762,
"endOffset": 18821,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._writeGeneric",
"ranges": [
{
"startOffset": 18859,
"endOffset": 19676,
"count": 2
},
{
"startOffset": 19081,
"endOffset": 19274,
"count": 0
},
{
"startOffset": 19355,
"endOffset": 19425,
"count": 0
},
{
"startOffset": 19523,
"endOffset": 19558,
"count": 0
},
{
"startOffset": 19636,
"endOffset": 19674,
"count": 0
}
],
"isBlockCoverage": true
},
{
"functionName": "connect",
"ranges": [
{
"startOffset": 19176,
"endOffset": 19256,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._writev",
"ranges": [
{
"startOffset": 19707,
"endOffset": 19775,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket._write",
"ranges": [
{
"startOffset": 19805,
"endOffset": 19886,
"count": 2
}
],
"isBlockCoverage": true
},
{
"functionName": "_bytesDispatched",
"ranges": [
{
"startOffset": 20079,
"endOffset": 20183,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "bytesWritten",
"ranges": [
{
"startOffset": 20215,
"endOffset": 21157,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "afterWrite",
"ranges": [
{
"startOffset": 21162,
"endOffset": 21836,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "checkBindError",
"ranges": [
{
"startOffset": 21839,
"endOffset": 22636,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "internalConnect",
"ranges": [
{
"startOffset": 22639,
"endOffset": 24401,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.connect",
"ranges": [
{
"startOffset": 24431,
"endOffset": 25753,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lookupAndConnect",
"ranges": [
{
"startOffset": 25757,
"endOffset": 28877,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "connectErrorNT",
"ranges": [
{
"startOffset": 28880,
"endOffset": 28939,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.ref",
"ranges": [
{
"startOffset": 28965,
"endOffset": 29152,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Socket.unref",
"ranges": [
{
"startOffset": 29181,
"endOffset": 29374,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "afterConnect",
"ranges": [
{
"startOffset": 29378,
"endOffset": 30697,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server",
"ranges": [
{
"startOffset": 30700,
"endOffset": 32081,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "toNumber",
"ranges": [
{
"startOffset": 32121,
"endOffset": 32186,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "createServerHandle",
"ranges": [
{
"startOffset": 32254,
"endOffset": 33732,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "setupListenHandle",
"ranges": [
{
"startOffset": 33734,
"endOffset": 36012,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitErrorNT",
"ranges": [
{
"startOffset": 36079,
"endOffset": 36141,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitListeningNT",
"ranges": [
{
"startOffset": 36144,
"endOffset": 36259,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "listenInCluster",
"ranges": [
{
"startOffset": 36262,
"endOffset": 37459,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.listen",
"ranges": [
{
"startOffset": 37488,
"endOffset": 40636,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "lookupAndListen",
"ranges": [
{
"startOffset": 40639,
"endOffset": 41037,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "get",
"ranges": [
{
"startOffset": 41101,
"endOffset": 41144,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.address",
"ranges": [
{
"startOffset": 41219,
"endOffset": 41517,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "onconnection",
"ranges": [
{
"startOffset": 41520,
"endOffset": 42135,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.getConnections",
"ranges": [
{
"startOffset": 42172,
"endOffset": 42925,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.close",
"ranges": [
{
"startOffset": 42954,
"endOffset": 43821,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server._emitCloseIfDrained",
"ranges": [
{
"startOffset": 43863,
"endOffset": 44249,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "emitCloseNT",
"ranges": [
{
"startOffset": 44253,
"endOffset": 44336,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "",
"ranges": [
{
"startOffset": 44390,
"endOffset": 44446,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server._setupWorker",
"ranges": [
{
"startOffset": 44621,
"endOffset": 44847,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.ref",
"ranges": [
{
"startOffset": 44873,
"endOffset": 44971,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "Server.unref",
"ranges": [
{
"startOffset": 44999,
"endOffset": 45098,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "_setSimultaneousAccepts",
"ranges": [
{
"startOffset": 45223,
"endOffset": 45665,
"count": 0
}
],
"isBlockCoverage": false
},
{
"functionName": "_setSimultaneousAccepts",
"ranges": [
{
"startOffset": 45704,
"endOffset": 45717,
"count": 0
}
],
"isBlockCoverage": false
}
]
},
{
"url": "path.js",
"source": "(function (exports, require, module, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;\nconst {\n CHAR_UPPERCASE_A,\n CHAR_LOWERCASE_A,\n CHAR_UPPERCASE_Z,\n CHAR_LOWERCASE_Z,\n CHAR_DOT,\n CHAR_FORWARD_SLASH,\n CHAR_BACKWARD_SLASH,\n CHAR_COLON,\n CHAR_QUESTION_MARK,\n} = require('internal/constants');\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new ERR_INVALID_ARG_TYPE('path', 'string', path);\n }\n}\n\nfunction isPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n}\n\nfunction isPosixPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH;\n}\n\nfunction isWindowsDeviceRoot(code) {\n return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z ||\n code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeString(path, allowAboveRoot, separator, isPathSeparator) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (isPathSeparator(code))\n break;\n else\n code = CHAR_FORWARD_SLASH;\n\n if (isPathSeparator(code)) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 ||\n res.charCodeAt(res.length - 1) !== CHAR_DOT ||\n res.charCodeAt(res.length - 2) !== CHAR_DOT) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(separator);\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += `${separator}..`;\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += separator + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === CHAR_DOT && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n const dir = pathObject.dir || pathObject.root;\n const base = pathObject.base ||\n ((pathObject.name || '') + (pathObject.ext || ''));\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nconst win32 = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedDevice = '';\n var resolvedTail = '';\n var resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1; i--) {\n var path;\n if (i >= 0) {\n path = arguments[i];\n } else if (!resolvedDevice) {\n path = process.cwd();\n } else {\n // Windows has the concept of drive-specific current working\n // directories. If we've resolved a drive letter but not yet an\n // absolute path, get cwd for that drive, or the process cwd if\n // the drive cwd is not available. We're sure the device is not\n // a UNC path at this points, because UNC paths are always absolute.\n path = process.env['=' + resolvedDevice] || process.cwd();\n\n // Verify that a cwd was found and that it actually points\n // to our drive. If not, default to the drive's root.\n if (path === undefined ||\n path.slice(0, 3).toLowerCase() !==\n resolvedDevice.toLowerCase() + '\\\\') {\n path = resolvedDevice + '\\\\';\n }\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n var len = path.length;\n var rootEnd = 0;\n var device = '';\n var isAbsolute = f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment