getProxyCode() — astro Function Reference
Architecture documentation for the getProxyCode() function in proxy.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 2f03f600_7738_4533_6bca_9c5043da2d18["getProxyCode()"] 85d0c1dc_23f0_1ee9_36a9_5f694f05b280["proxy.ts"] 2f03f600_7738_4533_6bca_9c5043da2d18 -->|defined in| 85d0c1dc_23f0_1ee9_36a9_5f694f05b280 style 2f03f600_7738_4533_6bca_9c5043da2d18 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/assets/utils/proxy.ts lines 3–23
export function getProxyCode(options: ImageMetadata, isSSR: boolean): string {
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];
}
})
`;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getProxyCode() do?
getProxyCode() is a function in the astro codebase, defined in packages/astro/src/assets/utils/proxy.ts.
Where is getProxyCode() defined?
getProxyCode() is defined in packages/astro/src/assets/utils/proxy.ts at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free