lighthouse 8.4.0-dev.20210913 → 8.4.0-dev.20210917

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 (45) hide show
  1. package/flow-report/assets/styles.css +46 -4
  2. package/flow-report/src/app.tsx +6 -2
  3. package/flow-report/src/icons.tsx +11 -0
  4. package/flow-report/src/topbar.tsx +60 -0
  5. package/flow-report/tsconfig.json +6 -22
  6. package/lighthouse-cli/.eslintrc.cjs +27 -0
  7. package/lighthouse-cli/bin.js +31 -21
  8. package/lighthouse-cli/cli-flags.js +12 -7
  9. package/lighthouse-cli/commands/commands.js +2 -7
  10. package/lighthouse-cli/commands/list-audits.js +2 -2
  11. package/lighthouse-cli/commands/list-trace-categories.js +2 -2
  12. package/lighthouse-cli/index.js +3 -1
  13. package/lighthouse-cli/{test/smokehouse/package.json → package.json} +0 -0
  14. package/lighthouse-cli/printer.js +4 -3
  15. package/lighthouse-cli/run.js +14 -15
  16. package/lighthouse-cli/sentry-prompt.js +5 -6
  17. package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -1
  18. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +54 -1
  19. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +1 -1
  20. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +1 -1
  21. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  22. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +6 -1
  23. package/lighthouse-core/audits/dobetterweb/js-libraries.js +5 -0
  24. package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -0
  25. package/lighthouse-core/audits/lcp-lazy-loaded.js +1 -0
  26. package/lighthouse-core/audits/oopif-iframe-test-audit.js +1 -0
  27. package/lighthouse-core/fraggle-rock/config/validation.js +2 -1
  28. package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +2 -0
  29. package/lighthouse-core/gather/driver/prepare.js +43 -17
  30. package/lighthouse-core/gather/gatherers/trace.js +4 -3
  31. package/lighthouse-core/index.js +4 -0
  32. package/lighthouse-core/lib/i18n/locales/en-US.json +6 -0
  33. package/lighthouse-core/lib/i18n/locales/en-XL.json +6 -0
  34. package/lighthouse-core/lib/proto-preprocessor.js +5 -10
  35. package/package.json +7 -6
  36. package/readme.md +2 -0
  37. package/report/generator/tsconfig.json +5 -16
  38. package/report/renderer/report-ui-features.js +1 -4
  39. package/report/tsconfig.json +6 -21
  40. package/root.js +3 -1
  41. package/tsconfig-all.json +15 -0
  42. package/tsconfig-base.json +24 -0
  43. package/tsconfig.json +8 -19
  44. package/types/lhr/lhr.d.ts +5 -1
  45. package/types/lhr/tsconfig.json +4 -14
@@ -13,6 +13,7 @@
13
13
 
14
14
  /* eslint-disable no-console */
15
15
 
16
+ import {strict as assert} from 'assert';
16
17
  import path from 'path';
17
18
  import fs from 'fs';
18
19
  import url from 'url';
@@ -79,6 +80,52 @@ function getDefinitionsToRun(allTestDefns, requestedIds, {invertMatch}) {
79
80
  return smokes;
80
81
  }
81
82
 
