-
Notifications
You must be signed in to change notification settings - Fork 196
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
Update mime to v2.2.0 #218
Conversation
A bunch of people depend on the mime files capability, though. Do you know of a way to mitigate this? |
I'm trying to dig up some relevant content and figure out who I have to at |
The most recent time we punted this #212 and I think it links to most of the relevant issues. I don't actually know how popular the mime files format is, or what it would take to replace it. Maybe we can find some people involved in the mime module we're using to comment on why they removed it? /cc @dotnetCarpenter @mk-pmb might be relevant to your interests? no obligation to comment etc |
It should also be noted that a bunch of the tests are failing 👇 |
Yeah, I just wanted to get the ball rolling on this again. I can look into fixing up the PR if there is interest.
It’s a breaking change for sure. Bumping the major version (per semver) would prevent those depending on this functionality from suffering any breakage. |
It prevents immediate breakage but also doesn't supply a migration path, which is still pretty unfortunate. |
I have an unstable branch where my migration strategy is to provide a hook for users to supply their own MIME lookup function, individual for each ecstatic instance. IIRC the old mime package had the problem of keeping a global database for itself, so all modules customizeing "their" MIME would also customize all other modules that use it. Bonus features I'd like to see soon[TM]:
|
Thenable's a good idea. Otherwise I guess we'd expect the v2 API, include a basic wrapper for the v1 API and drop cli support? That could be a reasonable compromise. |
In which way "expect"? We'd use the MIME v2 API for the default lookup of course. If users want to customize that lookup in any way, they can provide a function that looks up a MIME type by filename. If we're generous we can supply additional context about the ecstatic instance and/or current request as a 2nd argument. If they want to use the "mime" module (or any other) under the hood, its API is their problem. |
Sorry for the mixup. I meant the ecstatic instance, there's no FTP here. :-) |
Even better compromise: If the user MIME function yields a false-y result, that means ecstatic shall figure out on its own, using its default strategy (currently: mime v2). function customMime(filename) {
var fext = (filename.match(/\.(\w+)$/) || false)[1];
return ({
txt: 'text/comma-separated-values',
ico: 'image/bitmap',
})[fext || ''];
} |
oh I gotcha, we'd do I think as far as accepting thenables, I think that can be done in a separate PR. @mathiasbynens if this proposal makes sense to you, and I'm not missing something, and you want to implement this rq (it shouldn't be too bad, the options parsing is a bit involved but easy to copy), I'd merge it. |
As the default for |
without a default it would break, no? There's no behavior difference here. |
Yes, behavior is the same, it's just ninja protection. Avoiding to expose a useful MIME handler via config is just meant to help people not be overly "clever" by depending on an accidential API feature. |
Is the key blocker here the regression of the ability to load a custom The There are two conceivable approaches (so far 😉):
My preference would be for option 1 as the command line "signature" and expectations would be the same, but I can understand the motivations behind option 2. Thoughts? |
There's also
which was suggested by mk-pmb, who iirc is the most vocal person around this sort of functionality, so it works for me. |
This would be good to support WASM, as it still doesn't serve in Firefox with this server as far as I can tell. |
Closing in favor of #240 |
No description provided.