lighthouse 9.5.0-dev.20220416 → 9.5.0-dev.20220419

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/report/bundle.esm.js +117 -70
  2. package/dist/report/flow.js +23 -23
  3. package/dist/report/standalone.js +14 -14
  4. package/flow-report/src/summary/category.tsx +1 -1
  5. package/lighthouse-cli/.eslintrc.cjs +3 -4
  6. package/lighthouse-cli/bin.js +0 -1
  7. package/lighthouse-cli/cli-flags.js +0 -1
  8. package/lighthouse-cli/commands/commands.js +0 -1
  9. package/lighthouse-cli/commands/list-audits.js +0 -1
  10. package/lighthouse-cli/commands/list-locales.js +0 -1
  11. package/lighthouse-cli/commands/list-trace-categories.js +0 -1
  12. package/lighthouse-cli/index.js +0 -1
  13. package/lighthouse-cli/printer.js +0 -1
  14. package/lighthouse-cli/run.js +0 -1
  15. package/lighthouse-cli/sentry-prompt.js +0 -1
  16. package/lighthouse-cli/test/smokehouse/core-tests.js +0 -1
  17. package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +0 -1
  18. package/lighthouse-cli/test/smokehouse/frontends/lib.js +0 -1
  19. package/lighthouse-cli/test/smokehouse/frontends/node.js +0 -1
  20. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -1
  21. package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +0 -1
  22. package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +0 -1
  23. package/lighthouse-cli/test/smokehouse/lib/local-console.js +0 -1
  24. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +0 -1
  25. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +0 -1
  26. package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +0 -1
  27. package/lighthouse-cli/test/smokehouse/report-assert.js +0 -1
  28. package/lighthouse-cli/test/smokehouse/smokehouse.js +0 -1
  29. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +1 -1
  30. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +16 -2
  31. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +3 -2
  32. package/lighthouse-core/index.js +2 -9
  33. package/lighthouse-core/lib/stack-packs.js +4 -0
  34. package/lighthouse-core/scripts/manual-chrome-launcher.js +0 -1
  35. package/lighthouse-core/util-commonjs.js +14 -8
  36. package/package.json +3 -3
  37. package/report/.eslintrc.cjs +3 -1
  38. package/report/assets/styles.css +5 -2
  39. package/report/assets/templates.html +10 -9
  40. package/report/clients/bundle.js +0 -1
  41. package/report/clients/standalone.js +0 -1
  42. package/report/renderer/api.js +0 -1
  43. package/report/renderer/category-renderer.js +0 -1
  44. package/report/renderer/components.js +13 -14
  45. package/report/renderer/crc-details-renderer.js +0 -1
  46. package/report/renderer/details-renderer.js +0 -1
  47. package/report/renderer/dom.js +0 -1
  48. package/report/renderer/drop-down-menu.js +0 -1
  49. package/report/renderer/element-screenshot-renderer.js +0 -4
  50. package/report/renderer/features-util.js +0 -1
  51. package/report/renderer/i18n.js +91 -49
  52. package/report/renderer/logger.js +0 -1
  53. package/report/renderer/open-tab.js +0 -1
  54. package/report/renderer/performance-category-renderer.js +0 -1
  55. package/report/renderer/pwa-category-renderer.js +0 -1
  56. package/report/renderer/report-renderer.js +0 -1
  57. package/report/renderer/report-ui-features.js +0 -1
  58. package/report/renderer/snippet-renderer.js +0 -1
  59. package/report/renderer/swap-locale-feature.js +0 -1
  60. package/report/renderer/text-encoding.js +0 -1
  61. package/report/renderer/topbar-features.js +0 -1
  62. package/report/renderer/util.js +13 -8
  63. package/report/test/clients/bundle-test.js +0 -1
  64. package/report/test/renderer/category-renderer-test.js +0 -1
  65. package/report/test/renderer/components-test.js +0 -1
  66. package/report/test/renderer/crc-details-renderer-test.js +0 -1
  67. package/report/test/renderer/details-renderer-test.js +0 -1
  68. package/report/test/renderer/dom-test.js +0 -1
  69. package/report/test/renderer/element-screenshot-renderer-test.js +3 -4
  70. package/report/test/renderer/i18n-test.js +26 -8
  71. package/report/test/renderer/performance-category-renderer-test.js +0 -1
  72. package/report/test/renderer/pwa-category-renderer-test.js +0 -1
  73. package/report/test/renderer/report-renderer-axe-test.js +0 -1
  74. package/report/test/renderer/report-renderer-test.js +0 -1
  75. package/report/test/renderer/report-ui-features-test.js +0 -1
  76. package/report/test/renderer/snippet-renderer-test.js +0 -1
  77. package/report/test/renderer/text-encoding-test.js +0 -1
  78. package/report/test/renderer/util-test.js +2 -3
  79. package/report/test-assets/faux-psi.js +0 -1
  80. package/shared/localization/locales/en-US.json +26 -5
  81. package/shared/localization/locales/en-XL.json +26 -5
  82. package/third-party/snyk/snapshot.json +2 -2
  83. package/types/config.d.ts +2 -0
