Skip to content

refactor: allow @netlify/blobs v9 and v10 as peer dependency#640

Merged
pi0 merged 8 commits intounjs:mainfrom
serhalp:fix/support-netlify-blobs-v9-v10
Jul 14, 2025
Merged

refactor: allow @netlify/blobs v9 and v10 as peer dependency#640
pi0 merged 8 commits intounjs:mainfrom
serhalp:fix/support-netlify-blobs-v9-v10

Conversation

@serhalp
Copy link
Contributor

@serhalp serhalp commented Jun 25, 2025

Breaking changes are compatible with unstorage:

This also bumps the dev dep to latest while I'm at it.

@pi0
Copy link
Member

pi0 commented Jun 25, 2025

Nice! Anything left for draft PR? (we should check failing ci)

@pi0 pi0 changed the title fix(peerDeps): allow @netlify/blobs v9 and v10 build: allow @netlify/blobs v9 and v10 as peer dependency Jun 25, 2025
@pi0
Copy link
Member

pi0 commented Jun 25, 2025

Pushed commit to fix types

@serhalp
Copy link
Contributor Author

serhalp commented Jun 25, 2025

Yeah, I guess I need to adjust the netlify blobs driver options type to support some new options added in v10. I'll get to that soon.

@serhalp
Copy link
Contributor Author

serhalp commented Jun 25, 2025

oh heh I see you just pushed! I think we still need the driver options type to be compatible with all supported @netlify/blobs versions. We already have a pattern there with a union type. We just need to add to it.

This is the weird thing with peer dependencies... and CI won't capture this because we only (implicitly) test type compat via the calls in the test suite, which use only the dev dep version. 🤷🏼

@codecov
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.34%. Comparing base (70310f9) to head (895c605).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
+ Coverage   59.99%   61.34%   +1.34%     
==========================================
  Files          42       42              
  Lines        3657     3795     +138     
  Branches      590      632      +42     
==========================================
+ Hits         2194     2328     +134     
- Misses       1460     1464       +4     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +94 to +95
// TODO(serhalp): Allow drivers to return a value from `setItem`. The @netlify/blobs v10
// functionality isn't usable without this.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's get this merged and released as is for now, but it would be great to discuss this afterwards!

Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain why the functionality isn't usable? Aren't keys in netlify blobs predictable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Everything will "work" fine—it just won't be possible to leverage the new functionality in v10 because the user won't be able to access the return value {modified, etag} from set() and setJSON().

I think this is just a driver interface typing issue. It's marked as returning Promise<void> but we would need it to be something like <T = void>...Promise<T>.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Currently the interface is intentionally making sure bo return value so that any usage of drivers wont be vendor/driver specific and switching seamless.

We might later add vendor prefixed namespaces for users that really know what they do or a new API set for blobs (some providers don’t even have predictable key after upload it makes sense for them to return meta on set)

@serhalp serhalp marked this pull request as ready for review July 4, 2025 14:26
@serhalp
Copy link
Contributor Author

serhalp commented Jul 4, 2025

@pi0 I saw you changed this to build:. shouldn't this be fix?

@serhalp serhalp requested a review from pi0 July 4, 2025 14:27
@pi0 pi0 changed the title build: allow @netlify/blobs v9 and v10 as peer dependency refactor: allow @netlify/blobs v9 and v10 as peer dependency Jul 4, 2025
@43081j
Copy link
Member

43081j commented Jul 10, 2025

Maybe longer term, we can have a scheduled monthly workflow or something which force installs the various versions of peers we have, including latest

To then run regular tests

We don't need it on every ci build but it could help us catch upcoming compat problems etc too

@pi0 pi0 merged commit 925c83f into unjs:main Jul 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments