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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-lqip",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Native extended Astro components for generating low quality image placeholders (LQIP).",
5
5
  "keywords": [
6
6
  "astro",
@@ -0,0 +1 @@
1
+ export type ImagePath = string | { src: string } | Promise<{ default: { src: string } }>
@@ -1,4 +1,5 @@
1
1
  export * from './components-options.type'
2
+ export * from './image-path.type'
2
3
  export * from './lqip.type'
3
4
  export * from './plaiceholder.type'
4
5
  export * from './props.type'
@@ -1,6 +1,10 @@
1
- export async function resolveImagePath(path: string | { src: string }) {
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
  }