mime
mime copied to clipboard
Adding ESM support.
If you have an issue with a specific extension or type
Locate the definition for your extension/type in the db.json file in the mime-db
project. Does it look right?
- [ ] No. File a
mime-db
issue. - [x] Yes: Go ahead and submit your issue/PR here and I'll look into it.
@broofa any concerns about merging this one?
@broofa in the end it's about providing a es6-module-bundle on some URL, nothing more, nothing less. I would still be okay, to not mention deno as it might make allusion to any support neither you nor me are willing to give.
Also looke HERE where i used that branch already. It was quite straight forward. https://github.com/NMathar/deno-express/pull/4/files
@broofa what's the next move here?
@broofa i spent some time, refining the PR in the way we discussed.
As a result the type of present module is now explicitly declared as '"type": "commonjs"' (was like it by default). Thereby adopting merely the option presented here: https://2ality.com/2019/10/hybrid-npm-packages.html#support-for-esm, declaring '"module": "..."' as an extra.
The one thing left open to me is,which is gonna be the resulting URL after the releasing process. Can you help me predict it? It would then be documented as pattern for browser usage (which again is much similar to deno-import). Updating the README_js.md in this regards would be last TODO to handle.
Just to be clear – since some may be seeing this as a PR for adding native ESM support – this is only adding an ESM file, which could be used by bundlers that respect the module
entry field. Even for this target usecase, this PR is missing the lite.mjs
variant.
In order to add actual native ESM support, a number of other changes would have to be made. Doing so should warrant a 3.0 release since the addition of an exports
map can be a breaking change for Node 13.0 - 13.7 users (please upgrade if this is you). At this point, I (personally) consider adjusting the minimum engines
support and/or publishing to Deno.
@lukeed i rebased the PR, and added lite.mjs as suggested. rollup seems to have dropped node8 support, so that CI will not fully pass.
Regarding the releases, please refer to @broofa
Cheers, Jan
Hey Jan, my apologies for letting this PR languish like this. I'm not even going to pretend there's a good excuse for it. Just... again, my apologies.
I'm going to close this out now that I've released mime@4
(npm install
mime@beta`). It has full ESM support, as well as a few other goodies. I know asking you to take a look at provide feedback is pretty presumptuous, considering how I've ignored your contribution here, but I promise I'll be better about this in the future.
Cheers!