Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assets: rework mime-type detection to be consistent/centralized; add support for webp/webm, apng, avif #3730

Merged
merged 3 commits into from May 13, 2024

Conversation

mimecuvalo
Copy link
Collaborator

As I started working on image LOD stuff and wrapping my head around the codebase, this was bothering me.

  • there are missing popular types, especially WebP
  • there are places where we're copy/pasting the same list of types but they can get out-of-date with each other (also, one place described supporting webm but we didn't actually do that)

This adds animated apng/avif detection as well (alongside our animated gif detection). Furthermore, it moves the gif logic to be alongside the png logic (they were in separate packages unnecessarily)

Change Type

  • sdk — Changes the tldraw SDK
  • dotcom — Changes the tldraw.com web app
  • docs — Changes to the documentation, examples, or templates.
  • vs code — Changes to the vscode plugin
  • internal — Does not affect user-facing stuff
  • bugfix — Bug fix
  • feature — New feature
  • improvement — Improving existing features
  • chore — Updating dependencies, other boring stuff
  • galaxy brain — Architectural changes
  • tests — Changes to any test code
  • tools — Changes to infrastructure, CI, internal scripts, debugging tools, etc.
  • dunno — I don't know

Release Notes

  • Images: unify list of acceptable types and expand to include webp, webm, apng, avif

Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview May 13, 2024 8:25am
1 Ignored Deployment
Name Status Preview Updated (UTC)
tldraw-docs ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 8:25am

@huppy-bot huppy-bot bot added improvement Improves existing features sdk Affects the tldraw sdk labels May 9, 2024
Copy link
Contributor

@MitjaBezensek MitjaBezensek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 💅

Just checked the webp support, seems quite high already.
image

return false
}

// globalThis.isApng = isApng
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some leftover tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is from the open-source library ¯\(ツ)
i think they put it here as an example of usage

@mimecuvalo mimecuvalo enabled auto-merge May 13, 2024 08:24
@mimecuvalo mimecuvalo added this pull request to the merge queue May 13, 2024
Merged via the queue into main with commit d2d3e58 May 13, 2024
10 checks passed
@mimecuvalo mimecuvalo deleted the mime/image-types branch May 13, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves existing features sdk Affects the tldraw sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants