lighthouse 8.6.0-dev.20211027 → 8.6.0-dev.20211031

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 (73) hide show
  1. package/dist/report/flow.js +6 -6
  2. package/flow-report/src/common.tsx +8 -8
  3. package/flow-report/src/header.tsx +7 -8
  4. package/flow-report/src/summary/summary.tsx +1 -1
  5. package/flow-report/src/util.ts +4 -4
  6. package/flow-report/src/wrappers/report.tsx +12 -0
  7. package/flow-report/test/common-test.tsx +6 -6
  8. package/flow-report/test/flow-report-pptr-test.ts +46 -0
  9. package/jest.config.js +1 -0
  10. package/lighthouse-core/audits/errors-in-console.js +0 -2
  11. package/lighthouse-core/audits/image-aspect-ratio.js +1 -2
  12. package/lighthouse-core/audits/image-size-responsive.js +4 -5
  13. package/lighthouse-core/audits/unsized-images.js +1 -1
  14. package/lighthouse-core/computed/image-records.js +4 -3
  15. package/lighthouse-core/config/default-config.js +0 -3
  16. package/lighthouse-core/fraggle-rock/config/default-config.js +0 -3
  17. package/lighthouse-core/gather/driver/storage.js +0 -1
  18. package/lighthouse-core/gather/gatherers/image-elements.js +0 -3
  19. package/package.json +1 -2
  20. package/report/README.md +1 -1
  21. package/report/generator/README.md +1 -1
  22. package/shared/localization/format.js +5 -9
  23. package/shared/localization/locales/ar-XB.json +0 -12
  24. package/shared/localization/locales/ar.json +0 -12
  25. package/shared/localization/locales/bg.json +0 -12
  26. package/shared/localization/locales/ca.json +0 -12
  27. package/shared/localization/locales/cs.json +0 -12
  28. package/shared/localization/locales/da.json +0 -12
  29. package/shared/localization/locales/de.json +0 -12
  30. package/shared/localization/locales/el.json +0 -12
  31. package/shared/localization/locales/en-GB.json +0 -12
  32. package/shared/localization/locales/en-US.json +0 -12
  33. package/shared/localization/locales/en-XA.json +0 -12
  34. package/shared/localization/locales/en-XL.json +0 -12
  35. package/shared/localization/locales/es-419.json +0 -12
  36. package/shared/localization/locales/es.json +0 -12
  37. package/shared/localization/locales/fi.json +0 -12
  38. package/shared/localization/locales/fil.json +0 -12
  39. package/shared/localization/locales/fr.json +0 -12
  40. package/shared/localization/locales/he.json +0 -12
  41. package/shared/localization/locales/hi.json +0 -12
  42. package/shared/localization/locales/hr.json +0 -12
  43. package/shared/localization/locales/hu.json +0 -12
  44. package/shared/localization/locales/id.json +0 -12
  45. package/shared/localization/locales/it.json +0 -12
  46. package/shared/localization/locales/ja.json +0 -12
  47. package/shared/localization/locales/ko.json +0 -12
  48. package/shared/localization/locales/lt.json +0 -12
  49. package/shared/localization/locales/lv.json +0 -12
  50. package/shared/localization/locales/nl.json +0 -12
  51. package/shared/localization/locales/no.json +0 -12
  52. package/shared/localization/locales/pl.json +0 -12
  53. package/shared/localization/locales/pt-PT.json +0 -12
  54. package/shared/localization/locales/pt.json +0 -12
  55. package/shared/localization/locales/ro.json +0 -12
  56. package/shared/localization/locales/ru.json +0 -12
  57. package/shared/localization/locales/sk.json +0 -12
  58. package/shared/localization/locales/sl.json +0 -12
  59. package/shared/localization/locales/sr-Latn.json +0 -12
  60. package/shared/localization/locales/sr.json +0 -12
  61. package/shared/localization/locales/sv.json +0 -12
  62. package/shared/localization/locales/ta.json +0 -12
  63. package/shared/localization/locales/te.json +0 -12
  64. package/shared/localization/locales/th.json +0 -12
  65. package/shared/localization/locales/tr.json +0 -12
  66. package/shared/localization/locales/uk.json +0 -12
  67. package/shared/localization/locales/vi.json +0 -12
  68. package/shared/localization/locales/zh-HK.json +0 -12
  69. package/shared/localization/locales/zh-TW.json +0 -12
  70. package/shared/localization/locales/zh.json +0 -12
  71. package/types/artifacts.d.ts +5 -4
  72. package/lighthouse-core/audits/dobetterweb/appcache-manifest.js +0 -67
  73. package/lighthouse-core/gather/gatherers/dobetterweb/appcache.js +0 -34
