lighthouse 13.5.0-dev.20261019 → 13.5.0-dev.20261021

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.
Files changed (46) hide show
  1. package/cli/bin.d.ts +2 -2
  2. package/cli/bin.js +5 -4
  3. package/cli/cli-flags.d.ts +16 -1
  4. package/cli/cli-flags.js +51 -0
  5. package/cli/run.d.ts +5 -5
  6. package/cli/run.js +97 -47
  7. package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +1 -1
  8. package/core/audits/baseline.d.ts +3 -0
  9. package/core/audits/baseline.js +1 -1
  10. package/core/audits/byte-efficiency/byte-efficiency-audit.js +2 -2
  11. package/core/audits/script-treemap-data.js +12 -2
  12. package/core/computed/lcp-image-record.d.ts +2 -23
  13. package/core/computed/lcp-image-record.js +3 -67
  14. package/core/computed/lcp-network-record.d.ts +24 -0
  15. package/core/computed/lcp-network-record.js +74 -0
  16. package/core/computed/metrics/lcp-breakdown.js +2 -2
  17. package/core/config/config-helpers.d.ts +5 -0
  18. package/core/config/config-helpers.js +6 -24
  19. package/core/gather/base-artifacts.js +6 -0
  20. package/core/gather/gatherers/full-page-screenshot.js +2 -2
  21. package/core/lib/baseline/web-features-data.json +14 -1
  22. package/core/lib/i18n/i18n.d.ts +0 -1
  23. package/core/lib/i18n/i18n.js +16 -9
  24. package/core/lib/sentry.d.ts +1 -0
  25. package/core/lib/sentry.js +3 -0
  26. package/dist/report/bundle.esm.js +2 -2
  27. package/dist/report/flow.js +13 -13
  28. package/dist/report/standalone.js +2 -2
  29. package/flow-report/src/util.d.ts +1 -1
  30. package/package.json +42 -50
  31. package/readme.md +11 -17
  32. package/report/generator/file-namer.d.ts +1 -1
  33. package/report/generator/file-namer.js +4 -3
  34. package/report/renderer/performance-category-renderer.js +2 -1
  35. package/report/renderer/text-encoding.js +2 -2
  36. package/report/types/augment-dom.d.ts +4 -0
  37. package/shared/localization/locales/en-US.json +1 -1
  38. package/shared/localization/locales/en-XL.json +1 -1
  39. package/tsconfig.json +0 -1
  40. package/types/externs.d.ts +4 -0
  41. package/types/internal/test.d.ts +1 -0
  42. package/third-party/esbuild-plugins-polyfills/LICENSE +0 -3
  43. package/third-party/esbuild-plugins-polyfills/README.md +0 -7
  44. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +0 -9
  45. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +0 -129
  46. package/types/internal/lookup-closest-locale.d.ts +0 -13
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "13.5.0-dev.20261019",
4
+ "version": "13.5.0-dev.20261021",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "reset-link": "(yarn unlink || true) && yarn link && yarn link lighthouse",
38
38
  "clean": "rm -r dist proto/scripts/*.json proto/scripts/*_pb2.* proto/scripts/*_pb.* proto/scripts/__pycache__ proto/scripts/*.pyc *.report.html *.report.dom.html *.report.json *.devtoolslog.json *.trace.json shared/localization/locales/*.ctc.json || true",
39
39
  "clean-types": "git clean -xfq '*.d.ts' '*.d.cts' -e 'node_modules/' -e 'dist/' -e '.tmp/' -e '**/types/'",
40
- "lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
40
+ "lint": "[ \"$CI\" = true ] && eslint --quiet . || eslint .",
41
41
  "zizmor": "uvx zizmor@1.25.2 --gh-token=\"$(gh auth token)\" .github/workflows",
42
42
  "smoke": "node --enable-source-maps cli/test/smokehouse/frontends/smokehouse-bin.js",
43
43
  "debug": "node --inspect-brk ./cli/index.js",
@@ -72,7 +72,7 @@
72
72
  "deploy-viewer": "yarn build-viewer --deploy",
73
73
  "vercel-build": "yarn build-sample-reports && yarn build-viewer && yarn build-treemap",
74
74
  "timing-trace": "node core/scripts/generate-timing-trace.js",
75
- "changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file",
75
+ "changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md",
76
76
  "type-check": "tsc --build ./tsconfig-all.json",
77
77
  "i18n:checks": "./core/scripts/i18n/assert-strings-collected.sh",
78
78
  "i18n:collect-strings": "node core/scripts/i18n/collect-strings.js",
@@ -102,91 +102,83 @@
102
102
  "devDependencies": {
103
103
  "@eslint/js": "^9.28.0",
104
104
  "@formatjs/icu-messageformat-parser": "^2.6.2",
105
- "@jest/fake-timers": "^29.7.0",
106
- "@testing-library/preact": "^3.1.1",
107
- "@testing-library/preact-hooks": "^1.1.0",
105
+ "@jest/fake-timers": "^30.5.2",
106
+ "@testing-library/preact": "^3.2.4",
108
107
  "@types/archiver": "^8.0.0",
109
- "@types/chrome": "^0.1.42",
110
- "@types/debug": "^4.1.7",
111
- "@types/estree": "^0.0.50",
112
- "@types/gh-pages": "^2.0.0",
113
- "@types/google.analytics": "0.0.39",
108
+ "@types/chrome": "^0.3.5",
109
+ "@types/debug": "^4.1.13",
110
+ "@types/estree": "^1.0.9",
111
+ "@types/gh-pages": "^6.1.0",
112
+ "@types/google.analytics": "0.0.46",
114
113
  "@types/gtag.js": "0.0.20",
115
114
  "@types/jsdom": "^28.0.3",
116
115
  "@types/mocha": "^10.0.10",
117
116
  "@types/node": "*",
118
- "@types/pako": "^1.0.1",
119
117
  "@types/yargs": "^17.0.35",
120
118
  "@types/yargs-parser": "^21.0.3",
121
- "@typescript-eslint/eslint-plugin": "^8.60.1",
122
- "@typescript-eslint/parser": "^8.60.1",
123
- "acorn": "^8.5.0",
124
- "angular": "^1.7.4",
119
+ "acorn": "^8.19.0",
120
+ "ajv": "^8.20.0",
125
121
  "archiver": "^8.0.0",
126
122
  "chrome-devtools-frontend": "1.0.1705227",
127
- "concurrently": "^9.2.1",
128
- "conventional-changelog-cli": "^2.1.1",
129
- "core-js-compat": "^3.44.0",
130
- "csv-validator": "^0.0.3",
131
- "esbuild": "0.28.0",
123
+ "concurrently": "^10.0.6",
124
+ "conventional-changelog": "^8.1.3",
125
+ "core-js-compat": "^3.51.0",
126
+ "esbuild": "0.28.2",
132
127
  "eslint": "^9.28.0",
133
- "eslint-formatter-codeframe": "^7.32.1",
134
128
  "eslint-plugin-import": "^2.32.0",
135
- "expect": "^28.1.0",
136
- "firebase": "^12.14.0",
137
- "gh-pages": "^2.0.1",
138
- "globals": "^15.14.0",
139
- "idb-keyval": "2.2.0",
140
- "jest-mock": "^29.7.0",
141
- "jest-snapshot": "^29.7.0",
129
+ "expect": "^30.5.2",
130
+ "firebase": "^12.19.0",
131
+ "gh-pages": "^6.3.0",
132
+ "globals": "^17.13.0",
133
+ "idb-keyval": "^6.3.0",
134
+ "jest-mock": "^30.5.2",
135
+ "jest-snapshot": "^30.5.2",
142
136
  "jsdom": "^29.1.1",
143
137
  "lighthouse-plugin-soft-navigation": "^1.1.0",
144
- "magic-string": "^0.25.7",
145
- "mime-types": "^2.1.30",
138
+ "magic-string": "^1.4.3",
139
+ "mime-types": "^3.0.2",
146
140
  "mocha": "^12.0.3",
147
- "pako": "^2.1.0",
148
- "preact": "^10.7.2",
141
+ "pako": "^3.0.2",
142
+ "preact": "^10.29.8",
149
143
  "pretty-json-stringify": "^0.0.2",
150
- "puppeteer": "^25.12.0",
151
- "rollup-plugin-polyfill-node": "^0.12.0",
152
- "terser": "^5.48.0",
153
- "testdouble": "^3.20.2",
144
+ "puppeteer": "^25.15.0",
145
+ "terser": "^5.51.2",
146
+ "testdouble": "^4.0.0",
154
147
  "tsx": "^4.23.15",
155
- "typed-query-selector": "^2.12.0",
148
+ "typed-query-selector": "^2.12.3",
156
149
  "typescript": "6.0.3",
157
- "wait-for-expect": "^3.0.2",
158
- "web-features": "^3.40.0",
150
+ "typescript-eslint": "^8.60.1",
151
+ "wait-for-expect": "^4.0.0",
152
+ "web-features": "^3.43.0",
159
153
  "webtreemap-cdt": "^3.2.1"
160
154
  },
