-
Notifications
You must be signed in to change notification settings - Fork 270
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(ipx): support nuxt layers #1177
Conversation
@pi0 Migratated the PR to use unjs/ipx#203. Tested locally with ipx@2.1.0, I did not want to update deps as part of feature, assuming they gonna be bumped independently. I've also tried to mimic the style from your commits on my other PRs, minimal diff, helper functions after main one, do not break logic if not necessary. Hope it fits your vision :) Also kept the TODO comment, since we reverted back to ipx's fs driver. |
Amazing thanks for efforts. Will double check in the meantime feel free to bump dep in same PR should be fine. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1177 +/- ##
==========================================
+ Coverage 68.90% 69.01% +0.10%
==========================================
Files 75 75
Lines 4245 4266 +21
Branches 393 399 +6
==========================================
+ Hits 2925 2944 +19
- Misses 1293 1295 +2
Partials 27 27 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing ❤️ 🔥
Sorry for not pushing the update myself, got caught in other work 😅 |
Not to worry! This is a great improvement. ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than two above comments looks nice thanks for helping on this ❤️
* Pin to nuxt/image 1.2.0, since 1.3.0 breaks IPX rendering. Most likely due to nuxt/image#1177. * Add an explicit resolution for jackspeak to work around nuxt/nuxt#21231.
* Pin to nuxt/image 1.2.0, since 1.3.0 breaks IPX rendering. Most likely due to nuxt/image#1177. * Add an explicit resolution for jackspeak to work around nuxt/nuxt#21231.
Issue: #940
The issue is caused by IPX receiving only the root
public
directory. IPX'snode-fs
storage does not support multiple directories. I've migrated tounstorage
(as per TODO left in comment. Next I implementedcombine
driver which combines multiple unstorage storages, at least the parts which gets used by IPX.Considerations
The performance of
combine
driver is probably a bit worse than if it was all single storage, but I do not think this is a big issue considering it gets enabled only in dev, when using layers with public assets. And even then, I do not think any degradation would be noticeable with sane number of images.Please notice
unstorage
added todevDependencies
. I am unsure where it belongs.ipx
isdevDependency
and is marked asexternal
inbuild.config.ts
. But I never had to installipx
separately when adding@nuxt/image
, not quite sure how it works.IPXRuntimeConfig
has changed. Please check if it makes sense. The is only onefs-lite
driver option that could be exposed (ignore
). As the directory is supposed to be deployed (public), I do not think there is a point in allowing@nuxt/image
user configuring underlying storage solution. Ignoring should be either dealt on module level or IPX. Not in provider configuration.I find the
image.dir
module option weird in context ofipx
code. Inmodule.ts
we resolve it to absolute path, but later inipx.ts
we resolve it again...? This also makes it impossible to resolve against layers. Docs have 3 notes explaining contexts the option does not work. Maybe it is a good idea to remove it and just recommend people to stick topublic
?@pi0 I could not figure out how to use
unstorageToIPXStorage
fromunstorage
. It requiresprefix
and does not translate/
to:
in path, making it unusable. It is probably a good idea to updateunstorage
with proper implementation and remove the makeshift one from here. Also a proper built-incombine
utility, ornode-fs-multiple
driver would have helped a lot.