loadLocalImage() — astro Function Reference
Architecture documentation for the loadLocalImage() function in node.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 6b92f0a2_bdc0_17a6_3da6_70585a39c264["loadLocalImage()"] b4396eb3_3c48_69c3_9cdf_b53ef92bae86["node.ts"] 6b92f0a2_bdc0_17a6_3da6_70585a39c264 -->|defined in| b4396eb3_3c48_69c3_9cdf_b53ef92bae86 c368da5c_3669_5369_225a_387a561f912d["resolveOutDir()"] 6b92f0a2_bdc0_17a6_3da6_70585a39c264 -->|calls| c368da5c_3669_5369_225a_387a561f912d style 6b92f0a2_bdc0_17a6_3da6_70585a39c264 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/assets/endpoint/node.ts lines 10–34
async function loadLocalImage(src: string, url: URL) {
const outDirURL = resolveOutDir();
// If the _image segment isn't at the start of the path, we have a base
const idx = url.pathname.indexOf('/_image');
if (idx > 0) {
// Remove the base path
src = src.slice(idx);
}
if (!URL.canParse('.' + src, outDirURL)) {
return undefined;
}
const fileUrl = new URL('.' + src, outDirURL);
if (fileUrl.protocol !== 'file:') {
return undefined;
}
if (!isParentDirectory(fileURLToPath(outDirURL), fileURLToPath(fileUrl))) {
return undefined;
}
try {
return await readFile(fileUrl);
} catch {
return undefined;
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does loadLocalImage() do?
loadLocalImage() is a function in the astro codebase, defined in packages/astro/src/assets/endpoint/node.ts.
Where is loadLocalImage() defined?
loadLocalImage() is defined in packages/astro/src/assets/endpoint/node.ts at line 10.
What does loadLocalImage() call?
loadLocalImage() calls 1 function(s): resolveOutDir.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free