Rocky_Mountain_Vending/.pnpm-store/v10/files/49/23e96fc67943fe3635c9be64fb2576f1f002579eb3f64882692e3a9a4271e890d157ac735b14d70e9316c33af3438290776ab946cf0b92b83712209929a6f3
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

29 lines
No EOL
1.1 KiB
Text

import { createReadStream, promises as fs } from 'fs';
import { requestToBodyStream } from '../../body-streams';
import { resolve } from 'path';
/**
* Short-circuits the `fetch` function
* to return a stream for a given asset, if a user used `new URL("file", import.meta.url)`.
* This allows to embed assets in Edge Runtime.
*/ export async function fetchInlineAsset(options) {
const inputString = String(options.input);
if (!inputString.startsWith('blob:')) {
return;
}
const name = inputString.replace('blob:', '');
const asset = options.assets ? options.assets.find((x)=>x.name === name) : {
name,
filePath: name
};
if (!asset) {
return;
}
const filePath = resolve(options.distDir, asset.filePath);
const fileIsReadable = await fs.access(filePath).then(()=>true, ()=>false);
if (fileIsReadable) {
const readStream = createReadStream(filePath);
return new options.context.Response(requestToBodyStream(options.context, Uint8Array, readStream));
}
}
//# sourceMappingURL=fetch-inline-assets.js.map