lighthouse 13.5.0-dev.20261014 → 13.5.0-dev.20261019
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/.agents/skills/update-trace-engine/SKILL.md +154 -0
- package/cli/test/smokehouse/version-check.d.ts +1 -1
- package/commitlint.config.js +1 -1
- package/core/audits/baseline.d.ts +3 -1
- package/core/audits/baseline.js +4 -3
- package/core/audits/insights/insight-audit.js +34 -28
- package/core/computed/metrics/time-to-first-byte.js +5 -3
- package/core/computed/navigation-insights.js +3 -2
- package/core/computed/trace-engine-result.js +22 -4
- package/core/config/config-helpers.js +3 -5
- package/core/config/config.js +1 -2
- package/core/gather/base-artifacts.js +1 -1
- package/core/gather/driver/storage.js +3 -2
- package/core/gather/gatherers/inspector-issues.js +2 -0
- package/core/gather/gatherers/js-usage.js +2 -0
- package/core/gather/gatherers/scripts.d.ts +16 -3
- package/core/gather/gatherers/scripts.js +157 -14
- package/core/gather/gatherers/stylesheets.js +2 -0
- package/core/gather/gatherers/trace-elements.js +2 -1
- package/core/lib/arbitrary-equality-map.d.ts +14 -3
- package/core/lib/arbitrary-equality-map.js +73 -6
- package/core/lib/cdt/Common.d.ts +1 -1
- package/core/lib/cdt/Common.js +2 -2
- package/core/lib/cdt/Platform.d.ts +7 -7
- package/core/lib/cdt/Platform.js +11 -8
- package/core/lib/cdt/SDK.d.ts +5 -1
- package/core/lib/cdt/SDK.js +4 -2
- package/core/lib/cdt/generated/ParsedURL.d.ts +0 -1
- package/core/lib/cdt/generated/ParsedURL.js +3 -9
- package/core/lib/cdt/generated/SourceMap.d.ts +24 -25
- package/core/lib/cdt/generated/SourceMap.js +7 -15
- package/core/lib/i18n/i18n.js +1 -2
- package/core/lib/legacy-javascript/legacy-javascript.d.ts +2 -2
- package/core/lib/legacy-javascript/legacy-javascript.js +1 -1
- package/core/runner.js +3 -3
- package/dist/report/flow.js +4 -4
- package/package.json +14 -38
- package/report/generator/flow-report-assets.js +1 -3
- package/report/generator/report-assets.js +1 -2
- package/shared/esm-utils.d.ts +0 -8
- package/shared/esm-utils.js +0 -18
- package/shared/localization/format.js +1 -2
- package/shared/localization/locales/ar-XB.json +0 -6
- package/shared/localization/locales/ar.json +0 -6
- package/shared/localization/locales/bg.json +0 -6
- package/shared/localization/locales/ca.json +0 -6
- package/shared/localization/locales/cs.json +0 -6
- package/shared/localization/locales/da.json +0 -6
- package/shared/localization/locales/de.json +0 -6
- package/shared/localization/locales/el.json +0 -6
- package/shared/localization/locales/en-GB.json +0 -6
- package/shared/localization/locales/en-US.json +3 -6
- package/shared/localization/locales/en-XL.json +3 -6
- package/shared/localization/locales/es-419.json +22 -28
- package/shared/localization/locales/es.json +0 -6
- package/shared/localization/locales/fi.json +0 -6
- package/shared/localization/locales/fil.json +0 -6
- package/shared/localization/locales/fr.json +0 -6
- package/shared/localization/locales/he.json +127 -133
- package/shared/localization/locales/hi.json +0 -6
- package/shared/localization/locales/hr.json +0 -6
- package/shared/localization/locales/hu.json +0 -6
- package/shared/localization/locales/id.json +0 -6
- package/shared/localization/locales/it.json +0 -6
- package/shared/localization/locales/ja.json +115 -121
- package/shared/localization/locales/ko.json +2 -8
- package/shared/localization/locales/lt.json +0 -6
- package/shared/localization/locales/lv.json +0 -6
- package/shared/localization/locales/nl.json +0 -6
- package/shared/localization/locales/no.json +0 -6
- package/shared/localization/locales/pl.json +0 -6
- package/shared/localization/locales/pt-PT.json +0 -6
- package/shared/localization/locales/pt.json +0 -6
- package/shared/localization/locales/ro.json +3 -9
- package/shared/localization/locales/ru.json +3 -9
- package/shared/localization/locales/sk.json +0 -6
- package/shared/localization/locales/sl.json +0 -6
- package/shared/localization/locales/sr-Latn.json +0 -6
- package/shared/localization/locales/sr.json +0 -6
- package/shared/localization/locales/sv.json +0 -6
- package/shared/localization/locales/ta.json +0 -6
- package/shared/localization/locales/te.json +0 -6
- package/shared/localization/locales/th.json +0 -6
- package/shared/localization/locales/tr.json +0 -6
- package/shared/localization/locales/uk.json +0 -6
- package/shared/localization/locales/vi.json +0 -6
- package/shared/localization/locales/zh-HK.json +18 -24
- package/shared/localization/locales/zh-TW.json +60 -66
- package/shared/localization/locales/zh.json +2 -8
- package/shared/localization/swap-locale.js +10 -5
- package/shared/root.js +1 -3
- package/tsconfig.json +0 -1
- package/types/artifacts.d.ts +8 -1
- package/core/lib/cdt/package.json +0 -4
- package/eslint-local-rules.d.cts +0 -9
- package/eslint.config.mjs +0 -242
|
@@ -5,19 +5,31 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import BaseGatherer from '../base-gatherer.js';
|
|
8
|
+
import Trace from './trace.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Object} TraceScript
|
|
12
|
+
* @property {string} scriptId
|
|
13
|
+
* @property {string} [sourceText]
|
|
14
|
+
* @property {string[]} [chunks]
|
|
15
|
+
* @property {string} [url]
|
|
16
|
+
* @property {string} [sourceUrl]
|
|
17
|
+
* @property {number} [executionContextId]
|
|
18
|
+
* @property {string} [frame]
|
|
19
|
+
*/
|
|
8
20
|
|
|
9
21
|
/**
|
|
10
22
|
* @template T, U
|
|
11
23
|
* @param {Array<T>} values
|
|
12
|
-
* @param {(value: T) => Promise<U>} promiseMapper
|
|
24
|
+
* @param {(value: T, index: number) => Promise<U>} promiseMapper
|
|
13
25
|
* @param {boolean} runInSeries
|
|
14
26
|
* @return {Promise<Array<U>>}
|
|
15
27
|
*/
|
|
16
28
|
async function runInSeriesOrParallel(values, promiseMapper, runInSeries) {
|
|
17
29
|
if (runInSeries) {
|
|
18
30
|
const results = [];
|
|
19
|
-
for (
|
|
20
|
-
const result = await promiseMapper(
|
|
31
|
+
for (let i = 0; i < values.length; i++) {
|
|
32
|
+
const result = await promiseMapper(values[i], i);
|
|
21
33
|
results.push(result);
|
|
22
34
|
}
|
|
23
35
|
return results;
|
|
@@ -27,6 +39,121 @@ async function runInSeriesOrParallel(values, promiseMapper, runInSeries) {
|
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Extracts script source text and disambiguating metadata from trace rundown events,
|
|
44
|
+
* grouped by `scriptId`.
|
|
45
|
+
* @param {LH.TraceEvent[]} traceEvents
|
|
46
|
+
* @return {Map<string, TraceScript[]>}
|
|
47
|
+
*/
|
|
48
|
+
function collectTraceScripts(traceEvents) {
|
|
49
|
+
/** @type {Map<string, TraceScript>} */
|
|
50
|
+
const byIsolateAndScriptId = new Map();
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {NonNullable<LH.TraceEvent['args']['data']>} data
|
|
54
|
+
* @return {TraceScript}
|
|
55
|
+
*/
|
|
56
|
+
const getOrCreateRecord = (data) => {
|
|
57
|
+
const scriptId = String(data.scriptId);
|
|
58
|
+
const key = `${data.isolate ?? ''}.${scriptId}`;
|
|
59
|
+
let record = byIsolateAndScriptId.get(key);
|
|
60
|
+
if (!record) {
|
|
61
|
+
record = {scriptId};
|
|
62
|
+
byIsolateAndScriptId.set(key, record);
|
|
63
|
+
}
|
|
64
|
+
return record;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
for (const event of traceEvents) {
|
|
68
|
+
const data = event.args?.data;
|
|
69
|
+
if (!data || data.scriptId === undefined) continue;
|
|
70
|
+
|
|
71
|
+
if (event.cat === 'disabled-by-default-devtools.target-rundown') {
|
|
72
|
+
if (typeof data.frame === 'string') {
|
|
73
|
+
getOrCreateRecord(data).frame = data.frame;
|
|
74
|
+
}
|
|
75
|
+
} else if (event.cat === 'disabled-by-default-devtools.v8-source-rundown' &&
|
|
76
|
+
event.name === 'ScriptCatchup') {
|
|
77
|
+
const record = getOrCreateRecord(data);
|
|
78
|
+
if (typeof data.url === 'string') record.url = data.url;
|
|
79
|
+
if (typeof data.sourceUrl === 'string') record.sourceUrl = data.sourceUrl;
|
|
80
|
+
if (typeof data.executionContextId === 'number') {
|
|
81
|
+
record.executionContextId = data.executionContextId;
|
|
82
|
+
}
|
|
83
|
+
} else if (event.cat === 'disabled-by-default-devtools.v8-source-rundown-sources' &&
|
|
84
|
+
typeof data.sourceText === 'string') {
|
|
85
|
+
const record = getOrCreateRecord(data);
|
|
86
|
+
if (event.name === 'ScriptCatchup') {
|
|
87
|
+
record.sourceText = data.sourceText;
|
|
88
|
+
} else if (event.name === 'LargeScriptCatchup') {
|
|
89
|
+
if (!record.chunks || data.splitIndex === 0) record.chunks = [];
|
|
90
|
+
record.chunks.push(data.sourceText);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @type {Map<string, TraceScript[]>} */
|
|
96
|
+
const byScriptId = new Map();
|
|
97
|
+
for (const record of byIsolateAndScriptId.values()) {
|
|
98
|
+
if (record.chunks) record.sourceText = record.chunks.join('');
|
|
99
|
+
if (record.sourceText === undefined) continue;
|
|
100
|
+
|
|
101
|
+
let list = byScriptId.get(record.scriptId);
|
|
102
|
+
if (!list) {
|
|
103
|
+
list = [];
|
|
104
|
+
byScriptId.set(record.scriptId, list);
|
|
105
|
+
}
|
|
106
|
+
list.push(record);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return byScriptId;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {TraceScript} traceScript
|
|
114
|
+
* @param {LH.Crdp.Debugger.ScriptParsedEvent} script
|
|
115
|
+
* @return {boolean}
|
|
116
|
+
*/
|
|
117
|
+
function matchesScriptParsedEvent(traceScript, script) {
|
|
118
|
+
const frameId = script.executionContextAuxData?.frameId;
|
|
119
|
+
if (frameId && traceScript.frame !== undefined && traceScript.frame !== frameId) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const scriptUrl = script.embedderName || script.url;
|
|
123
|
+
if (traceScript.url !== undefined &&
|
|
124
|
+
traceScript.url !== scriptUrl &&
|
|
125
|
+
traceScript.sourceUrl !== script.url) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
if (script.executionContextId !== undefined &&
|
|
129
|
+
traceScript.executionContextId !== undefined &&
|
|
130
|
+
traceScript.executionContextId !== script.executionContextId) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {LH.Crdp.Debugger.ScriptParsedEvent} script
|
|
138
|
+
* @param {Map<string, TraceScript[]>} traceScriptsByScriptId
|
|
139
|
+
* @return {string|undefined}
|
|
140
|
+
*/
|
|
141
|
+
function findTraceScriptSource(script, traceScriptsByScriptId) {
|
|
142
|
+
const candidates = traceScriptsByScriptId.get(script.scriptId);
|
|
143
|
+
if (!candidates) return undefined;
|
|
144
|
+
|
|
145
|
+
const matches = candidates.filter((candidate) => matchesScriptParsedEvent(candidate, script));
|
|
146
|
+
if (matches.length === 1) return matches[0].sourceText;
|
|
147
|
+
|
|
148
|
+
const frameId = script.executionContextAuxData?.frameId;
|
|
149
|
+
if (matches.length > 1 && frameId) {
|
|
150
|
+
const frameMatches = matches.filter((candidate) => candidate.frame === frameId);
|
|
151
|
+
if (frameMatches.length === 1) return frameMatches[0].sourceText;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
30
157
|
/**
|
|
31
158
|
* Returns true if the script was created via our own calls
|
|
32
159
|
* to Runtime.evaluate.
|
|
@@ -50,18 +177,16 @@ function isLighthouseRuntimeEvaluateScript(script) {
|
|
|
50
177
|
class Scripts extends BaseGatherer {
|
|
51
178
|
static symbol = Symbol('Scripts');
|
|
52
179
|
|
|
53
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
180
|
+
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
54
181
|
meta = {
|
|
55
182
|
symbol: Scripts.symbol,
|
|
56
183
|
supportedModes: ['timespan', 'navigation'],
|
|
184
|
+
dependencies: {Trace: Trace.symbol},
|
|
57
185
|
};
|
|
58
186
|
|
|
59
187
|
/** @type {LH.Crdp.Debugger.ScriptParsedEvent[]} */
|
|
60
188
|
_scriptParsedEvents = [];
|
|
61
189
|
|
|
62
|
-
/** @type {Array<string | undefined>} */
|
|
63
|
-
_scriptContents = [];
|
|
64
|
-
|
|
65
190
|
constructor() {
|
|
66
191
|
super();
|
|
67
192
|
this.onScriptParsed = this.onScriptParsed.bind(this);
|
|
@@ -89,26 +214,42 @@ class Scripts extends BaseGatherer {
|
|
|
89
214
|
* @param {LH.Gatherer.Context} context
|
|
90
215
|
*/
|
|
91
216
|
async stopInstrumentation(context) {
|
|
217
|
+
const session = context.driver.defaultSession;
|
|
218
|
+
session.off('Debugger.scriptParsed', this.onScriptParsed);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @param {LH.Gatherer.Context<'Trace'>} context
|
|
223
|
+
* @return {Promise<LH.Artifacts['Scripts']>}
|
|
224
|
+
*/
|
|
225
|
+
async getArtifact(context) {
|
|
92
226
|
const session = context.driver.defaultSession;
|
|
93
227
|
const formFactor = context.baseArtifacts.HostFormFactor;
|
|
228
|
+
const traceScriptsByScriptId = collectTraceScripts(context.dependencies.Trace.traceEvents);
|
|
229
|
+
const traceSources = this._scriptParsedEvents.map(
|
|
230
|
+
(script) => findTraceScriptSource(script, traceScriptsByScriptId)
|
|
231
|
+
);
|
|
94
232
|
|
|
95
|
-
|
|
233
|
+
if (traceSources.some((source) => source === undefined)) {
|
|
234
|
+
// `disableAsyncStacks()` in `prepare.js` runs after `stopInstrumentation` and calls
|
|
235
|
+
// `Debugger.disable`, so re-enable `Debugger` if we need to call `Debugger.getScriptSource`.
|
|
236
|
+
await session.sendCommand('Debugger.enable');
|
|
237
|
+
}
|
|
96
238
|
|
|
97
239
|
// If run on a mobile device, be sensitive to memory limitations and only
|
|
98
240
|
// request one at a time.
|
|
99
|
-
|
|
241
|
+
const scriptContents = await runInSeriesOrParallel(
|
|
100
242
|
this._scriptParsedEvents,
|
|
101
|
-
(
|
|
102
|
-
return
|
|
243
|
+
(script, i) => {
|
|
244
|
+
if (traceSources[i] !== undefined) return Promise.resolve(traceSources[i]);
|
|
245
|
+
return session.sendCommand('Debugger.getScriptSource', {scriptId: script.scriptId})
|
|
103
246
|
.then((resp) => resp.scriptSource)
|
|
104
247
|
.catch(() => undefined);
|
|
105
248
|
},
|
|
106
249
|
formFactor === 'mobile' /* runInSeries */
|
|
107
250
|
);
|
|
108
251
|
await session.sendCommand('Debugger.disable');
|
|
109
|
-
}
|
|
110
252
|
|
|
111
|
-
async getArtifact() {
|
|
112
253
|
/** @type {LH.Artifacts['Scripts']} */
|
|
113
254
|
const scripts = this._scriptParsedEvents.map((event, i) => {
|
|
114
255
|
// 'embedderName' and 'url' are confusingly named, so we rewrite them here.
|
|
@@ -123,10 +264,12 @@ class Scripts extends BaseGatherer {
|
|
|
123
264
|
// embedderName is optional on the protocol because backends like Node may not set it.
|
|
124
265
|
// For our purposes, it is always set. But just in case it isn't... fallback to the url.
|
|
125
266
|
url: event.embedderName || event.url,
|
|
126
|
-
content:
|
|
267
|
+
content: scriptContents[i],
|
|
127
268
|
};
|
|
128
269
|
});
|
|
129
270
|
|
|
271
|
+
this._scriptParsedEvents = [];
|
|
272
|
+
|
|
130
273
|
return scripts;
|
|
131
274
|
}
|
|
132
275
|
}
|
|
@@ -82,6 +82,8 @@ class Stylesheets extends BaseGatherer {
|
|
|
82
82
|
|
|
83
83
|
// Ensure we finish fetching all stylesheet contents before disabling the CSS domain
|
|
84
84
|
const sheets = await Promise.all(this._sheetPromises.values());
|
|
85
|
+
this._sheetPromises.clear();
|
|
86
|
+
this._session = undefined;
|
|
85
87
|
|
|
86
88
|
await session.sendCommand('CSS.disable');
|
|
87
89
|
await session.sendCommand('DOM.disable');
|
|
@@ -21,6 +21,7 @@ import {ProcessedTrace} from '../../computed/processed-trace.js';
|
|
|
21
21
|
import {Responsiveness} from '../../computed/metrics/responsiveness.js';
|
|
22
22
|
import {CumulativeLayoutShift} from '../../computed/metrics/cumulative-layout-shift.js';
|
|
23
23
|
import {TraceEngineResult} from '../../computed/trace-engine-result.js';
|
|
24
|
+
import {Helpers} from '../../lib/trace-engine.js';
|
|
24
25
|
import SourceMaps from './source-maps.js';
|
|
25
26
|
|
|
26
27
|
/** @typedef {{nodeId: number, animations?: {name?: string, failureReasonsMask?: number, unsupportedProperties?: string[]}[], type?: string}} TraceElementData */
|
|
@@ -80,7 +81,7 @@ class TraceElements extends BaseGatherer {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
if (navigationId) {
|
|
83
|
-
if (insightSet.navigation
|
|
84
|
+
if (Helpers.Trace.navigationIDForEvent(insightSet.navigation) !== navigationId) {
|
|
84
85
|
return [];
|
|
85
86
|
}
|
|
86
87
|
} else {
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class ArbitraryEqualityMap {
|
|
7
7
|
/**
|
|
8
|
-
* Determines whether two objects are deeply equal.
|
|
9
|
-
* easy usage by consumers.
|
|
10
|
-
* See https://lodash.com/docs/4.17.5#isEqual.
|
|
8
|
+
* Determines whether two objects are deeply equal.
|
|
11
9
|
* @param {*} objA
|
|
12
10
|
* @param {*} objB
|
|
13
11
|
* @return {boolean}
|
|
@@ -44,4 +42,17 @@ export class ArbitraryEqualityMap {
|
|
|
44
42
|
*/
|
|
45
43
|
_findIndexOf(key: any): number;
|
|
46
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @license
|
|
47
|
+
* Copyright 2018 Google LLC
|
|
48
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @param {*} a
|
|
52
|
+
* @param {*} b
|
|
53
|
+
* @param {WeakMap<object, object>=} seen
|
|
54
|
+
* @return {boolean}
|
|
55
|
+
*/
|
|
56
|
+
declare function deepEquals(a: any, b: any, seen?: WeakMap<object, object> | undefined): boolean;
|
|
57
|
+
export { deepEquals as isEqual };
|
|
47
58
|
//# sourceMappingURL=arbitrary-equality-map.d.ts.map
|
|
@@ -4,7 +4,76 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param {*} a
|
|
9
|
+
* @param {*} b
|
|
10
|
+
* @param {WeakMap<object, object>=} seen
|
|
11
|
+
* @return {boolean}
|
|
12
|
+
*/
|
|
13
|
+
function deepEquals(a, b, seen) {
|
|
14
|
+
if (a === b || (Number.isNaN(a) && Number.isNaN(b))) return true;
|
|
15
|
+
if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (a.constructor !== b.constructor) return false;
|
|
19
|
+
|
|
20
|
+
if (a instanceof Date && b instanceof Date) {
|
|
21
|
+
return a.getTime() === b.getTime() || (Number.isNaN(a.getTime()) && Number.isNaN(b.getTime()));
|
|
22
|
+
}
|
|
23
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
|
24
|
+
return a.source === b.source && a.flags === b.flags;
|
|
25
|
+
}
|
|
26
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
27
|
+
if (a.byteLength !== b.byteLength) return false;
|
|
28
|
+
const viewA = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
|
|
29
|
+
const viewB = new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
|
|
30
|
+
for (let i = 0; i < viewA.length; i++) {
|
|
31
|
+
if (viewA[i] !== viewB[i]) return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (seen) {
|
|
37
|
+
if (seen.get(a) === b) return true;
|
|
38
|
+
} else {
|
|
39
|
+
seen = new WeakMap();
|
|
40
|
+
}
|
|
41
|
+
seen.set(a, b);
|
|
42
|
+
|
|
43
|
+
if (Array.isArray(a)) {
|
|
44
|
+
const arrB = /** @type {unknown[]} */ (b);
|
|
45
|
+
if (a.length !== arrB.length) return false;
|
|
46
|
+
for (let i = 0; i < a.length; i++) {
|
|
47
|
+
if (!deepEquals(a[i], arrB[i], seen)) return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (a instanceof Map && b instanceof Map) {
|
|
53
|
+
if (a.size !== b.size) return false;
|
|
54
|
+
for (const [k, v] of a) {
|
|
55
|
+
if (!b.has(k) || !deepEquals(v, b.get(k), seen)) return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (a instanceof Set && b instanceof Set) {
|
|
61
|
+
if (a.size !== b.size) return false;
|
|
62
|
+
for (const v of a) {
|
|
63
|
+
if (!b.has(v)) return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const keysA = Object.keys(a);
|
|
69
|
+
const keysB = Object.keys(b);
|
|
70
|
+
if (keysA.length !== keysB.length) return false;
|
|
71
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
72
|
+
const key = keysA[i];
|
|
73
|
+
if (!Object.hasOwn(b, key) || !deepEquals(a[key], b[key], seen)) return false;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
8
77
|
|
|
9
78
|
/**
|
|
10
79
|
* @fileoverview This class is designed to allow maps with arbitrary equality functions.
|
|
@@ -65,16 +134,14 @@ class ArbitraryEqualityMap {
|
|
|
65
134
|
}
|
|
66
135
|
|
|
67
136
|
/**
|
|
68
|
-
* Determines whether two objects are deeply equal.
|
|
69
|
-
* easy usage by consumers.
|
|
70
|
-
* See https://lodash.com/docs/4.17.5#isEqual.
|
|
137
|
+
* Determines whether two objects are deeply equal.
|
|
71
138
|
* @param {*} objA
|
|
72
139
|
* @param {*} objB
|
|
73
140
|
* @return {boolean}
|
|
74
141
|
*/
|
|
75
142
|
static deepEquals(objA, objB) {
|
|
76
|
-
return
|
|
143
|
+
return deepEquals(objA, objB);
|
|
77
144
|
}
|
|
78
145
|
}
|
|
79
146
|
|
|
80
|
-
export {ArbitraryEqualityMap};
|
|
147
|
+
export {ArbitraryEqualityMap, deepEquals as isEqual};
|
package/core/lib/cdt/Common.d.ts
CHANGED
package/core/lib/cdt/Common.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export namespace ArrayUtilities {
|
|
2
|
+
export { lowerBound };
|
|
3
|
+
export { upperBound };
|
|
4
|
+
}
|
|
5
|
+
export namespace DevToolsPath {
|
|
6
|
+
let EmptyUrlString: string;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* @license
|
|
3
10
|
* Copyright 2021 Google LLC
|
|
@@ -15,12 +22,5 @@ declare function lowerBound(array: any[], needle: any, comparator: any, left: an
|
|
|
15
22
|
* @param {any} comparator
|
|
16
23
|
*/
|
|
17
24
|
declare function upperBound(array: any[], needle: any, comparator: any, left: any, right: any): any;
|
|
18
|
-
export namespace ArrayUtilities {
|
|
19
|
-
export { lowerBound };
|
|
20
|
-
export { upperBound };
|
|
21
|
-
}
|
|
22
|
-
export namespace DevToolsPath {
|
|
23
|
-
let EmptyUrlString: string;
|
|
24
|
-
}
|
|
25
25
|
export {};
|
|
26
26
|
//# sourceMappingURL=Platform.d.ts.map
|
package/core/lib/cdt/Platform.js
CHANGED
|
@@ -46,12 +46,15 @@ function upperBound(array, needle, comparator, left, right) {
|
|
|
46
46
|
return r;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const ArrayUtilities = {
|
|
50
|
+
lowerBound,
|
|
51
|
+
upperBound,
|
|
52
|
+
};
|
|
53
|
+
const DevToolsPath = {
|
|
54
|
+
EmptyUrlString: '',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
ArrayUtilities,
|
|
59
|
+
DevToolsPath,
|
|
57
60
|
};
|
package/core/lib/cdt/SDK.d.ts
CHANGED
package/core/lib/cdt/SDK.js
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import SourceMap from './generated/SourceMap.js';
|
|
8
|
+
|
|
7
9
|
const SDK = {
|
|
8
|
-
SourceMap
|
|
10
|
+
SourceMap,
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
// Add `lastColumnNumber` to mappings. This will eventually be added to CDT.
|
|
@@ -25,4 +27,4 @@ SDK.SourceMap.prototype.computeLastGeneratedColumns = function() {
|
|
|
25
27
|
// Now, all but the last mapping on each line will have 'lastColumnNumber' set to a number.
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
export default SDK;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// generated by yarn build-cdt-lib
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
"use strict";
|
|
5
4
|
/*
|
|
6
5
|
* Copyright (C) 2012 Google Inc. All rights reserved.
|
|
7
6
|
*
|
|
@@ -31,15 +30,11 @@
|
|
|
31
30
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
31
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
32
|
*/
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.ParsedURL = void 0;
|
|
36
|
-
exports.normalizePath = normalizePath;
|
|
37
|
-
exports.schemeIs = schemeIs;
|
|
38
33
|
;
|
|
39
34
|
/**
|
|
40
35
|
* http://tools.ietf.org/html/rfc3986#section-5.2.4
|
|
41
36
|
*/
|
|
42
|
-
function normalizePath(path) {
|
|
37
|
+
export function normalizePath(path) {
|
|
43
38
|
if (path.indexOf('..') === -1 && path.indexOf('.') === -1) {
|
|
44
39
|
return path;
|
|
45
40
|
}
|
|
@@ -69,7 +64,7 @@ function normalizePath(path) {
|
|
|
69
64
|
}
|
|
70
65
|
return normalizedPath;
|
|
71
66
|
}
|
|
72
|
-
function schemeIs(url, scheme) {
|
|
67
|
+
export function schemeIs(url, scheme) {
|
|
73
68
|
try {
|
|
74
69
|
return (new URL(url)).protocol === scheme;
|
|
75
70
|
}
|
|
@@ -77,7 +72,7 @@ function schemeIs(url, scheme) {
|
|
|
77
72
|
return false;
|
|
78
73
|
}
|
|
79
74
|
}
|
|
80
|
-
class ParsedURL {
|
|
75
|
+
export class ParsedURL {
|
|
81
76
|
isValid;
|
|
82
77
|
url;
|
|
83
78
|
scheme;
|
|
@@ -186,5 +181,4 @@ class ParsedURL {
|
|
|
186
181
|
}
|
|
187
182
|
static urlRegexInstance = null;
|
|
188
183
|
}
|
|
189
|
-
exports.ParsedURL = ParsedURL;
|
|
190
184
|
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Parses the {@link content} as JSON, ignoring BOM markers in the beginning, and
|
|
3
|
+
* also handling the CORB bypass prefix correctly.
|
|
4
|
+
*
|
|
5
|
+
* @param content the string representation of a sourcemap.
|
|
6
|
+
* @returns the {@link SourceMapV3} representation of the {@link content}.
|
|
7
|
+
*/
|
|
8
|
+
export function parseSourceMap(content: any): any;
|
|
9
|
+
export class SourceMapEntry {
|
|
10
|
+
static compare(entry1: any, entry2: any): number;
|
|
11
|
+
constructor(lineNumber: any, columnNumber: any, sourceIndex: any, sourceURL: any, sourceLineNumber: any, sourceColumnNumber: any, name: any);
|
|
12
|
+
lineNumber: any;
|
|
13
|
+
columnNumber: any;
|
|
14
|
+
sourceIndex: any;
|
|
15
|
+
sourceURL: any;
|
|
16
|
+
sourceLineNumber: any;
|
|
17
|
+
sourceColumnNumber: any;
|
|
18
|
+
name: any;
|
|
19
|
+
}
|
|
20
|
+
export class SourceMap {
|
|
3
21
|
/**
|
|
4
22
|
* @param {string} compiledURL
|
|
5
23
|
* @param {string} sourceMappingURL
|
|
@@ -76,30 +94,10 @@ declare class SourceMap {
|
|
|
76
94
|
findOriginalFunctionName(position: any): any;
|
|
77
95
|
#private;
|
|
78
96
|
}
|
|
79
|
-
|
|
80
|
-
export { parseSourceMap
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Parses the {@link content} as JSON, ignoring BOM markers in the beginning, and
|
|
84
|
-
* also handling the CORB bypass prefix correctly.
|
|
85
|
-
*
|
|
86
|
-
* @param content the string representation of a sourcemap.
|
|
87
|
-
* @returns the {@link SourceMapV3} representation of the {@link content}.
|
|
88
|
-
*/
|
|
89
|
-
declare function parseSourceMap(content: any): any;
|
|
90
|
-
declare const __esModule: boolean;
|
|
91
|
-
declare class SourceMapEntry {
|
|
92
|
-
static compare(entry1: any, entry2: any): number;
|
|
93
|
-
constructor(lineNumber: any, columnNumber: any, sourceIndex: any, sourceURL: any, sourceLineNumber: any, sourceColumnNumber: any, name: any);
|
|
94
|
-
lineNumber: any;
|
|
95
|
-
columnNumber: any;
|
|
96
|
-
sourceIndex: any;
|
|
97
|
-
sourceURL: any;
|
|
98
|
-
sourceLineNumber: any;
|
|
99
|
-
sourceColumnNumber: any;
|
|
100
|
-
name: any;
|
|
97
|
+
export namespace SourceMap {
|
|
98
|
+
export { parseSourceMap };
|
|
101
99
|
}
|
|
102
|
-
|
|
100
|
+
export class TokenIterator {
|
|
103
101
|
constructor(string: any);
|
|
104
102
|
next(): any;
|
|
105
103
|
/** Returns the unicode value of the next character and advances the iterator */
|
|
@@ -114,4 +112,5 @@ declare class TokenIterator {
|
|
|
114
112
|
peekVLQ(): number | null;
|
|
115
113
|
#private;
|
|
116
114
|
}
|
|
115
|
+
export default SourceMap;
|
|
117
116
|
//# sourceMappingURL=SourceMap.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// generated by yarn build-cdt-lib
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Platform = require('../Platform.js');
|
|
4
|
+
import * as Common from '../Common.js';
|
|
5
|
+
import * as Platform from '../Platform.js';
|
|
7
6
|
|
|
8
7
|
const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9
8
|
const BASE64_CODES = new Uint8Array(123);
|
|
@@ -14,9 +13,6 @@ const Platform = require('../Platform.js');
|
|
|
14
13
|
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
15
14
|
// Use of this source code is governed by a BSD-style license that can be
|
|
16
15
|
// found in the LICENSE file.
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TokenIterator = exports.SourceMap = exports.SourceMapEntry = void 0;
|
|
19
|
-
exports.parseSourceMap = parseSourceMap;
|
|
20
16
|
/*
|
|
21
17
|
* Copyright (C) 2012 Google Inc. All rights reserved.
|
|
22
18
|
*
|
|
@@ -59,7 +55,7 @@ exports.parseSourceMap = parseSourceMap;
|
|
|
59
55
|
* @param content the string representation of a sourcemap.
|
|
60
56
|
* @returns the {@link SourceMapV3} representation of the {@link content}.
|
|
61
57
|
*/
|
|
62
|
-
function parseSourceMap(content) {
|
|
58
|
+
export function parseSourceMap(content) {
|
|
63
59
|
if (content.startsWith(')]}')) {
|
|
64
60
|
content = content.substring(content.indexOf('\n'));
|
|
65
61
|
}
|
|
@@ -69,7 +65,7 @@ function parseSourceMap(content) {
|
|
|
69
65
|
}
|
|
70
66
|
return JSON.parse(content);
|
|
71
67
|
}
|
|
72
|
-
class SourceMapEntry {
|
|
68
|
+
export class SourceMapEntry {
|
|
73
69
|
lineNumber;
|
|
74
70
|
columnNumber;
|
|
75
71
|
sourceIndex;
|
|
@@ -93,8 +89,7 @@ class SourceMapEntry {
|
|
|
93
89
|
return entry1.columnNumber - entry2.columnNumber;
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
class SourceMap {
|
|
92
|
+
export class SourceMap {
|
|
98
93
|
#json;
|
|
99
94
|
#compiledURLInternal;
|
|
100
95
|
#sourceMappingURL;
|
|
@@ -502,11 +497,10 @@ class SourceMap {
|
|
|
502
497
|
return this.#scopesInfo?.findOriginalFunctionName(position) ?? null;
|
|
503
498
|
}
|
|
504
499
|
}
|
|
505
|
-
exports.SourceMap = SourceMap;
|
|
506
500
|
const VLQ_BASE_SHIFT = 5;
|
|
507
501
|
const VLQ_BASE_MASK = (1 << 5) - 1;
|
|
508
502
|
const VLQ_CONTINUATION_MASK = 1 << 5;
|
|
509
|
-
class TokenIterator {
|
|
503
|
+
export class TokenIterator {
|
|
510
504
|
#string;
|
|
511
505
|
#position;
|
|
512
506
|
constructor(string) {
|
|
@@ -565,8 +559,6 @@ class TokenIterator {
|
|
|
565
559
|
}
|
|
566
560
|
}
|
|
567
561
|
}
|
|
568
|
-
exports.TokenIterator = TokenIterator;
|
|
569
562
|
|
|
570
|
-
|
|
571
|
-
module.exports = SourceMap;
|
|
563
|
+
export default SourceMap;
|
|
572
564
|
SourceMap.parseSourceMap = parseSourceMap;
|