perf: deprecate mime_guess in favor of a lighter guessing function.#1698
perf: deprecate mime_guess in favor of a lighter guessing function.#1698IWANABETHATGUY merged 3 commits intorolldown:mainfrom
mime_guess in favor of a lighter guessing function.#1698Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
mime_more crate to handle dataurl.
|
I will suggest to inline this package if code is proven to be better. However, in this case, using outside crate is not friendly for future maintaining, if we want to change something. |
|
Ok. How about using the crate's Other implementations are the same as the original one in this repo. |
mime_more crate to handle dataurl.mime_more crate to guess mime.
If it's better I will suggest just copy those code to rolldown's repo. Using outside crate is not friendly for future maintaining, if we want to change something. |
|
OK, I see. |
ad0b8ca to
27f72ef
Compare
mime_more crate to guess mime.mime_guess in favor of a lighter guessing function.
|
All snapshot you could found under https://github.com/evanw/esbuild/tree/main/internal/bundler_tests/snapshots, just convert our snake_case into PascalCase and prefix with |
|
Okay, thanks. I will fix them when I'm free. |
|
It should be a problem in our test case, and sadly I don't have a way to handle it (indistinguishable file is not supported in GitHub, see it in #1668). In esbuild, the hexString := "\x48\x65\x6C\x6C\x6F"The |
Looks like our output is already wrong before https://github.com/rolldown/rolldown/pull/1668/files#diff-d0d7250843734347c76a1838a8e0b2d2f19752da56098bfea90a4e9fc7ac67c0L18, ---------- /out.js ----------
// test.custom
var require_test = __commonJS({
"test.custom"(exports, module) {
module.exports = "data:application/octet-stream;base64,YQBigGP/ZA==";
}
});
// entry.js
console.log(require_test()); |
Even if before #1668, the behavior with the test may still be "incorrect" because we may regard every |
71bc2e2 to
d2f48bf
Compare
I wrapped the
mime, andinfercrate tomime_more(benchmark result also in README). It also provides lighter mime guessing functions, with the benchmark from usingmime_guessin about 289 ns to 37 ns and less rare extensions.Also, the behavior of the Data URL is aligned with esbuild (except the percent decoding).