Files
skills-here-run-place/node_modules/astro/dist/assets/utils/proxy.js
Alejandro Martinez f09af719cf Initial commit
2026-02-12 02:04:10 +01:00

21 lines
582 B
JavaScript

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
};