UNPKG

astro

Version:

Astro is a modern site builder with web best practices, performance, and DX front-of-mind.

21 lines (20 loc) 582 B
function getProxyCode(options, isSSR) { const stringifiedFSPath = JSON.stringify(options.fsPath); return ` new Proxy(${JSON.stringify(options)}, { get(target, name, receiver) { if (name === 'clone') { return structuredClone(target); } if (name === 'fsPath') { return ${stringifiedFSPath}; } ${!isSSR ? `if (target[name] !== undefined && globalThis.astroAsset) globalThis.astroAsset?.referencedImages.add(${stringifiedFSPath});` : ""} return target[name]; } }) `; } export { getProxyCode };