83
+ /**
84
+ * Parses the cli `shardArg` flag into `shardNumber/shardTotal`. Splits
85
+ * `testDefns` into `shardTotal` shards and returns the `shardNumber`th shard.
86
+ * Shards will differ in size by at most 1.
87
+ * Shard params must be 1 ≤ shardNumber ≤ shardTotal.
88
+ * @param {Array<Smokehouse.TestDfn>} testDefns
89
+ * @param {string=} shardArg
90
+ * @return {Array<Smokehouse.TestDfn>}
91
+ */
92
+ function getShardedDefinitions(testDefns, shardArg) {
93
+ if (!shardArg) return testDefns;
94
+
95
+ // eslint-disable-next-line max-len
96
+ const errorMessage = `'shard' must be of the form 'n/d' and n and d must be positive integers with 1 ≤ n ≤ d. Got '${shardArg}'`;
97
+ const match = /^(?<shardNumber>\d+)\/(?<shardTotal>\d+)$/.exec(shardArg);
98
+ assert(match && match.groups, errorMessage);
99
+ const shardNumber = Number(match.groups.shardNumber);
100
+ const shardTotal = Number(match.groups.shardTotal);
101
+ assert(shardNumber > 0 && Number.isInteger(shardNumber), errorMessage);
102
+ assert(shardTotal > 0 && Number.isInteger(shardTotal));
103
+ assert(shardNumber <= shardTotal, errorMessage);
104
+
105
+ // Array is sharded with `Math.ceil(length / shardTotal)` shards first
106
+ // and then the remaining `Math.floor(length / shardTotal) shards.
107
+ // e.g. `[0, 1, 2, 3]` split into 3 shards is `[[0, 1], [2], [3]]`.
108
+ const baseSize = Math.floor(testDefns.length / shardTotal);
109
+ const biggerSize = baseSize + 1;
110
+ const biggerShardCount = testDefns.length % shardTotal;
111
+
112
+ // Since we don't have tests for this file, construct all shards so correct
113
+ // structure can be asserted.
114
+ const shards = [];
115
+ let index = 0;
116
+ for (let i = 0; i < shardTotal; i++) {
117
+ const shardSize = i < biggerShardCount ? biggerSize : baseSize;
118
+ shards.push(testDefns.slice(index, index + shardSize));
119
+ index += shardSize;
120
+ }
121
+ assert.equal(shards.length, shardTotal);
122
+ assert.deepEqual(shards.flat(), testDefns);
123
+
124
+ const shardDefns = shards[shardNumber - 1];
125
+ console.log(`In this shard (${shardArg}), running: ${shardDefns.map(d => d.id).join(' ')}\n`);
126
+ return shardDefns;
127
+ }
128
+
82
129
  /**
83
130
  * Prune the `networkRequests` from the test expectations when `takeNetworkRequestUrls`
84
131
  * is not defined. Custom servers may not have this method available in-process.
@@ -163,6 +210,11 @@ async function begin() {
163
210
  default: false,
164
211
  describe: 'Run all available tests except the ones provided',
165
212
  },
213
+ 'shard': {
214
+ type: 'string',
215
+ // eslint-disable-next-line max-len
216
+ describe: 'A argument of the form "n/d", which divides the selected tests into d groups and runs the nth group. n and d must be positive integers with 1 ≤ n ≤ d.',
217
+ },
166
218
  })
167
219
  .wrap(y.terminalWidth())
168
220
  .argv;
@@ -187,7 +239,8 @@ async function begin() {
187
239
  const {default: rawTestDefns} = await import(url.pathToFileURL(testDefnPath).href);
188
240
  const allTestDefns = updateTestDefnFormat(rawTestDefns);
189
241
  const invertMatch = argv.invertMatch;
190
- const testDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invertMatch});
242
+ const requestedTestDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invertMatch});
243
+ const testDefns = getShardedDefinitions(requestedTestDefns, argv.shard);
191
244
 
192
245
  let smokehouseResult;
193
246
  let server;
@@ -62,5 +62,5 @@ async function runLighthouse(url, configJson, testRunnerOptions = {}) {
62
62
  }
63
63
 
64
64
  export {
65
- runLighthouse
65
+ runLighthouse,
66
66
  };
@@ -146,5 +146,5 @@ async function internalRun(url, tmpPath, configJson, options) {
146
146
  }
147
147
 
148
148
  export {
149
- runLighthouse
149
+ runLighthouse,
150
150
  };
@@ -228,5 +228,5 @@ function getAssertionLog(count) {
228
228
  }
229
229
 
230
230
  export {
231
- runSmokehouse
231
+ runSmokehouse,
232
232
  };
@@ -17,6 +17,10 @@ const URL = require('../../lib/url-shim.js');
17
17
  const i18n = require('../../lib/i18n/i18n.js');
18
18
 
19
19
  const UIStrings = {
20
+ /** Descriptive title of a Lighthouse audit that checks if images match their displayed dimensions. This is displayed when the audit is passing. */
21
+ title: 'Images were appropriate for their displayed size',
22
+ /** Descriptive title of a Lighthouse audit that checks if images match their displayed dimensions. This is displayed when the audit is failing. */
23
+ failureTitle: 'Images were larger than their displayed size',
20
24
  /** Label for a column in a data table; entries will be the dimensions of an image as it appears on the page. */
21
25
  columnDisplayedDimensions: 'Displayed dimensions',
