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. |
|
Sorry for not pushing the update myself, got caught in other work 😅 |
|
Not to worry! This is a great improvement. ❤️ |
pi0
left a comment
There was a problem hiding this comment.
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
publicdirectory. IPX'snode-fsstorage does not support multiple directories. I've migrated tounstorage(as per TODO left in comment. Next I implementedcombinedriver which combines multiple unstorage storages, at least the parts which gets used by IPX.Considerations
The performance of
combinedriver 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
unstorageadded todevDependencies. I am unsure where it belongs.ipxisdevDependencyand is marked asexternalinbuild.config.ts. But I never had to installipxseparately when adding@nuxt/image, not quite sure how it works.IPXRuntimeConfighas changed. Please check if it makes sense. The is only onefs-litedriver 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/imageuser configuring underlying storage solution. Ignoring should be either dealt on module level or IPX. Not in provider configuration.I find the
image.dirmodule option weird in context ofipxcode. Inmodule.tswe resolve it to absolute path, but later inipx.tswe 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
unstorageToIPXStoragefromunstorage. It requiresprefixand does not translate/to:in path, making it unusable. It is probably a good idea to updateunstoragewith proper implementation and remove the makeshift one from here. Also a proper built-incombineutility, ornode-fs-multipledriver would have helped a lot.