@@ -132,7 +132,7 @@ const SummaryTooltip: FunctionComponent<{
132
132
  {
133
133
  !displayAsFraction && category.score !== null && <>
134
134
  <span> · </span>
135
- <span>{i18n.formatNumber(category.score * 100)}</span>
135
+ <span>{i18n.formatInteger(category.score * 100)}</span>
136
136
  </>
137
137
  }
138
138
  </div>
@@ -3,12 +3,8 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  module.exports = {
9
- env: {
10
- browser: true,
11
- },
12
8
  rules: {
13
9
  // TODO(esmodules): move to root eslint when all code is ESM
14
10
  // or when this is resolved: https://github.com/import-js/eslint-plugin-import/issues/2214
@@ -26,4 +22,7 @@ module.exports = {
26
22
  'import/group-exports': 2,
27
23
  'import/exports-last': 2,
28
24
  },
25
+ parserOptions: {
26
+ sourceType: 'module',
27
+ },
29
28
  };
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview The relationship between these CLI modules:
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /* eslint-disable max-len */
9
8
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  export {listAudits} from './list-audits.js';
9
8
  export {listTraceCategories} from './list-trace-categories.js';
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import lighthouse from '../../lighthouse-core/index.js';
9
8
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import locales from '../../shared/localization/locales.js';
9
8
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import lighthouse from '../../lighthouse-core/index.js';
9
8
 
@@ -4,7 +4,6 @@
4
4
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5
5
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
6
6
  */
7
- 'use strict';
8
7
 
9
8
  import {begin} from './bin.js';
10
9
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import fs from 'fs';
9
8
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /* eslint-disable no-console */
9
8
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import Configstore from 'configstore';
9
8
  import Confirm from 'enquirer';
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  import a11y from './test-definitions/a11y.js';
9
8
  import byteEfficiency from './test-definitions/byte-efficiency.js';
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * COMPAT: update from the old TestDefn format (array of `expectations` per
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview Smoke test runner.
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview A smokehouse frontend for running within a node process.
@@ -4,7 +4,6 @@
4
4
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5
5
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
6
6
  */
7
- 'use strict';
8
7
 
9
8
  /**
10
9
  * @fileoverview A smokehouse frontend for running from the command line. Parse
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * An extension of Error that includes any stdout or stderr from a child
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * A class that maintains a concurrency pool to coordinate many jobs that should
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * A simple buffered log to use in place of `console`.
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview A runner that launches Chrome and executes Lighthouse via a
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview A runner that executes Lighthouse via the Lighthouse CLI to
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview A runner that launches Chrome and executes Lighthouse via DevTools.
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview An assertion library for comparing smoke-test expectations
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview An end-to-end test runner for Lighthouse. Takes a set of smoke
@@ -30,7 +30,7 @@ const UIStrings = {
30
30
  // eslint-disable-next-line max-len
31
31
  // TODO: web.dev article. this codelab is good starting place: https://web.dev/codelab-serve-modern-code/
32
32
  /** Description of a Lighthouse audit that tells the user about old JavaScript that is no longer needed. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
33
- description: 'Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren\'t necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn More](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/)',
33
+ description: 'Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren\'t necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn More](https://web.dev/publish-modern-javascript/)',
34
34
  };
35
35
 
36
36
  const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
@@ -5,6 +5,7 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
+ const puppeteer = require('puppeteer-core');
8
9
  const log = require('lighthouse-logger');
9
10
  const Driver = require('./driver.js');
10
11
  const Runner = require('../../runner.js');
@@ -43,6 +44,9 @@ const NetworkRecords = require('../../computed/network-records.js');
43
44
 
44
45
  /** @typedef {Omit<Parameters<typeof collectPhaseArtifacts>[0], 'phase'>} PhaseState */
45
46
 
47
+ const DEFAULT_HOSTNAME = '127.0.0.1';
48
+ const DEFAULT_PORT = 9222;
49
+
46
50
  /**
47
51
  * @param {{driver: Driver, config: LH.Config.FRConfig, options?: InternalOptions}} args
48
52
  * @return {Promise<{baseArtifacts: LH.FRBaseArtifacts}>}
@@ -299,11 +303,11 @@ async function _cleanup({requestedUrl, driver, config}) {
299
303
 
300
304
  /**
301
305
  * @param {LH.NavigationRequestor|undefined} requestor
302
- * @param {{page: LH.Puppeteer.Page, config?: LH.Config.Json, configContext?: LH.Config.FRContext}} options
306
+ * @param {{page?: LH.Puppeteer.Page, config?: LH.Config.Json, configContext?: LH.Config.FRContext}} options
303
307
  * @return {Promise<LH.Gatherer.FRGatherResult>}
304
308
  */
305
309
  async function navigationGather(requestor, options) {
306
- const {page, configContext = {}} = options;
310
+ const {configContext = {}} = options;
307
311
  log.setLevel(configContext.logLevel || 'error');
308
312
 
309
313
  const {config} = initializeConfig(options.config, {...configContext, gatherMode: 'navigation'});
@@ -321,6 +325,16 @@ async function navigationGather(requestor, options) {
321
325
  const runnerOptions = {config, computedCache};
322
326
  const artifacts = await Runner.gather(
323
327
  async () => {
328
+ let {page} = options;
329
+
330
+ // For navigation mode, we shouldn't connect to a browser in audit mode,
331
+ // therefore we connect to the browser in the gatherFn callback.
332
+ if (!page) {
333
+ const {hostname = DEFAULT_HOSTNAME, port = DEFAULT_PORT} = configContext;
334
+ const browser = await puppeteer.connect({browserURL: `http://${hostname}:${port}`});
335
+ page = await browser.newPage();
336
+ }
337
+
324
338
  const driver = new Driver(page);
325
339
  const context = {
326
340
  driver,
@@ -15,6 +15,7 @@ const {waitForNetworkIdle} = require('../driver/wait-for-condition.js');
15
15
 
16
16
  // JPEG quality setting
17
17
  // Exploration and examples of reports using different quality settings: https://docs.google.com/document/d/1ZSffucIca9XDW2eEwfoevrk-OTl7WQFeMf0CgeJAA8M/edit#
18
+ // Note: this analysis was done for JPEG, but now we use WEBP.
18
19
  const FULL_PAGE_SCREENSHOT_QUALITY = 30;
19
20
 
20
21
  /**
@@ -118,10 +119,10 @@ class FullPageScreenshot extends FRGatherer {
118
119
  await context.driver.executionContext.evaluate(waitForDoubleRaf, {args: []});
119
120
 
120
121
  const result = await session.sendCommand('Page.captureScreenshot', {
121
- format: 'jpeg',
122
+ format: 'webp',
122
123
  quality: FULL_PAGE_SCREENSHOT_QUALITY,
123
124
  });
124
- const data = 'data:image/jpeg;base64,' + result.data;
125
+ const data = 'data:image/webp;base64,' + result.data;
125
126
 
126
127
  return {
127
128
  data,
@@ -5,7 +5,6 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const puppeteer = require('puppeteer-core');
9
8
  const Runner = require('./runner.js');
10
9
  const log = require('lighthouse-logger');
11
10
  const ChromeProtocol = require('./gather/connections/cri.js');
@@ -15,9 +14,6 @@ const fraggleRock = require('./fraggle-rock/api.js');
15
14
 
16
15
  /** @typedef {import('./gather/connections/connection.js')} Connection */
17
16
 
18
- const DEFAULT_HOSTNAME = '127.0.0.1';
19
- const DEFAULT_PORT = 9222;
20
-
21
17
  /*
22
18
  * The relationship between these root modules:
23
19
  *
@@ -42,15 +38,12 @@ const DEFAULT_PORT = 9222;
42
38
  * @return {Promise<LH.RunnerResult|undefined>}
43
39
  */
44
40
  async function lighthouse(url, flags = {}, configJSON, page) {
45
- if (!page) {
46
- const {hostname = DEFAULT_HOSTNAME, port = DEFAULT_PORT} = flags;
47
- const browser = await puppeteer.connect({browserURL: `http://${hostname}:${port}`});
48
- page = await browser.newPage();
49
- }
50
41
  const configContext = {
51
42
  configPath: flags.configPath,
52
43
  settingsOverrides: flags,
53
44
  logLevel: flags.logLevel,
45
+ hostname: flags.hostname,
46
+ port: flags.port,
54
47
  };
55
48
  return fraggleRock.navigation(url, {page, config: configJSON, configContext});
56
49
  }
@@ -48,6 +48,10 @@ const stackPacksToInclude = [
48
48
  packId: 'next.js',
49
49
  requiredStacks: ['js:next'],
50
50
  },
51
+ {
52
+ packId: 'nuxt',
53
+ requiredStacks: ['js:nuxt'],
54
+ },
51
55
  {
52
56
  packId: 'angular',
53
57
  requiredStacks: ['js:@angular/core'],
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
4
3
 
5
4
  /**
6
5
  * @fileoverview Script to launch a clean Chrome instance on-demand.
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by lighthouse-core/scripts/copy-util-commonjs.sh
3
3
  // Temporary solution until all our code uses esmodules
4
+ 'use strict';
4
5
  /**
5
6
  * @license
6
7
  * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
@@ -17,7 +18,6 @@
17
18
  * See the License for the specific language governing permissions and
18
19
  * limitations under the License.
19
20
  */
20
- 'use strict';
21
21
 
22
22
  /** @template T @typedef {import('./i18n').I18n<T>} I18n */
23
23
 
@@ -433,10 +433,13 @@ class Util {
433
433
  break;
434
434
  case 'devtools': {
435
435
  const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
436
- cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (DevTools)`;
437
- networkThrottling = `${Util.i18n.formatNumber(requestLatencyMs)}${NBSP}ms HTTP RTT, ` +
438
- `${Util.i18n.formatNumber(throttling.downloadThroughputKbps)}${NBSP}Kbps down, ` +
439
- `${Util.i18n.formatNumber(throttling.uploadThroughputKbps)}${NBSP}Kbps up (DevTools)`;
436
+ // TODO: better api in i18n formatter such that this isn't needed.
437
+ const cpuGranularity = Number.isInteger(cpuSlowdownMultiplier) ? 1 : 0.1;
438
+ // eslint-disable-next-line max-len
439
+ cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier, cpuGranularity)}x slowdown (DevTools)`;
440
+ networkThrottling = `${Util.i18n.formatMilliseconds(requestLatencyMs, 1)} HTTP RTT, ` +
441
+ `${Util.i18n.formatKbps(throttling.downloadThroughputKbps)} down, ` +
442
+ `${Util.i18n.formatKbps(throttling.uploadThroughputKbps)} up (DevTools)`;
440
443
 
441
444
  const isSlow4G = () => {
442
445
  return requestLatencyMs === 150 * 3.75 &&
@@ -448,9 +451,12 @@ class Util {
448
451
  }
449
452
  case 'simulate': {
450
453
  const {cpuSlowdownMultiplier, rttMs, throughputKbps} = throttling;
451
- cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (Simulated)`;
452
- networkThrottling = `${Util.i18n.formatNumber(rttMs)}${NBSP}ms TCP RTT, ` +
453
- `${Util.i18n.formatNumber(throughputKbps)}${NBSP}Kbps throughput (Simulated)`;
454
+ // TODO: better api in i18n formatter such that this isn't needed.
455
+ const cpuGranularity = Number.isInteger(cpuSlowdownMultiplier) ? 1 : 0.1;
456
+ // eslint-disable-next-line max-len
457
+ cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier, cpuGranularity)}x slowdown (Simulated)`;
458
+ networkThrottling = `${Util.i18n.formatMilliseconds(rttMs)} TCP RTT, ` +
459
+ `${Util.i18n.formatKbps(throughputKbps)} throughput (Simulated)`;
454
460
 
455
461
  const isSlow4G = () => {
456
462
  return rttMs === 150 && throughputKbps === 1.6 * 1024;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "9.5.0-dev.20220416",
3
+ "version": "9.5.0-dev.20220419",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -193,7 +193,7 @@
193
193
  "jpeg-js": "^0.4.3",
194
194
  "js-library-detector": "^6.4.0",
195
195
  "lighthouse-logger": "^1.3.0",
196
- "lighthouse-stack-packs": "^1.7.0",
196
+ "lighthouse-stack-packs": "^1.8.1",
197
197
  "lodash": "^4.17.21",
198
198
  "lookup-closest-locale": "6.2.0",
199
199
  "metaviewport-parser": "0.2.0",
@@ -204,7 +204,7 @@
204
204
  "robots-parser": "^3.0.0",
205
205
  "semver": "^5.3.0",
206
206
  "speedline-core": "^1.4.3",
207
- "third-party-web": "^0.15.0",
207
+ "third-party-web": "^0.17.1",
208
208
  "ws": "^7.0.0",
209
209
  "yargs": "^17.3.1",
210
210
  "yargs-parser": "^21.0.0"
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * eslint does not support ESM rc files, so this must be a .cjs file.
@@ -32,4 +31,7 @@ module.exports = {
32
31
  'import/group-exports': 2,
33
32
  'import/exports-last': 2,
34
33
  },
34
+ parserOptions: {
35
+ sourceType: 'module',
36
+ },
35
37
  };
@@ -1745,15 +1745,18 @@ details[open] .lh-clump-toggletext--hide { display: block;}
1745
1745
 
1746
1746
  /* Element screenshot */
1747
1747
  .lh-element-screenshot {
1748
- position: relative;
1749
- overflow: hidden;
1750
1748
  float: left;
1751
1749
  margin-right: 20px;
1752
1750
  }
1753
1751
  .lh-element-screenshot__content {
1754
1752
  overflow: hidden;
1753
+ min-width: 110px;
1754
+ display: flex;
1755
+ justify-content: center;
1756
+ background-color: var(--report-background-color);
1755
1757
  }
1756
1758
  .lh-element-screenshot__image {
1759
+ position: relative;
1757
1760
  /* Set by ElementScreenshotRenderer.installFullPageScreenshotCssVariable */
1758
1761
  background-image: var(--element-screenshot-url);
1759
1762
  outline: 2px solid #777;
@@ -893,16 +893,17 @@ limitations under the License.
893
893
  <template id="elementScreenshot">
894
894
  <div class="lh-element-screenshot">
895
895
  <div class="lh-element-screenshot__content">
896
- <div class="lh-element-screenshot__mask">
897
- <svg height="0" width="0">
898
- <defs>
899
- <clipPath clipPathUnits="objectBoundingBox"></clipPath>
900
- <!-- clipPath filled by ElementScreenshotRenderer.renderClipPath -->
901
- </defs>
902
- </svg>
896
+ <div class="lh-element-screenshot__image">
897
+ <div class="lh-element-screenshot__mask">
898
+ <svg height="0" width="0">
899
+ <defs>
900
+ <clipPath clipPathUnits="objectBoundingBox"></clipPath>
901
+ <!-- clipPath filled by ElementScreenshotRenderer.renderClipPath -->
902
+ </defs>
903
+ </svg>
904
+ </div>
905
+ <div class="lh-element-screenshot__element-marker"></div>
903
906
  </div>
904
- <div class="lh-element-screenshot__image"></div>
905
- <div class="lh-element-screenshot__element-marker"></div>
906
907
  </div>
907
908
  </div>
908
909
  </template>
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  // This file is used to generate a bundle that can be imported
9
8
  // into an esmodules codebase to render the lighthouse report.
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
  /**
9
8
  * @fileoverview The entry point for rendering the Lighthouse report for the HTML
@@ -3,7 +3,6 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
- 'use strict';
7
6
 
8
7
 
9
8
  import {DOM} from '../renderer/dom.js';
@@ -14,7 +14,6 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- 'use strict';
18
17
 
19
18
  /** @typedef {import('./dom.js').DOM} DOM */
20
19
  /** @typedef {import('./report-renderer.js').ReportRenderer} ReportRenderer */