lighthouse 13.5.0-dev.20261005 → 13.5.0-dev.20261007

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.
@@ -112,13 +112,6 @@
112
112
  ],
113
113
  "corejs": true
114
114
  },
115
- {
116
- "name": "Array.prototype.includes",
117
- "modules": [
118
- "es.array.includes"
119
- ],
120
- "corejs": true
121
- },
122
115
  {
123
116
  "name": "Array.prototype.indexOf",
124
117
  "modules": [
@@ -175,6 +168,30 @@
175
168
  ],
176
169
  "corejs": true
177
170
  },
171
+ {
172
+ "name": "Array.prototype.toReversed",
173
+ "modules": [
174
+ "es.array.to-reversed",
175
+ "esnext.array.to-reversed"
176
+ ],
177
+ "corejs": true
178
+ },
179
+ {
180
+ "name": "Array.prototype.toSorted",
181
+ "modules": [
182
+ "es.array.to-sorted",
183
+ "esnext.array.to-sorted"
184
+ ],
185
+ "corejs": true
186
+ },
187
+ {
188
+ "name": "Array.prototype.toSpliced",
189
+ "modules": [
190
+ "es.array.to-spliced",
191
+ "esnext.array.to-spliced"
192
+ ],
193
+ "corejs": true
194
+ },
178
195
  {
179
196
  "name": "Array.prototype.unshift",
180
197
  "modules": [
@@ -436,6 +453,14 @@
436
453
  ],
437
454
  "corejs": true
438
455
  },
456
+ {
457
+ "name": "Promise.withResolvers",
458
+ "modules": [
459
+ "es.promise.with-resolvers",
460
+ "esnext.promise.with-resolvers"
461
+ ],
462
+ "corejs": true
463
+ },
439
464
  {
440
465
  "name": "Reflect.apply",
441
466
  "modules": [
@@ -541,6 +566,14 @@
541
566
  ],
542
567
  "corejs": true
543
568
  },
569
+ {
570
+ "name": "String.prototype.isWellFormed",
571
+ "modules": [
572
+ "es.string.is-well-formed",
573
+ "esnext.string.is-well-formed"
574
+ ],
575
+ "corejs": true
576
+ },
544
577
  {
545
578
  "name": "String.prototype.matchAll",
546
579
  "modules": [
@@ -585,6 +618,14 @@
585
618
  ],
586
619
  "corejs": true
587
620
  },
