diff --git a/package-lock.json b/package-lock.json index 7b1b6eb..c98cd0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@melt-ui/pp": "^0.3.2", "@melt-ui/svelte": "^0.86.6", "@oddbird/popover-polyfill": "^0.6.1", - "@projectwallace/css-analyzer": "^7.6.0", + "@projectwallace/css-analyzer": "^7.6.3", "@projectwallace/css-code-coverage": "^0.8.2", "@projectwallace/css-code-quality": "^3.0.2", "@projectwallace/css-design-tokens": "^0.10.0", @@ -1351,9 +1351,9 @@ "license": "MIT" }, "node_modules/@projectwallace/css-analyzer": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@projectwallace/css-analyzer/-/css-analyzer-7.6.0.tgz", - "integrity": "sha512-up4GNW2WM/L0cKBrwhoKKcKB+Q9gRvlL9+llGRh9wZraUSzlJSoVvv76Olsx6K/gfQjZZxQiwQEBwcsVcVfDlg==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@projectwallace/css-analyzer/-/css-analyzer-7.6.3.tgz", + "integrity": "sha512-v8Ss33dj1+8TcRh6oHWMDIXHhl1ER8QAT6u1jREDMAE2yYCC8pQG7eIynErcoy2CamgNyQWml0ka6FEyluUqCQ==", "license": "MIT", "dependencies": { "@bramus/specificity": "^2.4.2", diff --git a/package.json b/package.json index 997107b..7eaa148 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@melt-ui/pp": "^0.3.2", "@melt-ui/svelte": "^0.86.6", "@oddbird/popover-polyfill": "^0.6.1", - "@projectwallace/css-analyzer": "^7.6.0", + "@projectwallace/css-analyzer": "^7.6.3", "@projectwallace/css-code-coverage": "^0.8.2", "@projectwallace/css-code-quality": "^3.0.2", "@projectwallace/css-design-tokens": "^0.10.0", @@ -63,6 +63,7 @@ "vitest": "^4.0.6" }, "overrides": { + "@projectwallace/css-analyzer": "$@projectwallace/css-analyzer", "runed": "$runed" } } diff --git a/src/lib/components/stats/ColorTable.svelte b/src/lib/components/stats/ColorTable.svelte index 4ed6791..b2b2cac 100644 --- a/src/lib/components/stats/ColorTable.svelte +++ b/src/lib/components/stats/ColorTable.svelte @@ -6,6 +6,7 @@ import type { NormalizedColorWithAuthored } from 'color-sorter' import type { CssLocation } from '$lib/css-location' import ShowMore from '$components/ShowMore.svelte' + import type { UniqueWithLocations } from '@projectwallace/css-analyzer' let { items = Object.create(null), @@ -19,7 +20,7 @@ unique: { converted: NormalizedColorWithAuthored; locations: CssLocation[] }[] total: number totalUnique: number - uniqueWithLocations: Record + uniqueWithLocations: UniqueWithLocations } let max_colors = $derived.by(() => { @@ -50,13 +51,12 @@ >( Object.entries(items) .sort((a, b) => b[1].total - a[1].total) - // @ts-expect-error We _know_ that the value is an Item .map(([property, item]: [string, Item]) => { let unique = [] as { converted: { authored: string }; locations: ArrayLike }[] for (let [value, locations] of Object.entries(item.uniqueWithLocations)) { unique.push({ converted: { authored: value }, - locations: new Uint8Array(locations.length) + locations: new Uint8Array((locations as {}[]).length) }) } return [ diff --git a/src/lib/components/stats/FontFaces.svelte b/src/lib/components/stats/FontFaces.svelte index 230ed37..2f0c19a 100644 --- a/src/lib/components/stats/FontFaces.svelte +++ b/src/lib/components/stats/FontFaces.svelte @@ -10,6 +10,7 @@ import { get_css_state } from '$lib/css-state.svelte' import { hash } from '$lib/hash' import { string_sort } from '$lib/string-sort' + import type { Location } from '@projectwallace/css-analyzer' let css_state = get_css_state() let selected_item = $derived(css_state.selected_item) @@ -112,7 +113,7 @@ type: 'font-face', node_type: 'atrule', value, - locations: item[1] + locations: item[1] as Location[] }) } } diff --git a/src/lib/components/stats/Properties.svelte b/src/lib/components/stats/Properties.svelte index c3eeb43..1a05e55 100644 --- a/src/lib/components/stats/Properties.svelte +++ b/src/lib/components/stats/Properties.svelte @@ -49,16 +49,16 @@ let filtered = $derived.by(() => { switch (visibility_filter) { case show_hacks: - return Object.entries(browserhacks[LOCATIONS_PROP_NAME]!) + return Object.entries(browserhacks[LOCATIONS_PROP_NAME]) case show_custom: - return Object.entries(custom[LOCATIONS_PROP_NAME]!) + return Object.entries(custom[LOCATIONS_PROP_NAME]) case show_prefixed: - return Object.entries(prefixed[LOCATIONS_PROP_NAME]!) + return Object.entries(prefixed[LOCATIONS_PROP_NAME]) case show_shorthands: return shorthand_properties } return Object.entries(uniqueWithLocations) - }) + }) as [string, CssLocation[]][]
diff --git a/src/lib/components/stats/Radiuses.svelte b/src/lib/components/stats/Radiuses.svelte index aebe16c..e087375 100644 --- a/src/lib/components/stats/Radiuses.svelte +++ b/src/lib/components/stats/Radiuses.svelte @@ -25,7 +25,6 @@ let { itemsPerContext } = $derived(items) let flattened = $derived( Object.entries(itemsPerContext).flatMap(([property, data]) => { - // @ts-expect-error Incorrect type from analyze-css let uniqueWithLocations = data.uniqueWithLocations as Record return Object.entries(uniqueWithLocations).map(([value, locations]) => { return {