astro-lqip 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ImagePath = string | { src: string } | Promise<{ default: { src: string } }>
|
package/src/types/index.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ImagePath } from '../types'
|
|
2
|
+
|
|
3
|
+
export async function resolveImagePath(path: ImagePath) {
|
|
2
4
|
// If it's a string, we can't resolve it here. ex: Remote images URLs
|
|
3
5
|
if (typeof path === 'string') return null
|
|
6
|
+
// Handle dynamic imports
|
|
7
|
+
if ('then' in path && typeof path.then === 'function') return (await path).default
|
|
4
8
|
if ('src' in path) return path
|
|
5
9
|
return null
|
|
6
10
|
}
|