Home / File/ runtime.ts — astro Source File

runtime.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 7 functions

Entity Profile

Dependency Diagram

graph LR
  ba37e1cf_3c52_9aae_c778_4156e3c9fdff["runtime.ts"]
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  ba37e1cf_3c52_9aae_c778_4156e3c9fdff --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  3286ed3b_b4ab_78a3_0aff_00b1b2083234["./errors.js"]
  ba37e1cf_3c52_9aae_c778_4156e3c9fdff --> 3286ed3b_b4ab_78a3_0aff_00b1b2083234
  cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c["./validators.js"]
  ba37e1cf_3c52_9aae_c778_4156e3c9fdff --> cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c
  style ba37e1cf_3c52_9aae_c778_4156e3c9fdff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { invalidVariablesToError } from './errors.js';
import type { ValidationResultInvalid } from './validators.js';

export { getEnvFieldType, validateEnvVariable } from './validators.js';

export type GetEnv = (key: string) => string | undefined;
type OnSetGetEnv = () => void;

let _getEnv: GetEnv = (key) => process.env[key];

export function setGetEnv(fn: GetEnv) {
	_getEnv = fn;

	_onSetGetEnv();
}

let _onSetGetEnv: OnSetGetEnv = () => {};

export function setOnSetGetEnv(fn: OnSetGetEnv) {
	_onSetGetEnv = fn;
}

export function getEnv(...args: Parameters<GetEnv>) {
	return _getEnv(...args);
}

export function createInvalidVariablesError(
	key: string,
	type: string,
	result: ValidationResultInvalid,
) {
	return new AstroError({
		...AstroErrorData.EnvInvalidVariables,
		message: AstroErrorData.EnvInvalidVariables.message(
			invalidVariablesToError([{ key, type, errors: result.errors }]),
		),
	});
}

Domain

Subdomains

Dependencies

  • ../core/errors/index.js
  • ./errors.js
  • ./validators.js

Frequently Asked Questions

What does runtime.ts do?
runtime.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 runtime.ts?
runtime.ts defines 7 function(s): _getEnv, _onSetGetEnv, createInvalidVariablesError, getEnv, key, setGetEnv, setOnSetGetEnv.
What does runtime.ts depend on?
runtime.ts imports 3 module(s): ../core/errors/index.js, ./errors.js, ./validators.js.
Where is runtime.ts in the architecture?
runtime.ts is located at packages/astro/src/env/runtime.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