lighthouse 11.6.0-dev.20240221 → 11.6.0-dev.20240223

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.
@@ -12,6 +12,10 @@ declare class DevtoolsLog extends BaseGatherer {
12
12
  * @param {LH.Gatherer.Context} passContext
13
13
  */
14
14
  stopSensitiveInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
15
+ /**
16
+ * @return {LH.Artifacts['DevtoolsLog']}
17
+ */
18
+ getDebugData(): LH.Artifacts['DevtoolsLog'];
15
19
  /**
16
20
  * @return {Promise<LH.Artifacts['DevtoolsLog']>}
17
21
  */
@@ -49,6 +49,13 @@ class DevtoolsLog extends BaseGatherer {
49
49
  driver.targetManager.off('protocolevent', this._onProtocolMessage);
50
50
  }
51
51
 
52
+ /**
53
+ * @return {LH.Artifacts['DevtoolsLog']}
54
+ */
55
+ getDebugData() {
56
+ return this._messageLog.messages;
57
+ }
58
+
52
59
  /**
53
60
  * @return {Promise<LH.Artifacts['DevtoolsLog']>}
54
61
  */
@@ -17,6 +17,7 @@ declare class Trace extends BaseGatherer {
17
17
  * @param {LH.Gatherer.Context} passContext
18
18
  */
19
19
  stopSensitiveInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
20
+ getDebugData(): import("../../index.js").Trace;
20
21
  getArtifact(): import("../../index.js").Trace;
21
22
  }
22
23
  import BaseGatherer from '../base-gatherer.js';
@@ -126,6 +126,10 @@ class Trace extends BaseGatherer {
126
126
  this._trace = await Trace.endTraceAndCollectEvents(driver.defaultSession);
127
127
  }
128
128
 
129
+ getDebugData() {
130
+ return this._trace;
131
+ }
132
+
129
133
  getArtifact() {
130
134
  return this._trace;
131
135
  }
@@ -110,32 +110,20 @@ async function _navigate(navigationContext) {
110
110
  * @return {Promise<{devtoolsLog?: LH.DevtoolsLog, records?: Array<LH.Artifacts.NetworkRequest>, trace?: LH.Trace}>}
111
111
  */
112
112
  async function _collectDebugData(navigationContext, phaseState) {
113
- const devtoolsLogArtifactDefn = phaseState.artifactDefinitions.find(
114
- definition => definition.gatherer.instance.meta.symbol === DevtoolsLog.symbol
115
- );
116
- const traceArtifactDefn = phaseState.artifactDefinitions.find(
117
- definition => definition.gatherer.instance.meta.symbol === Trace.symbol
118
- );
119
-
120
- const artifactDefinitions = [devtoolsLogArtifactDefn, traceArtifactDefn].filter(
121
- /**
122
- * @param {LH.Config.AnyArtifactDefn | undefined} defn
123
- * @return {defn is LH.Config.AnyArtifactDefn}
124
- */
125
- defn => Boolean(defn)
126
- );
127
- if (!artifactDefinitions.length) return {};
128
-
129
- await collectPhaseArtifacts({...phaseState, phase: 'getArtifact', artifactDefinitions});
130
- const getArtifactState = phaseState.artifactState.getArtifact;
113
+ let devtoolsLog;
114
+ let trace;
115
+
116
+ for (const definition of phaseState.artifactDefinitions) {
117
+ const {instance} = definition.gatherer;
118
+ if (instance instanceof DevtoolsLog) {
119
+ devtoolsLog = instance.getDebugData();
120
+ } else if (instance instanceof Trace) {
121
+ trace = instance.getDebugData();
122
+ }
123
+ }
131
124
 
132
- const devtoolsLogArtifactId = devtoolsLogArtifactDefn?.id;
133
- const devtoolsLog = devtoolsLogArtifactId && (await getArtifactState[devtoolsLogArtifactId]);
134
125
  const records = devtoolsLog && (await NetworkRecords.request(devtoolsLog, navigationContext));
135
126
 
136
- const traceArtifactId = traceArtifactDefn?.id;
137
- const trace = traceArtifactId && (await getArtifactState[traceArtifactId]);
138
-
139
127
  return {devtoolsLog, records, trace};
140
128
  }
141
129
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "11.6.0-dev.20240221",
4
+ "version": "11.6.0-dev.20240223",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {