lighthouse 9.5.0-dev.20220609 → 9.5.0-dev.20220610
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.
- package/lighthouse-cli/bin.js +1 -1
- package/lighthouse-cli/index.js +1 -4
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -4
- package/lighthouse-core/config/config-helpers.js +16 -14
- package/lighthouse-core/config/config.js +36 -19
- package/lighthouse-core/fraggle-rock/config/config.js +10 -9
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -1
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +2 -1
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +2 -1
- package/lighthouse-core/fraggle-rock/user-flow.js +1 -1
- package/lighthouse-core/gather/connections/cri.js +3 -17
- package/lighthouse-core/index.js +3 -3
- package/lighthouse-core/lib/asset-saver.js +3 -4
- package/package.json +4 -4
- package/tsconfig-base.json +1 -1
package/lighthouse-cli/bin.js
CHANGED
|
@@ -120,7 +120,7 @@ async function begin() {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
if (cliFlags.printConfig) {
|
|
123
|
-
const config = lighthouse.generateConfig(configJson, cliFlags);
|
|
123
|
+
const config = await lighthouse.generateConfig(configJson, cliFlags);
|
|
124
124
|
process.stdout.write(config.getPrintString());
|
|
125
125
|
return;
|
|
126
126
|
}
|
package/lighthouse-cli/index.js
CHANGED
|
@@ -211,7 +211,8 @@ const bundledModules = new Map(/* BUILD_REPLACE_BUNDLED_MODULES */);
|
|
|
211
211
|
* See build-bundle.js
|
|
212
212
|
* @param {string} requirePath
|
|
213
213
|
*/
|
|
214
|
-
function requireWrapper(requirePath) {
|
|
214
|
+
async function requireWrapper(requirePath) {
|
|
215
|
+
// This is async because eventually this function needs to do async dynamic imports.
|
|
215
216
|
return bundledModules.get(requirePath) || require(requirePath);
|
|
216
217
|
}
|
|
217
218
|
|
|
@@ -219,9 +220,9 @@ function requireWrapper(requirePath) {
|
|
|
219
220
|
* @param {string} gathererPath
|
|
220
221
|
* @param {Array<string>} coreGathererList
|
|
221
222
|
* @param {string=} configDir
|
|
222
|
-
* @return {LH.Config.GathererDefn}
|
|
223
|
+
* @return {Promise<LH.Config.GathererDefn>}
|
|
223
224
|
*/
|
|
224
|
-
function requireGatherer(gathererPath, coreGathererList, configDir) {
|
|
225
|
+
async function requireGatherer(gathererPath, coreGathererList, configDir) {
|
|
225
226
|
const coreGatherer = coreGathererList.find(a => a === `${gathererPath}.js`);
|
|
226
227
|
|
|
227
228
|
let requirePath = `../gather/gatherers/${gathererPath}`;
|
|
@@ -230,7 +231,7 @@ function requireGatherer(gathererPath, coreGathererList, configDir) {
|
|
|
230
231
|
requirePath = resolveModulePath(gathererPath, configDir, 'gatherer');
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
const GathererClass = /** @type {GathererConstructor} */ (requireWrapper(requirePath));
|
|
234
|
+
const GathererClass = /** @type {GathererConstructor} */ (await requireWrapper(requirePath));
|
|
234
235
|
|
|
235
236
|
return {
|
|
236
237
|
instance: new GathererClass(),
|
|
@@ -243,7 +244,7 @@ function requireGatherer(gathererPath, coreGathererList, configDir) {
|
|
|
243
244
|
* @param {string} auditPath
|
|
244
245
|
* @param {Array<string>} coreAuditList
|
|
245
246
|
* @param {string=} configDir
|
|
246
|
-
* @return {LH.Config.AuditDefn['implementation']}
|
|
247
|
+
* @return {Promise<LH.Config.AuditDefn['implementation']>}
|
|
247
248
|
*/
|
|
248
249
|
function requireAudit(auditPath, coreAuditList, configDir) {
|
|
249
250
|
// See if the audit is a Lighthouse core audit.
|
|
@@ -328,9 +329,9 @@ function resolveSettings(settingsJson = {}, overrides = undefined) {
|
|
|
328
329
|
* @param {LH.Config.Json} configJSON
|
|
329
330
|
* @param {string | undefined} configDir
|
|
330
331
|
* @param {{plugins?: string[]} | undefined} flags
|
|
331
|
-
* @return {LH.Config.Json}
|
|
332
|
+
* @return {Promise<LH.Config.Json>}
|
|
332
333
|
*/
|
|
333
|
-
function mergePlugins(configJSON, configDir, flags) {
|
|
334
|
+
async function mergePlugins(configJSON, configDir, flags) {
|
|
334
335
|
const configPlugins = configJSON.plugins || [];
|
|
335
336
|
const flagPlugins = flags?.plugins || [];
|
|
336
337
|
const pluginNames = new Set([...configPlugins, ...flagPlugins]);
|
|
@@ -342,7 +343,7 @@ function mergePlugins(configJSON, configDir, flags) {
|
|
|
342
343
|
const pluginPath = isBundledEnvironment() ?
|
|
343
344
|
pluginName :
|
|
344
345
|
resolveModulePath(pluginName, configDir, 'plugin');
|
|
345
|
-
const rawPluginJson = requireWrapper(pluginPath);
|
|
346
|
+
const rawPluginJson = await requireWrapper(pluginPath);
|
|
346
347
|
const pluginJson = ConfigPlugin.parsePlugin(rawPluginJson, pluginName);
|
|
347
348
|
|
|
348
349
|
configJSON = mergeConfigFragment(configJSON, pluginJson);
|
|
@@ -360,9 +361,9 @@ function mergePlugins(configJSON, configDir, flags) {
|
|
|
360
361
|
* @param {LH.Config.GathererJson} gathererJson
|
|
361
362
|
* @param {Array<string>} coreGathererList
|
|
362
363
|
* @param {string=} configDir
|
|
363
|
-
* @return {LH.Config.GathererDefn}
|
|
364
|
+
* @return {Promise<LH.Config.GathererDefn>}
|
|
364
365
|
*/
|
|
365
|
-
function resolveGathererToDefn(gathererJson, coreGathererList, configDir) {
|
|
366
|
+
async function resolveGathererToDefn(gathererJson, coreGathererList, configDir) {
|
|
366
367
|
const gathererDefn = expandGathererShorthand(gathererJson);
|
|
367
368
|
if (gathererDefn.instance) {
|
|
368
369
|
return {
|
|
@@ -391,21 +392,21 @@ function resolveGathererToDefn(gathererJson, coreGathererList, configDir) {
|
|
|
391
392
|
* leaving only an array of AuditDefns.
|
|
392
393
|
* @param {LH.Config.Json['audits']} audits
|
|
393
394
|
* @param {string=} configDir
|
|
394
|
-
* @return {Array<LH.Config.AuditDefn>|null}
|
|
395
|
+
* @return {Promise<Array<LH.Config.AuditDefn>|null>}
|
|
395
396
|
*/
|
|
396
|
-
function resolveAuditsToDefns(audits, configDir) {
|
|
397
|
+
async function resolveAuditsToDefns(audits, configDir) {
|
|
397
398
|
if (!audits) {
|
|
398
399
|
return null;
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
const coreList = Runner.getAuditList();
|
|
402
|
-
const
|
|
403
|
+
const auditDefnsPromises = audits.map(async (auditJson) => {
|
|
403
404
|
const auditDefn = expandAuditShorthand(auditJson);
|
|
404
405
|
let implementation;
|
|
405
406
|
if ('implementation' in auditDefn) {
|
|
406
407
|
implementation = auditDefn.implementation;
|
|
407
408
|
} else {
|
|
408
|
-
implementation = requireAudit(auditDefn.path, coreList, configDir);
|
|
409
|
+
implementation = await requireAudit(auditDefn.path, coreList, configDir);
|
|
409
410
|
}
|
|
410
411
|
|
|
411
412
|
return {
|
|
@@ -414,6 +415,7 @@ function resolveAuditsToDefns(audits, configDir) {
|
|
|
414
415
|
options: auditDefn.options || {},
|
|
415
416
|
};
|
|
416
417
|
});
|
|
418
|
+
const auditDefns = await Promise.all(auditDefnsPromises);
|
|
417
419
|
|
|
418
420
|
const mergedAuditDefns = mergeOptionsOfItems(auditDefns);
|
|
419
421
|
mergedAuditDefns.forEach(audit => validation.assertValidAudit(audit));
|
|
@@ -149,17 +149,18 @@ function assertValidFlags(flags) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
|
|
153
152
|
/**
|
|
154
153
|
* @implements {LH.Config.Config}
|
|
155
154
|
*/
|
|
156
155
|
class Config {
|
|
157
156
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
157
|
+
* Resolves the provided config (inherits from extended config, if set), resolves
|
|
158
|
+
* all referenced modules, and validates.
|
|
159
|
+
* @param {LH.Config.Json=} configJSON If not provided, uses the default config.
|
|
160
160
|
* @param {LH.Flags=} flags
|
|
161
|
+
* @return {Promise<Config>}
|
|
161
162
|
*/
|
|
162
|
-
|
|
163
|
+
static async fromJson(configJSON, flags) {
|
|
163
164
|
const status = {msg: 'Create config', id: 'lh:init:config'};
|
|
164
165
|
log.time(status, 'verbose');
|
|
165
166
|
let configPath = flags?.configPath;
|
|
@@ -188,7 +189,7 @@ class Config {
|
|
|
188
189
|
const configDir = configPath ? path.dirname(configPath) : undefined;
|
|
189
190
|
|
|
190
191
|
// Validate and merge in plugins (if any).
|
|
191
|
-
configJSON = mergePlugins(configJSON, configDir, flags);
|
|
192
|
+
configJSON = await mergePlugins(configJSON, configDir, flags);
|
|
192
193
|
|
|
193
194
|
if (flags) {
|
|
194
195
|
assertValidFlags(flags);
|
|
@@ -198,14 +199,28 @@ class Config {
|
|
|
198
199
|
// Augment passes with necessary defaults and require gatherers.
|
|
199
200
|
const passesWithDefaults = Config.augmentPassesWithDefaults(configJSON.passes);
|
|
200
201
|
Config.adjustDefaultPassForThrottling(settings, passesWithDefaults);
|
|
201
|
-
const passes = Config.requireGatherers(passesWithDefaults, configDir);
|
|
202
|
+
const passes = await Config.requireGatherers(passesWithDefaults, configDir);
|
|
202
203
|
|
|
204
|
+
const audits = await Config.requireAudits(configJSON.audits, configDir);
|
|
205
|
+
|
|
206
|
+
const config = new Config(configJSON, {settings, passes, audits});
|
|
207
|
+
log.timeEnd(status);
|
|
208
|
+
return config;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @deprecated `Config.fromJson` should be used instead.
|
|
213
|
+
* @constructor
|
|
214
|
+
* @param {LH.Config.Json} configJSON
|
|
215
|
+
* @param {{settings: LH.Config.Settings, passes: ?LH.Config.Pass[], audits: ?LH.Config.AuditDefn[]}} opts
|
|
216
|
+
*/
|
|
217
|
+
constructor(configJSON, opts) {
|
|
203
218
|
/** @type {LH.Config.Settings} */
|
|
204
|
-
this.settings = settings;
|
|
219
|
+
this.settings = opts.settings;
|
|
205
220
|
/** @type {?Array<LH.Config.Pass>} */
|
|
206
|
-
this.passes = passes;
|
|
221
|
+
this.passes = opts.passes;
|
|
207
222
|
/** @type {?Array<LH.Config.AuditDefn>} */
|
|
208
|
-
this.audits =
|
|
223
|
+
this.audits = opts.audits;
|
|
209
224
|
/** @type {?Record<string, LH.Config.Category>} */
|
|
210
225
|
this.categories = configJSON.categories || null;
|
|
211
226
|
/** @type {?Record<string, LH.Config.Group>} */
|
|
@@ -215,8 +230,6 @@ class Config {
|
|
|
215
230
|
|
|
216
231
|
assertValidPasses(this.passes, this.audits);
|
|
217
232
|
validation.assertValidCategories(this.categories, this.audits, this.groups);
|
|
218
|
-
|
|
219
|
-
log.timeEnd(status);
|
|
220
233
|
}
|
|
221
234
|
|
|
222
235
|
/**
|
|
@@ -499,12 +512,12 @@ class Config {
|
|
|
499
512
|
* leaving only an array of AuditDefns.
|
|
500
513
|
* @param {LH.Config.Json['audits']} audits
|
|
501
514
|
* @param {string=} configDir
|
|
502
|
-
* @return {Config['audits']}
|
|
515
|
+
* @return {Promise<Config['audits']>}
|
|
503
516
|
*/
|
|
504
|
-
static requireAudits(audits, configDir) {
|
|
517
|
+
static async requireAudits(audits, configDir) {
|
|
505
518
|
const status = {msg: 'Requiring audits', id: 'lh:config:requireAudits'};
|
|
506
519
|
log.time(status, 'verbose');
|
|
507
|
-
const auditDefns = resolveAuditsToDefns(audits, configDir);
|
|
520
|
+
const auditDefns = await resolveAuditsToDefns(audits, configDir);
|
|
508
521
|
log.timeEnd(status);
|
|
509
522
|
return auditDefns;
|
|
510
523
|
}
|
|
@@ -515,9 +528,9 @@ class Config {
|
|
|
515
528
|
* provided) using `resolveModulePath`, returning an array of full Passes.
|
|
516
529
|
* @param {?Array<Required<LH.Config.PassJson>>} passes
|
|
517
530
|
* @param {string=} configDir
|
|
518
|
-
* @return {Config['passes']}
|
|
531
|
+
* @return {Promise<Config['passes']>}
|
|
519
532
|
*/
|
|
520
|
-
static requireGatherers(passes, configDir) {
|
|
533
|
+
static async requireGatherers(passes, configDir) {
|
|
521
534
|
if (!passes) {
|
|
522
535
|
return null;
|
|
523
536
|
}
|
|
@@ -525,9 +538,11 @@ class Config {
|
|
|
525
538
|
log.time(status, 'verbose');
|
|
526
539
|
|
|
527
540
|
const coreList = Runner.getGathererList();
|
|
528
|
-
const
|
|
529
|
-
const gathererDefns =
|
|
530
|
-
.
|
|
541
|
+
const fullPassesPromises = passes.map(async (pass) => {
|
|
542
|
+
const gathererDefns = await Promise.all(
|
|
543
|
+
pass.gatherers
|
|
544
|
+
.map(gatherer => resolveGathererToDefn(gatherer, coreList, configDir))
|
|
545
|
+
);
|
|
531
546
|
|
|
532
547
|
// De-dupe gatherers by artifact name because artifact IDs must be unique at runtime.
|
|
533
548
|
const uniqueDefns = Array.from(
|
|
@@ -537,6 +552,8 @@ class Config {
|
|
|
537
552
|
|
|
538
553
|
return Object.assign(pass, {gatherers: uniqueDefns});
|
|
539
554
|
});
|
|
555
|
+
const fullPasses = await Promise.all(fullPassesPromises);
|
|
556
|
+
|
|
540
557
|
log.timeEnd(status);
|
|
541
558
|
return fullPasses;
|
|
542
559
|
}
|
|
@@ -121,9 +121,9 @@ function resolveArtifactDependencies(artifact, gatherer, artifactDefnsBySymbol)
|
|
|
121
121
|
*
|
|
122
122
|
* @param {LH.Config.ArtifactJson[]|null|undefined} artifacts
|
|
123
123
|
* @param {string|undefined} configDir
|
|
124
|
-
* @return {LH.Config.AnyArtifactDefn[] | null}
|
|
124
|
+
* @return {Promise<LH.Config.AnyArtifactDefn[] | null>}
|
|
125
125
|
*/
|
|
126
|
-
function resolveArtifactsToDefns(artifacts, configDir) {
|
|
126
|
+
async function resolveArtifactsToDefns(artifacts, configDir) {
|
|
127
127
|
if (!artifacts) return null;
|
|
128
128
|
|
|
129
129
|
const status = {msg: 'Resolve artifact definitions', id: 'lh:config:resolveArtifactsToDefns'};
|
|
@@ -133,12 +133,12 @@ function resolveArtifactsToDefns(artifacts, configDir) {
|
|
|
133
133
|
const artifactDefnsBySymbol = new Map();
|
|
134
134
|
|
|
135
135
|
const coreGathererList = Runner.getGathererList();
|
|
136
|
-
const
|
|
136
|
+
const artifactDefnsPromises = artifacts.map(async (artifactJson) => {
|
|
137
137
|
/** @type {LH.Config.GathererJson} */
|
|
138
138
|
// @ts-expect-error - remove when legacy runner path is removed.
|
|
139
139
|
const gathererJson = artifactJson.gatherer;
|
|
140
140
|
|
|
141
|
-
const gatherer = resolveGathererToDefn(gathererJson, coreGathererList, configDir);
|
|
141
|
+
const gatherer = await resolveGathererToDefn(gathererJson, coreGathererList, configDir);
|
|
142
142
|
if (!isFRGathererDefn(gatherer)) {
|
|
143
143
|
throw new Error(`${gatherer.instance.name} gatherer does not have a Fraggle Rock meta obj`);
|
|
144
144
|
}
|
|
@@ -156,6 +156,7 @@ function resolveArtifactsToDefns(artifacts, configDir) {
|
|
|
156
156
|
if (symbol) artifactDefnsBySymbol.set(symbol, artifact);
|
|
157
157
|
return artifact;
|
|
158
158
|
});
|
|
159
|
+
const artifactDefns = await Promise.all(artifactDefnsPromises);
|
|
159
160
|
|
|
160
161
|
log.timeEnd(status);
|
|
161
162
|
return artifactDefns;
|
|
@@ -242,28 +243,28 @@ function resolveNavigationsToDefns(navigations, artifactDefns, settings) {
|
|
|
242
243
|
/**
|
|
243
244
|
* @param {LH.Config.Json|undefined} configJSON
|
|
244
245
|
* @param {ConfigContext} context
|
|
245
|
-
* @return {{config: LH.Config.FRConfig, warnings: string[]}}
|
|
246
|
+
* @return {Promise<{config: LH.Config.FRConfig, warnings: string[]}>}
|
|
246
247
|
*/
|
|
247
|
-
function initializeConfig(configJSON, context) {
|
|
248
|
+
async function initializeConfig(configJSON, context) {
|
|
248
249
|
const status = {msg: 'Initialize config', id: 'lh:config'};
|
|
249
250
|
log.time(status, 'verbose');
|
|
250
251
|
|
|
251
252
|
let {configWorkingCopy, configDir} = resolveWorkingCopy(configJSON, context); // eslint-disable-line prefer-const
|
|
252
253
|
|
|
253
254
|
configWorkingCopy = resolveExtensions(configWorkingCopy);
|
|
254
|
-
configWorkingCopy = mergePlugins(configWorkingCopy, configDir, context.settingsOverrides);
|
|
255
|
+
configWorkingCopy = await mergePlugins(configWorkingCopy, configDir, context.settingsOverrides);
|
|
255
256
|
|
|
256
257
|
const settings = resolveSettings(configWorkingCopy.settings || {}, context.settingsOverrides);
|
|
257
258
|
overrideSettingsForGatherMode(settings, context);
|
|
258
259
|
|
|
259
|
-
const artifacts = resolveArtifactsToDefns(configWorkingCopy.artifacts, configDir);
|
|
260
|
+
const artifacts = await resolveArtifactsToDefns(configWorkingCopy.artifacts, configDir);
|
|
260
261
|
const navigations = resolveNavigationsToDefns(configWorkingCopy.navigations, artifacts, settings);
|
|
261
262
|
|
|
262
263
|
/** @type {LH.Config.FRConfig} */
|
|
263
264
|
let config = {
|
|
264
265
|
artifacts,
|
|
265
266
|
navigations,
|
|
266
|
-
audits: resolveAuditsToDefns(configWorkingCopy.audits, configDir),
|
|
267
|
+
audits: await resolveAuditsToDefns(configWorkingCopy.audits, configDir),
|
|
267
268
|
categories: configWorkingCopy.categories || null,
|
|
268
269
|
groups: configWorkingCopy.groups || null,
|
|
269
270
|
settings,
|
|
@@ -310,7 +310,8 @@ async function navigationGather(requestor, options) {
|
|
|
310
310
|
const {configContext = {}} = options;
|
|
311
311
|
log.setLevel(configContext.logLevel || 'error');
|
|
312
312
|
|
|
313
|
-
const {config} =
|
|
313
|
+
const {config} =
|
|
314
|
+
await initializeConfig(options.config, {...configContext, gatherMode: 'navigation'});
|
|
314
315
|
const computedCache = new Map();
|
|
315
316
|
const internalOptions = {
|
|
316
317
|
skipAboutBlank: configContext.skipAboutBlank,
|
|
@@ -24,7 +24,8 @@ async function snapshotGather(options) {
|
|
|
24
24
|
const {configContext = {}} = options;
|
|
25
25
|
log.setLevel(configContext.logLevel || 'error');
|
|
26
26
|
|
|
27
|
-
const {config} =
|
|
27
|
+
const {config} =
|
|
28
|
+
await initializeConfig(options.config, {...configContext, gatherMode: 'snapshot'});
|
|
28
29
|
const driver = new Driver(options.page);
|
|
29
30
|
await driver.connect();
|
|
30
31
|
|
|
@@ -25,7 +25,8 @@ async function startTimespanGather(options) {
|
|
|
25
25
|
const {configContext = {}} = options;
|
|
26
26
|
log.setLevel(configContext.logLevel || 'error');
|
|
27
27
|
|
|
28
|
-
const {config} =
|
|
28
|
+
const {config} =
|
|
29
|
+
await initializeConfig(options.config, {...configContext, gatherMode: 'timespan'});
|
|
29
30
|
const driver = new Driver(options.page);
|
|
30
31
|
await driver.connect();
|
|
31
32
|
|
|
@@ -205,7 +205,7 @@ async function auditGatherSteps(gatherSteps, options) {
|
|
|
205
205
|
// Step specific configs take precedence over a config for the entire flow.
|
|
206
206
|
const configJson = gatherStep.config || options.config;
|
|
207
207
|
const {gatherMode} = artifacts.GatherContext;
|
|
208
|
-
const {config} = initializeConfig(configJson, {...configContext, gatherMode});
|
|
208
|
+
const {config} = await initializeConfig(configJson, {...configContext, gatherMode});
|
|
209
209
|
runnerOptions = {
|
|
210
210
|
config,
|
|
211
211
|
computedCache: new Map(),
|
|
@@ -33,23 +33,9 @@ class CriConnection extends Connection {
|
|
|
33
33
|
* @override
|
|
34
34
|
* @return {Promise<void>}
|
|
35
35
|
*/
|
|
36
|
-
connect() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.catch(_ => {
|
|
40
|
-
// COMPAT: headless didn't support `/json/new` before m59. (#970, crbug.com/699392)
|
|
41
|
-
// If no support, we fallback and reuse an existing open tab
|
|
42
|
-
log.warn('CriConnection', 'Cannot create new tab; reusing open tab.');
|
|
43
|
-
return this._runJsonCommand('list').then(tabs => {
|
|
44
|
-
if (!Array.isArray(tabs) || tabs.length === 0) {
|
|
45
|
-
return Promise.reject(new Error('Cannot create new tab, and no tabs already open.'));
|
|
46
|
-
}
|
|
47
|
-
const firstTab = tabs[0];
|
|
48
|
-
// first, we activate it to a foreground tab, then we connect
|
|
49
|
-
return this._runJsonCommand(`activate/${firstTab.id}`)
|
|
50
|
-
.then(() => this._connectToSocket(firstTab));
|
|
51
|
-
});
|
|
52
|
-
});
|
|
36
|
+
async connect() {
|
|
37
|
+
const response = await this._runJsonCommand('new');
|
|
38
|
+
return this._connectToSocket(/** @type {LH.DevToolsJsonTarget} */(response));
|
|
53
39
|
}
|
|
54
40
|
|
|
55
41
|
/**
|
package/lighthouse-core/index.js
CHANGED
|
@@ -64,7 +64,7 @@ async function legacyNavigation(url, flags = {}, configJSON, userConnection) {
|
|
|
64
64
|
flags.logLevel = flags.logLevel || 'error';
|
|
65
65
|
log.setLevel(flags.logLevel);
|
|
66
66
|
|
|
67
|
-
const config = generateConfig(configJSON, flags);
|
|
67
|
+
const config = await generateConfig(configJSON, flags);
|
|
68
68
|
const computedCache = new Map();
|
|
69
69
|
const options = {config, computedCache};
|
|
70
70
|
const connection = userConnection || new ChromeProtocol(flags.port, flags.hostname);
|
|
@@ -83,10 +83,10 @@ async function legacyNavigation(url, flags = {}, configJSON, userConnection) {
|
|
|
83
83
|
* not present, the default config is used.
|
|
84
84
|
* @param {LH.Flags=} flags Optional settings for the Lighthouse run. If present,
|
|
85
85
|
* they will override any settings in the config.
|
|
86
|
-
* @return {Config}
|
|
86
|
+
* @return {Promise<Config>}
|
|
87
87
|
*/
|
|
88
88
|
function generateConfig(configJson, flags) {
|
|
89
|
-
return
|
|
89
|
+
return Config.fromJson(configJson, flags);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
lighthouse.legacyNavigation = legacyNavigation;
|
|
@@ -288,10 +288,9 @@ async function saveAssets(artifacts, audits, pathWithBasename) {
|
|
|
288
288
|
fs.writeFileSync(devtoolsLogFilename, JSON.stringify(passAssets.devtoolsLog, null, 2));
|
|
289
289
|
log.log('saveAssets', 'devtools log saved to disk: ' + devtoolsLogFilename);
|
|
290
290
|
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
log.log('saveAssets', 'trace file streamed to disk: ' + streamTraceFilename);
|
|
291
|
+
const traceFilename = `${pathWithBasename}-${index}${traceSuffix}`;
|
|
292
|
+
await saveTrace(passAssets.traceData, traceFilename);
|
|
293
|
+
log.log('saveAssets', 'trace file streamed to disk: ' + traceFilename);
|
|
295
294
|
});
|
|
296
295
|
|
|
297
296
|
await Promise.all(saveAll);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.5.0-dev.
|
|
3
|
+
"version": "9.5.0-dev.20220610",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
"@types/ws": "^7.0.0",
|
|
126
126
|
"@types/yargs": "^17.0.8",
|
|
127
127
|
"@types/yargs-parser": "^20.2.1",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
129
|
-
"@typescript-eslint/parser": "^5.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
129
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
130
130
|
"acorn": "^8.5.0",
|
|
131
131
|
"angular": "^1.7.4",
|
|
132
132
|
"archiver": "^3.0.0",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"terser": "^5.3.8",
|
|
176
176
|
"ts-jest": "^27.0.4",
|
|
177
177
|
"typed-query-selector": "^2.6.1",
|
|
178
|
-
"typescript": "^4.7.
|
|
178
|
+
"typescript": "^4.7.3",
|
|
179
179
|
"wait-for-expect": "^3.0.2",
|
|
180
180
|
"webtreemap-cdt": "^3.2.1"
|
|
181
181
|
},
|