Skip to content

fix: warn in dev mode if density is provided above 2x - #973

Merged
danielroe merged 5 commits into
mainfrom
fix/warn-density-2+
Sep 10, 2023
Merged

fix: warn in dev mode if density is provided above 2x#973
danielroe merged 5 commits into
mainfrom
fix/warn-density-2+

Conversation

@danielroe

Copy link
Copy Markdown
Member

resolves #912

This PR warns in dev mode if user is setting a density > 2x, linking to https://observablehq.com/@eeeps/visual-acuity-and-device-pixel-ratio.

It doesn't hard-disable this although this might be something we consider in future.

This also refactors the density parsing expression slightly to use a Set for deduplicating.

@danielroe danielroe added the enhancement New feature or request label Sep 9, 2023
@danielroe
danielroe requested review from kara and pi0 September 9, 2023 13:56
@danielroe danielroe self-assigned this Sep 9, 2023
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 9, 2023

Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 486f8a1
Status: ✅  Deploy successful!
Preview URL: https://2077866c.nuxt-image.pages.dev
Branch Preview URL: https://fix-warn-density-2.nuxt-image.pages.dev

View logs

@codecov-commenter

codecov-commenter commented Sep 9, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 88.23% and project coverage change: -0.04% ⚠️

Comparison is base (576aaf3) 89.18% compared to head (486f8a1) 89.15%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #973      +/-   ##
==========================================
- Coverage   89.18%   89.15%   -0.04%     
==========================================
  Files          44       44              
  Lines        2904     2914      +10     
  Branches      322      324       +2     
==========================================
+ Hits         2590     2598       +8     
- Misses        313      315       +2     
  Partials        1        1              
Files Changed Coverage Δ
src/runtime/utils/index.ts 76.86% <86.66%> (+0.63%) ⬆️
src/runtime/image.ts 86.02% <100.00%> (-0.11%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread src/runtime/utils/index.ts Outdated
Comment thread src/runtime/utils/index.ts Outdated
danielroe and others added 2 commits September 10, 2023 13:20
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
@danielroe
danielroe merged commit b0a8c4a into main Sep 10, 2023
@danielroe
danielroe deleted the fix/warn-density-2+ branch September 10, 2023 13:57
@danielroe danielroe mentioned this pull request Sep 13, 2023
riddla pushed a commit to tricks-gmbh/nuxt-image that referenced this pull request Mar 1, 2024
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set reasonable cap for density-based srcsets

3 participants