Home / File/ proxy.ts — astro Source File

proxy.ts — astro Source File

Architecture documentation for proxy.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  85d0c1dc_23f0_1ee9_36a9_5f694f05b280["proxy.ts"]
  416eda3d_47e6_c298_102b_b7a37d86a44e["../../assets/types.js"]
  85d0c1dc_23f0_1ee9_36a9_5f694f05b280 --> 416eda3d_47e6_c298_102b_b7a37d86a44e
  style 85d0c1dc_23f0_1ee9_36a9_5f694f05b280 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ImageMetadata } from '../types.js';

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

Functions

Dependencies

  • ../../assets/types.js

Frequently Asked Questions

What does proxy.ts do?
proxy.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in proxy.ts?
proxy.ts defines 1 function(s): getProxyCode.
What does proxy.ts depend on?
proxy.ts imports 1 module(s): ../../assets/types.js.
Where is proxy.ts in the architecture?
proxy.ts is located at packages/astro/src/assets/utils/proxy.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets/utils).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free