Home / Function/ reverseSymlink() — astro Function Reference

reverseSymlink() — astro Function Reference

Architecture documentation for the reverseSymlink() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  17178687_9187_5597_6626_d01610744961["reverseSymlink()"]
  7a09e708_c090_71c0_8138_7343699b1865["utils.ts"]
  17178687_9187_5597_6626_d01610744961 -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865
  style 17178687_9187_5597_6626_d01610744961 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/utils.ts lines 305–326

export function reverseSymlink({
	entry,
	symlinks,
	contentDir,
}: {
	entry: string | URL;
	contentDir: string | URL;
	symlinks?: Map<string, string>;
}): string {
	const entryPath = normalizePath(typeof entry === 'string' ? entry : fileURLToPath(entry));
	const contentDirPath = typeof contentDir === 'string' ? contentDir : fileURLToPath(contentDir);
	if (!symlinks || symlinks.size === 0) {
		return entryPath;
	}

	for (const [realPath, symlinkName] of symlinks) {
		if (entryPath.startsWith(realPath)) {
			return normalizePath(path.join(contentDirPath, symlinkName, entryPath.replace(realPath, '')));
		}
	}
	return entryPath;
}

Subdomains

Frequently Asked Questions

What does reverseSymlink() do?
reverseSymlink() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is reverseSymlink() defined?
reverseSymlink() is defined in packages/astro/src/content/utils.ts at line 305.

Analyze Your Own Codebase

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

Try Supermodel Free