Skip to content

refactor: replace mime with mrmime for smaller bundle size#504

Open
raghavsharma29 wants to merge 1 commit into
tinyhttp:masterfrom
raghavsharma29:fix-mime-to-mrmime
Open

refactor: replace mime with mrmime for smaller bundle size#504
raghavsharma29 wants to merge 1 commit into
tinyhttp:masterfrom
raghavsharma29:fix-mime-to-mrmime

Conversation

@raghavsharma29

Copy link
Copy Markdown

Swaps the mime package for mrmime across res, type-is, accepts, and send packages. mrmime is ~5x smaller and provides equivalent functionality via lookup() as a drop-in replacement for mime's getType(), since only standard mime type lookups were needed.

Fixes #499

Summary

Replaces mime with mrmime across the codebase, as suggested in #499.

Why

mrmime is ~5x smaller than mime and provides everything needed here
via its lookup() function, equivalent to mime's getType(). Since
only standard mime type lookups are used (no custom type registration),
mrmime is a clean drop-in replacement.

Changes

  • packages/res/src/headers.ts
  • packages/res/src/util.ts
  • packages/type-is/src/index.ts
  • packages/accepts/src/index.ts
  • packages/send/src/sendFile.ts
  • Updated respective package.json dependencies in each affected package

Testing

  • Ran full build across all 18 workspace packages — all pass
  • Ran full test suite — 821 tests pass, 3 skipped (pre-existing skips,
    unrelated to this change)

Fixes #499

Swaps the mime package for mrmime across res, type-is, accepts, and
send packages. mrmime is ~5x smaller and provides equivalent
functionality via lookup() as a drop-in replacement for mime's
getType(), since only standard mime type lookups were needed.

Fixes tinyhttp#499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider to replace mime with mrmime if possible

1 participant