-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor busboy constructor - add esm #61
Conversation
Maybe if this helps for the approval:
|
yeah, it looks good, just need a bit of focus to review it throughly. also want to apply the infamous triplet pattern for cross cjs/esm support. |
Do you mean this? if (typeof define === 'function' && define.amd) {
define('Busboy', function () {
return Busboy;
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = Busboy;
module.exports.default = Busboy
module.exports.Busboy = Busboy;
} else {
global.Busboy = Busboy;
} |
we've been doing just the second branch without condition in the past. global doesn't seem applicable to node-only lib, do you find first branch useful? |
I just copied and modified it from another project. But yes you are right, the last one is for browser compatibility. |
AMD seems frontend-focused too. So I'd suggest keeping just the second branch without any checks. |
add infamous ejs, cjs triplet :) |
We also need to update TS types and add import tests. |
…pak/busboy into refactor-busboy-constructor
@kibertoad |
@Uzlopak I'm not so sure. |
@kibertoad |
@kibertoad
I know you assigned esm support, but i took the opportunity to also refactor the whole busboy constructor functionality and write corresponding unit tests.
It makes it also possible to set autoDestroy to true or false, if somebody wants to do that.
test coverage for main.js increases to 100%
Checklist
npm run test
andnpm run benchmark
and the Code of conduct