vinext 0.0.34 → 0.0.35
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/README.md +1 -0
- package/dist/build/prerender.d.ts +9 -4
- package/dist/build/prerender.js +27 -9
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/run-prerender.js +4 -1
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/config/next-config.d.ts +7 -1
- package/dist/config/next-config.js +39 -26
- package/dist/config/next-config.js.map +1 -1
- package/dist/entries/pages-server-entry.js +59 -140
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/plugins/optimize-imports.js +28 -2
- package/dist/plugins/optimize-imports.js.map +1 -1
- package/dist/server/app-browser-entry.js +2 -2
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-page-render.js +6 -4
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-response.js +1 -1
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +9 -1
- package/dist/server/app-page-stream.js +37 -4
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-ssr-stream.js +5 -3
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +54 -0
- package/dist/server/pages-page-response.js +140 -0
- package/dist/server/pages-page-response.js.map +1 -0
- package/dist/server/prod-server.js +3 -0
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/seed-cache.d.ts +44 -0
- package/dist/server/seed-cache.js +127 -0
- package/dist/server/seed-cache.js.map +1 -0
- package/dist/shims/image.js +4 -2
- package/dist/shims/image.js.map +1 -1
- package/package.json +1 -1
package/dist/shims/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":["UnpicImage"],"sources":["../../src/shims/image.tsx"],"sourcesContent":["/**\n * next/image shim\n *\n * Translates Next.js Image props to @unpic/react Image component.\n * @unpic/react auto-detects CDN from URL and uses native transforms.\n * For local images (relative paths), routes through `/_vinext/image`\n * for server-side optimization (resize, format negotiation, quality).\n *\n * Remote images are validated against `images.remotePatterns` and\n * `images.domains` from next.config.js. Unmatched URLs are blocked\n * in production and warn in development, matching Next.js behavior.\n */\nimport React, { forwardRef } from \"react\";\nimport { Image as UnpicImage } from \"@unpic/react\";\nimport { hasRemoteMatch, type RemotePattern } from \"./image-config.js\";\n\nexport interface StaticImageData {\n src: string;\n height: number;\n width: number;\n blurDataURL?: string;\n}\n\n/**\n * Image config injected at build time via Vite define.\n * Serialized as JSON — parsed once at module level.\n */\nconst __imageRemotePatterns: RemotePattern[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __imageDomains: string[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;\nconst __isDev = process.env.NODE_ENV !== \"production\";\nconst __imageDeviceSizes: number[] = (() => {\n try {\n return JSON.parse(\n process.env.__VINEXT_IMAGE_DEVICE_SIZES ?? \"[640,750,828,1080,1200,1920,2048,3840]\",\n );\n } catch {\n return [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\n }\n})();\n/**\n * Whether dangerouslyAllowSVG is enabled in next.config.js.\n * When false (default), .svg sources auto-skip the optimization endpoint\n * and are served directly, matching Next.js behavior.\n * When true, .svg sources are routed through the optimizer (served as-is\n * with security headers).\n */\nconst __dangerouslyAllowSVG = process.env.__VINEXT_IMAGE_DANGEROUSLY_ALLOW_SVG === \"true\";\n/**\n * Validate that a remote URL is allowed by the configured remote patterns.\n * Returns true if the URL is allowed, false otherwise.\n *\n * When no remotePatterns/domains are configured, all remote URLs are allowed\n * (backwards-compatible — user hasn't opted into restriction).\n *\n * When patterns ARE configured, only matching URLs are allowed.\n * In development, non-matching URLs produce a console warning.\n * In production, non-matching URLs are blocked (src replaced with empty string).\n */\nfunction validateRemoteUrl(src: string): { allowed: boolean; reason?: string } {\n if (!__hasImageConfig) {\n // No image config — allow everything (backwards-compatible)\n return { allowed: true };\n }\n\n let url: URL;\n try {\n url = new URL(src, \"http://n\");\n } catch {\n return { allowed: false, reason: `Invalid URL: ${src}` };\n }\n\n if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) {\n return { allowed: true };\n }\n\n return {\n allowed: false,\n reason: `Image URL \"${src}\" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`,\n };\n}\n\ninterface ImageProps {\n src: string | StaticImageData;\n alt: string;\n width?: number;\n height?: number;\n fill?: boolean;\n priority?: boolean;\n quality?: number;\n placeholder?: \"blur\" | \"empty\";\n blurDataURL?: string;\n loader?: (params: { src: string; width: number; quality?: number }) => string;\n sizes?: string;\n className?: string;\n style?: React.CSSProperties;\n onLoad?: React.ReactEventHandler<HTMLImageElement>;\n /** @deprecated Use onLoad instead. Still supported for migration compat. */\n onLoadingComplete?: (img: HTMLImageElement) => void;\n onError?: React.ReactEventHandler<HTMLImageElement>;\n onClick?: React.MouseEventHandler<HTMLImageElement>;\n id?: string;\n // Accept and ignore Next.js-specific props that don't apply\n unoptimized?: boolean;\n overrideSrc?: string;\n loading?: \"lazy\" | \"eager\";\n}\n\n/**\n * Sanitize a blurDataURL to prevent CSS injection.\n *\n * A crafted data URL containing `)` can break out of the `url()` CSS function,\n * allowing injection of arbitrary CSS properties or rules. Characters like `{`,\n * `}`, and `\\` can also assist in crafting injection payloads.\n *\n * This validates the URL starts with `data:image/` and rejects characters that\n * could escape the `url()` context. Semicolons are allowed since they're part\n * of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.\n *\n * Returns undefined for invalid URLs, which causes the blur placeholder to be\n * skipped gracefully.\n */\nfunction sanitizeBlurDataURL(url: string): string | undefined {\n // Must be a data: image URL\n if (!url.startsWith(\"data:image/\")) return undefined;\n // Reject characters that can break out of CSS url():\n // ) - closes url()\n // ( - could open nested functions\n // { } - CSS rule boundaries\n // \\ - CSS escape sequences\n // newlines - break CSS parsing\n if (/[)(}{\\\\'\"\\n\\r]/.test(url)) return undefined;\n return url;\n}\n\n/**\n * Determine if a src is a remote URL (CDN-optimizable) or local.\n */\nfunction isRemoteUrl(src: string): boolean {\n return src.startsWith(\"http://\") || src.startsWith(\"https://\") || src.startsWith(\"//\");\n}\n\n/**\n * Responsive image widths matching Next.js's device sizes config.\n * These are the breakpoints used for srcSet generation.\n * Configurable via `images.deviceSizes` in next.config.js.\n */\nconst RESPONSIVE_WIDTHS = __imageDeviceSizes;\n\n/**\n * Build a `/_vinext/image` optimization URL.\n *\n * In production (Cloudflare Workers), the worker intercepts this path and uses\n * the Images binding to resize/transcode on the fly. In dev, the Vite dev\n * server handles it as a passthrough (serves the original file).\n */\nexport function imageOptimizationUrl(src: string, width: number, quality: number = 75): string {\n return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;\n}\n\n/**\n * Generate a srcSet string for responsive images.\n *\n * Each width points to the `/_vinext/image` optimization endpoint so the\n * server can resize and transcode the image. Only includes widths that are\n * <= 2x the original image width to avoid pointless upscaling.\n */\nfunction generateSrcSet(src: string, originalWidth: number, quality: number = 75): string {\n const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);\n if (widths.length === 0)\n return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;\n return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(\", \");\n}\n\nconst Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality,\n placeholder,\n blurDataURL,\n loader,\n sizes,\n className,\n style,\n onLoad,\n onLoadingComplete,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n },\n ref,\n) {\n // Wire onLoadingComplete (deprecated) into onLoad — matches Next.js behavior.\n // onLoad fires first, then onLoadingComplete receives the HTMLImageElement.\n const handleLoad = onLoadingComplete\n ? (e: React.SyntheticEvent<HTMLImageElement>) => {\n onLoad?.(e);\n onLoadingComplete(e.currentTarget);\n }\n : onLoad;\n\n // Handle StaticImageData (import result)\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL =\n blurDataURL ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // If a custom loader is provided, use basic img with loader URL\n if (loader) {\n const resolvedSrc = loader({ src, width: imgWidth ?? 0, quality: quality ?? 75 });\n return (\n <img\n ref={ref}\n src={resolvedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n decoding=\"async\"\n sizes={sizes}\n className={className}\n onLoad={handleLoad}\n style={\n fill\n ? {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n ...style,\n }\n : style\n }\n {...rest}\n />\n );\n }\n\n // For remote URLs, validate against remotePatterns then use @unpic/react\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n // In dev, render the image but with a warning — matches Next.js dev behavior\n } else {\n // In production, block the image entirely\n console.error(`[next/image] ${validation.reason}`);\n return null;\n }\n }\n\n const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const bg = placeholder === \"blur\" && sanitizedBlur ? `url(${sanitizedBlur})` : undefined;\n\n if (fill) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n layout=\"fullWidth\"\n priority={priority}\n sizes={sizes}\n className={className}\n background={bg}\n onLoad={handleLoad}\n />\n );\n }\n // constrained layout requires width+height or aspectRatio\n if (imgWidth && imgHeight) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n width={imgWidth}\n height={imgHeight}\n layout=\"constrained\"\n priority={priority}\n sizes={sizes}\n className={className}\n background={bg}\n onLoad={handleLoad}\n />\n );\n }\n // Fall through to basic <img> if dimensions not provided\n // (unpic requires them for constrained layout)\n }\n\n // Route local images through the /_vinext/image optimization endpoint.\n // In production on Cloudflare Workers, this resizes and transcodes via\n // the Images binding. In dev, it serves the original file as a passthrough.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n // SVG sources auto-skip unless dangerouslyAllowSVG is enabled, matching\n // Next.js behavior where .svg triggers unoptimized=true by default.\n const imgQuality = quality ?? 75;\n const isSvg = src.endsWith(\".svg\");\n const skipOptimization = _unoptimized === true || (isSvg && !__dangerouslyAllowSVG);\n\n // Build srcSet for responsive local images (common breakpoints).\n // Each entry points to /_vinext/image with the appropriate width.\n const srcSet =\n imgWidth && !fill && !skipOptimization\n ? generateSrcSet(src, imgWidth, imgQuality)\n : imgWidth && !fill\n ? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2)\n .map((w) => `${src} ${w}w`)\n .join(\", \") || `${src} ${imgWidth}w`\n : undefined;\n\n // The main `src` also goes through the optimization endpoint. Use the\n // declared width (or the first responsive width as fallback).\n const optimizedSrc = skipOptimization\n ? src\n : imgWidth\n ? imageOptimizationUrl(src, imgWidth, imgQuality)\n : imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Blur placeholder: show a low-quality background while the image loads.\n // Sanitize blurDataURL to prevent CSS injection via crafted data URLs.\n const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle =\n placeholder === \"blur\" && sanitizedLocalBlur\n ? {\n backgroundImage: `url(${sanitizedLocalBlur})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center\",\n }\n : undefined;\n\n // For local images, render a standard <img> tag with srcSet and blur support.\n // The src and srcSet point to the /_vinext/image optimization endpoint.\n return (\n <img\n ref={ref}\n src={optimizedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n fetchPriority={priority ? \"high\" : undefined}\n decoding=\"async\"\n srcSet={srcSet}\n sizes={sizes ?? (fill ? \"100vw\" : undefined)}\n className={className}\n data-nimg={fill ? \"fill\" : \"1\"}\n onLoad={handleLoad}\n style={\n fill\n ? {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n ...blurStyle,\n ...style,\n }\n : { ...blurStyle, ...style }\n }\n {...rest}\n />\n );\n});\n\n/**\n * getImageProps — for advanced use cases (picture elements, background images).\n * Returns the props that would be passed to the underlying <img> element.\n */\nexport function getImageProps(props: ImageProps): {\n props: React.ImgHTMLAttributes<HTMLImageElement>;\n} {\n const {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality: _quality,\n placeholder,\n blurDataURL: blurDataURLProp,\n loader,\n sizes,\n className,\n style,\n onLoad: _onLoad,\n onLoadingComplete: _onLoadingComplete,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n } = props;\n\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL =\n blurDataURLProp ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // Validate remote URLs against configured patterns\n let blockedInProd = false;\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n } else {\n console.error(`[next/image] ${validation.reason}`);\n blockedInProd = true;\n }\n }\n }\n\n // Resolve src through custom loader if provided\n const imgQuality = _quality ?? 75;\n const resolvedSrc = blockedInProd\n ? \"\"\n : loader\n ? loader({ src, width: imgWidth ?? 0, quality: imgQuality })\n : src;\n\n // For local images (no loader, not remote), route through optimization endpoint.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n // SVG sources auto-skip unless dangerouslyAllowSVG is enabled.\n const isSvg = resolvedSrc.endsWith(\".svg\");\n const skipOpt =\n _unoptimized === true ||\n (isSvg && !__dangerouslyAllowSVG) ||\n blockedInProd ||\n !!loader ||\n isRemoteUrl(resolvedSrc);\n const optimizedSrc = skipOpt\n ? resolvedSrc\n : imgWidth\n ? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality)\n : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Build srcSet for local images — each width points to /_vinext/image\n const srcSet =\n imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !skipOpt\n ? generateSrcSet(resolvedSrc, imgWidth, imgQuality)\n : undefined;\n\n // Blur placeholder styles — sanitize to prevent CSS injection\n const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle =\n placeholder === \"blur\" && sanitizedBlurURL\n ? {\n backgroundImage: `url(${sanitizedBlurURL})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\" as const,\n backgroundPosition: \"center\" as const,\n }\n : undefined;\n\n return {\n props: {\n src: optimizedSrc,\n alt,\n width: fill ? undefined : imgWidth,\n height: fill ? undefined : imgHeight,\n loading: priority ? \"eager\" : (loading ?? \"lazy\"),\n fetchPriority: priority ? (\"high\" as const) : undefined,\n decoding: \"async\" as const,\n srcSet,\n sizes: sizes ?? (fill ? \"100vw\" : undefined),\n className,\n \"data-nimg\": fill ? \"fill\" : \"1\",\n style: fill\n ? {\n position: \"absolute\" as const,\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\" as const,\n ...blurStyle,\n ...style,\n }\n : { ...blurStyle, ...style },\n ...rest,\n } as React.ImgHTMLAttributes<HTMLImageElement>,\n };\n}\n\nexport default Image;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,+BAAgD;AACpD,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ,IAAI,kCAAkC,KAAK;SAC/D;AACN,SAAO,EAAE;;IAET;AACJ,MAAM,wBAAkC;AACtC,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ,IAAI,0BAA0B,KAAK;SACvD;AACN,SAAO,EAAE;;IAET;AACJ,MAAM,mBAAmB,sBAAsB,SAAS,KAAK,eAAe,SAAS;AACrF,MAAM,UAAU,QAAQ,IAAI,aAAa;AACzC,MAAM,4BAAsC;AAC1C,KAAI;AACF,SAAO,KAAK,MACV,QAAQ,IAAI,+BAA+B,yCAC5C;SACK;AACN,SAAO;GAAC;GAAK;GAAK;GAAK;GAAM;GAAM;GAAM;GAAM;GAAK;;IAEpD;;;;;;;;AAQJ,MAAM,wBAAwB,QAAQ,IAAI,yCAAyC;;;;;;;;;;;;AAYnF,SAAS,kBAAkB,KAAoD;AAC7E,KAAI,CAAC,iBAEH,QAAO,EAAE,SAAS,MAAM;CAG1B,IAAI;AACJ,KAAI;AACF,QAAM,IAAI,IAAI,KAAK,WAAW;SACxB;AACN,SAAO;GAAE,SAAS;GAAO,QAAQ,gBAAgB;GAAO;;AAG1D,KAAI,eAAe,gBAAgB,uBAAuB,IAAI,CAC5D,QAAO,EAAE,SAAS,MAAM;AAG1B,QAAO;EACL,SAAS;EACT,QAAQ,cAAc,IAAI;EAC3B;;;;;;;;;;;;;;;;AA2CH,SAAS,oBAAoB,KAAiC;AAE5D,KAAI,CAAC,IAAI,WAAW,cAAc,CAAE,QAAO,KAAA;AAO3C,KAAI,iBAAiB,KAAK,IAAI,CAAE,QAAO,KAAA;AACvC,QAAO;;;;;AAMT,SAAS,YAAY,KAAsB;AACzC,QAAO,I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CAC/B,MAAM,cAAc,gBAChB,KACA,SACE,OAAO;EAAE;EAAK,OAAO,YAAY;EAAG,SAAS;EAAY,CAAC,GAC1D;CAKN,MAAM,QAAQ,YAAY,SAAS,OAAO;CAC1C,MAAM,UACJ,iBAAiB,QAChB,SAAS,CAAC,yBACX,iBACA,CAAC,CAAC,UACF,YAAY,YAAY;CAC1B,MAAM,eAAe,UACjB,cACA,WACE,qBAAqB,aAAa,UAAU,WAAW,GACvD,qBAAqB,aAAa,kBAAkB,IAAI,WAAW;CAGzE,MAAM,SACJ,YAAY,CAAC,QAAQ,CAAC,YAAY,YAAY,IAAI,CAAC,UAAU,CAAC,UAC1D,eAAe,aAAa,UAAU,WAAW,GACjD,KAAA;CAGN,MAAM,mBAAmB,iBAAiB,oBAAoB,eAAe,GAAG,KAAA;CAChF,MAAM,YACJ,gBAAgB,UAAU,mBACtB;EACE,iBAAiB,OAAO,iBAAiB;EACzC,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACrB,GACD,KAAA;AAEN,QAAO,EACL,OAAO;EACL,KAAK;EACL;EACA,OAAO,OAAO,KAAA,IAAY;EAC1B,QAAQ,OAAO,KAAA,IAAY;EAC3B,SAAS,WAAW,UAAW,WAAW;EAC1C,eAAe,WAAY,SAAmB,KAAA;EAC9C,UAAU;EACV;EACA,OAAO,UAAU,OAAO,UAAU,KAAA;EAClC;EACA,aAAa,OAAO,SAAS;EAC7B,OAAO,OACH;GACE,UAAU;GACV,OAAO;GACP,OAAO;GACP,QAAQ;GACR,WAAW;GACX,GAAG;GACH,GAAG;GACJ,GACD;GAAE,GAAG;GAAW,GAAG;GAAO;EAC9B,GAAG;EACJ,EACF"}
|
|
1
|
+
{"version":3,"file":"image.js","names":["UnpicImage"],"sources":["../../src/shims/image.tsx"],"sourcesContent":["/**\n * next/image shim\n *\n * Translates Next.js Image props to @unpic/react Image component.\n * @unpic/react auto-detects CDN from URL and uses native transforms.\n * For local images (relative paths), routes through `/_vinext/image`\n * for server-side optimization (resize, format negotiation, quality).\n *\n * Remote images are validated against `images.remotePatterns` and\n * `images.domains` from next.config.js. Unmatched URLs are blocked\n * in production and warn in development, matching Next.js behavior.\n */\nimport React, { forwardRef } from \"react\";\nimport { Image as UnpicImage } from \"@unpic/react\";\nimport { hasRemoteMatch, type RemotePattern } from \"./image-config.js\";\n\nexport interface StaticImageData {\n src: string;\n height: number;\n width: number;\n blurDataURL?: string;\n}\n\n/**\n * Image config injected at build time via Vite define.\n * Serialized as JSON — parsed once at module level.\n */\nconst __imageRemotePatterns: RemotePattern[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __imageDomains: string[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;\nconst __isDev = process.env.NODE_ENV !== \"production\";\nconst __imageDeviceSizes: number[] = (() => {\n try {\n return JSON.parse(\n process.env.__VINEXT_IMAGE_DEVICE_SIZES ?? \"[640,750,828,1080,1200,1920,2048,3840]\",\n );\n } catch {\n return [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\n }\n})();\n/**\n * Whether dangerouslyAllowSVG is enabled in next.config.js.\n * When false (default), .svg sources auto-skip the optimization endpoint\n * and are served directly, matching Next.js behavior.\n * When true, .svg sources are routed through the optimizer (served as-is\n * with security headers).\n */\nconst __dangerouslyAllowSVG = process.env.__VINEXT_IMAGE_DANGEROUSLY_ALLOW_SVG === \"true\";\n/**\n * Validate that a remote URL is allowed by the configured remote patterns.\n * Returns true if the URL is allowed, false otherwise.\n *\n * When no remotePatterns/domains are configured, all remote URLs are allowed\n * (backwards-compatible — user hasn't opted into restriction).\n *\n * When patterns ARE configured, only matching URLs are allowed.\n * In development, non-matching URLs produce a console warning.\n * In production, non-matching URLs are blocked (src replaced with empty string).\n */\nfunction validateRemoteUrl(src: string): { allowed: boolean; reason?: string } {\n if (!__hasImageConfig) {\n // No image config — allow everything (backwards-compatible)\n return { allowed: true };\n }\n\n let url: URL;\n try {\n url = new URL(src, \"http://n\");\n } catch {\n return { allowed: false, reason: `Invalid URL: ${src}` };\n }\n\n if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) {\n return { allowed: true };\n }\n\n return {\n allowed: false,\n reason: `Image URL \"${src}\" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`,\n };\n}\n\ninterface ImageProps {\n src: string | StaticImageData;\n alt: string;\n width?: number;\n height?: number;\n fill?: boolean;\n priority?: boolean;\n quality?: number;\n placeholder?: \"blur\" | \"empty\";\n blurDataURL?: string;\n loader?: (params: { src: string; width: number; quality?: number }) => string;\n sizes?: string;\n className?: string;\n style?: React.CSSProperties;\n onLoad?: React.ReactEventHandler<HTMLImageElement>;\n /** @deprecated Use onLoad instead. Still supported for migration compat. */\n onLoadingComplete?: (img: HTMLImageElement) => void;\n onError?: React.ReactEventHandler<HTMLImageElement>;\n onClick?: React.MouseEventHandler<HTMLImageElement>;\n id?: string;\n // Accept and ignore Next.js-specific props that don't apply\n unoptimized?: boolean;\n overrideSrc?: string;\n loading?: \"lazy\" | \"eager\";\n}\n\n/**\n * Sanitize a blurDataURL to prevent CSS injection.\n *\n * A crafted data URL containing `)` can break out of the `url()` CSS function,\n * allowing injection of arbitrary CSS properties or rules. Characters like `{`,\n * `}`, and `\\` can also assist in crafting injection payloads.\n *\n * This validates the URL starts with `data:image/` and rejects characters that\n * could escape the `url()` context. Semicolons are allowed since they're part\n * of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.\n *\n * Returns undefined for invalid URLs, which causes the blur placeholder to be\n * skipped gracefully.\n */\nfunction sanitizeBlurDataURL(url: string): string | undefined {\n // Must be a data: image URL\n if (!url.startsWith(\"data:image/\")) return undefined;\n // Reject characters that can break out of CSS url():\n // ) - closes url()\n // ( - could open nested functions\n // { } - CSS rule boundaries\n // \\ - CSS escape sequences\n // newlines - break CSS parsing\n if (/[)(}{\\\\'\"\\n\\r]/.test(url)) return undefined;\n return url;\n}\n\n/**\n * Determine if a src is a remote URL (CDN-optimizable) or local.\n */\nfunction isRemoteUrl(src: string): boolean {\n return src.startsWith(\"http://\") || src.startsWith(\"https://\") || src.startsWith(\"//\");\n}\n\n/**\n * Responsive image widths matching Next.js's device sizes config.\n * These are the breakpoints used for srcSet generation.\n * Configurable via `images.deviceSizes` in next.config.js.\n */\nconst RESPONSIVE_WIDTHS = __imageDeviceSizes;\n\n/**\n * Build a `/_vinext/image` optimization URL.\n *\n * In production (Cloudflare Workers), the worker intercepts this path and uses\n * the Images binding to resize/transcode on the fly. In dev, the Vite dev\n * server handles it as a passthrough (serves the original file).\n */\nexport function imageOptimizationUrl(src: string, width: number, quality: number = 75): string {\n return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;\n}\n\n/**\n * Generate a srcSet string for responsive images.\n *\n * Each width points to the `/_vinext/image` optimization endpoint so the\n * server can resize and transcode the image. Only includes widths that are\n * <= 2x the original image width to avoid pointless upscaling.\n */\nfunction generateSrcSet(src: string, originalWidth: number, quality: number = 75): string {\n const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);\n if (widths.length === 0)\n return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;\n return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(\", \");\n}\n\nconst Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality,\n placeholder,\n blurDataURL,\n loader,\n sizes,\n className,\n style,\n onLoad,\n onLoadingComplete,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n },\n ref,\n) {\n // Wire onLoadingComplete (deprecated) into onLoad — matches Next.js behavior.\n // onLoad fires first, then onLoadingComplete receives the HTMLImageElement.\n const handleLoad = onLoadingComplete\n ? (e: React.SyntheticEvent<HTMLImageElement>) => {\n onLoad?.(e);\n onLoadingComplete(e.currentTarget);\n }\n : onLoad;\n\n // Handle StaticImageData (import result)\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL =\n blurDataURL ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // If a custom loader is provided, use basic img with loader URL\n if (loader) {\n const resolvedSrc = loader({ src, width: imgWidth ?? 0, quality: quality ?? 75 });\n return (\n <img\n ref={ref}\n src={resolvedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n decoding=\"async\"\n sizes={sizes}\n className={className}\n onLoad={handleLoad}\n style={\n fill\n ? {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n ...style,\n }\n : style\n }\n {...rest}\n />\n );\n }\n\n // For remote URLs, validate against remotePatterns then use @unpic/react\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n // In dev, render the image but with a warning — matches Next.js dev behavior\n } else {\n // In production, block the image entirely\n console.error(`[next/image] ${validation.reason}`);\n return null;\n }\n }\n\n const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const bg = placeholder === \"blur\" && sanitizedBlur ? `url(${sanitizedBlur})` : undefined;\n\n if (fill) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n layout=\"fullWidth\"\n // `priority` is a Next.js concept — translate it to HTML attributes so\n // it is never forwarded to the DOM as a non-boolean attribute, which\n // would trigger React's \"Received `true` for a non-boolean attribute\"\n // warning.\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n fetchPriority={priority ? \"high\" : undefined}\n sizes={sizes}\n className={className}\n background={bg}\n onLoad={handleLoad}\n />\n );\n }\n // constrained layout requires width+height or aspectRatio\n if (imgWidth && imgHeight) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n width={imgWidth}\n height={imgHeight}\n layout=\"constrained\"\n // Same translation as above — never pass `priority` to the DOM.\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n fetchPriority={priority ? \"high\" : undefined}\n sizes={sizes}\n className={className}\n background={bg}\n onLoad={handleLoad}\n />\n );\n }\n // Fall through to basic <img> if dimensions not provided\n // (unpic requires them for constrained layout)\n }\n\n // Route local images through the /_vinext/image optimization endpoint.\n // In production on Cloudflare Workers, this resizes and transcodes via\n // the Images binding. In dev, it serves the original file as a passthrough.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n // SVG sources auto-skip unless dangerouslyAllowSVG is enabled, matching\n // Next.js behavior where .svg triggers unoptimized=true by default.\n const imgQuality = quality ?? 75;\n const isSvg = src.endsWith(\".svg\");\n const skipOptimization = _unoptimized === true || (isSvg && !__dangerouslyAllowSVG);\n\n // Build srcSet for responsive local images (common breakpoints).\n // Each entry points to /_vinext/image with the appropriate width.\n const srcSet =\n imgWidth && !fill && !skipOptimization\n ? generateSrcSet(src, imgWidth, imgQuality)\n : imgWidth && !fill\n ? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2)\n .map((w) => `${src} ${w}w`)\n .join(\", \") || `${src} ${imgWidth}w`\n : undefined;\n\n // The main `src` also goes through the optimization endpoint. Use the\n // declared width (or the first responsive width as fallback).\n const optimizedSrc = skipOptimization\n ? src\n : imgWidth\n ? imageOptimizationUrl(src, imgWidth, imgQuality)\n : imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Blur placeholder: show a low-quality background while the image loads.\n // Sanitize blurDataURL to prevent CSS injection via crafted data URLs.\n const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle =\n placeholder === \"blur\" && sanitizedLocalBlur\n ? {\n backgroundImage: `url(${sanitizedLocalBlur})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center\",\n }\n : undefined;\n\n // For local images, render a standard <img> tag with srcSet and blur support.\n // The src and srcSet point to the /_vinext/image optimization endpoint.\n return (\n <img\n ref={ref}\n src={optimizedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n fetchPriority={priority ? \"high\" : undefined}\n decoding=\"async\"\n srcSet={srcSet}\n sizes={sizes ?? (fill ? \"100vw\" : undefined)}\n className={className}\n data-nimg={fill ? \"fill\" : \"1\"}\n onLoad={handleLoad}\n style={\n fill\n ? {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n ...blurStyle,\n ...style,\n }\n : { ...blurStyle, ...style }\n }\n {...rest}\n />\n );\n});\n\n/**\n * getImageProps — for advanced use cases (picture elements, background images).\n * Returns the props that would be passed to the underlying <img> element.\n */\nexport function getImageProps(props: ImageProps): {\n props: React.ImgHTMLAttributes<HTMLImageElement>;\n} {\n const {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality: _quality,\n placeholder,\n blurDataURL: blurDataURLProp,\n loader,\n sizes,\n className,\n style,\n onLoad: _onLoad,\n onLoadingComplete: _onLoadingComplete,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n } = props;\n\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL =\n blurDataURLProp ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // Validate remote URLs against configured patterns\n let blockedInProd = false;\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n } else {\n console.error(`[next/image] ${validation.reason}`);\n blockedInProd = true;\n }\n }\n }\n\n // Resolve src through custom loader if provided\n const imgQuality = _quality ?? 75;\n const resolvedSrc = blockedInProd\n ? \"\"\n : loader\n ? loader({ src, width: imgWidth ?? 0, quality: imgQuality })\n : src;\n\n // For local images (no loader, not remote), route through optimization endpoint.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n // SVG sources auto-skip unless dangerouslyAllowSVG is enabled.\n const isSvg = resolvedSrc.endsWith(\".svg\");\n const skipOpt =\n _unoptimized === true ||\n (isSvg && !__dangerouslyAllowSVG) ||\n blockedInProd ||\n !!loader ||\n isRemoteUrl(resolvedSrc);\n const optimizedSrc = skipOpt\n ? resolvedSrc\n : imgWidth\n ? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality)\n : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Build srcSet for local images — each width points to /_vinext/image\n const srcSet =\n imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !skipOpt\n ? generateSrcSet(resolvedSrc, imgWidth, imgQuality)\n : undefined;\n\n // Blur placeholder styles — sanitize to prevent CSS injection\n const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle =\n placeholder === \"blur\" && sanitizedBlurURL\n ? {\n backgroundImage: `url(${sanitizedBlurURL})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\" as const,\n backgroundPosition: \"center\" as const,\n }\n : undefined;\n\n return {\n props: {\n src: optimizedSrc,\n alt,\n width: fill ? undefined : imgWidth,\n height: fill ? undefined : imgHeight,\n loading: priority ? \"eager\" : (loading ?? \"lazy\"),\n fetchPriority: priority ? (\"high\" as const) : undefined,\n decoding: \"async\" as const,\n srcSet,\n sizes: sizes ?? (fill ? \"100vw\" : undefined),\n className,\n \"data-nimg\": fill ? \"fill\" : \"1\",\n style: fill\n ? {\n position: \"absolute\" as const,\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\" as const,\n ...blurStyle,\n ...style,\n }\n : { ...blurStyle, ...style },\n ...rest,\n } as React.ImgHTMLAttributes<HTMLImageElement>,\n };\n}\n\nexport default Image;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,+BAAgD;AACpD,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ,IAAI,kCAAkC,KAAK;SAC/D;AACN,SAAO,EAAE;;IAET;AACJ,MAAM,wBAAkC;AACtC,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ,IAAI,0BAA0B,KAAK;SACvD;AACN,SAAO,EAAE;;IAET;AACJ,MAAM,mBAAmB,sBAAsB,SAAS,KAAK,eAAe,SAAS;AACrF,MAAM,UAAU,QAAQ,IAAI,aAAa;AACzC,MAAM,4BAAsC;AAC1C,KAAI;AACF,SAAO,KAAK,MACV,QAAQ,IAAI,+BAA+B,yCAC5C;SACK;AACN,SAAO;GAAC;GAAK;GAAK;GAAK;GAAM;GAAM;GAAM;GAAM;GAAK;;IAEpD;;;;;;;;AAQJ,MAAM,wBAAwB,QAAQ,IAAI,yCAAyC;;;;;;;;;;;;AAYnF,SAAS,kBAAkB,KAAoD;AAC7E,KAAI,CAAC,iBAEH,QAAO,EAAE,SAAS,MAAM;CAG1B,IAAI;AACJ,KAAI;AACF,QAAM,IAAI,IAAI,KAAK,WAAW;SACxB;AACN,SAAO;GAAE,SAAS;GAAO,QAAQ,gBAAgB;GAAO;;AAG1D,KAAI,eAAe,gBAAgB,uBAAuB,IAAI,CAC5D,QAAO,EAAE,SAAS,MAAM;AAG1B,QAAO;EACL,SAAS;EACT,QAAQ,cAAc,IAAI;EAC3B;;;;;;;;;;;;;;;;AA2CH,SAAS,oBAAoB,KAAiC;AAE5D,KAAI,C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