22
26
  /** Label for a column in a data table; entries will be the dimensions of an image from it's source file. */
@@ -35,7 +39,8 @@ class UsesResponsiveImagesSnapshot extends Audit {
35
39
  static get meta() {
36
40
  return {
37
41
  id: 'uses-responsive-images-snapshot',
38
- title: UsesResponsiveImages.str_(UsesResponsiveImages.UIStrings.title),
42
+ title: str_(UIStrings.title),
43
+ failureTitle: str_(UIStrings.failureTitle),
39
44
  description: UsesResponsiveImages.str_(UsesResponsiveImages.UIStrings.description),
40
45
  supportedModes: ['snapshot'],
41
46
  requiredArtifacts: ['ImageElements', 'ViewportDimensions'],
@@ -32,6 +32,7 @@ class JsLibrariesAudit extends Audit {
32
32
  return {
33
33
  id: 'js-libraries',
34
34
  title: str_(UIStrings.title),
35
+ scoreDisplayMode: Audit.SCORING_MODES.INFORMATIVE,
35
36
  description: str_(UIStrings.description),
36
37
  requiredArtifacts: ['Stacks'],
37
38
  };
@@ -69,6 +70,10 @@ class JsLibrariesAudit extends Audit {
69
70
  }),
70
71
  };
71
72
 
73
+ if (!libDetails.length) {
74
+ return {score: null, notApplicable: true};
75
+ }
76
+
72
77
  return {
73
78
  score: 1, // Always pass for now.
74
79
  details: {
@@ -60,6 +60,7 @@ class UsesHTTP2Audit extends Audit {
60
60
  id: 'uses-http2',
61
61
  title: str_(UIStrings.title),
62
62
  description: str_(UIStrings.description),
63
+ scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
63
64
  supportedModes: ['navigation'],
64
65
  requiredArtifacts: ['URL', 'devtoolsLogs', 'traces'],
65
66
  };
@@ -27,6 +27,7 @@ class LargestContentfulPaintLazyLoaded extends Audit {
27
27
  return {
28
28
  id: 'lcp-lazy-loaded',
29
29
  title: str_(UIStrings.title),
30
+ failureTitle: str_(UIStrings.failureTitle),
30
31
  description: str_(UIStrings.description),
31
32
  supportedModes: ['navigation'],
32
33
  requiredArtifacts: ['TraceElements', 'ViewportDimensions', 'ImageElements'],
@@ -22,6 +22,7 @@ module.exports = {
22
22
  meta: {
23
23
  id: 'oopif-iframe-test-audit',
24
24
  title: 'IFrame Elements',
25
+ failureTitle: 'IFrame Elements',
25
26
  description: 'Audit to force the inclusion of IFrameElements artifact',
26
27
  requiredArtifacts: ['IFrameElements'],
27
28
  },
@@ -139,9 +139,10 @@ function assertValidAudit(auditDefinition) {
139
139
  }
140
140
 
141
141
  // If it'll have a ✔ or ✖ displayed alongside the result, it should have failureTitle
142
+ const scoreDisplayMode = implementation.meta.scoreDisplayMode || Audit.SCORING_MODES.BINARY;
142
143
  if (
143
144
  !i18n.isStringOrIcuMessage(implementation.meta.failureTitle) &&
144
- implementation.meta.scoreDisplayMode === Audit.SCORING_MODES.BINARY
145
+ scoreDisplayMode === Audit.SCORING_MODES.BINARY
145
146
  ) {
146
147
  throw new Error(`${auditName} has no meta.failureTitle and should.`);
147
148
  }
@@ -12,6 +12,7 @@ const {
12
12
  collectPhaseArtifacts,
13
13
  awaitArtifacts,
14
14
  } = require('./runner-helpers.js');
15
+ const {prepareTargetForTimespanMode} = require('../../gather/driver/prepare.js');
15
16
  const {initializeConfig} = require('../config/config.js');
16
17
  const {getBaseArtifacts, finalizeArtifacts} = require('./base-artifacts.js');
17
18
 
@@ -42,6 +43,7 @@ async function startTimespan(options) {
42
43
  settings: config.settings,
43
44
  };
44
45
 
46
+ await prepareTargetForTimespanMode(driver, config.settings);
45
47
  await collectPhaseArtifacts({phase: 'startInstrumentation', ...phaseOptions});
46
48
  await collectPhaseArtifacts({phase: 'startSensitiveInstrumentation', ...phaseOptions});
47
49
 
@@ -88,25 +88,25 @@ async function resetStorageForNavigation(session, navigation) {
88
88
  }
89
89
 
90
90
  /**
91
- * Prepares a target for a particular navigation by resetting storage and setting throttling.
91
+ * Prepares a target for observational analysis by setting throttling and network headers/blocked patterns.
92
92
  *
93
- * This method assumes `prepareTargetForNavigationMode` has already been invoked.
93
+ * This method assumes `prepareTargetForNavigationMode` or `prepareTargetForTimespanMode` has already been invoked.
94
94
  *
95
95
  * @param {LH.Gatherer.FRProtocolSession} session
96
96
  * @param {LH.Config.Settings} settings
97
- * @param {Pick<LH.Config.NavigationDefn, 'disableThrottling'|'disableStorageReset'|'blockedUrlPatterns'> & {url: string}} navigation
97
+ * @param {{disableThrottling: boolean, blockedUrlPatterns?: string[]}} options
98
98
  */
99
- async function prepareNetworkForNavigation(session, settings, navigation) {
100
- const status = {msg: 'Preparing network conditions', id: `lh:gather:prepareNetworkForNavigation`};
99
+ async function prepareThrottlingAndNetwork(session, settings, options) {
100
+ const status = {msg: 'Preparing network conditions', id: `lh:gather:prepareThrottlingAndNetwork`};
101
101
  log.time(status);
102
102
 
103
- if (navigation.disableThrottling) await emulation.clearThrottling(session);
103
+ if (options.disableThrottling) await emulation.clearThrottling(session);
104
104
  else await emulation.throttle(session, settings);
105
105
 
106
106
  // Set request blocking before any network activity.
107
- // No "clearing" is done at the end of the navigation since Network.setBlockedURLs([]) will unset all if
108
- // neccessary at the beginning of the next navigation.
109
- const blockedUrls = (navigation.blockedUrlPatterns || []).concat(
107
+ // No "clearing" is done at the end of the recording since Network.setBlockedURLs([]) will unset all if
108
+ // neccessary at the beginning of the next section.
109
+ const blockedUrls = (options.blockedUrlPatterns || []).concat(
110
110
  settings.blockedUrlPatterns || []
111
111
  );
112
112
  await session.sendCommand('Network.setBlockedURLs', {urls: blockedUrls});
@@ -118,16 +118,14 @@ async function prepareNetworkForNavigation(session, settings, navigation) {
118
118
  }
119
119
 
120
120
  /**
121
- * Prepares a target to be analyzed in navigation mode by enabling protocol domains, emulation, and new document
122
- * handlers for global APIs or error handling.
123
- *
124
- * This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
121
+ * Prepares a target to be analyzed by setting up device emulation (screen/UA, not throttling) and
122
+ * async stack traces for network initiators.
125
123
  *
126
124
  * @param {LH.Gatherer.FRTransitionalDriver} driver
127
125
  * @param {LH.Config.Settings} settings
128
126
  */
129
- async function prepareTargetForNavigationMode(driver, settings) {
130
- // Enable network domain here so future calls to `emulate()` don't clear cache (#12631)
127
+ async function prepareDeviceEmulationAndAsyncStacks(driver, settings) {
128
+ // Enable network domain here so future calls to `emulate()` don't clear cache (https://github.com/GoogleChrome/lighthouse/issues/12631)
131
129
  await driver.defaultSession.sendCommand('Network.enable');
132
130
 
133
131
  // Emulate our target device screen and user agent.
@@ -135,6 +133,33 @@ async function prepareTargetForNavigationMode(driver, settings) {
135
133
 
136
134
  // Enable better stacks on network requests.
137
135
  await enableAsyncStacks(driver.defaultSession);
136
+ }
137
+
138
+ /**
139
+ * Prepares a target to be analyzed in timespan mode by enabling protocol domains, emulation, and throttling.
140
+ *
141
+ * @param {LH.Gatherer.FRTransitionalDriver} driver
142
+ * @param {LH.Config.Settings} settings
143
+ */
144
+ async function prepareTargetForTimespanMode(driver, settings) {
145
+ await prepareDeviceEmulationAndAsyncStacks(driver, settings);
146
+ await prepareThrottlingAndNetwork(driver.defaultSession, settings, {
147
+ disableThrottling: false,
148
+ blockedUrlPatterns: undefined,
149
+ });
150
+ }
151
+
152
+ /**
153
+ * Prepares a target to be analyzed in navigation mode by enabling protocol domains, emulation, and new document
154
+ * handlers for global APIs or error handling.
155
+ *
156
+ * This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
157
+ *
158
+ * @param {LH.Gatherer.FRTransitionalDriver} driver
159
+ * @param {LH.Config.Settings} settings
160
+ */
161
+ async function prepareTargetForNavigationMode(driver, settings) {
162
+ await prepareDeviceEmulationAndAsyncStacks(driver, settings);
138
163
 
139
164
  // Automatically handle any JavaScript dialogs to prevent a hung renderer.
140
165
  await dismissJavaScriptDialogs(driver.defaultSession);
@@ -168,13 +193,14 @@ async function prepareTargetForIndividualNavigation(session, settings, navigatio
168
193
  warnings.push(...storageWarnings);
169
194
  }
170
195
 
171
- await prepareNetworkForNavigation(session, settings, navigation);
196
+ await prepareThrottlingAndNetwork(session, settings, navigation);
172
197
 
173
198
  return {warnings};
174
199
  }
175
200
 
176
201
  module.exports = {
177
- prepareNetworkForNavigation,
202
+ prepareThrottlingAndNetwork,
203
+ prepareTargetForTimespanMode,
178
204
  prepareTargetForNavigationMode,
179
205
  prepareTargetForIndividualNavigation,
180
206
  };
@@ -60,7 +60,6 @@ class Trace extends FRGatherer {
60
60
  // A bug introduced in M92 causes these categories to crash targets on Linux.
61
61
  // See https://github.com/GoogleChrome/lighthouse/issues/12835 for full investigation.
62
62
  // 'disabled-by-default-v8.cpu_profiler',
63
- // 'disabled-by-default-v8.cpu_profiler.hires',
64
63
  ];
65
64
  }
66
65
 
@@ -102,10 +101,12 @@ class Trace extends FRGatherer {
102
101
  /**
103
102
  * @param {LH.Gatherer.FRTransitionalContext} passContext
104
103
  */
105
- async startSensitiveInstrumentation({driver, gatherMode}) {
104
+ async startSensitiveInstrumentation({driver, gatherMode, settings}) {
105
+ const traceCategories = Trace.getDefaultTraceCategories()
106
+ .concat(settings.additionalTraceCategories || []);
106
107
  await driver.defaultSession.sendCommand('Page.enable');
107
108
  await driver.defaultSession.sendCommand('Tracing.start', {
108
- categories: Trace.getDefaultTraceCategories().join(','),
109
+ categories: traceCategories.join(','),
109
110
  options: 'sampling-frequency=10000', // 1000 is default and too slow.
110
111
  });
111
112
 
@@ -70,6 +70,10 @@ lighthouse.getAuditList = Runner.getAuditList;
70
70
  lighthouse.traceCategories = require('./gather/driver.js').traceCategories;
71
71
  lighthouse.Audit = require('./audits/audit.js');
72
72
  lighthouse.Gatherer = require('./gather/gatherers/gatherer.js');
73
+
74
+ // Explicit type reference (hidden by makeComputedArtifact) for d.ts export.
75
+ // TODO(esmodules): should be a workaround for module.export and can be removed when in esm.
76
+ /** @type {typeof import('./computed/network-records.js')} */
73
77
  lighthouse.NetworkRecords = require('./computed/network-records.js');
74
78
 
75
79
  module.exports = lighthouse;
@@ -554,6 +554,12 @@
554
554
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | columnDisplayedDimensions": {
555
555
  "message": "Displayed dimensions"
556
556
  },
557
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | failureTitle": {
558
+ "message": "Images were larger than their displayed size"
559
+ },
560
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | title": {
561
+ "message": "Images were appropriate for their displayed size"
562
+ },
557
563
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images.js | description": {
558
564
  "message": "Serve images that are appropriately-sized to save cellular data and improve load time. [Learn more](https://web.dev/uses-responsive-images/)."
559
565
  },
@@ -554,6 +554,12 @@
554
554
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | columnDisplayedDimensions": {
555
555
  "message": "D̂íŝṕl̂áŷéd̂ d́îḿêńŝíôńŝ"
556
556
  },
557
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | failureTitle": {
558
+ "message": "Îḿâǵêś ŵér̂é l̂ár̂ǵêŕ t̂h́âń t̂h́êír̂ d́îśp̂ĺâýêd́ ŝíẑé"
559
+ },
560
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | title": {
561
+ "message": "Îḿâǵêś ŵér̂é âṕp̂ŕôṕr̂íât́ê f́ôŕ t̂h́êír̂ d́îśp̂ĺâýêd́ ŝíẑé"
562
+ },
557
563
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images.js | description": {
558
564
  "message": "Ŝér̂v́ê ím̂áĝéŝ t́ĥát̂ ár̂é âṕp̂ŕôṕr̂íât́êĺŷ-śîźêd́ t̂ó ŝáv̂é ĉél̂ĺûĺâŕ d̂át̂á âńd̂ ím̂ṕr̂óv̂é l̂óâd́ t̂ím̂é. [L̂éâŕn̂ ḿôŕê](https://web.dev/uses-responsive-images/)."
559
565
  },
@@ -16,10 +16,10 @@ const fs = require('fs');
16
16
  */
17
17
 
18
18
  /**
19
- * Transform an LHR into a proto-friendly, mostly-compatible LHR.
20
- * @param {LH.Result} lhr
21
- * @return {LH.Result}
22
- */
19
+ * Transform an LHR into a proto-friendly, mostly-compatible LHR.
20
+ * @param {LH.Result} lhr
21
+ * @return {LH.Result}
22
+ */
23
23
  function processForProto(lhr) {
24
24
  /** @type {LH.Result} */
25
25
  const reportJson = JSON.parse(JSON.stringify(lhr));
@@ -68,13 +68,8 @@ function processForProto(lhr) {
68
68
  });
69
69
  }
70
70
 
71
- // Drop the i18n icuMessagePaths. Painful in proto, and low priority to expose currently.
72
- if (reportJson.i18n && reportJson.i18n.icuMessagePaths) {
73
- delete reportJson.i18n.icuMessagePaths;
74
- }
75
-
76
- // Remove any found empty strings, as they are dropped after round-tripping anyway
77
71
  /**
72
+ * Remove any found empty strings, as they are dropped after round-tripping anyway
78
73
  * @param {any} obj
79
74
  */
80
75
  function removeStrings(obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.4.0-dev.20210913",
3
+ "version": "8.4.0-dev.20210917",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "build-extension-firefox": "node ./build/build-extension.js firefox",
22
22
  "build-devtools": "yarn reset-link && node ./build/build-bundle.js clients/devtools-entry.js dist/lighthouse-dt-bundle.js && node ./build/build-dt-report-resources.js",
23
23
  "build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
24
- "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js && rollup lighthouse-cli/test/fixtures/static-server.js -o dist/lightrider/static-server.js -p commonjs -p node-resolve -e mime-types,glob",
24
+ "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js && rollup lighthouse-cli/test/fixtures/static-server.js -o dist/lightrider/static-server.js -f commonjs -p commonjs -p node-resolve -e mime-types,glob",
25
25
  "build-pack": "bash build/build-pack.sh",
26
26
  "build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && node build/build-report.js",
27
27
  "build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
@@ -68,7 +68,7 @@
68
68
  "dogfood-lhci": "./lighthouse-core/scripts/dogfood-lhci.sh",
69
69
  "timing-trace": "node lighthouse-core/scripts/generate-timing-trace.js",
70
70
  "changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file",
71
- "type-check": "tsc --build ./ report/ lighthouse-viewer/ lighthouse-treemap/ flow-report/",
71
+ "type-check": "tsc --build ./tsconfig-all.json",
72
72
  "i18n:checks": "./lighthouse-core/scripts/i18n/assert-strings-collected.sh",
73
73
  "i18n:collect-strings": "node lighthouse-core/scripts/i18n/collect-strings.js",
74
74
  "update:lantern-baseline": "node lighthouse-core/scripts/lantern/update-baseline-lantern-values.js",
@@ -96,7 +96,7 @@
96
96
  "@firebase/auth-types": "0.3.2",
97
97
  "@firebase/util": "0.2.1",
98
98
  "@rollup/plugin-node-resolve": "^13.0.4",
99
- "@rollup/plugin-typescript": "^2.1.0",
99
+ "@rollup/plugin-typescript": "^8.2.5",
100
100
  "@testing-library/preact": "^2.0.1",
101
101
  "@testing-library/preact-hooks": "^1.1.0",
102
102
  "@types/archiver": "^2.1.2",
@@ -151,7 +151,7 @@
151
151
  "glob": "^7.1.3",
152
152
  "idb-keyval": "2.2.0",
153
153
  "intl-messageformat-parser": "^1.8.1",
154
- "jest": "27.0.3",
154
+ "jest": "27.1.1",
155
155
  "jsdom": "^12.2.0",
156
156
  "jsonld": "^5.2.0",
157
157
  "jsonlint-mod": "^1.7.6",
@@ -167,12 +167,13 @@
167
167
  "rollup": "^2.50.6",
168
168
  "rollup-plugin-commonjs": "^10.1.0",
169
169
  "rollup-plugin-node-resolve": "^5.2.0",
170
+ "rollup-plugin-shim": "^1.0.0",
170
171
  "rollup-plugin-terser": "^7.0.2",
171
172
  "tabulator-tables": "^4.9.3",
172
173
  "terser": "^5.3.8",
173
174
  "ts-jest": "^27.0.4",
174
175
  "typed-query-selector": "^2.4.0",
175
- "typescript": "4.4.2",
176
+ "typescript": "4.4.3",
176
177
  "webtreemap-cdt": "^3.2.1"
177
178
  },
178
179
  "dependencies": {
package/readme.md CHANGED
@@ -363,6 +363,8 @@ This section details services that have integrated Lighthouse data. If you're wo
363
363
 
364
364
  * **[Microlink](https://microlink.io)** — Microlink is a cloud browser as API. It offers Lighthouse reports on demand, making it easy to build any service on top. Similar functionality is available via the underlying open-source project named browserless.
365
365
 
366
+ * **[Peyk](https://peyk.com)** - Peyk is a website change detection & monitoring service. Peyk can detect changes in cookies, network requests, technologies, local & session storage, lighthouse audits, screenshots and so much more. Peyk is offered via free and paid plans.
367
+
366
368
  * **[Wattspeed](https://wattspeed.com/)** — Wattspeed is a free tool that generates snapshots - historical captures of your web pages that include Lighthouse scores, a list of technologies, W3C HTML validator results, DOM size, mixed content info, and more.
367
369
 
368
370
  * **[AwesomeTechStack](https://awesometechstack.com)** — AwesomeTechStack is a free to use website tech stack analyzer. AwesomeTechStack provides insights into the security, modernity, and performance of any website's technology stack and guidance to improve performance. Lighthouse insights are a crucial part of a website's tech stack rating.
@@ -1,23 +1,12 @@
1
1
  {
2
+ "extends": "../../tsconfig-base.json",
2
3
  "compilerOptions": {
3
- "composite": true,
4
4
  "outDir": "../../.tmp/tsbuildinfo/report/generator",
5
- "emitDeclarationOnly": true,
6
- "declarationMap": true,
7
5
 
8
- "target": "ES2020",
9
- "module": "commonjs",
10
- "moduleResolution": "node",
11
-
12
- "allowJs": true,
13
- "checkJs": true,
14
- "strict": true,
15
- // TODO: remove the next line to be fully `strict`.
16
- "useUnknownInCatchVariables": false,
17
-
18
- // "listFiles": true,
19
- // "noErrorTruncation": true,
20
- "extendedDiagnostics": true,
6
+ // Limit defs to base JS and DOM (for URL: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960).
7
+ "lib": ["es2020", "dom"],
8
+ // Only include `@types/node` from node_modules/.
9
+ "types": ["node"],
21
10
  },
22
11
  "references": [
23
12
  {"path": "../../types/lhr/"},
@@ -219,16 +219,14 @@ export class ReportUIFeatures {
219
219
  return !thirdPartyFilterAuditExclusions.includes(containingAudit.id);
220
220
  });
221
221
 
222
- tablesWithUrls.forEach((tableEl, index) => {
222
+ tablesWithUrls.forEach((tableEl) => {
223
223
  const rowEls = getTableRows(tableEl);
224
224
  const thirdPartyRows = this._getThirdPartyRows(rowEls, this.json.finalUrl);
225
225
 
226
226
  // create input box
227
227
  const filterTemplate = this._dom.createComponent('3pFilter');
228
228
  const filterInput = this._dom.find('input', filterTemplate);
229
- const id = `lh-3p-filter-label--${index}`;
230
229
 
231
- filterInput.id = id;
232
230
  filterInput.addEventListener('change', e => {
233
231
  const shouldHideThirdParty = e.target instanceof HTMLInputElement && !e.target.checked;
234
232
  let even = true;
@@ -250,7 +248,6 @@ export class ReportUIFeatures {
250
248
  }
251
249
  });
252
250
 
253
- this._dom.find('label', filterTemplate).setAttribute('for', id);
254
251
  this._dom.find('.lh-3p-filter-count', filterTemplate).textContent =
255
252
  `${thirdPartyRows.length}`;
256
253
  this._dom.find('.lh-3p-ui-string', filterTemplate).textContent =
@@ -1,36 +1,21 @@
1
1
  {
2
+ "extends": "../tsconfig-base.json",
2
3
  "compilerOptions": {
3
- "composite": true,
4
4
  "outDir": "../.tmp/tsbuildinfo/report",
5
- "emitDeclarationOnly": true,
6
- "declarationMap": true,
7
5
 
8
6
  // Limit to base JS and DOM defs.
9
7
  "lib": ["es2020", "dom", "dom.iterable"],
10
- // Don't include any types from node_modules.
8
+ // Don't include any types from node_modules/.
11
9
  "types": [],
12
- "target": "es2020",
13
- "module": "es2020",
14
- "moduleResolution": "node",
15
-
16
- "allowJs": true,
17
- "checkJs": true,
18
- "strict": true,
19
- // TODO: remove the next line to be fully `strict`.
20
- "useUnknownInCatchVariables": false,
21
-
22
- // "listFiles": true,
23
- // "noErrorTruncation": true,
24
- "extendedDiagnostics": true,
25
10
  },
26
- "include": [
27
- "**/*.js",
28
- "types/**/*.d.ts",
29
- ],
30
11
  "references": [
31
12
  {"path": "../types/lhr/"},
32
13
  {"path": "./generator/"}
33
14
  ],
15
+ "include": [
16
+ "**/*.js",
17
+ "types/**/*.d.ts",
18
+ ],
34
19
  "exclude": [
35
20
  "generator/**/*.js",
36
21
  // These test files require further changes before they can be type checked.
package/root.js CHANGED
@@ -5,4 +5,6 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- module.exports.LH_ROOT = __dirname;
8
+ module.exports = {
9
+ LH_ROOT: __dirname,
10
+ };
@@ -0,0 +1,15 @@
1
+ // Compilation entry point for all tsc projects within Lighthouse.
2
+
3
+ {
4
+ "references": [
5
+ {"path": "./"},
6
+ {"path": "./types/lhr/"},
7
+ {"path": "./report/"},
8
+ {"path": "./report/generator/"},
9
+ {"path": "./lighthouse-viewer/"},
10
+ {"path": "./lighthouse-treemap/"},
11
+ {"path": "./flow-report/"},
12
+ ],
13
+ "files": [],
14
+ "include": [],
15
+ }
@@ -0,0 +1,24 @@
1
+ // Base compiler options for all tsconfig files.
2
+
3
+ {
4
+ "compilerOptions": {
5
+ "composite": true,
6
+ "emitDeclarationOnly": true,
7
+ "declarationMap": true,
8
+
9
+ "target": "es2020",
10
+ "module": "es2020",
11
+ "moduleResolution": "node",
12
+ "esModuleInterop": true,
13
+
14
+ "allowJs": true,
15
+ "checkJs": true,
16
+ "strict": true,
17
+ // TODO: remove the next line to be fully `strict`.
18
+ "useUnknownInCatchVariables": false,
19
+
20
+ // "listFiles": true,
21
+ // "noErrorTruncation": true,
22
+ "extendedDiagnostics": true,
23
+ },
24
+ }