@@ -8,7 +8,7 @@ import {FunctionComponent} from 'preact';
8
8
  import {useEffect, useState} from 'preact/hooks';
9
9
 
10
10
  import {NavigationIcon, SnapshotIcon, TimespanIcon} from './icons';
11
- import {getFilmstripFrames, getScreenDimensions, getScreenshot} from './util';
11
+ import {getFilmstripFrames, getScreenDimensions, getFullPageScreenshot} from './util';
12
12
 
13
13
  const ANIMATION_FRAME_DURATION_MS = 500;
14
14
 
@@ -72,15 +72,15 @@ const FlowStepAnimatedThumbnail: FunctionComponent<{
72
72
  };
73
73
 
74
74
  export const FlowStepThumbnail: FunctionComponent<{
75
- reportResult: LH.ReportResult,
75
+ lhr: LH.Result,
76
76
  width?: number,
77
77
  height?: number,
78
- }> = ({reportResult, width, height}) => {
79
- const screenshot = getScreenshot(reportResult);
80
- const frames = getFilmstripFrames(reportResult);
78
+ }> = ({lhr, width, height}) => {
79
+ const screenshot = getFullPageScreenshot(lhr);
80
+ const frames = getFilmstripFrames(lhr);
81
81
 
82
82
  // Resize the image to fit the viewport aspect ratio.
83
- const dimensions = getScreenDimensions(reportResult);
83
+ const dimensions = getScreenDimensions(lhr);
84
84
  if (width && height === undefined) {
85
85
  height = dimensions.height * width / dimensions.width;
86
86
  } else if (height && width === undefined) {
@@ -92,7 +92,7 @@ export const FlowStepThumbnail: FunctionComponent<{
92
92
  return <></>;
93
93
  }
94
94
 
95
- if (reportResult.gatherMode === 'timespan' && frames && frames.length) {
95
+ if (lhr.gatherMode === 'timespan' && frames && frames.length) {
96
96
  return <FlowStepAnimatedThumbnail frames={frames} width={width} height={height} />;
97
97
  }
98
98
 
@@ -101,7 +101,7 @@ export const FlowStepThumbnail: FunctionComponent<{
101
101
  screenshot &&
102
102
  <img
103
103
  className="FlowStepThumbnail"
104
- src={screenshot}
104
+ src={screenshot.screenshot.data}
105
105
  style={{width, height}}
106
106
  alt="Screenshot of a page tested by Lighthouse"
107
107
  />
@@ -6,7 +6,6 @@
6
6
 
7
7
  import {FunctionComponent} from 'preact';
8
8
 
9
- import {Util} from '../../report/renderer/util';
10
9
  import {FlowStepIcon, FlowStepThumbnail} from './common';
11
10
  import {useLocalizedStrings} from './i18n/i18n';
12
11
  import {getModeDescription, useFlowResult} from './util';
@@ -15,16 +14,16 @@ const SIDE_THUMBNAIL_HEIGHT = 80;
15
14
  const MAIN_THUMBNAIL_HEIGHT = 120;
16
15
 
17
16
  const HeaderThumbnail: FunctionComponent<{
18
- reportResult: LH.ReportResult,
17
+ lhr: LH.Result,
19
18
  position: 'prev'|'next'|'main'
20
19
  }> =
21
- ({reportResult, position}) => {
20
+ ({lhr, position}) => {
22
21
  const height = position === 'main' ? MAIN_THUMBNAIL_HEIGHT : SIDE_THUMBNAIL_HEIGHT;
23
22
  return (
24
23
  <div className={`HeaderThumbnail HeaderThumbnail--${position}`}>
25
- <FlowStepThumbnail reportResult={reportResult} height={height}/>
24
+ <FlowStepThumbnail lhr={lhr} height={height}/>
26
25
  <div className="HeaderThumbnail__icon">
27
- <FlowStepIcon mode={reportResult.gatherMode}/>
26
+ <FlowStepIcon mode={lhr.gatherMode}/>
28
27
  </div>
29
28
  </div>
30
29
  );
@@ -50,7 +49,7 @@ export const Header: FunctionComponent<{currentLhr: LH.FlowResult.LhrRef}> =
50
49
  flowResult.steps[index - 2] && <div className="Header__segment"/>
51
50
  }
52
51
  <div className="Header__prev-thumbnail">
53
- <HeaderThumbnail reportResult={Util.prepareReportResult(prevStep.lhr)} position="prev"/>
52
+ <HeaderThumbnail lhr={prevStep.lhr} position="prev"/>
54
53
  <div className="Header__segment"/>
55
54
  </div>
56
55
  <a
@@ -60,7 +59,7 @@ export const Header: FunctionComponent<{currentLhr: LH.FlowResult.LhrRef}> =
60
59
  </>
61
60
  }
62
61
  <div className="Header__current-thumbnail">
63
- <HeaderThumbnail reportResult={Util.prepareReportResult(step.lhr)} position="main"/>
62
+ <HeaderThumbnail lhr={step.lhr} position="main"/>
64
63
  </div>
65
64
  <div className="Header__current-title">
66
65
  {step.name}
@@ -72,7 +71,7 @@ export const Header: FunctionComponent<{currentLhr: LH.FlowResult.LhrRef}> =
72
71
  nextStep && <>
73
72
  <div className="Header__next-thumbnail">
74
73
  <div className="Header__segment"/>
75
- <HeaderThumbnail reportResult={Util.prepareReportResult(nextStep.lhr)} position="next"/>
74
+ <HeaderThumbnail lhr={nextStep.lhr} position="next"/>
76
75
  </div>
77
76
  <a
78
77
  className="Header__next-title"
@@ -63,7 +63,7 @@ export const SummaryFlowStep: FunctionComponent<{
63
63
  <Separator/>
64
64
  </div>
65
65
  }
66
- <FlowStepThumbnail reportResult={reportResult} width={THUMBNAIL_WIDTH}/>
66
+ <FlowStepThumbnail lhr={lhr} width={THUMBNAIL_WIDTH}/>
67
67
  <FlowSegment mode={lhr.gatherMode}/>
68
68
  <div className="SummaryFlowStep__label">
69
69
  <div className="SummaryFlowStep__mode">{modeDescription}</div>
@@ -35,24 +35,24 @@ export function classNames(...args: Array<string|undefined|Record<string, boolea
35
35
  return classes.join(' ');
36
36
  }
37
37
 
38
- export function getScreenDimensions(reportResult: LH.ReportResult) {
38
+ export function getScreenDimensions(reportResult: LH.Result) {
39
39
  const {width, height} = reportResult.configSettings.screenEmulation;
40
40
  return {width, height};
41
41
  }
42
42
 
43
- export function getScreenshot(reportResult: LH.ReportResult) {
43
+ export function getFullPageScreenshot(reportResult: LH.Result) {
44
44
  const fullPageScreenshotAudit = reportResult.audits['full-page-screenshot'];
45
45
  const fullPageScreenshot =
46
46
  fullPageScreenshotAudit &&
47
47
  fullPageScreenshotAudit.details &&
48
48
  fullPageScreenshotAudit.details.type === 'full-page-screenshot' &&
49
- fullPageScreenshotAudit.details.screenshot.data;
49
+ fullPageScreenshotAudit.details;
50
50
 
51
51
  return fullPageScreenshot || null;
52
52
  }
53
53
 
54
54
  export function getFilmstripFrames(
55
- reportResult: LH.ReportResult
55
+ reportResult: LH.Result
56
56
  ): Array<{data: string}> | undefined {
57
57
  const filmstripAudit = reportResult.audits['screenshot-thumbnails'];
58
58
  if (!filmstripAudit) return undefined;
@@ -7,6 +7,8 @@
7
7
  import {FunctionComponent} from 'preact';
8
8
  import {useLayoutEffect, useRef} from 'preact/hooks';
9
9
 
10
+ import {ElementScreenshotRenderer} from '../../../report/renderer/element-screenshot-renderer';
11
+ import {getFullPageScreenshot} from '../util';
10
12
  import {useReportRenderer} from './report-renderer';
11
13
 
12
14
  /**
@@ -41,6 +43,16 @@ export const Report: FunctionComponent<{currentLhr: LH.FlowResult.LhrRef}> =
41
43
  dom.clearComponentCache();
42
44
  reportRenderer.renderReport(currentLhr.value, ref.current);
43
45
  convertChildAnchors(ref.current, currentLhr.index);
46
+ const fullPageScreenshot = getFullPageScreenshot(currentLhr.value);
47
+ if (fullPageScreenshot) {
48
+ const container = dom.find('.lh-container', ref.current);
49
+ ElementScreenshotRenderer.installOverlayFeature({
50
+ dom,
51
+ reportEl: container,
52
+ overlayContainerEl: container,
53
+ fullPageScreenshot,
54
+ });
55
+ }
44
56
  const topbar = ref.current.querySelector('.lh-topbar');
45
57
  if (topbar) topbar.remove();
46
58
  }
@@ -9,7 +9,7 @@ import {act, render} from '@testing-library/preact';
9
9
 
10
10
  import {FlowStepThumbnail} from '../src/common';
11
11
 
12
- let lhr: LH.ReportResult;
12
+ let lhr: LH.Result;
13
13
 
14
14
  jest.useFakeTimers();
15
15
 
@@ -33,7 +33,7 @@ describe('FlowStepThumbnail', () => {
33
33
  });
34
34
 
35
35
  it('renders a thumbnail', () => {
36
- const root = render(<FlowStepThumbnail reportResult={lhr} width={200} height={200} />);
36
+ const root = render(<FlowStepThumbnail lhr={lhr} width={200} height={200} />);
37
37
 
38
38
  const thumbnail = root.getByAltText(/Screenshot/);
39
39
  expect(thumbnail.style.width).toEqual('200px');
@@ -41,14 +41,14 @@ describe('FlowStepThumbnail', () => {
41
41
  });
42
42
 
43
43
  it('renders nothing without dimensions', () => {
44
- const root = render(<FlowStepThumbnail reportResult={lhr} />);
44
+ const root = render(<FlowStepThumbnail lhr={lhr} />);
45
45
 
46
46
  expect(() => root.getByAltText(/Screenshot/)).toThrow();
47
47
  expect(global.console.warn).toHaveBeenCalled();
48
48
  });
49
49
 
50
50
  it('interpolates height', () => {
51
- const root = render(<FlowStepThumbnail reportResult={lhr} width={200} />);
51
+ const root = render(<FlowStepThumbnail lhr={lhr} width={200} />);
52
52
 
53
53
  const thumbnail = root.getByAltText(/Screenshot/);
54
54
  expect(thumbnail.style.width).toEqual('200px');
@@ -56,7 +56,7 @@ describe('FlowStepThumbnail', () => {
56
56
  });
57
57
 
58
58
  it('interpolates width', () => {
59
- const root = render(<FlowStepThumbnail reportResult={lhr} height={150} />);
59
+ const root = render(<FlowStepThumbnail lhr={lhr} height={150} />);
60
60
 
61
61
  const thumbnail = root.getByAltText(/Screenshot/);
62
62
  expect(thumbnail.style.width).toEqual('100px');
@@ -74,7 +74,7 @@ describe('FlowStepThumbnail', () => {
74
74
  ],
75
75
  },
76
76
  } as any;
77
- const root = render(<FlowStepThumbnail reportResult={lhr} height={150} />);
77
+ const root = render(<FlowStepThumbnail lhr={lhr} height={150} />);
78
78
 
79
79
  const thumbnail = root.getByAltText(/Animated/) as HTMLImageElement;
80
80
  expect(thumbnail.style.width).toEqual('100px');
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
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
+ * 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
+ */
6
+
7
+ import {jest} from '@jest/globals';
8
+ import puppeteer, {Browser, Page} from 'puppeteer';
9
+
10
+ import ReportGenerator from '../../report/generator/report-generator.js';
11
+ import {flowResult} from './sample-flow';
12
+
13
+ jest.setTimeout(35_000);
14
+
15
+ describe('Lighthouse Flow Report', () => {
16
+ console.log('\n✨ Be sure to have recently run this: yarn build-report');
17
+
18
+ let browser: Browser;
19
+ let page: Page;
20
+ const pageErrors: Error[] = [];
21
+
22
+ beforeAll(async () => {
23
+ browser = await puppeteer.launch({
24
+ headless: true,
25
+ });
26
+ page = await browser.newPage();
27
+ page.on('pageerror', pageError => pageErrors.push(pageError));
28
+ });
29
+
30
+ afterAll(async () => {
31
+ if (pageErrors.length > 0) console.error(pageErrors);
32
+
33
+ await browser.close();
34
+ });
35
+
36
+ describe('Renders the flow report', () => {
37
+ beforeAll(async () => {
38
+ const html = ReportGenerator.generateFlowReportHtml(flowResult);
39
+ await page.setContent(html);
40
+ });
41
+
42
+ it('should load with no errors', async () => {
43
+ expect(pageErrors).toHaveLength(0);
44
+ });
45
+ });
46
+ });
package/jest.config.js CHANGED
@@ -20,6 +20,7 @@ module.exports = {
20
20
  '**/shared/**/*-test.js',
21
21
  '**/build/**/*-test.js',
22
22
  ],
23
+ modulePathIgnorePatterns: ['<rootDir>/.tmp'],
23
24
  transform: {},
24
25
  prettierPath: null,
25
26
  projects: [
@@ -88,8 +88,6 @@ class ErrorLogs extends Audit {
88
88
  return {
89
89
  source: item.source,
90
90
  description: item.text,
91
- // TODO: remove for v8 (url is covered in sourceLocation)
92
- url: item.url,
93
91
  sourceLocation: Audit.makeSourceLocationFromConsoleMessage(item),
94
92
  };
95
93
  });
@@ -89,8 +89,7 @@ class ImageAspectRatio extends Audit {
89
89
  // - filter all svgs as they have no natural dimensions to audit
90
90
  // - filter out images that have falsy naturalWidth or naturalHeight
91
91
  return !image.isCss &&
92
- image.mimeType &&
93
- image.mimeType !== 'image/svg+xml' &&
92
+ URL.guessMimeType(image.src) !== 'image/svg+xml' &&
94
93
  image.naturalDimensions &&
95
94
  image.naturalDimensions.height > 5 &&
96
95
  image.naturalDimensions.width > 5 &&
@@ -45,7 +45,7 @@ const LARGE_IMAGE_FACTOR = 0.75;
45
45
  // considered SMALL.
46
46
  const SMALL_IMAGE_THRESHOLD = 64;
47
47
 
48
- /** @typedef {{url: string, node: LH.Audit.Details.NodeValue, elidedUrl: string, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */
48
+ /** @typedef {{url: string, node: LH.Audit.Details.NodeValue, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */
49
49
 
50
50
  /**
51
51
  * @param {{top: number, bottom: number, left: number, right: number}} imageRect
@@ -95,7 +95,7 @@ function isCandidate(image) {
95
95
  ) {
96
96
  return false;
97
97
  }
98
- if (image.mimeType === 'image/svg+xml') {
98
+ if (URL.guessMimeType(image.src) === 'image/svg+xml') {
99
99
  return false;
100
100
  }
101
101
  if (image.isCss) {
@@ -146,9 +146,8 @@ function getResult(image, DPR) {
146
146
  const [expectedWidth, expectedHeight] =
147
147
  expectedImageSize(image.displayedWidth, image.displayedHeight, DPR);
148
148
  return {
149
- url: image.src,
149
+ url: URL.elideDataURI(image.src),
150
150
  node: Audit.makeNodeItem(image.node),
151
- elidedUrl: URL.elideDataURI(image.src),
152
151
  displayedSize: `${image.displayedWidth} x ${image.displayedHeight}`,
153
152
  actualSize: `${image.naturalDimensions.width} x ${image.naturalDimensions.height}`,
154
153
  actualPixels: image.naturalDimensions.width * image.naturalDimensions.height,
@@ -265,7 +264,7 @@ class ImageSizeResponsive extends Audit {
265
264
  /** @type {LH.Audit.Details.Table['headings']} */
266
265
  const headings = [
267
266
  {key: 'node', itemType: 'node', text: ''},
268
- {key: 'elidedUrl', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
267
+ {key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
269
268
  {key: 'displayedSize', itemType: 'text', text: str_(UIStrings.columnDisplayed)},
270
269
  {key: 'actualSize', itemType: 'text', text: str_(UIStrings.columnActual)},
271
270
  {key: 'expectedSize', itemType: 'text', text: str_(UIStrings.columnExpected)},
@@ -106,7 +106,7 @@ class UnsizedImages extends Audit {
106
106
  * @return {boolean}
107
107
  */
108
108
  static isNonNetworkSvg(image) {
109
- const isSvg = image.mimeType === 'image/svg+xml';
109
+ const isSvg = URL.guessMimeType(image.src) === 'image/svg+xml';
110
110
  const urlScheme = image.src.slice(0, image.src.indexOf(':'));
111
111
  const isNonNetwork = URL.isNonNetworkProtocol(urlScheme);
112
112
  return isSvg && isNonNetwork;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
+ const URL = require('../lib/url-shim.js');
8
9
  const makeComputedArtifact = require('./computed-artifact.js');
9
10
 
10
11
  class ImageRecords {
@@ -28,12 +29,12 @@ class ImageRecords {
28
29
 
29
30
  /**
30
31
  * @param {{ImageElements: LH.Artifacts['ImageElements'], networkRecords: LH.Artifacts.NetworkRequest[]}} data
31
- * @return {Promise<LH.Artifacts.ImageElement[]>}
32
+ * @return {Promise<LH.Artifacts.ImageElementRecord[]>}
32
33
  */
33
34
  static async compute_(data) {
34
35
  const indexedNetworkRecords = ImageRecords.indexNetworkRecords(data.networkRecords);
35
36
 
36
- /** @type {LH.Artifacts.ImageElement[]} */
37
+ /** @type {LH.Artifacts.ImageElementRecord[]} */
37
38
  const imageRecords = [];
38
39
 
39
40
  for (const element of data.ImageElements) {
@@ -43,7 +44,7 @@ class ImageRecords {
43
44
  // Don't change the guessed mime type if no mime type was found.
44
45
  imageRecords.push({
45
46
  ...element,
46
- mimeType: mimeType ? mimeType : element.mimeType,
47
+ mimeType: mimeType ? mimeType : URL.guessMimeType(element.src),
47
48
  });
48
49
  }
49
50
 
@@ -147,7 +147,6 @@ const defaultConfig = {
147
147
  'form-elements',
148
148
  'main-document-content',
149
149
  'global-listeners',
150
- 'dobetterweb/appcache',
151
150
  'dobetterweb/doctype',
152
151
  'dobetterweb/domstats',
153
152
  'dobetterweb/optimized-images',
@@ -301,7 +300,6 @@ const defaultConfig = {
301
300
  'byte-efficiency/efficient-animated-content',
302
301
  'byte-efficiency/duplicated-javascript',
303
302
  'byte-efficiency/legacy-javascript',
304
- 'dobetterweb/appcache-manifest',
305
303
  'dobetterweb/doctype',
306
304
  'dobetterweb/charset',
307
305
  'dobetterweb/dom-size',
@@ -565,7 +563,6 @@ const defaultConfig = {
565
563
  {id: 'charset', weight: 1, group: 'best-practices-browser-compat'},
566
564
  // General Group
567
565
  {id: 'no-unload-listeners', weight: 1, group: 'best-practices-general'},
568
- {id: 'appcache-manifest', weight: 1, group: 'best-practices-general'},
569
566
  {id: 'js-libraries', weight: 0, group: 'best-practices-general'},
570
567
  {id: 'deprecations', weight: 1, group: 'best-practices-general'},
571
568
  {id: 'errors-in-console', weight: 1, group: 'best-practices-general'},
@@ -37,7 +37,6 @@ const artifacts = {
37
37
  Trace: '',
38
38
  Accessibility: '',
39
39
  AnchorElements: '',
40
- AppCacheManifest: '',
41
40
  CacheContents: '',
42
41
  ConsoleMessages: '',
43
42
  CSSUsage: '',
@@ -88,7 +87,6 @@ const defaultConfig = {
88
87
  /* eslint-disable max-len */
89
88
  {id: artifacts.Accessibility, gatherer: 'accessibility'},
90
89
  {id: artifacts.AnchorElements, gatherer: 'anchor-elements'},
91
- {id: artifacts.AppCacheManifest, gatherer: 'dobetterweb/appcache'},
92
90
  {id: artifacts.CacheContents, gatherer: 'cache-contents'},
93
91
  {id: artifacts.ConsoleMessages, gatherer: 'console-messages'},
94
92
  {id: artifacts.CSSUsage, gatherer: 'css-usage'},
@@ -141,7 +139,6 @@ const defaultConfig = {
141
139
 
142
140
  artifacts.Accessibility,
143
141
  artifacts.AnchorElements,
144
- artifacts.AppCacheManifest,
145
142
  artifacts.CacheContents,
146
143
  artifacts.ConsoleMessages,
147
144
  artifacts.CSSUsage,
@@ -43,7 +43,6 @@ async function clearDataForOrigin(session, url) {
43
43
  // indexeddb, websql, and localstorage are not cleared to prevent loss of potentially important data.
44
44
  // https://chromedevtools.github.io/debugger-protocol-viewer/tot/Storage/#type-StorageType
45
45
  const typesToClear = [
46
- 'appcache',
47
46
  // 'cookies',
48
47
  'file_systems',
49
48
  'shader_cache',
@@ -12,7 +12,6 @@
12
12
  const log = require('lighthouse-logger');
13
13
  const FRGatherer = require('../../fraggle-rock/gather/base-gatherer.js');
14
14
  const pageFunctions = require('../../lib/page-functions.js');
15
- const URL = require('../../lib/url-shim.js');
16
15
  const FontSize = require('./seo/font-size.js');
17
16
 
18
17
  /* global window, getElementsInDocument, Image, getNodeDetails, ShadowRoot */
@@ -310,8 +309,6 @@ class ImageElements extends FRGatherer {
310
309
  let skippedCount = 0;
311
310
 
312
311
  for (const element of elements) {
313
- element.mimeType = URL.guessMimeType(element.src);
314
-
315
312
  if (reachedGatheringBudget) {
316
313
  skippedCount++;
317
314
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.6.0-dev.20211027",
3
+ "version": "8.6.0-dev.20211031",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -129,7 +129,6 @@
129
129
  "@types/yargs-parser": "^15.0.0",
130
130
  "@typescript-eslint/eslint-plugin": "^4.30.0",
131
131
  "@typescript-eslint/parser": "^4.30.0",
132
- "@wardpeet/brfs": "2.1.0",
133
132
  "acorn": "^8.5.0",
134
133
  "angular": "^1.7.4",
135
134
  "archiver": "^3.0.0",
package/report/README.md CHANGED
@@ -9,7 +9,7 @@ Example standalone HTML report, delivered by the CLI: [`dbwtest-3.0.3.html`](htt
9
9
  ### Report Renderer components
10
10
 
11
11
  1. [`report/generator/report-generator.js`](https://github.com/GoogleChrome/lighthouse/blob/master/report/generator/report-generator.js) is the entry point for generating the HTML from Node. It compiles together the HTML string with everything required within it.
12
- - It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `brfs`, which takes any `fs.readFileSync()` calls and replaces them with the stringified file content.
12
+ - It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `inline-fs`, which takes any `fs.readFileSync()` calls and replaces them with the stringified file content.
13
13
  1. [`report/renderer`](https://github.com/GoogleChrome/lighthouse/tree/master/report/renderer) are all client-side JS files. They transform an LHR object into a report DOM tree. They are all executed within the browser.
14
14
  1. [`report/assets/standalone-template.html`](https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/report/html/report-template.html) is where the client-side build of the DOM report is typically kicked off ([with these four lines](https://github.com/GoogleChrome/lighthouse/blob/eda3a3e2e271249f261655f9504fd542d6acf0f8/lighthouse-core/report/html/report-template.html#L29-L33)) However, see _Current Uses.._ below for more possibilities.
15
15
 
@@ -4,6 +4,6 @@
4
4
 
5
5
  Lighthouse's report generator is the entry point for creating reports from an **LHR** (Lighthouse Result object). It returns results as HTML, JSON, and CSV.
6
6
 
7
- It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `brfs`, which takes any `fs.readFileSync()` calls and replaces them with the stringified file content.
7
+ It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `inline-fs`, which takes any `fs.readFileSync()` calls and replaces them with the stringified file content.
8
8
 
9
9
  Because it's shared between core and the report, dependencies (both code and types) should be kept minimal.
@@ -17,18 +17,14 @@ const DEFAULT_LOCALE = 'en-US';
17
17
 
18
18
  /**
19
19
  * The locale tags for the localized messages available to Lighthouse on disk.
20
- * When bundled, these will be inlined by brfs.
20
+ * When bundled, these will be inlined by `inline-fs`.
21
21
  * These locales are considered the "canonical" locales. We support other locales which
22
22
  * are simply aliases to one of these. ex: es-AR (alias) -> es-419 (canonical)
23
23
  */
24
- let CANONICAL_LOCALES = ['__availableLocales__'];
25
- // TODO: need brfs in gh-pages-app. For now, above is replaced, see build-i18n.module.js
26
- if (fs.readdirSync) {
27
- CANONICAL_LOCALES = fs.readdirSync(__dirname + '/locales/')
28
- .filter(basename => basename.endsWith('.json') && !basename.endsWith('.ctc.json'))
29
- .map(locale => locale.replace('.json', ''))
30
- .sort();
31
- }
24
+ const CANONICAL_LOCALES = fs.readdirSync(__dirname + '/locales/')
25
+ .filter(basename => basename.endsWith('.json') && !basename.endsWith('.ctc.json'))
26
+ .map(locale => locale.replace('.json', ''))
27
+ .sort();
32
28
 
33
29
  /** @typedef {import('intl-messageformat-parser').Element} MessageElement */
34
30
  /** @typedef {import('intl-messageformat-parser').ArgumentElement} ArgumentElement */
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "‏‮Avoids‬‏ ‏‮deprecated‬‏ ‏‮APIs‬‏"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "‏‮Application‬‏ ‏‮Cache‬‏ ‏‮is‬‏ ‏‮deprecated‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "‏‮Found‬‏ \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "‏‮Uses‬‏ ‏‮Application‬‏ ‏‮Cache‬‏"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "‏‮Avoids‬‏ ‏‮Application‬‏ ‏‮Cache‬‏"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "‏‮A‬‏ ‏‮character‬‏ ‏‮encoding‬‏ ‏‮declaration‬‏ ‏‮is‬‏ ‏‮required‬‏. ‏‮It‬‏ ‏‮can‬‏ ‏‮be‬‏ ‏‮done‬‏ ‏‮with‬‏ ‏‮a‬‏ `<meta>` ‏‮tag‬‏ ‏‮in‬‏ ‏‮the‬‏ ‏‮first‬‏ 1024 ‏‮bytes‬‏ ‏‮of‬‏ ‏‮the‬‏ ‏‮HTML‬‏ ‏‮or‬‏ ‏‮in‬‏ ‏‮the‬‏ ‏‮Content‬‏-‏‮Type‬‏ ‏‮HTTP‬‏ ‏‮response‬‏ ‏‮header‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "يتم تجنّب واجهات برمجة التطبيقات المتوقفة"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "تم إيقاف ذاكرة التخزين المؤقت للتطبيق. [مزيد من المعلومات](https://web.dev/appcache-manifest/)"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "تم العثور على \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "يتم استخدام ذاكرة التخزين المؤقت للتطبيق"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "يتم تجنُب ذاكرة التخزين المؤقت للتطبيق"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "تعريف ترميز الأحرف مطلوب. ويمكن إجراء ذلك باستخدام علامة `<meta>` في أول 1024 وحدة بايت من عنوان HTML أو في عنوان الاستجابة Content-Type في HTTP. [مزيد من المعلومات](https://web.dev/charset/)"
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Избягва оттеглени API"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Кешът на приложенията е оттеглен. [Научете повече](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Намерихме {AppCacheManifest}"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Използва кеша на приложенията"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Избягва кеша на приложенията"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Трябва да декларирате система за кодиране на знаците. За целта можете да използвате маркер `<meta>` в първите 1024 байта на HTML кода или в заглавката Content-Type за HTTP отговор. [Научете повече](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Evita les API obsoletes"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "La memòria cau de l'aplicació està obsoleta. [Obtén més informació](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "S'ha trobat \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Utilitza la memòria cau de l'aplicació"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Evita la memòria cau de l'aplicació"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Cal una declaració de codificació de caràcters. Es pot fer amb una etiqueta `<meta>` als primers 1.024 bytes de l'HTML o a la capçalera de resposta HTTP de tipus contingut. [Obtén més informació](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Nepoužívá zastaralá rozhraní API"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Mezipaměť aplikace je zastaralá technologie. [Další informace](https://web.dev/appcache-manifest/)"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Nalezeno „{AppCacheManifest}“"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Používá mezipaměť aplikace"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Nepoužívá mezipaměť aplikace"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Je požadována deklarace kódování znaků. Lze ho deklarovat pomocí značky `<meta>` v prvních 1024 bajtech kódu HTML nebo pomocí záhlaví Content-Type odpovědi HTTP. [Další informace](https://web.dev/charset/)"
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Undgår udfasede API'er"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Application Cache er udfaset. [Få flere oplysninger](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "\"{AppCacheManifest}\" blev fundet"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Bruger Application Cache"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Undgår Application Cache"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Der skal angives en erklæring om tegnkodning. Det kan gøres med et `<meta>`-tag i de første 1024 bytes i HTML-koden eller i HTTP-svarheaderen for Content-Type. [Få flere oplysninger](https://web.dev/charset/)."
760
748
  },