Home / Function/ contentLayerSingleton() — astro Function Reference

contentLayerSingleton() — astro Function Reference

Architecture documentation for the contentLayerSingleton() function in content-layer.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  2a8b79e7_7c11_9c4a_89f5_488193135e27["contentLayerSingleton()"]
  3460caba_c22e_57de_8fed_316b77465ef7["content-layer.ts"]
  2a8b79e7_7c11_9c4a_89f5_488193135e27 -->|defined in| 3460caba_c22e_57de_8fed_316b77465ef7
  628b9ea0_b534_722a_c532_464eb65c9de7["dispose()"]
  2a8b79e7_7c11_9c4a_89f5_488193135e27 -->|calls| 628b9ea0_b534_722a_c532_464eb65c9de7
  style 2a8b79e7_7c11_9c4a_89f5_488193135e27 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/content-layer.ts lines 463–477

function contentLayerSingleton() {
	let instance: ContentLayer | null = null;
	return {
		init: (options: ContentLayerOptions) => {
			instance?.dispose();
			instance = new ContentLayer(options);
			return instance;
		},
		get: () => instance,
		dispose: () => {
			instance?.dispose();
			instance = null;
		},
	};
}

Subdomains

Calls

Frequently Asked Questions

What does contentLayerSingleton() do?
contentLayerSingleton() is a function in the astro codebase, defined in packages/astro/src/content/content-layer.ts.
Where is contentLayerSingleton() defined?
contentLayerSingleton() is defined in packages/astro/src/content/content-layer.ts at line 463.
What does contentLayerSingleton() call?
contentLayerSingleton() calls 1 function(s): dispose.

Analyze Your Own Codebase

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

Try Supermodel Free