161
155
  "dependencies": {
162
156
  "@paulirish/trace_engine": "0.0.67",
163
- "@sentry/node": "^10.0.0",
164
- "ajv": "^8.20.0",
157
+ "@sentry/node": "^11.8.0",
165
158
  "ajv-formats": "^3.0.1",
166
159
  "axe-core": "4.13.0",
167
160
  "chrome-launcher": "^1.2.2",
168
- "configstore": "^7.0.0",
161
+ "configstore": "^8.0.0",
169
162
  "csp_evaluator": "1.1.8",
170
- "devtools-protocol": "0.0.1704951",
163
+ "devtools-protocol": "0.0.1721602",
171
164
  "enquirer": "^2.3.6",
172
165
  "http-link-header": "^1.1.1",
173
166
  "intl-messageformat": "^10.5.3",
174
167
  "js-library-detector": "^6.7.0",
175
168
  "lighthouse-logger": "^2.0.2",
176
169
  "lighthouse-stack-packs": "1.12.3",
177
- "lookup-closest-locale": "6.2.0",
178
- "open": "^8.4.0",
179
- "puppeteer-core": "^25.12.0",
170
+ "open": "^11.0.4",
171
+ "puppeteer-core": "^25.15.0",
180
172
  "robots-parser": "^3.0.1",
181
173
  "speedline-core": "^1.4.3",
182
174
  "third-party-web": "^0.30.0",
183
- "tldts-icann": "^7.4.16",
175
+ "tldts-icann": "^7.4.19",
184
176
  "yargs": "^18.2.0",
185
177
  "yargs-parser": "^22.0.0"
186
178
  },
187
179
  "resolutions": {
188
- "puppeteer/**/devtools-protocol": "0.0.1704951",
189
- "puppeteer-core/**/devtools-protocol": "0.0.1704951"
180
+ "puppeteer/**/devtools-protocol": "0.0.1721602",
181
+ "puppeteer-core/**/devtools-protocol": "0.0.1721602"
190
182
  },
