Home / File/ utils.ts — astro Source File

utils.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  17f9899e_9175_fbc8_eaf1_6cea4706bd11["utils.ts"]
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  17f9899e_9175_fbc8_eaf1_6cea4706bd11 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"]
  17f9899e_9175_fbc8_eaf1_6cea4706bd11 --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7
  style 17f9899e_9175_fbc8_eaf1_6cea4706bd11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs/promises';
import type { PluginContainer } from 'vite';

export const frontmatterRE = /^---(.*?)^---/ms;

export async function loadId(pluginContainer: PluginContainer, id: string) {
	const result = await pluginContainer.load(id, { ssr: true });

	if (result) {
		if (typeof result === 'string') {
			return result;
		} else {
			return result.code;
		}
	}

	// Fallback to reading from fs (Vite doesn't add this by default)
	try {
		return await fs.readFile(id, 'utf-8');
	} catch {}
}

Domain

Subdomains

Functions

Dependencies

  • promises
  • vite

Frequently Asked Questions

What does utils.ts do?
utils.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 utils.ts?
utils.ts defines 1 function(s): loadId.
What does utils.ts depend on?
utils.ts imports 2 module(s): promises, vite.
Where is utils.ts in the architecture?
utils.ts is located at packages/astro/src/vite-plugin-astro/utils.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-astro).

Analyze Your Own Codebase

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

Try Supermodel Free