From ffde0542bef594b749a42ae32120f8aaee86dcaf Mon Sep 17 00:00:00 2001 From: Bart Veneman Date: Wed, 2 Dec 2026 11:24:09 +0100 Subject: [PATCH] chore(deps): update all deps --- package.json | 7 +++-- pnpm-lock.yaml | 42 +++++++++++++-------------- test/helpers/compose.ts | 12 ++++++-- test/helpers/fakes.ts | 16 +++++++--- test/helpers/powerset.ts | 4 ++- test/integration/link.test.ts | 4 ++- test/integration/permutations.test.ts | 4 ++- test/unit/error-handling.test.ts | 5 ++-- test/unit/link.test.ts | 5 ++-- 9 files changed, 61 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index ec56abe..09d6084 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,12 @@ "test:matrix": "vitest --project=matrix", "check": "tsc && tsc --project test", "lint": "oxlint && oxfmt --check", - "knip": "knip" + "knip": "knip", + "precommit": "pnpm test --run && pnpm lint && pnpm knip && pnpm check" }, "devDependencies": { - "@projectwallace/preset-oxlint": "^0.0.11", - "@types/node": "^26.6.5", + "@projectwallace/preset-oxlint": "^0.0.13", + "@types/node": "^26.6.10", "@vitest/coverage-v8": "^5.0.5", "knip": "^6.43.0", "oxfmt": "^0.80.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc1db43..f0d5d79 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -211,11 +211,11 @@ importers: .: devDependencies: '@projectwallace/preset-oxlint': - specifier: ^0.0.11 - version: 0.0.11(oxlint@1.95.0) + specifier: ^0.0.13 + version: 0.0.13(oxlint@1.95.0) '@types/node': - specifier: ^26.6.5 - version: 26.6.6 + specifier: ^26.6.10 + version: 26.6.10 '@vitest/coverage-v8': specifier: ^5.0.5 version: 5.1.1(vitest@5.1.1) @@ -245,10 +245,10 @@ importers: version: 7.0.2 vite: specifier: ^8.3.5 - version: 8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1) + version: 8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1) vitest: specifier: ^5.0.5 - version: 5.1.1(@types/node@26.6.6)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1)) + version: 5.1.1(@types/node@26.6.10)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1)) packages: @@ -783,8 +783,8 @@ packages: cpu: [x64] os: [win32] - '@projectwallace/preset-oxlint@0.0.11': - resolution: {integrity: sha512-hdrtBKSD3ctKkrug54PfHCJPl0jPs6Uw7Rdl/ZVGvim52jYUXp0lj2fTjEP9GVO1Hy3K/dyXKAeEvaFF1TlC4w==} + '@projectwallace/preset-oxlint@0.0.13': + resolution: {integrity: sha512-aVyVp2j1qjZEtKKyok2a5WYnArG+Hw1yjL/W0k2Q4sMzUMyt7z9iEg6aR9Nc0gVpknRsZfFRQrKQrZyq5n4pbQ==} peerDependencies: oxlint: ^1.0.0 @@ -1012,8 +1012,8 @@ packages: '@types/estree@1.0.9': resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} - '@types/node@26.6.6': - resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==} + '@types/node@26.6.10': + resolution: {integrity: sha512-WJuPHoGB8WNQuTksNF7SOQpnH02PXeDYz4iueWbBT6/hTWnShY5F3T/hoJA3fY9+uYReDZ7pyTKKx83jQa7aGg==} '@typescript/typescript-aix-ppc64@7.0.2': resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==} @@ -2002,7 +2002,7 @@ snapshots: '@oxlint/binding-win32-x64-msvc@1.95.0': optional: true - '@projectwallace/preset-oxlint@0.0.11(oxlint@1.95.0)': + '@projectwallace/preset-oxlint@0.0.13(oxlint@1.95.0)': dependencies: oxlint: 1.95.0 @@ -2134,7 +2134,7 @@ snapshots: '@types/estree@1.0.9': {} - '@types/node@26.6.6': + '@types/node@26.6.10': dependencies: undici-types: 8.9.0 @@ -2208,7 +2208,7 @@ snapshots: obug: 3.0.0 std-env: 4.3.0 tinyrainbow: 3.2.0 - vitest: 5.1.1(@types/node@26.6.6)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1)) + vitest: 5.1.1(@types/node@26.6.10)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1)) '@vitest/istanbul-lib-coverage@2.1.1': {} @@ -2216,14 +2216,14 @@ snapshots: dependencies: '@vitest/istanbul-lib-coverage': 2.1.1 - '@vitest/mocker@5.1.1(vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1))': + '@vitest/mocker@5.1.1(vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1))': dependencies: '@jridgewell/trace-mapping': 0.3.31 '@vitest/spy': 5.1.1 estree-walker: 3.0.3 magic-string: 1.4.5 optionalDependencies: - vite: 8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1) + vite: 8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1) '@vitest/spy@5.1.1': {} @@ -2657,7 +2657,7 @@ snapshots: verkit@0.5.0: {} - vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1): + vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1): dependencies: lightningcss: 1.33.0 picomatch: 4.0.7 @@ -2665,15 +2665,15 @@ snapshots: rolldown: 1.2.19 tinyglobby: 0.2.17 optionalDependencies: - '@types/node': 26.6.6 + '@types/node': 26.6.10 fsevents: 2.3.3 jiti: 2.7.0 yaml: 2.9.1 - vitest@5.1.1(@types/node@26.6.6)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1)): + vitest@5.1.1(@types/node@26.6.10)(@vitest/coverage-v8@5.1.1)(vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3 - '@vitest/mocker': 5.1.1(vite@8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1)) + '@vitest/mocker': 5.1.1(vite@8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1)) chai: 6.3.0 es-module-lexer: 2.3.2 expect-type: 1.4.0 @@ -2684,10 +2684,10 @@ snapshots: tinybench: 6.2.5 tinyexec: 1.3.1 tinyglobby: 0.2.17 - vite: 8.3.8(@types/node@26.6.6)(jiti@2.7.0)(yaml@2.9.1) + vite: 8.3.8(@types/node@26.6.10)(jiti@2.7.0)(yaml@2.9.1) why-is-node-running: 3.2.1 optionalDependencies: - '@types/node': 26.6.6 + '@types/node': 26.6.10 '@vitest/coverage-v8': 5.1.1(vitest@5.1.1) transitivePeerDependencies: - msw diff --git a/test/helpers/compose.ts b/test/helpers/compose.ts index c8bb0cb..780949b 100644 --- a/test/helpers/compose.ts +++ b/test/helpers/compose.ts @@ -4,8 +4,12 @@ import { INGREDIENTS } from './ingredients.ts' let counter = 0 function content_type_for(path: string): string { - if (path.endsWith('.css')) return 'text/css' - if (path.endsWith('.js')) return 'text/javascript' + if (path.endsWith('.css')) { + return 'text/css' + } + if (path.endsWith('.js')) { + return 'text/javascript' + } return 'text/plain' } @@ -17,7 +21,9 @@ function content_type_for(path: string): string { export function composePage(server: FixtureServer, ids: string[]): string { const chosen = ids.map((id) => { const ingredient = INGREDIENTS.find((candidate) => candidate.id === id) - if (!ingredient) throw new Error(`Unknown ingredient: ${id}`) + if (!ingredient) { + throw new Error(`Unknown ingredient: ${id}`) + } return ingredient }) diff --git a/test/helpers/fakes.ts b/test/helpers/fakes.ts index 52c6c4d..b35f9d0 100644 --- a/test/helpers/fakes.ts +++ b/test/helpers/fakes.ts @@ -30,7 +30,9 @@ export function fake_response(init: FakeResponseInit = {}): ResponseLike { headers: () => headers, request: () => request, text: () => { - if (typeof text === 'function') return text() + if (typeof text === 'function') { + return text() + } return Promise.resolve(text) }, } @@ -61,7 +63,9 @@ function fake_frame(init: FakeFrameInit, default_url: () => string): FrameLike { if (fn !== (read_page_css as unknown)) { return Promise.reject(new Error('fake frame can only evaluate read_page_css')) } - if (init.error) return Promise.reject(init.error) + if (init.error) { + return Promise.reject(init.error) + } return Promise.resolve((init.dom_entries ?? []) as never) }, } @@ -79,13 +83,17 @@ export function fake_page(init: FakePageInit = {}): PageLike { current_url = url const result = await init.goto?.(url, options) for (const response of init.responses ?? []) { - for (const listener of response_listeners) listener(response) + for (const listener of response_listeners) { + listener(response) + } } return result }, frames: () => frames, on(event, listener) { - if (event === 'response') response_listeners.add(listener as (response: ResponseLike) => void) + if (event === 'response') { + response_listeners.add(listener as (response: ResponseLike) => void) + } return this }, } diff --git a/test/helpers/powerset.ts b/test/helpers/powerset.ts index c8d31f9..10f3fb3 100644 --- a/test/helpers/powerset.ts +++ b/test/helpers/powerset.ts @@ -7,7 +7,9 @@ export function powerset(items: T[]): T[][] { for (let i = 0; i < n; i++) { if (mask & (1 << i)) { const item = items[i] - if (item !== undefined) subset.push(item) + if (item !== undefined) { + subset.push(item) + } } } result.push(subset) diff --git a/test/integration/link.test.ts b/test/integration/link.test.ts index f98a92f..0c4c782 100644 --- a/test/integration/link.test.ts +++ b/test/integration/link.test.ts @@ -9,7 +9,9 @@ let server: FixtureServer let page: TestPage // Media-conditioned sheets come back in network arrival order, which is not guaranteed. -const by_css = (a: CSSSource, b: CSSSource) => a.css.localeCompare(b.css) +function by_css(a: CSSSource, b: CSSSource) { + return a.css.localeCompare(b.css) +} beforeAll(async () => { server = await createFixtureServer() diff --git a/test/integration/permutations.test.ts b/test/integration/permutations.test.ts index 3faf937..21f82ee 100644 --- a/test/integration/permutations.test.ts +++ b/test/integration/permutations.test.ts @@ -11,7 +11,9 @@ const combos = powerset(INGREDIENTS.map((ingredient) => ingredient.id)) function ingredient_by_id(id: string) { const ingredient = INGREDIENTS.find((candidate) => candidate.id === id) - if (!ingredient) throw new Error(`Unknown ingredient: ${id}`) + if (!ingredient) { + throw new Error(`Unknown ingredient: ${id}`) + } return ingredient } diff --git a/test/unit/error-handling.test.ts b/test/unit/error-handling.test.ts index 806398c..2b41712 100644 --- a/test/unit/error-handling.test.ts +++ b/test/unit/error-handling.test.ts @@ -7,12 +7,13 @@ import { } from '../../src/index.ts' import { fake_page, fake_response } from '../helpers/fakes.ts' -const unreadable_response = (url: string) => - fake_response({ +function unreadable_response(url: string) { + return fake_response({ url, headers: { 'content-type': 'text/css' }, text: () => Promise.reject(new Error('body read failed')), }) +} describe('navigation', () => { test('scrape_css rejects with the error of a failed page.goto()', async () => { diff --git a/test/unit/link.test.ts b/test/unit/link.test.ts index b428726..3f3bd1c 100644 --- a/test/unit/link.test.ts +++ b/test/unit/link.test.ts @@ -3,8 +3,9 @@ import { scrape_css } from '../../src/index.ts' import { fake_page, fake_response } from '../helpers/fakes.ts' const href = 'https://example.test/style.css' -const css_response = (css = '.a {}') => - fake_response({ url: href, headers: { 'content-type': 'text/css' }, text: css }) +function css_response(css = '.a {}') { + return fake_response({ url: href, headers: { 'content-type': 'text/css' }, text: css }) +} // Whether a disabled stylesheet is fetched is up to the browser (Chromium 153 does, // Chromium 156 does not), so fake both behaviours instead of depending on the installed one.