@code-pushup/lighthouse-plugin 0.50.0 → 0.52.0

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/README.md CHANGED
@@ -119,24 +119,27 @@ export default {
119
119
 
120
120
  ## Flags
121
121
 
122
- The plugin accepts a second optional argument, `flags`.
122
+ The plugin accepts an optional second argument, `flags`.
123
123
 
124
- `flags` is the Lighthouse [CLI flags](https://github.com/GoogleChrome/lighthouse/blob/7d80178c37a1b600ea8f092fc0b098029799a659/cli/cli-flags.js#L80) as a JS object.
124
+ `flags` is a JavaScript object containing Lighthouse [CLI flags](https://github.com/GoogleChrome/lighthouse/blob/7d80178c37a1b600ea8f092fc0b098029799a659/cli/cli-flags.js#L80).
125
125
 
126
- Within the flags object a couple of other external configuration files can be referenced. E.g. `configPath` , `preset` or `budgetPath` reference external `json` or JavaScript files.
126
+ Within the `flags` object, external configuration files can be referenced using options like `configPath` , `preset`, or `budgetPath`. These options allow Lighthouse to load custom configurations, audit presets, or performance budgets from external `json` or JavaScript files.
127
127
 
128
- For a complete list the [official documentation of CLI flags](https://github.com/GoogleChrome/lighthouse/blob/main/readme.md#cli-options)
128
+ For a complete list of available options, refer to [the official Lighthouse documentation](https://github.com/GoogleChrome/lighthouse/blob/main/readme.md#cli-options).
129
129
 
130
130
  > [!TIP]
131
- > If you are not used to work with the Lighthouse CLI you would pass flags like this:
131
+ > If you are new to working with the Lighthouse CLI, flags can be passed like this:
132
132
  > `lighthouse https://example.com --output=json --chromeFlags='--headless=shell'`
133
133
  >
134
- > Now with the plugin it would look like this:
134
+ > With the plugin, the configuration would be:
135
135
  >
136
136
  > ```ts
137
137
  > // code-pushup.config.ts
138
138
  > ...
139
- > lighthousePlugin('https://example.com', { output: 'json', chromeFlags: ['--headless=shell']});
139
+ > lighthousePlugin('https://example.com', {
140
+ > output: 'json',
141
+ > chromeFlags: ['--headless=shell'],
142
+ > });
140
143
  > ```
141
144
 
142
145
  > [!note]
@@ -149,14 +152,47 @@ For a complete list the [official documentation of CLI flags](https://github.com
149
152
 
150
153
  ## Chrome Flags for Tooling
151
154
 
152
- We recommend using Chrome flags for more stable runs in a tooling environment.
153
- The [`chrome-launcher`](https://www.npmjs.com/package/chrome-launcher) package provides a set of flags dedicated to tooling that they also documented very well.
155
+ We recommend using Chrome flags for more stable runs in a tooling environment. The [`chrome-launcher`](https://www.npmjs.com/package/chrome-launcher) package offers a well-documented set of flags specifically designed to ensure reliable execution.
156
+
157
+ The latest version of `@code-pushup/lighthouse-plugin` provides `DEFAULT_CHROME_FLAGS`, a pre-configured constant that includes Chrome’s default flags for stable, headless execution out of the box. This means you do not need to specify `chromeFlags` manually unless you want to modify them.
158
+
159
+ ### Default Usage
160
+
161
+ If no `chromeFlags` are provided, the plugin automatically applies the default configuration:
154
162
 
155
163
  > ```ts
156
- > // code-pushup.config.ts
157
- > import { DEFAULT_FLAGS } from 'chrome-launcher/dist/flags.js';
158
- > ...
159
- > lighthousePlugin('https://example.com', { output: 'json', chromeFlags: DEFAULT_FLAGS });
164
+ > import lighthousePlugin from '@code-pushup/lighthouse-plugin';
165
+ >
166
+ > lighthousePlugin('https://example.com', {
167
+ > output: 'json',
168
+ > // Defaults to DEFAULT_CHROME_FLAGS internally
169
+ > });
170
+ > ```
171
+
172
+ ### Adding Extra Flags
173
+
174
+ If additional Chrome flags are required (e.g., verbose logging or debugging), they can be appended to the default flags:
175
+
176
+ > ```ts
177
+ > import lighthousePlugin, { DEFAULT_CHROME_FLAGS } from '@code-pushup/lighthouse-plugin';
178
+ >
179
+ > lighthousePlugin('https://example.com', {
180
+ > output: 'json',
181
+ > chromeFlags: DEFAULT_CHROME_FLAGS.concat(['--verbose']),
182
+ > });
183
+ > ```
184
+
185
+ ### Overriding Default Flags
186
+
187
+ To completely override the default flags and provide a custom configuration:
188
+
189
+ > ```ts
190
+ > import lighthousePlugin from '@code-pushup/lighthouse-plugin';
191
+ >
192
+ > lighthousePlugin('https://example.com', {
193
+ > output: 'json',
194
+ > chromeFlags: ['--verbose'],
195
+ > });
160
196
  > ```
161
197
 
162
198
  ## Config
package/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  // packages/plugin-lighthouse/package.json
2
2
  var name = "@code-pushup/lighthouse-plugin";
3
- var version = "0.50.0";
3
+ var version = "0.52.0";
4
4
 
5
5
  // packages/plugin-lighthouse/src/lib/constants.ts
6
+ import { DEFAULT_FLAGS } from "chrome-launcher/dist/flags.js";
6
7
  import { join } from "node:path";
7
8
 
8
9
  // packages/models/src/lib/implementation/schemas.ts
@@ -162,9 +163,27 @@ function hasNonZeroWeightedRef(refs) {
162
163
  return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
163
164
  }
164
165
 
165
- // packages/models/src/lib/audit.ts
166
+ // packages/models/src/lib/source.ts
166
167
  import { z as z2 } from "zod";
167
- var auditSchema = z2.object({
168
+ var sourceFileLocationSchema = z2.object(
169
+ {
170
+ file: filePathSchema.describe("Relative path to source file in Git repo"),
171
+ position: z2.object(
172
+ {
173
+ startLine: positiveIntSchema.describe("Start line"),
174
+ startColumn: positiveIntSchema.describe("Start column").optional(),
175
+ endLine: positiveIntSchema.describe("End line").optional(),
176
+ endColumn: positiveIntSchema.describe("End column").optional()
177
+ },
178
+ { description: "Location in file" }
179
+ ).optional()
180
+ },
181
+ { description: "Source file location" }
182
+ );
183
+
184
+ // packages/models/src/lib/audit.ts
185
+ import { z as z3 } from "zod";
186
+ var auditSchema = z3.object({
168
187
  slug: slugSchema.describe("ID (unique within plugin)")
169
188
  }).merge(
170
189
  metaSchema({
@@ -174,7 +193,7 @@ var auditSchema = z2.object({
174
193
  description: "List of scorable metrics for the given plugin"
175
194
  })
176
195
  );
177
- var pluginAuditsSchema = z2.array(auditSchema, {
196
+ var pluginAuditsSchema = z3.array(auditSchema, {
178
197
  description: "List of audits maintained in a plugin"
179
198
  }).min(1).refine(
180
199
  (auditMetadata) => !getDuplicateSlugsInAudits(auditMetadata),
@@ -193,31 +212,16 @@ function getDuplicateSlugsInAudits(audits2) {
193
212
  }
194
213
 
195
214
  // packages/models/src/lib/audit-output.ts
196
- import { z as z5 } from "zod";
215
+ import { z as z6 } from "zod";
197
216
 
198
217
  // packages/models/src/lib/issue.ts
199
- import { z as z3 } from "zod";
200
- var sourceFileLocationSchema = z3.object(
201
- {
202
- file: filePathSchema.describe("Relative path to source file in Git repo"),
203
- position: z3.object(
204
- {
205
- startLine: positiveIntSchema.describe("Start line"),
206
- startColumn: positiveIntSchema.describe("Start column").optional(),
207
- endLine: positiveIntSchema.describe("End line").optional(),
208
- endColumn: positiveIntSchema.describe("End column").optional()
209
- },
210
- { description: "Location in file" }
211
- ).optional()
212
- },
213
- { description: "Source file location" }
214
- );
215
- var issueSeveritySchema = z3.enum(["info", "warning", "error"], {
218
+ import { z as z4 } from "zod";
219
+ var issueSeveritySchema = z4.enum(["info", "warning", "error"], {
216
220
  description: "Severity level"
217
221
  });
218
- var issueSchema = z3.object(
222
+ var issueSchema = z4.object(
219
223
  {
220
- message: z3.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
224
+ message: z4.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
221
225
  severity: issueSeveritySchema,
222
226
  source: sourceFileLocationSchema.optional()
223
227
  },
@@ -225,60 +229,60 @@ var issueSchema = z3.object(
225
229
  );
226
230
 
227
231
  // packages/models/src/lib/table.ts
228
- import { z as z4 } from "zod";
229
- var tableAlignmentSchema = z4.enum(["left", "center", "right"], {
232
+ import { z as z5 } from "zod";
233
+ var tableAlignmentSchema = z5.enum(["left", "center", "right"], {
230
234
  description: "Cell alignment"
231
235
  });
232
- var tableColumnObjectSchema = z4.object({
233
- key: z4.string(),
234
- label: z4.string().optional(),
236
+ var tableColumnObjectSchema = z5.object({
237
+ key: z5.string(),
238
+ label: z5.string().optional(),
235
239
  align: tableAlignmentSchema.optional()
236
240
  });
237
- var tableRowObjectSchema = z4.record(tableCellValueSchema, {
241
+ var tableRowObjectSchema = z5.record(tableCellValueSchema, {
238
242
  description: "Object row"
239
243
  });
240
- var tableRowPrimitiveSchema = z4.array(tableCellValueSchema, {
244
+ var tableRowPrimitiveSchema = z5.array(tableCellValueSchema, {
241
245
  description: "Primitive row"
242
246
  });
243
- var tableSharedSchema = z4.object({
244
- title: z4.string().optional().describe("Display title for table")
247
+ var tableSharedSchema = z5.object({
248
+ title: z5.string().optional().describe("Display title for table")
245
249
  });
246
250
  var tablePrimitiveSchema = tableSharedSchema.merge(
247
- z4.object(
251
+ z5.object(
248
252
  {
249
- columns: z4.array(tableAlignmentSchema).optional(),
250
- rows: z4.array(tableRowPrimitiveSchema)
253
+ columns: z5.array(tableAlignmentSchema).optional(),
254
+ rows: z5.array(tableRowPrimitiveSchema)
251
255
  },
252
256
  { description: "Table with primitive rows and optional alignment columns" }
253
257
  )
254
258
  );
255
259
  var tableObjectSchema = tableSharedSchema.merge(
256
- z4.object(
260
+ z5.object(
257
261
  {
258
- columns: z4.union([
259
- z4.array(tableAlignmentSchema),
260
- z4.array(tableColumnObjectSchema)
262
+ columns: z5.union([
263
+ z5.array(tableAlignmentSchema),
264
+ z5.array(tableColumnObjectSchema)
261
265
  ]).optional(),
262
- rows: z4.array(tableRowObjectSchema)
266
+ rows: z5.array(tableRowObjectSchema)
263
267
  },
264
268
  {
265
269
  description: "Table with object rows and optional alignment or object columns"
266
270
  }
267
271
  )
268
272
  );
269
- var tableSchema = (description = "Table information") => z4.union([tablePrimitiveSchema, tableObjectSchema], { description });
273
+ var tableSchema = (description = "Table information") => z5.union([tablePrimitiveSchema, tableObjectSchema], { description });
270
274
 
271
275
  // packages/models/src/lib/audit-output.ts
272
276
  var auditValueSchema = nonnegativeNumberSchema.describe("Raw numeric value");
273
- var auditDisplayValueSchema = z5.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
274
- var auditDetailsSchema = z5.object(
277
+ var auditDisplayValueSchema = z6.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
278
+ var auditDetailsSchema = z6.object(
275
279
  {
276
- issues: z5.array(issueSchema, { description: "List of findings" }).optional(),
280
+ issues: z6.array(issueSchema, { description: "List of findings" }).optional(),
277
281
  table: tableSchema("Table of related findings").optional()
278
282
  },
279
283
  { description: "Detailed information" }
280
284
  );
281
- var auditOutputSchema = z5.object(
285
+ var auditOutputSchema = z6.object(
282
286
  {
283
287
  slug: slugSchema.describe("Reference to audit"),
284
288
  displayValue: auditDisplayValueSchema,
@@ -288,7 +292,7 @@ var auditOutputSchema = z5.object(
288
292
  },
289
293
  { description: "Audit information" }
290
294
  );
291
- var auditOutputsSchema = z5.array(auditOutputSchema, {
295
+ var auditOutputsSchema = z6.array(auditOutputSchema, {
292
296
  description: "List of JSON formatted audit output emitted by the runner process of a plugin"
293
297
  }).refine(
294
298
  (audits2) => !getDuplicateSlugsInAudits2(audits2),
@@ -305,13 +309,13 @@ function getDuplicateSlugsInAudits2(audits2) {
305
309
  }
306
310
 
307
311
  // packages/models/src/lib/category-config.ts
308
- import { z as z6 } from "zod";
312
+ import { z as z7 } from "zod";
309
313
  var categoryRefSchema = weightedRefSchema(
310
314
  "Weighted references to audits and/or groups for the category",
311
315
  "Slug of an audit or group (depending on `type`)"
312
316
  ).merge(
313
- z6.object({
314
- type: z6.enum(["audit", "group"], {
317
+ z7.object({
318
+ type: z7.enum(["audit", "group"], {
315
319
  description: "Discriminant for reference kind, affects where `slug` is looked up"
316
320
  }),
317
321
  plugin: slugSchema.describe(
@@ -332,8 +336,8 @@ var categoryConfigSchema = scorableSchema(
332
336
  description: "Meta info for category"
333
337
  })
334
338
  ).merge(
335
- z6.object({
336
- isBinary: z6.boolean({
339
+ z7.object({
340
+ isBinary: z7.boolean({
337
341
  description: 'Is this a binary category (i.e. only a perfect score considered a "pass")?'
338
342
  }).optional()
339
343
  })
@@ -349,7 +353,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
349
353
  metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
350
354
  );
351
355
  }
352
- var categoriesSchema = z6.array(categoryConfigSchema, {
356
+ var categoriesSchema = z7.array(categoryConfigSchema, {
353
357
  description: "Categorization of individual audits"
354
358
  }).refine(
355
359
  (categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
@@ -368,18 +372,18 @@ function getDuplicateSlugCategories(categories2) {
368
372
  }
369
373
 
370
374
  // packages/models/src/lib/commit.ts
371
- import { z as z7 } from "zod";
372
- var commitSchema = z7.object(
375
+ import { z as z8 } from "zod";
376
+ var commitSchema = z8.object(
373
377
  {
374
- hash: z7.string({ description: "Commit SHA (full)" }).regex(
378
+ hash: z8.string({ description: "Commit SHA (full)" }).regex(
375
379
  /^[\da-f]{40}$/,
376
380
  "Commit SHA should be a 40-character hexadecimal string"
377
381
  ),
378
- message: z7.string({ description: "Commit message" }),
379
- date: z7.coerce.date({
382
+ message: z8.string({ description: "Commit message" }),
383
+ date: z8.coerce.date({
380
384
  description: "Date and time when commit was authored"
381
385
  }),
382
- author: z7.string({
386
+ author: z8.string({
383
387
  description: "Commit author name"
384
388
  }).trim()
385
389
  },
@@ -387,22 +391,22 @@ var commitSchema = z7.object(
387
391
  );
388
392
 
389
393
  // packages/models/src/lib/core-config.ts
390
- import { z as z13 } from "zod";
394
+ import { z as z14 } from "zod";
391
395
 
392
396
  // packages/models/src/lib/persist-config.ts
393
- import { z as z8 } from "zod";
394
- var formatSchema = z8.enum(["json", "md"]);
395
- var persistConfigSchema = z8.object({
397
+ import { z as z9 } from "zod";
398
+ var formatSchema = z9.enum(["json", "md"]);
399
+ var persistConfigSchema = z9.object({
396
400
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
397
401
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
398
- format: z8.array(formatSchema).optional()
402
+ format: z9.array(formatSchema).optional()
399
403
  });
400
404
 
401
405
  // packages/models/src/lib/plugin-config.ts
402
- import { z as z11 } from "zod";
406
+ import { z as z12 } from "zod";
403
407
 
404
408
  // packages/models/src/lib/group.ts
405
- import { z as z9 } from "zod";
409
+ import { z as z10 } from "zod";
406
410
  var groupRefSchema = weightedRefSchema(
407
411
  "Weighted reference to a group",
408
412
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -419,7 +423,7 @@ var groupSchema = scorableSchema(
419
423
  getDuplicateRefsInGroups,
420
424
  duplicateRefsInGroupsErrorMsg
421
425
  ).merge(groupMetaSchema);
422
- var groupsSchema = z9.array(groupSchema, {
426
+ var groupsSchema = z10.array(groupSchema, {
423
427
  description: "List of groups"
424
428
  }).optional().refine(
425
429
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -447,14 +451,14 @@ function getDuplicateSlugsInGroups(groups) {
447
451
  }
448
452
 
449
453
  // packages/models/src/lib/runner-config.ts
450
- import { z as z10 } from "zod";
451
- var outputTransformSchema = z10.function().args(z10.unknown()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
452
- var runnerConfigSchema = z10.object(
454
+ import { z as z11 } from "zod";
455
+ var outputTransformSchema = z11.function().args(z11.unknown()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
456
+ var runnerConfigSchema = z11.object(
453
457
  {
454
- command: z10.string({
458
+ command: z11.string({
455
459
  description: "Shell command to execute"
456
460
  }),
457
- args: z10.array(z10.string({ description: "Command arguments" })).optional(),
461
+ args: z11.array(z11.string({ description: "Command arguments" })).optional(),
458
462
  outputFile: filePathSchema.describe("Output path"),
459
463
  outputTransform: outputTransformSchema.optional()
460
464
  },
@@ -462,8 +466,8 @@ var runnerConfigSchema = z10.object(
462
466
  description: "How to execute runner"
463
467
  }
464
468
  );
465
- var onProgressSchema = z10.function().args(z10.unknown()).returns(z10.void());
466
- var runnerFunctionSchema = z10.function().args(onProgressSchema.optional()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
469
+ var onProgressSchema = z11.function().args(z11.unknown()).returns(z11.void());
470
+ var runnerFunctionSchema = z11.function().args(onProgressSchema.optional()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
467
471
 
468
472
  // packages/models/src/lib/plugin-config.ts
469
473
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -474,13 +478,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
474
478
  description: "Plugin metadata"
475
479
  })
476
480
  ).merge(
477
- z11.object({
481
+ z12.object({
478
482
  slug: slugSchema.describe("Unique plugin slug within core config"),
479
483
  icon: materialIconSchema
480
484
  })
481
485
  );
482
- var pluginDataSchema = z11.object({
483
- runner: z11.union([runnerConfigSchema, runnerFunctionSchema]),
486
+ var pluginDataSchema = z12.object({
487
+ runner: z12.union([runnerConfigSchema, runnerFunctionSchema]),
484
488
  audits: pluginAuditsSchema,
485
489
  groups: groupsSchema
486
490
  });
@@ -506,22 +510,22 @@ function getMissingRefsFromGroups(pluginCfg) {
506
510
  }
507
511
 
508
512
  // packages/models/src/lib/upload-config.ts
509
- import { z as z12 } from "zod";
510
- var uploadConfigSchema = z12.object({
513
+ import { z as z13 } from "zod";
514
+ var uploadConfigSchema = z13.object({
511
515
  server: urlSchema.describe("URL of deployed portal API"),
512
- apiKey: z12.string({
516
+ apiKey: z13.string({
513
517
  description: "API key with write access to portal (use `process.env` for security)"
514
518
  }),
515
519
  organization: slugSchema.describe(
516
520
  "Organization slug from Code PushUp portal"
517
521
  ),
518
522
  project: slugSchema.describe("Project slug from Code PushUp portal"),
519
- timeout: z12.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
523
+ timeout: z13.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
520
524
  });
521
525
 
522
526
  // packages/models/src/lib/core-config.ts
523
- var unrefinedCoreConfigSchema = z13.object({
524
- plugins: z13.array(pluginConfigSchema, {
527
+ var unrefinedCoreConfigSchema = z14.object({
528
+ plugins: z14.array(pluginConfigSchema, {
525
529
  description: "List of plugins to be used (official, community-provided, or custom)"
526
530
  }).min(1),
527
531
  /** portal configuration for persisting results */
@@ -547,7 +551,7 @@ function refineCoreConfig(schema) {
547
551
  var DEFAULT_PERSIST_OUTPUT_DIR = ".code-pushup";
548
552
 
549
553
  // packages/models/src/lib/report.ts
550
- import { z as z14 } from "zod";
554
+ import { z as z15 } from "zod";
551
555
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
552
556
  var pluginReportSchema = pluginMetaSchema.merge(
553
557
  executionMetaSchema({
@@ -555,9 +559,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
555
559
  descriptionDuration: "Duration of the plugin run in ms"
556
560
  })
557
561
  ).merge(
558
- z14.object({
559
- audits: z14.array(auditReportSchema).min(1),
560
- groups: z14.array(groupSchema).optional()
562
+ z15.object({
563
+ audits: z15.array(auditReportSchema).min(1),
564
+ groups: z15.array(groupSchema).optional()
561
565
  })
562
566
  ).refine(
563
567
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -591,10 +595,10 @@ var reportSchema = packageVersionSchema({
591
595
  descriptionDuration: "Duration of the collect run in ms"
592
596
  })
593
597
  ).merge(
594
- z14.object(
598
+ z15.object(
595
599
  {
596
- categories: z14.array(categoryConfigSchema),
597
- plugins: z14.array(pluginReportSchema).min(1),
600
+ categories: z15.array(categoryConfigSchema),
601
+ plugins: z15.array(pluginReportSchema).min(1),
598
602
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
599
603
  },
600
604
  { description: "Collect output data" }
@@ -610,40 +614,40 @@ var reportSchema = packageVersionSchema({
610
614
  );
611
615
 
612
616
  // packages/models/src/lib/reports-diff.ts
613
- import { z as z15 } from "zod";
617
+ import { z as z16 } from "zod";
614
618
  function makeComparisonSchema(schema) {
615
619
  const sharedDescription = schema.description || "Result";
616
- return z15.object({
620
+ return z16.object({
617
621
  before: schema.describe(`${sharedDescription} (source commit)`),
618
622
  after: schema.describe(`${sharedDescription} (target commit)`)
619
623
  });
620
624
  }
621
625
  function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
622
- return z15.object(
626
+ return z16.object(
623
627
  {
624
- changed: z15.array(diffSchema),
625
- unchanged: z15.array(resultSchema),
626
- added: z15.array(resultSchema),
627
- removed: z15.array(resultSchema)
628
+ changed: z16.array(diffSchema),
629
+ unchanged: z16.array(resultSchema),
630
+ added: z16.array(resultSchema),
631
+ removed: z16.array(resultSchema)
628
632
  },
629
633
  { description }
630
634
  );
631
635
  }
632
- var scorableMetaSchema = z15.object({
636
+ var scorableMetaSchema = z16.object({
633
637
  slug: slugSchema,
634
638
  title: titleSchema,
635
639
  docsUrl: docsUrlSchema
636
640
  });
637
641
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
638
- z15.object({
642
+ z16.object({
639
643
  plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
640
644
  })
641
645
  );
642
646
  var scorableDiffSchema = scorableMetaSchema.merge(
643
- z15.object({
647
+ z16.object({
644
648
  scores: makeComparisonSchema(scoreSchema).merge(
645
- z15.object({
646
- diff: z15.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
649
+ z16.object({
650
+ diff: z16.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
647
651
  })
648
652
  ).describe("Score comparison")
649
653
  })
@@ -654,10 +658,10 @@ var scorableWithPluginDiffSchema = scorableDiffSchema.merge(
654
658
  var categoryDiffSchema = scorableDiffSchema;
655
659
  var groupDiffSchema = scorableWithPluginDiffSchema;
656
660
  var auditDiffSchema = scorableWithPluginDiffSchema.merge(
657
- z15.object({
661
+ z16.object({
658
662
  values: makeComparisonSchema(auditValueSchema).merge(
659
- z15.object({
660
- diff: z15.number().int().describe("Value change (`values.after - values.before`)")
663
+ z16.object({
664
+ diff: z16.number().int().describe("Value change (`values.after - values.before`)")
661
665
  })
662
666
  ).describe("Audit `value` comparison"),
663
667
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -666,18 +670,18 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
666
670
  })
667
671
  );
668
672
  var categoryResultSchema = scorableMetaSchema.merge(
669
- z15.object({ score: scoreSchema })
673
+ z16.object({ score: scoreSchema })
670
674
  );
671
675
  var groupResultSchema = scorableWithPluginMetaSchema.merge(
672
- z15.object({ score: scoreSchema })
676
+ z16.object({ score: scoreSchema })
673
677
  );
674
678
  var auditResultSchema = scorableWithPluginMetaSchema.merge(
675
679
  auditOutputSchema.pick({ score: true, value: true, displayValue: true })
676
680
  );
677
- var reportsDiffSchema = z15.object({
681
+ var reportsDiffSchema = z16.object({
678
682
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
679
683
  portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
680
- label: z15.string().optional().describe("Label (e.g. project name)"),
684
+ label: z16.string().optional().describe("Label (e.g. project name)"),
681
685
  categories: makeArraysComparisonSchema(
682
686
  categoryDiffSchema,
683
687
  categoryResultSchema,
@@ -706,6 +710,7 @@ var reportsDiffSchema = z15.object({
706
710
  );
707
711
 
708
712
  // packages/plugin-lighthouse/src/lib/constants.ts
713
+ var DEFAULT_CHROME_FLAGS = [...DEFAULT_FLAGS, "--headless"];
709
714
  var LIGHTHOUSE_PLUGIN_SLUG = "lighthouse";
710
715
  var LIGHTHOUSE_OUTPUT_PATH = join(
711
716
  DEFAULT_PERSIST_OUTPUT_DIR,
@@ -1049,8 +1054,7 @@ var DEFAULT_CLI_FLAGS = {
1049
1054
  // https://github.com/GoogleChrome/lighthouse/blob/7d80178c37a1b600ea8f092fc0b098029799a659/cli/cli-flags.js#L80
1050
1055
  verbose: false,
1051
1056
  saveAssets: false,
1052
- // needed to pass CI on linux and windows (locally it works without headless too)
1053
- chromeFlags: ["--headless=shell"],
1057
+ chromeFlags: DEFAULT_CHROME_FLAGS,
1054
1058
  port: 0,
1055
1059
  hostname: "127.0.0.1",
1056
1060
  view: false,
@@ -1624,6 +1628,7 @@ function lighthousePlugin(url, flags) {
1624
1628
  // packages/plugin-lighthouse/src/index.ts
1625
1629
  var src_default = lighthousePlugin;
1626
1630
  export {
1631
+ DEFAULT_CHROME_FLAGS,
1627
1632
  LIGHTHOUSE_OUTPUT_PATH,
1628
1633
  LIGHTHOUSE_PLUGIN_SLUG,
1629
1634
  LIGHTHOUSE_REPORT_NAME,
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@code-pushup/lighthouse-plugin",
3
- "version": "0.50.0",
3
+ "version": "0.52.0",
4
4
  "license": "MIT",
5
5
  "description": "Code PushUp plugin for measuring web performance and quality with Lighthouse 🔥",
6
6
  "dependencies": {
7
- "@code-pushup/models": "0.50.0",
8
- "@code-pushup/utils": "0.50.0",
7
+ "@code-pushup/models": "0.52.0",
8
+ "@code-pushup/utils": "0.52.0",
9
9
  "ansis": "^3.3.0",
10
+ "chrome-launcher": "^1.1.1",
10
11
  "lighthouse": "^12.0.0",
11
12
  "lighthouse-logger": "2.0.1"
12
13
  },
@@ -19,6 +20,9 @@
19
20
  "url": "git+https://github.com/code-pushup/cli.git",
20
21
  "directory": "packages/plugin-lighthouse"
21
22
  },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
22
26
  "type": "module",
23
27
  "main": "./index.js",
24
28
  "types": "./src/index.d.ts"
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { lighthousePlugin } from './lib/lighthouse-plugin';
2
2
  export { LIGHTHOUSE_REPORT_NAME } from './lib/runner';
3
- export { LIGHTHOUSE_PLUGIN_SLUG, LIGHTHOUSE_OUTPUT_PATH, } from './lib/constants';
3
+ export { DEFAULT_CHROME_FLAGS, LIGHTHOUSE_PLUGIN_SLUG, LIGHTHOUSE_OUTPUT_PATH, } from './lib/constants';
4
4
  export { lighthouseAuditRef, lighthouseGroupRef, type LighthouseGroupSlugs, } from './lib/utils';
5
5
  export type { LighthouseOptions } from './lib/types';
6
6
  export { lighthousePlugin } from './lib/lighthouse-plugin';
@@ -1,2 +1,3 @@
1
+ export declare const DEFAULT_CHROME_FLAGS: string[];
1
2
  export declare const LIGHTHOUSE_PLUGIN_SLUG = "lighthouse";
2
3
  export declare const LIGHTHOUSE_OUTPUT_PATH: string;