Rocky_Mountain_Vending/.pnpm-store/v10/files/f9/fb252984c5dcda55100e31239b36a91a270b56c1cb38d55f54db4920687670d0cfde417415e8f159e5c3f218d927cd87112dce50d644213086ba7e2c802c6a
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

53 lines
No EOL
2.2 KiB
Text

import path from 'path';
import loaderUtils from 'next/dist/compiled/loader-utils3';
import { getImageSize } from '../../../../server/image-optimizer';
import { getBlurImage } from './blur';
function nextImageLoader(content) {
const imageLoaderSpan = this.currentTraceSpan.traceChild('next-image-loader');
return imageLoaderSpan.traceAsyncFn(async ()=>{
const options = this.getOptions();
const { compilerType, isDev, assetPrefix, basePath } = options;
const context = this.rootContext;
const opts = {
context,
content
};
const interpolatedName = loaderUtils.interpolateName(this, '/static/media/[name].[hash:8].[ext]', opts);
const outputPath = assetPrefix + '/_next' + interpolatedName;
let extension = loaderUtils.interpolateName(this, '[ext]', opts);
if (extension === 'jpg') {
extension = 'jpeg';
}
const imageSizeSpan = imageLoaderSpan.traceChild('image-size-calculation');
const imageSize = await imageSizeSpan.traceAsyncFn(()=>getImageSize(content).catch((err)=>err));
if (imageSize instanceof Error) {
const err = imageSize;
err.name = 'InvalidImageFormatError';
throw err;
}
const { dataURL: blurDataURL, width: blurWidth, height: blurHeight } = await getBlurImage(content, extension, imageSize, {
basePath,
outputPath,
isDev,
tracing: imageLoaderSpan.traceChild.bind(imageLoaderSpan)
});
const stringifiedData = imageLoaderSpan.traceChild('image-data-stringify').traceFn(()=>JSON.stringify({
src: outputPath,
height: imageSize.height,
width: imageSize.width,
blurDataURL,
blurWidth,
blurHeight
}));
if (compilerType === 'client') {
this.emitFile(interpolatedName, content, null);
} else {
this.emitFile(path.join('..', isDev || compilerType === 'edge-server' ? '' : '..', interpolatedName), content, null);
}
return `export default ${stringifiedData};`;
});
}
export const raw = true;
export default nextImageLoader;
//# sourceMappingURL=index.js.map