diff --git a/docs/package.json b/docs/package.json index 8b9a4e1b2f05..39488ed6e16f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -71,7 +71,7 @@ "karma-jasmine": "^5.0.0", "karma-jasmine-html-reporter": "^2.0.0", "light-server": "^2.9.1", - "lighthouse": "~12.8.0", + "lighthouse": "^13.0.0", "lighthouse-logger": "~2.0.0", "npm-run-all": "^4.1.5", "protractor": "^7.0.0", diff --git a/docs/tools/audit-docs.js b/docs/tools/audit-docs.js index c9772bec1302..1ae314d33b30 100644 --- a/docs/tools/audit-docs.js +++ b/docs/tools/audit-docs.js @@ -46,14 +46,10 @@ const MIN_A11Y_SCORES_PER_PAGE = { 'components/button/examples': 75, }; -/** - * @type {{minScores: {performance: number, accessibility: number, 'best-practices': number, pwa: number, seo: number}, url: string}[]} - */ const MIN_SCORES_PER_PAGE = [ { url: '', minScores: { - pwa: 0, performance: 25, // Intentionally low because Ligthouse is flaky. seo: 90, 'best-practices': 90, @@ -66,10 +62,6 @@ const MIN_SCORES_PER_PAGE = [ })), ]; -/** - * @param {{performance?: number, accessibility?: number, 'best-practices'?: number, pwa?: number, seo?: number}} scores - * @returns string scores formatted as described in the docs of lighthouse-audit.mjs's _main() - */ function formatScores(scores) { let formattedScores = ''; Object.keys(scores).map((key, index) => { diff --git a/docs/tools/lighthouse-audit.mjs b/docs/tools/lighthouse-audit.mjs index 9aa71f5dbc4e..4a48e58d3833 100644 --- a/docs/tools/lighthouse-audit.mjs +++ b/docs/tools/lighthouse-audit.mjs @@ -14,7 +14,7 @@ const projectDir = path.join(dirname, '../'); const reportsDir = path.join(projectDir, 'dist/reports'); // Constants -const AUDIT_CATEGORIES = ['accessibility', 'best-practices', 'performance', 'pwa', 'seo']; +const AUDIT_CATEGORIES = ['accessibility', 'best-practices', 'performance', 'seo']; /** * @type {LH.Flags} @@ -34,16 +34,16 @@ _main(process.argv.slice(2)).then(() => console.log('Audit completed.')); /** * Usage: * ```sh - * node tools/lighthouse-audit [] + * node tools/lighthouse-audit {{url}} {{min-scores}} [{{log-file}}] * ``` * * Runs audits against the specified URL on specific categories (accessibility, * best practices, performance, PWA, SEO). It fails, if the score in any - * category is below the score specified in ``. (Only runs audits + * category is below the score specified in `{{min-scores}}`. (Only runs audits * for the specified categories.) * - * `` is either a number (in which case it is interpreted as - * `all:`) or a list of comma-separated strings of the form + * `{{min-scores}}` is either a number (in which case it is interpreted as + * `all:{{min-score}}`) or a list of comma-separated strings of the form * `key:value`, where `key` is one of `accessibility`, `best-practices`, * `performance`, `pwa`, `seo` or `all` and `value` is a number (between 0 and 100). * @@ -55,15 +55,13 @@ _main(process.argv.slice(2)).then(() => console.log('Audit completed.')); * - `performance:90`: Only run audits for the `performance` category and require a score of 90 * or higher. * - * If `` is defined, the full results will be logged there. + * If `{{log-file}}` is defined, the full results will be logged there. * * Skips HTTPS-related audits, when run for an HTTP URL. * * Originally from https://github.com/angular/angular/blob/ab8199f7c909eaa8937d293ab44405fe263417cd/aio/scripts/audit-web-app.js * - * @param {string[]} args [] - * @returns {Promise} - * @private + * @param args {{url}} {{min-scores}} [{{log-file}}] */ async function _main(args) { const {url, minScores} = parseInput(args); @@ -132,10 +130,10 @@ function formatScore(score) { } /** - * @param {string} url the URL to run Lighthouse against - * @param {LH.Flags} flags Lighthouse flags - * @param {LH.Config.Json} config Lighthouse JSON config - * @returns {Promise} the result of the Lighthouse run + * @param url the URL to run Lighthouse against + * @param flags Lighthouse flags + * @param config Lighthouse JSON config + * @returns the result of the Lighthouse run */ async function launchChromeAndRunLighthouse(url, flags, config) { const browser = await puppeteer.launch({ @@ -174,8 +172,6 @@ async function cleanupAndPrepareReportsDir() { /** * Parse CLI args and throw errors if any are invalid. - * @param {string[]} args [] - * @returns {{url: string, minScores: {all?: number, performance?: number, accessibility?: number, 'best-practices'?: number, pwa?: number, seo?: number}}} * the validated URL, parsed minimum scores, and optional file path to write the report to */ function parseInput(args) { @@ -244,10 +240,10 @@ function parseMinScores(raw) { } /** - * @param {LH.RunnerResult} results from a Lighthouse run - * @param {{all?: number, performance?: number, accessibility?: number, 'best-practices'?: number, pwa?: number, seo?: number}} minScores the minimum acceptable scores for each audit category - * @param {string=} logFile optional file path to write the report to - * @returns {Promise} true if all of the scores were above the required min scores, false otherwise + * @param results from a Lighthouse run + * @param minScores the minimum acceptable scores for each audit category + * @param logFile optional file path to write the report to + * @returns true if all of the scores were above the required min scores, false otherwise */ async function processResults(results, minScores, logFile) { const lhVersion = results.lhr.lighthouseVersion; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f12f93d1dd6f..9693269bbf7c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -472,8 +472,8 @@ importers: specifier: ^2.9.1 version: 2.9.1(bufferutil@4.0.9) lighthouse: - specifier: ~12.8.0 - version: 12.8.2(bufferutil@4.0.9) + specifier: ^13.0.0 + version: 13.0.0(bufferutil@4.0.9) lighthouse-logger: specifier: ~2.0.0 version: 2.0.2 @@ -2952,8 +2952,8 @@ packages: resolution: {integrity: sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==} engines: {node: '>= 10.0.0'} - '@paulirish/trace_engine@0.0.59': - resolution: {integrity: sha512-439NUzQGmH+9Y017/xCchBP9571J4bzhpcNhrxorf7r37wcyJZkgUfrUsRL3xl+JDcZ6ORhoFCzCw98c6S3YHw==} + '@paulirish/trace_engine@0.0.61': + resolution: {integrity: sha512-/O08DwmUqIlJjUSPSZbNF8lWnlxaMsIOV6sS+uDKCxBd5i1psAmjEoG3JAqR6+nHD8X+YY474NW7SxUH/K+/kQ==} '@phenomnomnominal/tsquery@4.2.0': resolution: {integrity: sha512-hR2U3uVcrrdkuG30ItQ+uFDs4ncZAybxWG0OjTE8ptPzVoU7GVeXpy+vMU8zX9EbmjGeITPw/su5HjYQyAH8bA==} @@ -3942,6 +3942,10 @@ packages: resolution: {integrity: sha512-Xm7bpRXnDSX2YE2YFfBk2FnF0ep6tmG7xPh8iHee8MIcrgq762Nkce856dYtJYLkuIoYZvGfTs/PbZhideTcEg==} engines: {node: '>=4'} + axe-core@4.11.0: + resolution: {integrity: sha512-ilYanEU8vxxBexpJd8cWM4ElSQq4QctCLKih0TSfjIfCQTeyH/6zVrmIJfLPrKTKJRbiG+cfnZbQIjAlJmF1jQ==} + engines: {node: '>=4'} + b4a@1.7.3: resolution: {integrity: sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==} peerDependencies: @@ -4804,12 +4808,12 @@ packages: detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - devtools-protocol@0.0.1507524: - resolution: {integrity: sha512-OjaNE7qpk6GRTXtqQjAE5bGx6+c4F1zZH0YXtpZQLM92HNXx4zMAaqlKhP4T52DosG6hDW8gPMNhGOF8xbwk/w==} - devtools-protocol@0.0.1508733: resolution: {integrity: sha512-QJ1R5gtck6nDcdM+nlsaJXcelPEI7ZxSMw1ujHpO1c4+9l+Nue5qlebi9xO1Z2MGr92bFOQTW7/rrheh5hHxDg==} + devtools-protocol@0.0.1527314: + resolution: {integrity: sha512-UohCFOlzpPPD/IcsxM0k4lVZp/GfhPVJ6l2No5XX+LknpGisPWJe17oOHQhZTHf6ThUFIMwHO6bSEZUq/6oP7w==} + dgeni-packages@0.30.0: resolution: {integrity: sha512-k5y9HSwJzWgc8S7bHxejojJfuo2heltY9lTa5UgfqoBv2vubCwqXhVxFBXr3nKfymc9YOALCnk10JYeOdVLLWQ==} engines: {node: '>=12.0.0', yarn: '>=0.17.9'} @@ -6599,12 +6603,12 @@ packages: lighthouse-logger@2.0.2: resolution: {integrity: sha512-vWl2+u5jgOQuZR55Z1WM0XDdrJT6mzMP8zHUct7xTlWhuQs+eV0g+QL0RQdFjT54zVmbhLCP8vIVpy1wGn/gCg==} - lighthouse-stack-packs@1.12.2: - resolution: {integrity: sha512-Ug8feS/A+92TMTCK6yHYLwaFMuelK/hAKRMdldYkMNwv+d9PtWxjXEg6rwKtsUXTADajhdrhXyuNCJ5/sfmPFw==} + lighthouse-stack-packs@1.12.3: + resolution: {integrity: sha512-d8IsOpE83kbANgnM+Tp8+x6HcMpX9o2ITBiUERssgzAIFdZCQzs/f4k6D0DLQTE59enml9mbAOU52Wu35exWtg==} - lighthouse@12.8.2: - resolution: {integrity: sha512-+5SKYzVaTFj22MgoYDPNrP9tlD2/Ay7j3SxPSFD9FpPyVxGr4UtOQGKyrdZ7wCmcnBaFk0mCkPfARU3CsE0nvA==} - engines: {node: '>=18.16'} + lighthouse@13.0.0: + resolution: {integrity: sha512-s9koINEnVGm4n4oej4G3NET4e8i1XjPYCxEqp+TDlwUUkS5jpeOiFbIRLvPol/kgaeYce7BBqg8m52V7MEW7Lw==} + engines: {node: '>=22.19'} hasBin: true lines-and-columns@1.2.4: @@ -6865,9 +6869,6 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} - metaviewport-parser@0.3.0: - resolution: {integrity: sha512-EoYJ8xfjQ6kpe9VbVHvZTZHiOl4HL1Z18CrZ+qahvLXT7ZO4YTC2JMyt5FaUp9JJp6J4Ybb/z7IsCXZt86/QkQ==} - methods@1.1.2: resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} engines: {node: '>= 0.6'} @@ -7415,9 +7416,6 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - parse-cache-control@1.0.1: - resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==} - parse-json@4.0.0: resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} engines: {node: '>=4'} @@ -8781,11 +8779,11 @@ packages: title-case@2.1.1: resolution: {integrity: sha512-EkJoZ2O3zdCz3zJsYCsxyq2OC5hrxR9mfdd5I+w8h/tmFfeOxJ+vvkxsKxdmN0WtS9zLdHEgfgVOiMVgv+Po4Q==} - tldts-core@7.0.16: - resolution: {integrity: sha512-XHhPmHxphLi+LGbH0G/O7dmUH9V65OY20R7vH8gETHsp5AZCjBk9l8sqmRKLaGOxnETU7XNSDUPtewAy/K6jbA==} + tldts-core@7.0.17: + resolution: {integrity: sha512-DieYoGrP78PWKsrXr8MZwtQ7GLCUeLxihtjC1jZsW1DnvSMdKPitJSe8OSYDM2u5H6g3kWJZpePqkp43TfLh0g==} - tldts-icann@7.0.16: - resolution: {integrity: sha512-WS/pPasPs2cx6orcxCcIz01SlG3dwYlgjLAnQt7vLAusTuTLqdI8zmkqbM8TWYEf3Z0o1S4BzM3oSRFPk/6WnA==} + tldts-icann@7.0.17: + resolution: {integrity: sha512-up4oFDoumyz2RscRxoYRxf+2OvIKUHjh7rUvuGWI0PZ/47k35sadoi2JyKR0AIfTw09qcfix8bUxXFQhY1QZIQ==} tmp@0.0.30: resolution: {integrity: sha512-HXdTB7lvMwcb55XFfrTM8CPr/IYREk4hVBFaQ4b/6nInrluSL86hfHm7vu0luYKCfyBZp2trCjpc8caC3vVM3w==} @@ -12441,7 +12439,7 @@ snapshots: '@parcel/watcher-win32-x64': 2.5.1 optional: true - '@paulirish/trace_engine@0.0.59': + '@paulirish/trace_engine@0.0.61': dependencies: legacy-javascript: 0.0.1 third-party-web: 0.27.0 @@ -13421,6 +13419,8 @@ snapshots: axe-core@4.10.3: {} + axe-core@4.11.0: {} + b4a@1.7.3: {} babel-loader@10.0.0(@babel/core@7.28.4)(webpack@5.102.0(esbuild@0.25.10)): @@ -14340,10 +14340,10 @@ snapshots: detect-node@2.1.0: {} - devtools-protocol@0.0.1507524: {} - devtools-protocol@0.0.1508733: {} + devtools-protocol@0.0.1527314: {} + dgeni-packages@0.30.0(dgeni@0.4.14): dependencies: canonical-path: 1.0.0 @@ -16702,34 +16702,32 @@ snapshots: transitivePeerDependencies: - supports-color - lighthouse-stack-packs@1.12.2: {} + lighthouse-stack-packs@1.12.3: {} - lighthouse@12.8.2(bufferutil@4.0.9): + lighthouse@13.0.0(bufferutil@4.0.9): dependencies: - '@paulirish/trace_engine': 0.0.59 + '@paulirish/trace_engine': 0.0.61 '@sentry/node': 9.46.0 - axe-core: 4.10.3 + axe-core: 4.11.0 chrome-launcher: 1.2.1 configstore: 7.1.0 csp_evaluator: 1.1.5 - devtools-protocol: 0.0.1507524 + devtools-protocol: 0.0.1527314 enquirer: 2.4.1 http-link-header: 1.1.3 intl-messageformat: 10.7.17 jpeg-js: 0.4.4 js-library-detector: 6.7.0 lighthouse-logger: 2.0.2 - lighthouse-stack-packs: 1.12.2 + lighthouse-stack-packs: 1.12.3 lodash-es: 4.17.21 lookup-closest-locale: 6.2.0 - metaviewport-parser: 0.3.0 open: 8.4.2 - parse-cache-control: 1.0.1 puppeteer-core: 24.23.0(bufferutil@4.0.9) robots-parser: 3.0.1 speedline-core: 1.4.3 third-party-web: 0.27.0 - tldts-icann: 7.0.16 + tldts-icann: 7.0.17 ws: 7.5.10(bufferutil@4.0.9) yargs: 17.7.2 yargs-parser: 21.1.1 @@ -17029,8 +17027,6 @@ snapshots: merge2@1.4.1: {} - metaviewport-parser@0.3.0: {} - methods@1.1.2: {} micromatch@4.0.8: @@ -17631,8 +17627,6 @@ snapshots: dependencies: callsites: 3.1.0 - parse-cache-control@1.0.1: {} - parse-json@4.0.0: dependencies: error-ex: 1.3.4 @@ -19335,11 +19329,11 @@ snapshots: no-case: 2.3.2 upper-case: 1.1.3 - tldts-core@7.0.16: {} + tldts-core@7.0.17: {} - tldts-icann@7.0.16: + tldts-icann@7.0.17: dependencies: - tldts-core: 7.0.16 + tldts-core: 7.0.17 tmp@0.0.30: dependencies: