lighthouse 9.5.0-dev.20220813 → 9.5.0-dev.20220816

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 (105) hide show
  1. package/cli/commands/list-locales.js +1 -1
  2. package/cli/run.js +13 -0
  3. package/core/config/config-helpers.js +0 -15
  4. package/core/config/config.js +1 -1
  5. package/core/config/constants.js +1 -0
  6. package/core/config/default-config.js +0 -2
  7. package/core/fraggle-rock/api.js +1 -1
  8. package/core/fraggle-rock/config/config.js +12 -13
  9. package/core/fraggle-rock/gather/navigation-runner.js +17 -26
  10. package/core/fraggle-rock/gather/snapshot-runner.js +4 -5
  11. package/core/fraggle-rock/gather/timespan-runner.js +4 -5
  12. package/core/fraggle-rock/replay/stringify-extension.js +105 -0
  13. package/core/fraggle-rock/user-flow.js +10 -12
  14. package/core/gather/driver/execution-context.js +19 -2
  15. package/core/gather/gather-runner.js +1 -1
  16. package/core/index.js +2 -5
  17. package/core/lib/asset-saver.js +2 -2
  18. package/core/lib/cdt/generated/SourceMap.js +113 -27
  19. package/core/lib/deprecations-strings.js +74 -10
  20. package/core/lib/network-request.js +1 -0
  21. package/core/lib/page-functions.js +15 -3
  22. package/core/lib/traces/{pwmetrics-events.js → metric-trace-events.js} +3 -4
  23. package/core/runner.js +2 -2
  24. package/dist/report/bundle.esm.js +1 -14
  25. package/dist/report/flow.js +28 -27
  26. package/dist/report/standalone.js +4 -4
  27. package/flow-report/test/flow-report-pptr-test.ts +1 -1
  28. package/package.json +6 -5
  29. package/report/generator/file-namer.js +5 -1
  30. package/report/generator/flow-report-assets.js +10 -6
  31. package/report/generator/report-assets.js +8 -5
  32. package/report/generator/report-generator.js +7 -7
  33. package/report/generator/tsconfig.json +1 -0
  34. package/report/test/generator/file-namer-test.js +2 -2
  35. package/report/test/generator/report-generator-test.js +8 -9
  36. package/report/test/renderer/report-renderer-axe-test.js +2 -2
  37. package/report/test/renderer/report-ui-features-test.js +1 -1
  38. package/shared/localization/format.js +11 -13
  39. package/shared/localization/i18n-module.js +7 -2
  40. package/shared/localization/locales/ar-XB.json +0 -21
  41. package/shared/localization/locales/ar.json +0 -21
  42. package/shared/localization/locales/bg.json +0 -21
  43. package/shared/localization/locales/ca.json +0 -21
  44. package/shared/localization/locales/cs.json +0 -21
  45. package/shared/localization/locales/da.json +0 -21
  46. package/shared/localization/locales/de.json +0 -21
  47. package/shared/localization/locales/el.json +0 -21
  48. package/shared/localization/locales/en-GB.json +0 -21
  49. package/shared/localization/locales/en-US.json +13 -22
  50. package/shared/localization/locales/en-XA.json +0 -21
  51. package/shared/localization/locales/en-XL.json +13 -22
  52. package/shared/localization/locales/es-419.json +0 -21
  53. package/shared/localization/locales/es.json +0 -21
  54. package/shared/localization/locales/fi.json +0 -21
  55. package/shared/localization/locales/fil.json +0 -21
  56. package/shared/localization/locales/fr.json +0 -21
  57. package/shared/localization/locales/he.json +0 -21
  58. package/shared/localization/locales/hi.json +0 -21
  59. package/shared/localization/locales/hr.json +0 -21
  60. package/shared/localization/locales/hu.json +0 -21
  61. package/shared/localization/locales/id.json +0 -21
  62. package/shared/localization/locales/it.json +0 -21
  63. package/shared/localization/locales/ja.json +0 -21
  64. package/shared/localization/locales/ko.json +0 -21
  65. package/shared/localization/locales/lt.json +0 -21
  66. package/shared/localization/locales/lv.json +0 -21
  67. package/shared/localization/locales/nl.json +0 -21
  68. package/shared/localization/locales/no.json +0 -21
  69. package/shared/localization/locales/pl.json +0 -21
  70. package/shared/localization/locales/pt-PT.json +0 -21
  71. package/shared/localization/locales/pt.json +0 -21
  72. package/shared/localization/locales/ro.json +0 -21
  73. package/shared/localization/locales/ru.json +0 -21
  74. package/shared/localization/locales/sk.json +0 -21
  75. package/shared/localization/locales/sl.json +0 -21
  76. package/shared/localization/locales/sr-Latn.json +0 -21
  77. package/shared/localization/locales/sr.json +0 -21
  78. package/shared/localization/locales/sv.json +0 -21
  79. package/shared/localization/locales/ta.json +0 -21
  80. package/shared/localization/locales/te.json +0 -21
  81. package/shared/localization/locales/th.json +0 -21
  82. package/shared/localization/locales/tr.json +0 -21
  83. package/shared/localization/locales/uk.json +0 -21
  84. package/shared/localization/locales/vi.json +0 -21
  85. package/shared/localization/locales/zh-HK.json +0 -21
  86. package/shared/localization/locales/zh-TW.json +0 -21
  87. package/shared/localization/locales/zh.json +0 -21
  88. package/shared/localization/locales.js +53 -50
  89. package/shared/localization/swap-flow-locale.js +6 -2
  90. package/shared/localization/swap-locale.js +4 -4
  91. package/shared/test/localization/format-test.js +17 -20
  92. package/shared/test/localization/locales-test.js +2 -2
  93. package/shared/test/localization/swap-locale-test.js +3 -2
  94. package/shared/tsconfig.json +1 -0
  95. package/shared/type-verifiers.js +1 -1
  96. package/tsconfig.json +1 -5
  97. package/types/config.d.ts +0 -13
  98. package/types/externs.d.ts +1 -1
  99. package/types/lhr/settings.d.ts +2 -0
  100. package/types/user-flow.d.ts +1 -1
  101. package/core/audits/dobetterweb/no-vulnerable-libraries.js +0 -229
  102. package/report/generator/package.json +0 -4
  103. package/report/test/generator/package.json +0 -4
  104. package/shared/package.json +0 -4
  105. package/third-party/snyk/snapshot.json +0 -182
@@ -854,27 +854,6 @@
854
854
  "core/audits/dobetterweb/no-document-write.js | title": {
855
855
  "message": "请勿使用 `document.write()`"
856
856
  },
857
- "core/audits/dobetterweb/no-vulnerable-libraries.js | columnSeverity": {
858
- "message": "最高严重程度"
859
- },
860
- "core/audits/dobetterweb/no-vulnerable-libraries.js | columnVersion": {
861
- "message": "库版本"
862
- },
863
- "core/audits/dobetterweb/no-vulnerable-libraries.js | columnVuln": {
864
- "message": "漏洞数量"
865
- },
866
- "core/audits/dobetterweb/no-vulnerable-libraries.js | description": {
867
- "message": "某些第三方脚本可能包含已知的安全漏洞,攻击者很容易识别和利用这些漏洞。[了解详情](https://web.dev/no-vulnerable-libraries/)。"
868
- },
869
- "core/audits/dobetterweb/no-vulnerable-libraries.js | displayValue": {
870
- "message": "{itemCount,plural, =1{检测到 1 个漏洞}other{检测到 # 个漏洞}}"
871
- },
872
- "core/audits/dobetterweb/no-vulnerable-libraries.js | failureTitle": {
873
- "message": "包含有已知安全漏洞的前端 JavaScript 库"
874
- },
875
- "core/audits/dobetterweb/no-vulnerable-libraries.js | title": {
876
- "message": "避免使用含已知安全漏洞的前端 JavaScript 库"
877
- },
878
857
  "core/audits/dobetterweb/notification-on-start.js | description": {
879
858
  "message": "如果网站在缺少上下文的情况下请求发送通知,会导致用户不信任网站或感到困惑。建议将请求与用户手势进行绑定。[了解详情](https://web.dev/notification-on-start/)。"
880
859
  },
@@ -22,61 +22,64 @@
22
22
 
23
23
  // TODO(paulirish): Centralize locale inheritance (combining this & i18n.lookupLocale()), adopt cldr parentLocale rules.
24
24
 
25
+ import fs from 'fs';
26
+ import {getModuleDirectory} from '../../esm-utils.js';
27
+
25
28
  /** @typedef {import('../../types/lhr/settings').Locale} Locale */
26
29
  /** @typedef {Record<string, {message: string}>} LhlMessages */
27
30
 
28
- const fs = require('fs');
31
+ const moduleDir = getModuleDirectory(import.meta);
29
32
 
30
33
  /** @type {Record<string, LhlMessages>} */
31
34
  const files = {
32
- 'ar': JSON.parse(fs.readFileSync(`${__dirname}/locales/ar.json`, 'utf8')),
33
- 'ar-XB': JSON.parse(fs.readFileSync(`${__dirname}/locales/ar-XB.json`, 'utf8')),
34
- 'bg': JSON.parse(fs.readFileSync(`${__dirname}/locales/bg.json`, 'utf8')),
35
- 'ca': JSON.parse(fs.readFileSync(`${__dirname}/locales/ca.json`, 'utf8')),
36
- 'cs': JSON.parse(fs.readFileSync(`${__dirname}/locales/cs.json`, 'utf8')),
37
- 'da': JSON.parse(fs.readFileSync(`${__dirname}/locales/da.json`, 'utf8')),
38
- 'de': JSON.parse(fs.readFileSync(`${__dirname}/locales/de.json`, 'utf8')),
39
- 'el': JSON.parse(fs.readFileSync(`${__dirname}/locales/el.json`, 'utf8')),
40
- 'en-GB': JSON.parse(fs.readFileSync(`${__dirname}/locales/en-GB.json`, 'utf8')),
41
- 'en-US': JSON.parse(fs.readFileSync(`${__dirname}/locales/en-US.json`, 'utf8')),
42
- 'en-XA': JSON.parse(fs.readFileSync(`${__dirname}/locales/en-XA.json`, 'utf8')),
43
- 'en-XL': JSON.parse(fs.readFileSync(`${__dirname}/locales/en-XL.json`, 'utf8')),
44
- 'es': JSON.parse(fs.readFileSync(`${__dirname}/locales/es.json`, 'utf8')),
45
- 'es-419': JSON.parse(fs.readFileSync(`${__dirname}/locales/es-419.json`, 'utf8')),
46
- 'fi': JSON.parse(fs.readFileSync(`${__dirname}/locales/fi.json`, 'utf8')),
47
- 'fil': JSON.parse(fs.readFileSync(`${__dirname}/locales/fil.json`, 'utf8')),
48
- 'fr': JSON.parse(fs.readFileSync(`${__dirname}/locales/fr.json`, 'utf8')),
49
- 'he': JSON.parse(fs.readFileSync(`${__dirname}/locales/he.json`, 'utf8')),
50
- 'hi': JSON.parse(fs.readFileSync(`${__dirname}/locales/hi.json`, 'utf8')),
51
- 'hr': JSON.parse(fs.readFileSync(`${__dirname}/locales/hr.json`, 'utf8')),
52
- 'hu': JSON.parse(fs.readFileSync(`${__dirname}/locales/hu.json`, 'utf8')),
53
- 'id': JSON.parse(fs.readFileSync(`${__dirname}/locales/id.json`, 'utf8')),
54
- 'it': JSON.parse(fs.readFileSync(`${__dirname}/locales/it.json`, 'utf8')),
55
- 'ja': JSON.parse(fs.readFileSync(`${__dirname}/locales/ja.json`, 'utf8')),
56
- 'ko': JSON.parse(fs.readFileSync(`${__dirname}/locales/ko.json`, 'utf8')),
57
- 'lt': JSON.parse(fs.readFileSync(`${__dirname}/locales/lt.json`, 'utf8')),
58
- 'lv': JSON.parse(fs.readFileSync(`${__dirname}/locales/lv.json`, 'utf8')),
59
- 'nl': JSON.parse(fs.readFileSync(`${__dirname}/locales/nl.json`, 'utf8')),
60
- 'no': JSON.parse(fs.readFileSync(`${__dirname}/locales/no.json`, 'utf8')),
61
- 'pl': JSON.parse(fs.readFileSync(`${__dirname}/locales/pl.json`, 'utf8')),
62
- 'pt': JSON.parse(fs.readFileSync(`${__dirname}/locales/pt.json`, 'utf8')),
63
- 'pt-PT': JSON.parse(fs.readFileSync(`${__dirname}/locales/pt-PT.json`, 'utf8')),
64
- 'ro': JSON.parse(fs.readFileSync(`${__dirname}/locales/ro.json`, 'utf8')),
65
- 'ru': JSON.parse(fs.readFileSync(`${__dirname}/locales/ru.json`, 'utf8')),
66
- 'sk': JSON.parse(fs.readFileSync(`${__dirname}/locales/sk.json`, 'utf8')),
67
- 'sl': JSON.parse(fs.readFileSync(`${__dirname}/locales/sl.json`, 'utf8')),
68
- 'sr': JSON.parse(fs.readFileSync(`${__dirname}/locales/sr.json`, 'utf8')),
69
- 'sr-Latn': JSON.parse(fs.readFileSync(`${__dirname}/locales/sr-Latn.json`, 'utf8')),
70
- 'sv': JSON.parse(fs.readFileSync(`${__dirname}/locales/sv.json`, 'utf8')),
71
- 'ta': JSON.parse(fs.readFileSync(`${__dirname}/locales/ta.json`, 'utf8')),
72
- 'te': JSON.parse(fs.readFileSync(`${__dirname}/locales/te.json`, 'utf8')),
73
- 'th': JSON.parse(fs.readFileSync(`${__dirname}/locales/th.json`, 'utf8')),
74
- 'tr': JSON.parse(fs.readFileSync(`${__dirname}/locales/tr.json`, 'utf8')),
75
- 'uk': JSON.parse(fs.readFileSync(`${__dirname}/locales/uk.json`, 'utf8')),
76
- 'vi': JSON.parse(fs.readFileSync(`${__dirname}/locales/vi.json`, 'utf8')),
77
- 'zh': JSON.parse(fs.readFileSync(`${__dirname}/locales/zh.json`, 'utf8')),
78
- 'zh-HK': JSON.parse(fs.readFileSync(`${__dirname}/locales/zh-HK.json`, 'utf8')),
79
- 'zh-TW': JSON.parse(fs.readFileSync(`${__dirname}/locales/zh-TW.json`, 'utf8')),
35
+ 'ar': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ar.json`, 'utf8')),
36
+ 'ar-XB': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ar-XB.json`, 'utf8')),
37
+ 'bg': JSON.parse(fs.readFileSync(`${moduleDir}/locales/bg.json`, 'utf8')),
38
+ 'ca': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ca.json`, 'utf8')),
39
+ 'cs': JSON.parse(fs.readFileSync(`${moduleDir}/locales/cs.json`, 'utf8')),
40
+ 'da': JSON.parse(fs.readFileSync(`${moduleDir}/locales/da.json`, 'utf8')),
41
+ 'de': JSON.parse(fs.readFileSync(`${moduleDir}/locales/de.json`, 'utf8')),
42
+ 'el': JSON.parse(fs.readFileSync(`${moduleDir}/locales/el.json`, 'utf8')),
43
+ 'en-GB': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-GB.json`, 'utf8')),
44
+ 'en-US': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-US.json`, 'utf8')),
45
+ 'en-XA': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-XA.json`, 'utf8')),
46
+ 'en-XL': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-XL.json`, 'utf8')),
47
+ 'es': JSON.parse(fs.readFileSync(`${moduleDir}/locales/es.json`, 'utf8')),
48
+ 'es-419': JSON.parse(fs.readFileSync(`${moduleDir}/locales/es-419.json`, 'utf8')),
49
+ 'fi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fi.json`, 'utf8')),
50
+ 'fil': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fil.json`, 'utf8')),
51
+ 'fr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fr.json`, 'utf8')),
52
+ 'he': JSON.parse(fs.readFileSync(`${moduleDir}/locales/he.json`, 'utf8')),
53
+ 'hi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hi.json`, 'utf8')),
54
+ 'hr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hr.json`, 'utf8')),
55
+ 'hu': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hu.json`, 'utf8')),
56
+ 'id': JSON.parse(fs.readFileSync(`${moduleDir}/locales/id.json`, 'utf8')),
57
+ 'it': JSON.parse(fs.readFileSync(`${moduleDir}/locales/it.json`, 'utf8')),
58
+ 'ja': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ja.json`, 'utf8')),
59
+ 'ko': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ko.json`, 'utf8')),
60
+ 'lt': JSON.parse(fs.readFileSync(`${moduleDir}/locales/lt.json`, 'utf8')),
61
+ 'lv': JSON.parse(fs.readFileSync(`${moduleDir}/locales/lv.json`, 'utf8')),
62
+ 'nl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/nl.json`, 'utf8')),
63
+ 'no': JSON.parse(fs.readFileSync(`${moduleDir}/locales/no.json`, 'utf8')),
64
+ 'pl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pl.json`, 'utf8')),
65
+ 'pt': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pt.json`, 'utf8')),
66
+ 'pt-PT': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pt-PT.json`, 'utf8')),
67
+ 'ro': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ro.json`, 'utf8')),
68
+ 'ru': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ru.json`, 'utf8')),
69
+ 'sk': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sk.json`, 'utf8')),
70
+ 'sl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sl.json`, 'utf8')),
71
+ 'sr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sr.json`, 'utf8')),
72
+ 'sr-Latn': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sr-Latn.json`, 'utf8')),
73
+ 'sv': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sv.json`, 'utf8')),
74
+ 'ta': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ta.json`, 'utf8')),
75
+ 'te': JSON.parse(fs.readFileSync(`${moduleDir}/locales/te.json`, 'utf8')),
76
+ 'th': JSON.parse(fs.readFileSync(`${moduleDir}/locales/th.json`, 'utf8')),
77
+ 'tr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/tr.json`, 'utf8')),
78
+ 'uk': JSON.parse(fs.readFileSync(`${moduleDir}/locales/uk.json`, 'utf8')),
79
+ 'vi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/vi.json`, 'utf8')),
80
+ 'zh': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh.json`, 'utf8')),
81
+ 'zh-HK': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh-HK.json`, 'utf8')),
82
+ 'zh-TW': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh-TW.json`, 'utf8')),
80
83
  };
81
84
 
82
85
  // The keys within this const must exactly match the LH.Locale type in externs.d.ts
@@ -172,4 +175,4 @@ const locales = {
172
175
  'zh-TW': files['zh-TW'], // aka zh-Hant, zh-Hant-TW, Traditional Chinese
173
176
  };
174
177
 
175
- module.exports = locales;
178
+ export {locales};
@@ -5,16 +5,20 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const swapLocale = require('./swap-locale.js');
8
+ import {swapLocale} from './swap-locale.js';
9
9
 
10
10
  /**
11
11
  * @param {LH.FlowResult} flowResult
12
12
  * @param {LH.Locale} locale
13
13
  */
14
- module.exports = function swapFlowLocale(flowResult, locale) {
14
+ function swapFlowLocale(flowResult, locale) {
15
15
  const localizedFlowResult = JSON.parse(JSON.stringify(flowResult));
16
16
  localizedFlowResult.steps = flowResult.steps.map(step => {
17
17
  return {...step, lhr: swapLocale(step.lhr, locale).lhr};
18
18
  });
19
19
  return localizedFlowResult;
20
+ }
21
+
22
+ export {
23
+ swapFlowLocale,
20
24
  };
@@ -5,10 +5,10 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const _set = require('lodash/set.js');
9
- const _get = require('lodash/get.js');
8
+ import _set from 'lodash/set.js';
9
+ import _get from 'lodash/get.js';
10
10
 
11
- const format = require('./format.js');
11
+ import * as format from './format.js';
12
12
 
13
13
  /**
14
14
  * @fileoverview Use the lhr.i18n.icuMessagePaths object to change locales.
@@ -110,4 +110,4 @@ function swapLocale(lhr, requestedLocale) {
110
110
  };
111
111
  }
112
112
 
113
- module.exports = swapLocale;
113
+ export {swapLocale};
@@ -5,18 +5,16 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const path = require('path');
8
+ import path from 'path';
9
9
 
10
- const format = require('../../localization/format.js');
11
- const locales = require('../../localization/locales.js');
10
+ import * as i18n from '../../../core/lib/i18n/i18n.js';
11
+ import * as constants from '../../../core/config/constants.js';
12
+ import * as format from '../../localization/format.js';
13
+ import {locales} from '../../localization/locales.js';
14
+ import {getModuleDirectory, getModulePath} from '../../../esm-utils.js';
12
15
 
13
- // TODO(esmodules): remove when shared/ is esm
14
- let i18n;
15
- let constants;
16
- before(async () => {
17
- i18n = await import('../../../core/lib/i18n/i18n.js');
18
- constants = await import('../../../core/config/constants.js');
19
- });
16
+ const moduleDir = getModuleDirectory(import.meta);
17
+ const modulePath = getModulePath(import.meta);
20
18
 
21
19
  describe('format', () => {
22
20
  describe('DEFAULT_LOCALE', () => {
@@ -83,7 +81,7 @@ describe('format', () => {
83
81
 
84
82
  describe('#replaceIcuMessages', () => {
85
83
  it('replaces the references in the LHR', () => {
86
- const fakeFile = path.join(__dirname, 'fake-file-number-2.js');
84
+ const fakeFile = path.join(moduleDir, 'fake-file-number-2.js');
87
85
  const UIStrings = {aString: 'different {x}!'};
88
86
  const formatter = i18n.createIcuMessageFn(fakeFile, UIStrings);
89
87
 
@@ -115,14 +113,14 @@ describe('format', () => {
115
113
  describe('#getFormatted', () => {
116
114
  it('returns the formatted string', () => {
117
115
  const UIStrings = {testMessage: 'happy test'};
118
- const str_ = i18n.createIcuMessageFn(__filename, UIStrings);
116
+ const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
119
117
  const formattedStr = format.getFormatted(str_(UIStrings.testMessage), 'en');
120
118
  expect(formattedStr).toEqual('happy test');
121
119
  });
122
120
 
123
121
  it('returns the formatted string with replacements', () => {
124
122
  const UIStrings = {testMessage: 'replacement test ({errorCode})'};
125
- const str_ = i18n.createIcuMessageFn(__filename, UIStrings);
123
+ const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
126
124
  const formattedStr = format.getFormatted(str_(UIStrings.testMessage,
127
125
  {errorCode: 'BOO'}), 'en');
128
126
  expect(formattedStr).toEqual('replacement test (BOO)');
@@ -131,7 +129,7 @@ describe('format', () => {
131
129
  it('throws an error for invalid locales', () => {
132
130
  // Populate a string to try to localize to a bad locale.
133
131
  const UIStrings = {testMessage: 'testy test'};
134
- const str_ = i18n.createIcuMessageFn(__filename, UIStrings);
132
+ const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
135
133
 
136
134
  expect(_ => format.getFormatted(str_(UIStrings.testMessage), 'still-not-a-locale'))
137
135
  .toThrow(`Unsupported locale 'still-not-a-locale'`);
@@ -141,7 +139,7 @@ describe('format', () => {
141
139
  const UIStrings = {
142
140
  testMessage: 'needs {count, number, bytes}KB test {str} in {timeInMs, number, seconds}s',
143
141
  };
144
- const str_ = i18n.createIcuMessageFn(__filename, UIStrings);
142
+ const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
145
143
 
146
144
  const replacements = {
147
145
  count: 2555,
@@ -172,8 +170,7 @@ describe('format', () => {
172
170
 
173
171
  describe('#registerLocaleData', () => {
174
172
  // Store original locale data so we can restore at the end
175
- const moduleLocales = require('../../localization/locales.js');
176
- const clonedLocales = JSON.parse(JSON.stringify(moduleLocales));
173
+ const clonedLocales = JSON.parse(JSON.stringify(locales));
177
174
 
178
175
  it('installs new locale strings', () => {
179
176
  const localeData = {
@@ -184,7 +181,7 @@ describe('format', () => {
184
181
  format.registerLocaleData('en-XZ', localeData);
185
182
 
186
183
  const UIStrings = {testString: 'en-US string!'};
187
- const str_ = i18n.createIcuMessageFn(__filename, UIStrings);
184
+ const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
188
185
  const formattedStr = format.getFormatted(str_(UIStrings.testString), 'en-XZ');
189
186
  expect(formattedStr).toEqual('en-XZ cuerda!');
190
187
  });
@@ -217,7 +214,7 @@ describe('format', () => {
217
214
  expect(newFailureTitle).toEqual('Does not use HTTPS');
218
215
 
219
216
  // Restore overwritten strings to avoid messing with other tests
220
- moduleLocales['es-419'] = clonedLocales['es-419'];
217
+ locales['es-419'] = clonedLocales['es-419'];
221
218
  const title = format.getFormatted(str_(UIStrings.title), 'es-419');
222
219
  expect(title).toEqual('Usa HTTPS');
223
220
  });
@@ -324,7 +321,7 @@ describe('format', () => {
324
321
 
325
322
  let str_;
326
323
  before(() => {
327
- str_ = i18n.createIcuMessageFn(__filename, UIStrings);
324
+ str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
328
325
  });
329
326
 
330
327
  it('formats a basic message', () => {
@@ -5,8 +5,8 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const locales = require('../../localization/locales.js');
9
- const assert = require('assert').strict;
8
+ import {locales} from '../../localization/locales.js';
9
+ import {strict as assert} from 'assert';
10
10
 
11
11
  describe('locales', () => {
12
12
  it('has only canonical (or expected-deprecated) language tags', () => {
@@ -5,9 +5,10 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const swapLocale = require('../../localization/swap-locale.js');
8
+ import {swapLocale} from '../../localization/swap-locale.js';
9
+ import {readJson} from '../../../core/test/test-utils.js';
9
10
 
10
- const lhr = require('../../../core/test/results/sample_v2.json');
11
+ const lhr = readJson('core/test/results/sample_v2.json');
11
12
 
12
13
  describe('swap-locale', () => {
13
14
  it('does not mutate the original lhr', () => {
@@ -13,6 +13,7 @@
13
13
  "include": [
14
14
  "**/*.js",
15
15
  "types/**/*.d.ts",
16
+ "../esm-utils.js",
16
17
  ],
17
18
  "exclude": [
18
19
  "test/**/*.js",
@@ -29,7 +29,7 @@ function isObjectOrArrayOfUnknownValues(val) {
29
29
  return typeof val === 'object' && val !== null;
30
30
  }
31
31
 
32
- module.exports = {
32
+ export {
33
33
  isObjectOfUnknownValues,
34
34
  isObjectOrArrayOfUnknownValues,
35
35
  };
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "./tsconfig-base.json",
3
3
  "compilerOptions": {
4
- // TODO(esmodules): included to support require('file.json'). Remove on the switch to ES Modules.
5
4
  "resolveJsonModule": true,
6
5
  },
7
6
  "references": [
@@ -24,13 +23,10 @@
24
23
  "eslint-local-rules.cjs",
25
24
  "third-party/axe/valid-langs.js",
26
25
 
27
- // TODO(esmodules): JSON files included via resolveJsonModule. Removable on the switch to ES Modules.
28
- "package.json",
29
26
  "core/test/results/sample_v2.json",
30
27
  "core/lib/sd-validation/assets/*.json",
31
28
  "core/test/fixtures/unresolved-perflog.json",
32
29
  "core/test/fixtures/traces/lcp-m78.devtools.log.json",
33
- "third-party/snyk/snapshot.json",
34
30
  "core/audits/byte-efficiency/polyfill-graph-data.json",
35
31
  "shared/localization/locales/en-US.json",
36
32
  ],
@@ -102,7 +98,7 @@
102
98
  "core/test/lib/tracehouse/main-thread-tasks-test.js",
103
99
  "core/test/lib/tracehouse/task-summary-test.js",
104
100
  "core/test/lib/tracehouse/trace-processor-test.js",
105
- "core/test/lib/traces/pwmetrics-events-test.js",
101
+ "core/test/lib/traces/metrics-trace-events-test.js",
106
102
  "core/test/lib/url-shim-test.js",
107
103
  "core/test/network-records-to-devtools-log-test.js",
108
104
  "core/test/runner-test.js",
package/types/config.d.ts CHANGED
@@ -57,19 +57,6 @@ declare module Config {
57
57
  groups: Record<string, Group> | null;
58
58
  }
59
59
 
60
- /**
61
- * Additional information about the context in which a Fraggle Rock config should be interpreted.
62
- * This information is typically set by the CLI or other channel integrations.
63
- */
64
- interface FRContext {
65
- configPath?: string;
66
- settingsOverrides?: SharedFlagsSettings & Pick<LH.Flags, 'plugins'>;
67
- skipAboutBlank?: boolean;
68
- logLevel?: string;
69
- hostname?: string;
70
- port?: number;
71
- }
72
-
73
60
  interface SharedPassNavigationJson {
74
61
  /**
75
62
  * Controls the behavior when the navigation fails to complete (due to server error, no FCP, etc).
@@ -30,7 +30,7 @@ declare global {
30
30
 
31
31
  /** Used by FullPageScreenshot gatherer. */
32
32
  __lighthouseNodesDontTouchOrAllVarianceGoesAway: Map<Element, string>;
33
- __lighthouseExecutionContextId?: number;
33
+ __lighthouseExecutionContextUniqueIdentifier?: number;
34
34
 
35
35
  /** Injected into the page when the `--debug` flag is used. */
36
36
  continueLighthouseRun(): void;
@@ -71,6 +71,8 @@ export type ScreenEmulationSettings = {
71
71
  disableStorageReset?: boolean;
72
72
  /** Flag indicating that Lighthouse should pause after page load to wait for the user's permission to continue the audit. */
73
73
  debugNavigation?: boolean;
74
+ /** If set to true, will skip the initial navigation to about:blank. This option is ignored when using the legacy navigation runner. */
75
+ skipAboutBlank?: boolean;
74
76
 
75
77
  /** How Lighthouse should interpret this run in regards to scoring performance metrics and skipping mobile-only tests in desktop. Must be set even if throttling/emulation is being applied outside of Lighthouse. */
76
78
  formFactor?: 'mobile'|'desktop';
@@ -10,7 +10,7 @@ declare module UserFlow {
10
10
  artifacts: LH.Artifacts;
11
11
  name: string;
12
12
  config?: LH.Config.Json;
13
- configContext?: LH.Config.FRContext;
13
+ flags?: LH.Flags;
14
14
  }
15
15
  }
16
16