Skip to content
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

feat: dropping support for node 16 #421

Merged
merged 1 commit into from
Sep 11, 2023
Merged

feat: dropping support for node 16 #421

merged 1 commit into from
Sep 11, 2023

Conversation

erunion
Copy link
Member

@erunion erunion commented Sep 11, 2023

🧰 Changes

Now that Node 16 is hitting EOL today1 we can now drop support for it and all of the quirky behavior that we've had to introduce to support non-native fetch solutions through node-fetch, form-data, and formdata-encoder.

This library now just supports pure fetch. 🐬

Footnotes

  1. https://endoflife.date/nodejs

@erunion erunion added the enhancement New feature or request label Sep 11, 2023
@erunion erunion requested a review from kanadgupta September 11, 2023 22:22
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took me a while to digest this (see some of my real time reaction in the comments) but overall LGTM! can't wait until this repo will start needing test suites for other runtime environments like bun + deno 😵‍💫

"optionalDependencies": {
"formdata-node": "^4.3.2"
"readable-stream": "^3.6.0",
"undici": "^5.24.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't you only pulling types from undici? could this be a dev-dep?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's pulling the File API out of undici if we don't have it -- which will be all Node environments because native fetch doesn't ship that. But it ships a global FormData? 🤷

}
}

if (!globalThis.File) {
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies
globalThis.File = require('formdata-node').File;
// Node's native `fetch` implementation unfortunately does not make this API global so we need
Copy link
Member

@kanadgupta kanadgupta Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah damn wait i think you answered this question i had lol — kinda confusing how undici is a separate npm package

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why weren't browser tests working in this file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented them out when I did the Vitest migration a few weeks back because I couldn't get @vitest/browser working and didn't feel at the time like debugging why.

},
"optionalDependencies": {
"formdata-node": "^4.3.2"
"readable-stream": "^3.6.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no way to conditionally load this right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do an await import() but I think even if this source gets compiled by Webpack it would still have to load it in the compiled source.

@erunion erunion merged commit 3aa296d into main Sep 11, 2023
7 checks passed
@erunion erunion deleted the feat/drop-node16 branch September 11, 2023 22:46
@kanadgupta kanadgupta mentioned this pull request Sep 27, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants