Skip to content

Commit fee826c

Browse files
committed
fix: add back layer0 and edgio providers (without) tests
This partially reverts commit 18dc3fb.
1 parent 1aad64f commit fee826c

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

src/provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const BuiltInProviders = [
2121
'cloudinary',
2222
'contentful',
2323
'directus',
24+
'edgio',
2425
'fastly',
2526
'filerobot',
2627
'glide',
@@ -31,6 +32,7 @@ const BuiltInProviders = [
3132
'imgix',
3233
'ipx',
3334
'ipxStatic',
35+
'layer0',
3436
'netlify',
3537
'netlifyLargeMedia',
3638
'netlifyImageCdn',

src/runtime/providers/edgio.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { joinURL } from 'ufo'
2+
import type { ProviderGetImage } from '../../module'
3+
import { createOperationsGenerator } from '#image'
4+
5+
const operationsGenerator = createOperationsGenerator({
6+
keyMap: {
7+
height: 'height',
8+
quality: 'quality',
9+
width: 'width',
10+
},
11+
joinWith: '&',
12+
formatter: (key, value) => String(value) === 'true' ? key : `${key}=${value}`,
13+
})
14+
15+
export const getImage: ProviderGetImage = (src, {
16+
modifiers = {},
17+
baseURL = 'https://opt.moovweb.net',
18+
} = {}) => {
19+
const operations = operationsGenerator(modifiers)
20+
21+
return {
22+
url: joinURL(baseURL, '?img=' + src + (operations ? ('&' + operations) : '')),
23+
}
24+
}

src/runtime/providers/layer0.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './edgio'

src/types/module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export interface ImageProviders {
110110
gumlet?: any
111111
imagekit?: any
112112
imgix?: any
113+
layer0?: any
114+
edgio?: any
113115
prismic?: any
114116
twicpics?: any
115117
storyblok?: any

0 commit comments

Comments
 (0)