Home / File/ sync.ts — astro Source File

sync.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f73e3658_46d2_0dd8_b1e9_ceec9707ddd6["sync.ts"]
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  f73e3658_46d2_0dd8_b1e9_ceec9707ddd6 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  63040f5c_bf79_3665_ce6d_7c06b710302a["./constants.js"]
  f73e3658_46d2_0dd8_b1e9_ceec9707ddd6 --> 63040f5c_bf79_3665_ce6d_7c06b710302a
  cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c["./validators.js"]
  f73e3658_46d2_0dd8_b1e9_ceec9707ddd6 --> cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c
  style f73e3658_46d2_0dd8_b1e9_ceec9707ddd6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { AstroSettings } from '../types/astro.js';
import { ENV_TYPES_FILE } from './constants.js';
import { getEnvFieldType } from './validators.js';

export function syncAstroEnv(settings: AstroSettings): void {
	let client = '';
	let server = '';

	for (const [key, options] of Object.entries(settings.config.env.schema)) {
		const str = `	export const ${key}: ${getEnvFieldType(options)};	\n`;
		if (options.context === 'client') {
			client += str;
		} else {
			server += str;
		}
	}

	let content = '';
	if (client !== '') {
		content = `declare module 'astro:env/client' {
${client}}`;
	}
	if (server !== '') {
		content += `declare module 'astro:env/server' {
${server}}`;
	}

	if (content !== '') {
		settings.injectedTypes.push({
			filename: ENV_TYPES_FILE,
			content,
		});
	}
}

Domain

Subdomains

Functions

Dependencies

  • ../types/astro.js
  • ./constants.js
  • ./validators.js

Frequently Asked Questions

What does sync.ts do?
sync.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 sync.ts?
sync.ts defines 1 function(s): syncAstroEnv.
What does sync.ts depend on?
sync.ts imports 3 module(s): ../types/astro.js, ./constants.js, ./validators.js.
Where is sync.ts in the architecture?
sync.ts is located at packages/astro/src/env/sync.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/env).

Analyze Your Own Codebase

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

Try Supermodel Free