chore(gatsby-source-wordpress): upgrade file-type to @^16
Description
Related Issues
[ch54707]
Hmm, this seems like the current code that make use file-type is just broken even with current version of that package - it now uses version 15 and it uses things that were removed in 14 - in particular FileType.minimumBytes is still used in the code, even tho it was removed in version 14 ( https://github.com/sindresorhus/file-type/releases/tag/v14.0.0 ):
https://github.com/gatsbyjs/gatsby/blob/8043d7e7f588eecfbc7d4a9d2cfadf10257e95af/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js#L290-L297
We have very similar code in https://github.com/gatsbyjs/gatsby/blob/8043d7e7f588eecfbc7d4a9d2cfadf10257e95af/packages/gatsby-core-utils/src/fetch-remote-file.ts#L221-L226 and that is already converted and is using new API - the code in wordpress plugin seems like copy of it that got stale (?)
@pieh yes it is a copy that got stale. Way back I made a copy to fix some bugs (back when it was source-wordpress-experimental) and then never PR'ed my fixes back 😅 I think possibly the solution here is to just remove the copy since most likely the bugs were fixed - I believe there was a mini overhaul of create-remote-file-node at some point after I made that copy
EDIT: iirc the bugs I saw were around retrying failed downloads, per-url there was a cache that never got cleared before and a retry counter that didn't get reset or something like that. So retrying later externally in the same process for a failed download would hang indefinitely