mime-types icon indicating copy to clipboard operation
mime-types copied to clipboard

feat!: move mime-db to peerDependencies

Open broofa opened this issue 1 year ago • 5 comments

See prior conversation at https://github.com/jshttp/mime-types/pull/114

broofa avatar Dec 11 '23 21:12 broofa

I think the main part the convo left off is how to work through dealing with multiple mime-types majors being in the dep tree at the same time and them wanting different mime-db majors.

So like we'd need to have mime-types support at minimum one major mime-db version prior each time or have a delicate dance of getting everything updated all in order. I would guess that express would always need form-data, then superagent, and finally supertest to all update their mime-types major before express itself could if multuple mime-db majors are not supported by mime-types.

dougwilson avatar Dec 11 '23 21:12 dougwilson

A challenge is that if mime-types depends on mime-db with "v1 or v2", eg, then npm's auto-installing logic will install v2 by default, so v1 users would be forced to be explicit with their dependency - which could arguably be considered a breaking change to v1 users.

ljharb avatar Dec 11 '23 22:12 ljharb

Yeah, that's kind of where my head went to. mime-types@next would have to be [email protected] aware (declare something like "mime-db": ">=1.0.0 <3.0.0 in its peerDependencies), to allow downstream modules to update without being blocked by upstream dependencies.

broofa avatar Dec 11 '23 22:12 broofa

I don't have a strong opinion either way here, but as we just published a new version of mime-db this came to my attention while I was updating it here. I would like to remove the pin (add ^) in the least so that we don't need to manually update here again, assuming no one is opposed. Removing the pin means we can at least reduce the impact of duplicates unless mime-db itself issues a major which seems likely to be really uncommon.

wesleytodd avatar Jul 12 '24 22:07 wesleytodd

Opened a PR with the above change: https://github.com/jshttp/mime-types/pull/126

wesleytodd avatar Jul 12 '24 22:07 wesleytodd