621
+ {
622
+ "name": "String.prototype.toWellFormed",
623
+ "modules": [
624
+ "es.string.to-well-formed",
625
+ "esnext.string.to-well-formed"
626
+ ],
627
+ "corejs": true
628
+ },
588
629
  {
589
630
  "name": "String.prototype.trim",
590
631
  "modules": [
@@ -7,7 +7,6 @@
7
7
  // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-punctuators
8
8
  // eslint-disable-next-line max-len
9
9
  const PUNCTUATOR_REGEX = /(return|case|else|{|\(|\[|\.\.\.|;|,|<|>|<=|>=|==|!=|===|!==|\+|-|\*|%|\*\*|\+\+|--|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|\*\*=|<<=|>>=|>>>=|&=|\|=|\^=|=>|\/|\/=|\})$/;
10
- const WHITESPACE_REGEX = /( |\n|\t)+$/;
11
10
 
12
11
  /**
13
12
  * Look backwards from `startPosition` in `content` for an ECMAScript punctuator.
@@ -19,11 +18,13 @@ const WHITESPACE_REGEX = /( |\n|\t)+$/;
19
18
  */
20
19
  function hasPunctuatorBefore(content, startPosition) {
21
20
  for (let i = startPosition; i > 0; i--) {
21
+ const char = content[i - 1];
22
+ // Skip over any ending whitespace
23
+ if (char === ' ' || char === '\n' || char === '\t') continue;
24
+
22
25
  // Try to grab at least 6 characters so we can check for `return`
23
26
  const sliceStart = Math.max(0, i - 6);
24
27
  const precedingCharacters = content.slice(sliceStart, i);
25
- // Skip over any ending whitespace
26
- if (WHITESPACE_REGEX.test(precedingCharacters)) continue;
27
28
  // Check if it's a punctuator
28
29
  return PUNCTUATOR_REGEX.test(precedingCharacters);
29
30
  }
@@ -56,8 +57,7 @@ function computeTokenLength(content, features) {
56
57
  const templateLiteralDepth = [];
57
58
 
58
59
  for (let i = 0; i < content.length; i++) {
59
- const twoChars = content.substr(i, 2);
60
- const char = twoChars.charAt(0);
60
+ const char = content[i];
61
61
 
62
62
  const isWhitespace = char === ' ' || char === '\n' || char === '\t';
63
63
  const isAStringOpenChar = char === `'` || char === '"' || char === '`';
@@ -71,7 +71,7 @@ function computeTokenLength(content, features) {
71
71
  // License comments count
72
72
  if (isInLicenseComment) totalTokenLength++;
73
73
 
74
- if (twoChars === '*/') {
74
+ if (char === '*' && content[i + 1] === '/') {
75
75
  // License comments count, account for the '/' character we're skipping over
76
76
  if (isInLicenseComment) totalTokenLength++;
77
77
  // End the comment when we hit the closing sequence
@@ -83,7 +83,7 @@ function computeTokenLength(content, features) {
83
83
  // String characters count
84
84
  totalTokenLength++;
85
85
 
86
- if (stringOpenChar === '`' && twoChars === '${') {
86
+ if (stringOpenChar === '`' && char === '$' && content[i + 1] === '{') {
87
87
  // Start new template literal
88
88
  templateLiteralDepth.push('templateBrace');
89
89
  isInString = false;
@@ -119,16 +119,16 @@ function computeTokenLength(content, features) {
119
119
  }
120
120
  } else {
121
121
  // We're not in any particular token mode, look for the start of different
122
- if (twoChars === '/*') {
122
+ if (char === '/' && content[i + 1] === '*') {
123
123
  // Start the multi-line comment
124
124
  isInMultilineComment = true;
125
125
  // Check if it's a license comment so we know whether to count it
126
- isInLicenseComment = content.charAt(i + 2) === '!';
126
+ isInLicenseComment = content[i + 2] === '!';
127
127
  // += 2 because we are processing 2 characters, not just 1
128
128
  if (isInLicenseComment) totalTokenLength += 2;
129
129
  // Skip over the '*' character since we've already processed it
130
130
  i++;
131
- } else if (twoChars === '//' && features.singlelineComments) {
131
+ } else if (char === '/' && content[i + 1] === '/' && features.singlelineComments) {
132
132
  // Start the single-line comment
133
133
  isInSinglelineComment = true;
134
134
  isInMultilineComment = false;
@@ -97,13 +97,10 @@ function getOuterHTMLSnippet(element, ignoreAttrs = [], snippetCharacterLimit =
97
97
  }
98
98
 
99
99
  try {
100
- /** @type {Element} */
101
- // @ts-expect-error - clone will be same type as element - see https://github.com/microsoft/TypeScript/issues/283
102
- const clone = element.cloneNode();
103
-
104
- // Prevent any potential side-effects by appending to a template element.
100
+ // Prevent any potential side-effects by cloning into a template element.
105
101
  // See https://github.com/GoogleChrome/lighthouse/issues/11465
106
102
  const template = element.ownerDocument.createElement('template');
103
+ const clone = template.content.ownerDocument.importNode(element);
107
104
  template.content.append(clone);
108
105
  ignoreAttrs.concat(autoFillIgnoreAttrs).forEach(attribute =>{
109
106
  clone.removeAttribute(attribute);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "13.5.0-dev.20261005",
4
+ "version": "13.5.0-dev.20261007",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -179,6 +179,7 @@
179
179
  "typed-query-selector": "^2.12.0",
180
180
  "typescript": "6.0.3",
181
181
  "wait-for-expect": "^3.0.2",
182
+ "web-features": "^3.40.0",
182
183
  "webtreemap-cdt": "^3.2.1"
183
184
  },
184
185
  "dependencies": {
@@ -186,7 +187,7 @@
186
187
  "@sentry/node": "^10.0.0",
187
188
  "ajv": "^8.20.0",
188
189
  "ajv-formats": "^3.0.1",
189
- "axe-core": "^4.13.0",
190
+ "axe-core": "4.13.0",
190
191
  "chrome-launcher": "^1.2.2",
191
192
  "configstore": "^7.0.0",
192
193
  "csp_evaluator": "1.1.8",
@@ -206,7 +207,6 @@
206
207
  "speedline-core": "^1.4.3",
207
208
  "third-party-web": "^0.30.0",
208
209
  "tldts-icann": "^7.4.16",
209
- "web-features": "^3.40.0",
210
210
  "ws": "^7.0.0",
211
211
  "yargs": "^17.3.1",
212
212
  "yargs-parser": "^21.0.0"