191
183
  "repository": {
192
184
  "type": "git",
package/readme.md CHANGED
@@ -106,6 +106,9 @@ Configuration:
106
106
  --only-categories Only run the specified categories. Available categories: accessibility, best-practices, performance, seo [array]
107
107
  --skip-audits Run everything except these audits [array]
108
108
  --disable-full-page-screenshot Disables collection of the full page screenshot, which can be quite large [boolean]
109
+ --ignore-status-code Disables failing on all error status codes, and instead issues a warning. [boolean]
110
+ --url-file The path to a file containing newline-delimited URLs to audit. [string]
111
+ --fail-fast Stop auditing remaining URLs immediately if a run fails. [boolean]
109
112
 
110
113
  Output:
111
114
  --output Reporter for the results, supports multiple values. choices: "json", "html", "csv" [array] [default: ["html"]]
@@ -177,6 +180,12 @@ lighthouse --output-path=~/mydir/foo.out --save-assets
177
180
 
178
181
  lighthouse --output-path=./report.json --output json
179
182
  # saves `./report.json`
183
+
184
+ lighthouse https://example.com https://example.org
185
+ # audits multiple URLs sequentially and saves `./<HOST>_<DATE>.report.html` for each
186
+
187
+ lighthouse --url-file=./urls.txt --output-path=./reports
188
+ # audits all URLs in `./urls.txt` and saves reports into the existing `./reports` directory
180
189
  ```
181
190
 
182
191
  ##### Lifecycle Examples
@@ -394,32 +403,17 @@ This section details services that have integrated Lighthouse data. If you're wo
394
403
  Other awesome open source projects that use Lighthouse.
395
404
 
396
405
  * **[auto-lighthouse](https://github.com/TGiles/auto-lighthouse)** - a CLI for crawling a domain and generating mobile and desktop reports for each page.
397
- * **[Exthouse](https://github.com/treosh/exthouse)** - Analyze the impact of a browser extension on web performance.
398
- * **[Gimbal](https://labs.moduscreate.com/gimbal-web-performance-audit-budgeting)** - An [open source (MIT licensed)](https://github.com/ModusCreateOrg/gimbal) tool used to measure, analyze, and budget aspects of a web application. Gimbal also integrates reports with GitHub pull requests.
399
- * **[Gradle Lighthouse Plugin](https://github.com/Cognifide/gradle-lighthouse-plugin)** - An open source Gradle plugin that runs Lighthouse tests on multiple URLs and asserts category score thresholds (useful in continuous integration).
400
406
  * **[lighthouse-badges](https://github.com/emazzotta/lighthouse-badges)** - Generate gh-badges (shields.io) based on Lighthouse performance.
401
- * **[lighthouse-batch](https://github.com/mikestead/lighthouse-batch)** - Run Lighthouse over a number of sites and generate a summary of their metrics/scores.
402
- * **[lighthouse-batch-parallel](https://github.com/Carr1005/lighthouse-batch-parallel)** - Run multiple Lighthouse runs in parallel to accelerate the data collecting process, get the result stream (csv, json, js object) in your own process (warning: performance results may be volatile).
403
407
  * **[lighthouse-check-action](https://github.com/foo-software/lighthouse-check-action)** - A GitHub Action to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
404
408
  * **[lighthouse-check-orb](https://circleci.com/orbs/registry/orb/foo-software/lighthouse-check)** - A CircleCI Orb to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
405
- * **[andreasonny83/lighthouse-ci](https://github.com/andreasonny83/lighthouse-ci)** - Run Lighthouse and assert scores satisfy your custom thresholds.
406
409
  * **[GoogleChrome/lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci)** - (**official**) Automate running Lighthouse for every commit, viewing the changes, and preventing regressions.
407
410
  * **[lighthouse-ci-action](https://github.com/treosh/lighthouse-ci-action)** - A GitHub Action that makes it easy to run Lighthouse in CI and keep your pages small using performance budgets.
408
- * **[lighthouse-gh-reporter](https://github.com/carlesnunez/lighthouse-gh-reporter)** - Run Lighthouse in CI and report back in a comment on your pull requests
409
- * **[lighthouse-jest-example](https://github.com/justinribeiro/lighthouse-jest-example)** - Gather performance metrics via Lighthouse and assert results with Jest; uses Puppeteer to start Chrome with network emulation settings defined by WebPageTest.
410
- * **[lighthouse-lambda](https://github.com/Otterseer/lighthouse-lambda)** - Run Lighthouse on AWS Lambda with prebuilt stable desktop Headless Chrome.
411
411
  * **[lighthouse-matchers](https://github.com/ackama/lighthouse-matchers)** - Provides RSpec matchers for executing and evaluating Google Chrome Lighthouse audit scores.
412
- * **[lighthouse-mocha-example](https://github.com/rishichawda/lighthouse-mocha-example)** - Run Lighthouse performance tests with Mocha and chrome-launcher.
413
- * **[lighthouse-monitor](https://github.com/verivox/lighthouse-monitor)** - Run Lighthouse against all your URLs. Send metrics to any backend you want, save all reports with automatic data retention, and compare any two results in a web UI.
414
412
  * **[lighthouse-persist](https://github.com/foo-software/lighthouse-persist)** - Run Lighthouse and upload HTML reports to an AWS S3 bucket.
415
413
  * **[lighthouse-viewer](https://github.com/dvelasquez/lighthouse-viewer/tree/main/packages/lighthouse-viewer)** - Render the Lighthouse JSON into a report, using the Lighthouse Report Renderer repackaged as UMD and ESM. Also available with React, Svelte and Vue wrappers.
416
- * **[lighthouse4u](https://github.com/godaddy/lighthouse4u)** - LH4U provides Google Lighthouse as a service, surfaced by both a friendly UI+API, and backed by Elastic Search for easy querying and visualization.
417
- * **[react-lighthouse-viewer](https://www.npmjs.com/package/react-lighthouse-viewer)** - Render a Lighthouse JSON report in a React Component.
414
+ * **[react-lighthouse-viewer](https://github.com/blencorp/react-lighthouse-viewer)** - Render a Lighthouse JSON report in a React Component.
418
415
  * **[site-audit-seo](https://github.com/viasite/site-audit-seo)** - CLI tool for SEO site audit, crawl site, lighthouse each page. Output to console and tables in csv, xlsx, json, web or Google Drive.
419
- * **[webpack-lighthouse-plugin](https://github.com/addyosmani/webpack-lighthouse-plugin)** - Run Lighthouse from a Webpack build.
420
- * **[cypress-audit](https://github.com/mfrachet/cypress-audit)** - Run Lighthouse and Pa11y audits directly in your E2E test suites.
421
- * **[laravel-lighthouse](https://github.com/adityadees/laravel-lighthouse)** - Google Lighthouse wrapper for laravel framework to run Google Lighthouse CLI with custom option and can automatically save result in your server directory.
422
- * **[Neodymium](https://github.com/Xceptance/neodymium/wiki/Accessibility)** - The Neodymium test automation framework integrates Lighthouse for accessibility and Web Vitals verification, allowing programmatic validation and assertion of all audit values.
416
+ * **[Neodymium](https://docs.xceptance.com/neodymium/features/accessibility/)** - The Neodymium test automation framework integrates Lighthouse for accessibility and Web Vitals verification, allowing programmatic validation and assertion of all audit values.
423
417
 
424
418
  ## FAQ
425
419
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS.
2
+ * Generate a filenamePrefix of hostname-pathname_YYYY-MM-DD_HH-MM-SS.
3
3
  * @param {{finalDisplayedUrl: string, fetchTime: string}} lhr
4
4
  * @return {string}
5
5
  */
@@ -34,13 +34,14 @@ function getFilenamePrefix(name, fetchTime) {
34
34
  }
35
35
 
36
36
  /**
37
- * Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS.
37
+ * Generate a filenamePrefix of hostname-pathname_YYYY-MM-DD_HH-MM-SS.
38
38
  * @param {{finalDisplayedUrl: string, fetchTime: string}} lhr
39
39
  * @return {string}
40
40
  */
41
41
  function getLhrFilenamePrefix(lhr) {
42
- const hostname = new URL(lhr.finalDisplayedUrl).hostname;
43
- return getFilenamePrefix(hostname, lhr.fetchTime);
42
+ const {hostname, pathname} = new URL(lhr.finalDisplayedUrl);
43
+ const name = hostname + pathname.replace(/\/$/, '');
44
+ return getFilenamePrefix(name, lhr.fetchTime);
44
45
  }
45
46
 
46
47
  /**
@@ -226,7 +226,8 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
226
226
  * @return {Element|null}
227
227
  */
228
228
  renderFilterableSection(category, groups, groupNames, metricAudits) {
229
- if (groupNames.some(groupName => !groups[groupName])) return null;
229
+ groupNames = groupNames.filter(groupName => Boolean(groups[groupName]));
230
+ if (!groupNames.length) return null;
230
231
 
231
232
  const element = this.dom.createElement('div');
232
233
 
@@ -36,7 +36,7 @@ async function toBase64(string, options) {
36
36
  } else {
37
37
  /** @type {typeof import('pako')=} */
38
38
  const pako = window.pako;
39
- bytes = /** @type {any} */ (pako.gzip(string));
39
+ bytes = pako.gzip(string);
40
40
  }
41
41
  }
42
42
 
@@ -62,7 +62,7 @@ function fromBase64(encoded, options) {
62
62
  if (options.gzip) {
63
63
  /** @type {typeof import('pako')=} */
64
64
  const pako = window.pako;
65
- return pako.ungzip(bytes, {to: 'string'});
65
+ return pako.ungzip(bytes, {toText: true});
66
66
  } else {
67
67
  return new TextDecoder().decode(bytes);
68
68
  }
@@ -11,3 +11,7 @@
11
11
 
12
12
  // Import to augment querySelector/querySelectorAll with stricter type checking.
13
13
  import '../../types/internal/query-selector';
14
+
15
+ declare global {
16
+ var pako: typeof import('pako');
17
+ }
@@ -708,7 +708,7 @@
708
708
  "message": "Baseline Status"
709
709
  },
710
710
  "core/audits/baseline.js | description": {
711
- "message": "Lists web features used on the page and their Baseline status as of {date}. [Learn more about Baseline](https://webstatus.dev/)."
711
+ "message": "Lists web features used on the page and their Baseline status as of {date}. [Learn more about Baseline](https://developer.chrome.com/docs/lighthouse/best-practices/baseline-features)."
712
712
  },
713
713
  "core/audits/baseline.js | title": {
714
714
  "message": "Baseline Features"
@@ -708,7 +708,7 @@
708
708
  "message": "B̂áŝél̂ín̂é Ŝt́ât́ûś"
709
709
  },
710
710
  "core/audits/baseline.js | description": {
711
- "message": "L̂íŝt́ŝ ẃêb́ f̂éât́ûŕêś ûśêd́ ôń t̂h́ê ṕâǵê án̂d́ t̂h́êír̂ B́âśêĺîńê śt̂át̂úŝ áŝ óf̂ {date}. [Ĺêár̂ń m̂ór̂é âb́ôút̂ B́âśêĺîńê](https://webstatus.dev/)."
711
+ "message": "L̂íŝt́ŝ ẃêb́ f̂éât́ûŕêś ûśêd́ ôń t̂h́ê ṕâǵê án̂d́ t̂h́êír̂ B́âśêĺîńê śt̂át̂úŝ áŝ óf̂ {date}. [Ĺêár̂ń m̂ór̂é âb́ôút̂ B́âśêĺîńê](https://developer.chrome.com/docs/lighthouse/best-practices/baseline-features)."
712
712
  },
713
713
  "core/audits/baseline.js | title": {
714
714
  "message": "B̂áŝél̂ín̂é F̂éât́ûŕêś"
package/tsconfig.json CHANGED
@@ -19,7 +19,6 @@
19
19
  "types.js",
20
20
  "./types/**/*.d.ts",
21
21
  "third-party/axe/valid-langs.js",
22
- "third-party/esbuild-plugins-polyfills/esbuild-polyfills.js",
23
22
  "third-party/ard/**/*.js",
24
23
 
25
24
  "core/test/results/sample_v2.json",
@@ -57,6 +57,10 @@ export interface CliFlags extends Flags {
57
57
  precomputedLanternDataPath?: string;
58
58
  /** Path to the file where precomputed lantern data should be written to. */
59
59
  lanternDataOutputPath?: string;
60
+ /** Path to a file containing newline-delimited URLs to audit. */
61
+ urlFile?: string[];
62
+ /** Flag to stop auditing remaining URLs immediately if a run fails. */
63
+ failFast?: boolean;
60
64
 
61
65
  // The following are given defaults in cli-flags, so are not optional like in Flags or SharedFlagsSettings.
62
66
  output: OutputMode[];
@@ -29,6 +29,7 @@ declare module 'expect' {
29
29
  */
30
30
  // tslint:disable-next-line: no-unnecessary-generics
31
31
  toMatchInlineSnapshot<U extends { [P in keyof T]: any }>(propertyMatchers: Partial<U>, snapshot?: string): R;
32
+ toMatchInlineSnapshot(snapshot?: string): R;
32
33
 
33
34
  // The following are custom matchers defined in expect-setup.js
34
35
 
@@ -1,3 +0,0 @@
1
- MIT
2
-
3
- https://github.com/remorses/esbuild-plugins/blob/d757c3bf5dff37a754d254168d4a3d88611e8175/package.json#L37
@@ -1,7 +0,0 @@
1
- # @esbuild-plugins/node-modules-polyfill
2
-
3
- This is `@esbuild-plugins/node-modules-polyfill`, with the following changes:
4
-
5
- - using a better library for polyfills as proposed by this PR ... https://github.com/remorses/esbuild-plugins/pull/19
6
- - ...but there are a couple correctness changes on top of the above PR, as described here: https://github.com/remorses/esbuild-plugins/pull/19#discussion_r990493080 (the PR has landed but is still broken for our use case)
7
- - File converted from TS to JS
@@ -1,9 +0,0 @@
1
- export function nodeModulesPolyfillPlugin(options?: {}): {
2
- name: any;
3
- setup: ({ onLoad, onResolve, initialOptions }: {
4
- onLoad: any;
5
- onResolve: any;
6
- initialOptions: any;
7
- }) => void;
8
- };
9
- //# sourceMappingURL=esbuild-polyfills.d.ts.map
@@ -1,129 +0,0 @@
1
- // @ts-nocheck
2
- /* eslint-disable */
3
-
4
- import path from 'path';
5
-
6
- import escapeStringRegexp from 'escape-string-regexp';
7
- import {getModules as builtinsPolyfills} from 'rollup-plugin-polyfill-node/dist/modules.js';
8
- import polyfillLib from 'rollup-plugin-polyfill-node/dist/polyfills.js';
9
-
10
- const NAME = 'node-modules-polyfills';
11
- const NAMESPACE = NAME;
12
-
13
- function removeEndingSlash(importee) {
14
- if (importee && importee.slice(-1) === '/') {
15
- importee = importee.slice(0, -1);
16
- }
17
- return importee;
18
- }
19
-
20
- function nodeModulesPolyfillPlugin(
21
- options = {}
22
- ) {
23
- const {namespace = NAMESPACE, name = NAME} = options;
24
- if (namespace.endsWith('commonjs')) {
25
- throw new Error(`namespace ${namespace} must not end with commonjs`);
26
- }
27
- // this namespace is needed to make ES modules expose their default export to require: require('assert') will give you import('assert').default
28
- const commonjsNamespace = namespace + '-commonjs';
29
- const polyfilledBuiltins = builtinsPolyfills();
30
- const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()];
31
-
32
- return {
33
- name,
34
- setup: function setup({onLoad, onResolve, initialOptions}) {
35
- // polyfills contain global keyword, it must be defined
36
- if (initialOptions?.define && !initialOptions.define?.global) {
37
- initialOptions.define['global'] = 'globalThis';
38
- } else if (!initialOptions?.define) {
39
- initialOptions.define = {global: 'globalThis'};
40
- }
41
-
42
- // TODO these polyfill module cannot import anything, is that ok?
43
- async function loader(
44
- args
45
- ) {
46
- try {
47
- const isCommonjs = args.namespace.endsWith('commonjs');
48
-
49
- const key = removeEndingSlash(args.path);
50
- const contents = polyfilledBuiltins.get(key) || polyfillLib[key + '.js'];
51
- const resolveDir = path.dirname(key);
52
-
53
- if (isCommonjs) {
54
- return {
55
- loader: 'js',
56
- contents: commonJsTemplate({
57
- importPath: args.path,
58
- }),
59
- resolveDir,
60
- };
61
- }
62
- return {
63
- loader: 'js',
64
- contents,
65
- resolveDir,
66
- };
67
- } catch (e) {
68
- console.error('node-modules-polyfill', e);
69
- return {
70
- contents: `export {}`,
71
- loader: 'js',
72
- };
73
- }
74
- }
75
- onLoad({filter: /.*/, namespace}, loader);
76
- onLoad({filter: /.*/, namespace: commonjsNamespace}, loader);
77
- const filter = new RegExp(
78
- polyfilledBuiltinsNames.map(escapeStringRegexp).join('|') // TODO builtins could end with slash, keep in mind in regex
79
- );
80
- async function resolver(args) {
81
- const ignoreRequire = args.namespace === commonjsNamespace;
82
-
83
- let key;
84
- if (args.path.startsWith('\0polyfill-node.')) {
85
- key = args.path.replace('\0polyfill-node.', '');
86
- } else {
87
- if (args.path.startsWith('.')) {
88
- key = path.join(path.dirname(args.importer), args.path);
89
- } else {
90
- key = args.path;
91
- }
92
- }
93
-
94
- if (!polyfilledBuiltins.has(key) && !polyfillLib[key + '.js']) {
95
- return;
96
- }
97
-
98
- const isCommonjs =
99
- !ignoreRequire && args.kind === 'require-call';
100
-
101
- return {
102
- namespace: isCommonjs ? commonjsNamespace : namespace,
103
- path: key,
104
- };
105
- }
106
- onResolve({filter}, resolver);
107
- onResolve({filter: /.*/, namespace}, resolver);
108
- },
109
- };
110
- }
111
-
112
- function commonJsTemplate({importPath}) {
113
- return `
114
- const polyfill = require('${importPath}')
115
-
116
- if (polyfill && polyfill.default) {
117
- module.exports = polyfill.default
118
- for (let k in polyfill) {
119
- module.exports[k] = polyfill[k]
120
- }
121
- } else if (polyfill) {
122
- module.exports = polyfill
123
- }
124
-
125
-
126
- `;
127
- }
128
-
129
- export {nodeModulesPolyfillPlugin};
@@ -1,13 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- type Locale = import('../lhr/settings.js').Locale;
8
-
9
- declare module 'lookup-closest-locale' {
10
- function lookupClosestLocale(locale: string[]|string|undefined, available: Record<Locale, any>): Locale|undefined;
11
-
12
- export = lookupClosestLocale;
13
- }