From 1b774e8d969a5314d4cf0f9a0eff87d0c4dbb1c2 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Fri, 9 Apr 2021 12:50:54 -0500 Subject: [PATCH 1/4] cli(asset-saver): print one devtoolsLog event per line --- lighthouse-core/lib/asset-saver.js | 108 ++++++++++--------- lighthouse-core/test/lib/asset-saver-test.js | 48 ++++++++- yarn.lock | 6 +- 3 files changed, 109 insertions(+), 53 deletions(-) diff --git a/lighthouse-core/lib/asset-saver.js b/lighthouse-core/lib/asset-saver.js index 23273545e1ed..16a630f0a0d4 100644 --- a/lighthouse-core/lib/asset-saver.js +++ b/lighthouse-core/lib/asset-saver.js @@ -9,6 +9,7 @@ const fs = require('fs'); const path = require('path'); const log = require('lighthouse-logger'); const stream = require('stream'); +const {promisify} = require('util'); const Simulator = require('./dependency-graph/simulator/simulator.js'); const lanternTraceSaver = require('./lantern-trace-saver.js'); const Metrics = require('./traces/pwmetrics-events.js'); @@ -16,6 +17,7 @@ const rimraf = require('rimraf'); const NetworkAnalysisComputed = require('../computed/network-analysis.js'); const LoadSimulatorComputed = require('../computed/load-simulator.js'); const LHError = require('../lib/lh-error.js'); +const pipeline = promisify(stream.pipeline); const artifactsFilename = 'artifacts.json'; const traceSuffix = '.trace.json'; @@ -112,8 +114,7 @@ async function saveArtifacts(artifacts, basePath) { // save devtools log for (const [passName, devtoolsLog] of Object.entries(devtoolsLogs)) { - const log = JSON.stringify(devtoolsLog); - fs.writeFileSync(`${basePath}/${passName}${devtoolsLogSuffix}`, log, 'utf8'); + await saveDevtoolsLog(devtoolsLog, `${basePath}/${passName}${devtoolsLogSuffix}`); } // save everything else, using a replacer to serialize LHErrors in the artifacts. @@ -164,47 +165,55 @@ async function prepareAssets(artifacts, audits) { } /** - * Generates a JSON representation of traceData line-by-line for a nicer printed - * version with one trace event per line. - * @param {LH.Trace} traceData + * Generates a JSON representation of an array of objects with the objects + * printed one per line for a more readable (but not too verbose) version. + * @param {Array} arrayOfObjects * @return {IterableIterator} */ -function* traceJsonGenerator(traceData) { - const EVENTS_PER_ITERATION = 500; - const keys = Object.keys(traceData); - - yield '{\n'; +function* arrayOfObjectsJsonGenerator(arrayOfObjects) { + const ELEMENTS_PER_ITERATION = 500; // Stringify and emit trace events separately to avoid a giant string in memory. - yield '"traceEvents": [\n'; - if (traceData.traceEvents.length > 0) { - const eventsIterator = traceData.traceEvents[Symbol.iterator](); - // Emit first item manually to avoid a trailing comma. - const firstEvent = eventsIterator.next().value; - yield ` ${JSON.stringify(firstEvent)}`; - - let eventsRemaining = EVENTS_PER_ITERATION; - let eventsJSON = ''; - for (const event of eventsIterator) { - eventsJSON += `,\n ${JSON.stringify(event)}`; - eventsRemaining--; - if (eventsRemaining === 0) { - yield eventsJSON; - eventsRemaining = EVENTS_PER_ITERATION; - eventsJSON = ''; + yield '[\n'; + if (arrayOfObjects.length > 0) { + const elementsIterator = arrayOfObjects[Symbol.iterator](); + // Emit first element manually to avoid a trailing comma. + const firstElement = elementsIterator.next().value; + yield ` ${JSON.stringify(firstElement)}`; + + let elementsRemaining = ELEMENTS_PER_ITERATION; + let elementsJSON = ''; + for (const element of elementsIterator) { + elementsJSON += `,\n ${JSON.stringify(element)}`; + elementsRemaining--; + if (elementsRemaining === 0) { + yield elementsJSON; + elementsRemaining = ELEMENTS_PER_ITERATION; + elementsJSON = ''; } } - yield eventsJSON; + yield elementsJSON; } yield '\n]'; +} + +/** + * Generates a JSON representation of traceData line-by-line for a nicer printed + * version with one trace event per line. + * @param {LH.Trace} traceData + * @return {IterableIterator} + */ +function* traceJsonGenerator(traceData) { + const {traceEvents, ...rest} = traceData; - // Emit the rest of the object (usually just `metadata`) - if (keys.length > 1) { - for (const key of keys) { - if (key === 'traceEvents') continue; + yield '{\n'; - yield `,\n"${key}": ${JSON.stringify(traceData[key], null, 2)}`; - } + yield '"traceEvents": '; + yield* arrayOfObjectsJsonGenerator(traceEvents); + + // Emit the rest of the object (usually just `metadata`, if anything). + for (const [key, value] of Object.entries(rest)) { + yield `,\n"${key}": ${JSON.stringify(value, null, 2)}`; } yield '}\n'; @@ -216,24 +225,24 @@ function* traceJsonGenerator(traceData) { * @param {string} traceFilename * @return {Promise} */ -function saveTrace(traceData, traceFilename) { - return new Promise((resolve, reject) => { - const traceIter = traceJsonGenerator(traceData); - // A stream that pulls in the next traceJsonGenerator chunk as writeStream - // reads from it. Closes stream with null when iteration is complete. - const traceStream = new stream.Readable({ - read() { - const next = traceIter.next(); - this.push(next.done ? null : next.value); - }, - }); +async function saveTrace(traceData, traceFilename) { + const traceIter = traceJsonGenerator(traceData); + const writeStream = fs.createWriteStream(traceFilename); - const writeStream = fs.createWriteStream(traceFilename); - writeStream.on('finish', resolve); - writeStream.on('error', reject); + return pipeline(stream.Readable.from(traceIter), writeStream); +} - traceStream.pipe(writeStream); - }); +/** + * Save a devtoolsLog as JSON by streaming to disk at devtoolLogFilename. + * @param {LH.DevtoolsLog} devtoolsLog + * @param {string} devtoolLogFilename + * @return {Promise} + */ +function saveDevtoolsLog(devtoolsLog, devtoolLogFilename) { + const logIter = arrayOfObjectsJsonGenerator(devtoolsLog); + const writeStream = fs.createWriteStream(devtoolLogFilename); + + return pipeline(stream.Readable.from(logIter), writeStream); } /** @@ -298,6 +307,7 @@ module.exports = { saveAssets, prepareAssets, saveTrace, + saveDevtoolsLog, saveLanternNetworkData, stringifyReplacer, }; diff --git a/lighthouse-core/test/lib/asset-saver-test.js b/lighthouse-core/test/lib/asset-saver-test.js index 45967ca6a579..64837541758b 100644 --- a/lighthouse-core/test/lib/asset-saver-test.js +++ b/lighthouse-core/test/lib/asset-saver-test.js @@ -89,6 +89,29 @@ describe('asset-saver helper', () => { fs.unlinkSync(traceFilename); }); + it('prints traces with an event per line', async () => { + const trace = { + traceEvents: [ + {args: {}, cat: 'devtools.timeline', pid: 1, ts: 2}, + {args: {}, cat: 'v8', pid: 1, ts: 3}, + {args: {IsMainFrame: true}, cat: 'v8', pid: 1, ts: 5}, + {args: {data: {encodedDataLength: 20, requestId: '1.22'}}, pid: 1, ts: 6}, + ], + }; + await assetSaver.saveTrace(trace, traceFilename); + + const traceFileContents = fs.readFileSync(traceFilename, 'utf8'); + expect(traceFileContents).toEqual( +`{ +"traceEvents": [ + {"args":{},"cat":"devtools.timeline","pid":1,"ts":2}, + {"args":{},"cat":"v8","pid":1,"ts":3}, + {"args":{"IsMainFrame":true},"cat":"v8","pid":1,"ts":5}, + {"args":{"data":{"encodedDataLength":20,"requestId":"1.22"}},"pid":1,"ts":6} +]} +`); + }); + it('correctly saves a trace with metadata to disk', () => { return assetSaver.saveTrace(fullTraceObj, traceFilename) .then(_ => { @@ -96,7 +119,7 @@ describe('asset-saver helper', () => { const traceEventsFromDisk = JSON.parse(traceFileContents).traceEvents; assertTraceEventsEqual(traceEventsFromDisk, fullTraceObj.traceEvents); }); - }, 10000); + }); it('correctly saves a trace with no trace events to disk', () => { const trace = { @@ -161,6 +184,29 @@ describe('asset-saver helper', () => { }, 40 * 1000); }); + describe('saveDevtoolsLog', () => { + const devtoolsLogFilename = 'test-devtoolslog-0.json'; + + afterEach(() => { + fs.unlinkSync(devtoolsLogFilename); + }); + + it('prints devtoolsLogs with an event per line', async () => { + const devtoolsLog = [ + {method: 'Network.requestServedFromCache', params: {requestId: '1.22'}}, + {method: 'Network.responseReceived', params: {status: 301, headers: {':method': 'POST'}}}, + ]; + await assetSaver.saveDevtoolsLog(devtoolsLog, devtoolsLogFilename); + + const devtoolsLogFileContents = fs.readFileSync(devtoolsLogFilename, 'utf8'); + expect(devtoolsLogFileContents).toEqual( +`[ + {"method":"Network.requestServedFromCache","params":{"requestId":"1.22"}}, + {"method":"Network.responseReceived","params":{"status":301,"headers":{":method":"POST"}}} +]`); + }); + }); + describe('loadArtifacts', () => { it('loads artifacts from disk', async () => { const artifactsPath = __dirname + '/../fixtures/artifacts/perflog/'; diff --git a/yarn.lock b/yarn.lock index 26121649386b..cd77f963120d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -665,9 +665,9 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*": - version "10.14.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.0.tgz#1c297530428c6f4e0a0a3222f5b44745669aa9f7" - integrity sha512-1UhSMMDix7bVdUeqtZERQQyJr3QuFoN5X5APtpIooGkumE3crPaeq7UgFeJNjGD8yCQ8od8PzRkgptR5+x327Q== + version "12.20.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.7.tgz#1cb61fd0c85cb87e728c43107b5fd82b69bc9ef8" + integrity sha512-gWL8VUkg8VRaCAUgG9WmhefMqHmMblxe2rVpMF86nZY/+ZysU+BkAp+3cz03AixWDSSz0ks5WX59yAhv/cDwFA== "@types/node@^11.10.4": version "11.15.9" From d65ce2e23585552360f327ca5e4cc467b5b2c852 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Fri, 9 Apr 2021 14:39:42 -0500 Subject: [PATCH 2/4] remove unneeded @ts-expect-errors --- lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js index 003cadb45bf5..e79a5b0424ec 100644 --- a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +++ b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js @@ -14,7 +14,6 @@ const ChromeLauncher = require('chrome-launcher'); const ChromeProtocol = require('../../../../lighthouse-core/gather/connections/cri.js'); -// @ts-expect-error - `require` isn't on `global` in the node typedefs. const originalRequire = global.require; if (typeof globalThis === 'undefined') { // @ts-expect-error - exposing for loading of dt-bundle. @@ -25,7 +24,6 @@ if (typeof globalThis === 'undefined') { // @ts-ignore - file exists if `yarn build-all` is run, but not used for types anyways. require('../../../../dist/lighthouse-dt-bundle.js'); // eslint-disable-line -// @ts-expect-error - `require` isn't on `global` in the node typedefs. global.require = originalRequire; /** @type {import('../../../../lighthouse-core/index.js')} */ From 3788b22b7e43ffd1f0ee0051d3cfd47d70995ab6 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Fri, 9 Apr 2021 16:26:45 -0500 Subject: [PATCH 3/4] update browserify --- package.json | 2 +- yarn.lock | 279 +++++++++++++++++++++++++++++---------------------- 2 files changed, 162 insertions(+), 119 deletions(-) diff --git a/package.json b/package.json index e1de17225511..5e4d4f99d18c 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "@wardpeet/brfs": "2.1.0", "angular": "^1.7.4", "archiver": "^3.0.0", - "browserify": "^16.2.3", + "browserify": "^17.0.0", "browserify-banner": "^1.0.15", "bundle-phobia-cli": "^0.14.6", "c8": "^7.4.0", diff --git a/yarn.lock b/yarn.lock index cd77f963120d..be79c1d75e9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1086,10 +1086,10 @@ array-equal@^1.0.0: resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= -array-filter@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" - integrity sha1-fajPLiZijtcygDWB/SH2fKzS7uw= +array-filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" + integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= array-find-index@^1.0.1: version "1.0.2" @@ -1106,16 +1106,6 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= -array-map@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" - integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= - -array-reduce@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" - integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= - array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -1206,6 +1196,13 @@ atob@^2.0.0: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.0.tgz#ab2b150e51d7b122b9efc8d7340c06b6c41076bc" integrity sha512-SuiKH8vbsOyCALjA/+EINmt/Kdl+TQPrtFgW7XZZcwtryFu9e5kQoX3bjCW6mIvGH1fbeAZZuvwGR5IlBRznGw== +available-typed-arrays@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5" + integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== + dependencies: + array-filter "^1.0.0" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1377,13 +1374,20 @@ browser-process-hrtime@^0.1.2: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" integrity sha1-Ql1opY00R/AqBKqJQYf86K+Le44= -browser-resolve@^1.11.0, browser-resolve@^1.11.3, browser-resolve@^1.7.0: +browser-resolve@^1.11.3: version "1.11.3" resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== dependencies: resolve "1.1.7" +browser-resolve@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-2.0.0.tgz#99b7304cb392f8d73dba741bb2d7da28c6d7842b" + integrity sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ== + dependencies: + resolve "^1.17.0" + browserify-aes@^1.0.0, browserify-aes@^1.0.4: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -1460,49 +1464,49 @@ browserify-zlib@~0.2.0: dependencies: pako "~1.0.5" -browserify@^16.2.3: - version "16.2.3" - resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.2.3.tgz#7ee6e654ba4f92bce6ab3599c3485b1cc7a0ad0b" - integrity sha512-zQt/Gd1+W+IY+h/xX2NYMW4orQWhqSwyV+xsblycTtpOuB27h1fZhhNQuipJ4t79ohw4P4mMem0jp/ZkISQtjQ== +browserify@^17.0.0: + version "17.0.0" + resolved "https://registry.yarnpkg.com/browserify/-/browserify-17.0.0.tgz#4c48fed6c02bfa2b51fd3b670fddb805723cdc22" + integrity sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w== dependencies: JSONStream "^1.0.3" assert "^1.4.0" browser-pack "^6.0.1" - browser-resolve "^1.11.0" + browser-resolve "^2.0.0" browserify-zlib "~0.2.0" - buffer "^5.0.2" + buffer "~5.2.1" cached-path-relative "^1.0.0" concat-stream "^1.6.0" console-browserify "^1.1.0" constants-browserify "~1.0.0" crypto-browserify "^3.0.0" defined "^1.0.0" - deps-sort "^2.0.0" + deps-sort "^2.0.1" domain-browser "^1.2.0" duplexer2 "~0.1.2" - events "^2.0.0" + events "^3.0.0" glob "^7.1.0" has "^1.0.0" htmlescape "^1.1.0" https-browserify "^1.0.0" inherits "~2.0.1" - insert-module-globals "^7.0.0" + insert-module-globals "^7.2.1" labeled-stream-splicer "^2.0.0" - mkdirp "^0.5.0" - module-deps "^6.0.0" + mkdirp-classic "^0.5.2" + module-deps "^6.2.3" os-browserify "~0.3.0" parents "^1.0.1" - path-browserify "~0.0.0" + path-browserify "^1.0.0" process "~0.11.0" punycode "^1.3.2" querystring-es3 "~0.2.0" read-only-stream "^2.0.0" readable-stream "^2.0.2" resolve "^1.1.4" - shasum "^1.0.0" + shasum-object "^1.0.0" shell-quote "^1.6.1" - stream-browserify "^2.0.0" - stream-http "^2.0.0" + stream-browserify "^3.0.0" + stream-http "^3.0.0" string_decoder "^1.1.1" subarg "^1.0.0" syntax-error "^1.1.1" @@ -1510,7 +1514,7 @@ browserify@^16.2.3: timers-browserify "^1.0.1" tty-browserify "0.0.1" url "~0.11.0" - util "~0.10.1" + util "~0.12.0" vm-browserify "^1.0.0" xtend "^4.0.0" @@ -1559,7 +1563,7 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= -buffer@^5.0.2, buffer@^5.1.0: +buffer@^5.1.0, buffer@~5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== @@ -1647,7 +1651,7 @@ cacheable-request@^6.0.0: normalize-url "^4.1.0" responselike "^1.0.2" -cached-path-relative@^1.0.0: +cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" integrity sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== @@ -2511,13 +2515,13 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= -deps-sort@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" - integrity sha1-CRckkC6EZYJg65EHSMzNGvbiH7U= +deps-sort@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" + integrity sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw== dependencies: JSONStream "^1.0.3" - shasum "^1.0.0" + shasum-object "^1.0.0" subarg "^1.0.0" through2 "^2.0.0" @@ -2544,7 +2548,7 @@ detect-newline@^2.1.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= -detective@^5.0.2: +detective@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== @@ -2693,7 +2697,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.5.1: +es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2, es-abstract@^1.5.1: version "1.18.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4" integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== @@ -2973,10 +2977,10 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -events@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/events/-/events-2.1.0.tgz#2a9a1e18e6106e0e812aa9ebd4a819b3c29c0ba5" - integrity sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== +events@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" @@ -3146,6 +3150,11 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-safe-stringify@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + fastq@^1.6.0: version "1.9.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.9.0.tgz#e16a72f338eaca48e91b5c23593bcc2ef66b7947" @@ -3279,6 +3288,11 @@ for-in@^1.0.2: resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= + foreground-child@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" @@ -3895,7 +3909,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3936,10 +3950,10 @@ inquirer@^7.1.0: strip-ansi "^6.0.0" through "^2.3.6" -insert-module-globals@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.0.tgz#ec87e5b42728479e327bd5c5c71611ddfb4752ba" - integrity sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== +insert-module-globals@^7.2.1: + version "7.2.1" + resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.1.tgz#d5e33185181a4e1f33b15f7bf100ee91890d5cb3" + integrity sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg== dependencies: JSONStream "^1.0.3" acorn-node "^1.5.2" @@ -4002,6 +4016,13 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-arguments@^1.0.4: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9" + integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg== + dependencies: + call-bind "^1.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -4129,6 +4150,11 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" integrity sha512-elzyIdM7iKoFHzcrndIqjYomImhxrFRnGP3galODoII4TB9gI7mZ+FnlLQmmjf27SxHS2gKEeyhX5/+YRS6H9g== +is-generator-function@^1.0.7: + version "1.0.8" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.8.tgz#dfb5c2b120e02b0a8d9d2c6806cd5621aa922f7b" + integrity sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ== + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -4259,6 +4285,17 @@ is-text-path@^1.0.0: dependencies: text-extensions "^1.0.0" +is-typed-array@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.5.tgz#f32e6e096455e329eb7b423862456aa213f0eb4e" + integrity sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug== + dependencies: + available-typed-arrays "^1.0.2" + call-bind "^1.0.2" + es-abstract "^1.18.0-next.2" + foreach "^2.0.5" + has-symbols "^1.0.1" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -4880,13 +4917,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -json-stable-stringify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" - integrity sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= - dependencies: - jsonify "~0.0.0" - json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -4906,11 +4936,6 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= - jsonld@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/jsonld/-/jsonld-5.2.0.tgz#d1e8af38a334cb95edf0f2ae4e2b58baf8d2b5a9" @@ -5483,6 +5508,11 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" +mkdirp-classic@^0.5.2: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.4: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" @@ -5502,17 +5532,17 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.0.tgz#e2b6cdeb9ce19f99317a53722f3dbf5df5eaaab2" integrity sha1-4rbN65zhn5kxelNyLz2/XfXqqrI= -module-deps@^6.0.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.0.tgz#d41a2e790245ce319171e4e7c4d8c73993ba3cd5" - integrity sha512-hKPmO06so6bL/ZvqVNVqdTVO8UAYsi3tQWlCa+z9KuWhoN4KDQtb5hcqQQv58qYiDE21wIvnttZEPiDgEbpwbA== +module-deps@^6.2.3: + version "6.2.3" + resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.3.tgz#15490bc02af4b56cf62299c7c17cba32d71a96ee" + integrity sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA== dependencies: JSONStream "^1.0.3" - browser-resolve "^1.7.0" - cached-path-relative "^1.0.0" + browser-resolve "^2.0.0" + cached-path-relative "^1.0.2" concat-stream "~1.6.0" defined "^1.0.0" - detective "^5.0.2" + detective "^5.2.0" duplexer2 "^0.1.2" inherits "^2.0.1" parents "^1.0.0" @@ -6090,10 +6120,10 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-browserify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" - integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== +path-browserify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== path-dirname@^1.0.0: version "1.0.2" @@ -6524,16 +6554,16 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -"readable-stream@2 || 3": - version "3.4.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" - integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== +"readable-stream@2 || 3", readable-stream@^3.5.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.3, readable-stream@~2.3.6: +readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@~2.3.3, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -6718,7 +6748,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0: +resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.4.0: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== @@ -6799,7 +6829,7 @@ rxjs@^6.6.0: dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -6904,7 +6934,7 @@ setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= -sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: +sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== @@ -6917,13 +6947,12 @@ shallow-copy@~0.0.1: resolved "https://registry.yarnpkg.com/shallow-copy/-/shallow-copy-0.0.1.tgz#415f42702d73d810330292cc5ee86eae1a11a170" integrity sha1-QV9CcC1z2BAzApLMXuhurhoRoXA= -shasum@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" - integrity sha1-5wEjENj0F/TetXEhUOVni4euVl8= +shasum-object@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shasum-object/-/shasum-object-1.0.0.tgz#0b7b74ff5b66ecf9035475522fa05090ac47e29e" + integrity sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg== dependencies: - json-stable-stringify "~0.0.0" - sha.js "~2.4.4" + fast-safe-stringify "^2.0.7" shebang-command@^1.2.0: version "1.2.0" @@ -6950,14 +6979,9 @@ shebang-regex@^3.0.0: integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== shell-quote@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" - integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= - dependencies: - array-filter "~0.0.0" - array-map "~0.0.0" - array-reduce "~0.0.0" - jsonify "~0.0.0" + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== shelljs@^0.8.3: version "0.8.4" @@ -7222,13 +7246,13 @@ stealthy-require@^1.1.0: resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= -stream-browserify@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" - integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== +stream-browserify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" + integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" + inherits "~2.0.4" + readable-stream "^3.5.0" stream-combiner2@^1.1.1: version "1.1.1" @@ -7238,16 +7262,15 @@ stream-combiner2@^1.1.1: duplexer2 "~0.1.0" readable-stream "^2.0.2" -stream-http@^2.0.0: - version "2.8.3" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" - integrity sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== +stream-http@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-3.1.1.tgz#0370a8017cf8d050b9a8554afe608f043eaff564" + integrity sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg== dependencies: builtin-status-codes "^3.0.0" - inherits "^2.0.1" - readable-stream "^2.3.6" - to-arraybuffer "^1.0.0" - xtend "^4.0.0" + inherits "^2.0.4" + readable-stream "^3.6.0" + xtend "^4.0.2" stream-splicer@^2.0.0: version "2.0.0" @@ -7322,11 +7345,11 @@ string.prototype.trimstart@^1.0.4: define-properties "^1.1.3" string_decoder@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" - integrity sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== dependencies: - safe-buffer "~5.1.0" + safe-buffer "~5.2.0" string_decoder@~1.1.1: version "1.1.1" @@ -7608,11 +7631,6 @@ tmpl@1.0.x: resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= - to-buffer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" @@ -7954,13 +7972,25 @@ util.promisify@^1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@0.10.3, util@~0.10.1: +util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= dependencies: inherits "2.0.1" +util@~0.12.0: + version "0.12.3" + resolved "https://registry.yarnpkg.com/util/-/util-0.12.3.tgz#971bb0292d2cc0c892dab7c6a5d37c2bec707888" + integrity sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + is-typed-array "^1.1.3" + safe-buffer "^5.1.2" + which-typed-array "^1.1.2" + uuid@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.0.tgz#6728fc0459c450d796a99c31837569bdf672d728" @@ -8101,6 +8131,19 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= +which-typed-array@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.4.tgz#8fcb7d3ee5adf2d771066fba7cf37e32fe8711ff" + integrity sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA== + dependencies: + available-typed-arrays "^1.0.2" + call-bind "^1.0.0" + es-abstract "^1.18.0-next.1" + foreach "^2.0.5" + function-bind "^1.1.1" + has-symbols "^1.0.1" + is-typed-array "^1.1.3" + which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From 557dcf6bee7ccf563c40e8a5a2c260cb28728992 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Mon, 12 Apr 2021 11:16:21 -0500 Subject: [PATCH 4/4] feedback --- lighthouse-core/lib/asset-saver.js | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lighthouse-core/lib/asset-saver.js b/lighthouse-core/lib/asset-saver.js index 16a630f0a0d4..4f1fec589f1e 100644 --- a/lighthouse-core/lib/asset-saver.js +++ b/lighthouse-core/lib/asset-saver.js @@ -171,28 +171,28 @@ async function prepareAssets(artifacts, audits) { * @return {IterableIterator} */ function* arrayOfObjectsJsonGenerator(arrayOfObjects) { - const ELEMENTS_PER_ITERATION = 500; + const ITEMS_PER_ITERATION = 500; - // Stringify and emit trace events separately to avoid a giant string in memory. + // Stringify and emit items separately to avoid a giant string in memory. yield '[\n'; if (arrayOfObjects.length > 0) { - const elementsIterator = arrayOfObjects[Symbol.iterator](); - // Emit first element manually to avoid a trailing comma. - const firstElement = elementsIterator.next().value; - yield ` ${JSON.stringify(firstElement)}`; - - let elementsRemaining = ELEMENTS_PER_ITERATION; - let elementsJSON = ''; - for (const element of elementsIterator) { - elementsJSON += `,\n ${JSON.stringify(element)}`; - elementsRemaining--; - if (elementsRemaining === 0) { - yield elementsJSON; - elementsRemaining = ELEMENTS_PER_ITERATION; - elementsJSON = ''; + const itemsIterator = arrayOfObjects[Symbol.iterator](); + // Emit first item manually to avoid a trailing comma. + const firstItem = itemsIterator.next().value; + yield ` ${JSON.stringify(firstItem)}`; + + let itemsRemaining = ITEMS_PER_ITERATION; + let itemsJSON = ''; + for (const item of itemsIterator) { + itemsJSON += `,\n ${JSON.stringify(item)}`; + itemsRemaining--; + if (itemsRemaining === 0) { + yield itemsJSON; + itemsRemaining = ITEMS_PER_ITERATION; + itemsJSON = ''; } } - yield elementsJSON; + yield itemsJSON; } yield '\n]'; } @@ -229,6 +229,8 @@ async function saveTrace(traceData, traceFilename) { const traceIter = traceJsonGenerator(traceData); const writeStream = fs.createWriteStream(traceFilename); + // TODO: Can remove Readable.from() in Node 13, promisify(pipeline) in Node 15. + // https://nodejs.org/api/stream.html#stream_stream_pipeline_streams_callback return pipeline(stream.Readable.from(traceIter), writeStream); }