Skip to content

Commit 017c335

Browse files
committed
feat(ipx): compatible with 0.7.x
1 parent 695c616 commit 017c335

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"fs-extra": "^10.0.0",
3030
"hasha": "^5.2.2",
3131
"image-meta": "^0.0.1",
32-
"ipx": "^0.7.0",
32+
"ipx": "^0.7.1",
3333
"is-https": "^4.0.0",
3434
"lru-cache": "^6.0.0",
3535
"node-fetch": "^2.6.1",

src/runtime/providers/ipx.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ProviderGetImage } from 'src'
2-
import { joinURL, encodeQueryItem, encodePath } from 'ufo'
2+
import { joinURL, encodePath, encodeParam } from 'ufo'
33
import { createOperationsGenerator } from '~image'
44

55
const operationsGenerator = createOperationsGenerator({
@@ -12,21 +12,21 @@ const operationsGenerator = createOperationsGenerator({
1212
quality: 'q',
1313
background: 'b'
1414
},
15-
joinWith: '&',
16-
formatter: (key, val) => encodeQueryItem(key, val)
15+
joinWith: ',',
16+
formatter: (key, val) => encodeParam(key) + '_' + encodeParam(val)
1717
})
1818

1919
export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL = '/_ipx' } = {}, { nuxtContext: { base: nuxtBase = '/' } = {} }) => {
2020
if (modifiers.width && modifiers.height) {
21-
modifiers.resize = `${modifiers.width}_${modifiers.height}`
21+
modifiers.resize = `${modifiers.width}x${modifiers.height}`
2222
delete modifiers.width
2323
delete modifiers.height
2424
}
2525

2626
const params = operationsGenerator(modifiers)
2727

2828
return {
29-
url: joinURL(nuxtBase, baseURL, encodePath(src) + (params ? '?' + params : ''))
29+
url: joinURL(nuxtBase, baseURL, params, encodePath(src))
3030
}
3131
}
3232

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6619,10 +6619,10 @@ ip@^1.1.5:
66196619
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
66206620
integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=
66216621

6622-
ipx@^0.7.0:
6623-
version "0.7.0"
6624-
resolved "https://registry.yarnpkg.com/ipx/-/ipx-0.7.0.tgz#a8b93161d7bf1e179297104bd2a744624ed5960d"
6625-
integrity sha512-qR8bsoIgbCL+CAocXCVvQkWnvE4q8A2Tu1Ltx0HJPnTYpRG4HihOilGQVzuqxs0Vn89MVFOZ7JR4MFplFwoFZQ==
6622+
ipx@^0.7.1:
6623+
version "0.7.1"
6624+
resolved "https://registry.yarnpkg.com/ipx/-/ipx-0.7.1.tgz#58c5f2791cf616b3bed0d48f95e19455ccf581fb"
6625+
integrity sha512-Vwegvv14h5xL9AisCp3v8fh87Tbne40qZFTf2Z/kYs4p5i/eZznbk3slNgNoPyv7cAfVVnjFWTLwnxMkYf3rpw==
66266626
dependencies:
66276627
consola "^2.15.3"
66286628
defu "^5.0.0"

0 commit comments

Comments
 (0)