Home / File/ session.ts — astro Source File

session.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  5e4918d2_001e_cdf1_6103_dc17a8a94758["session.ts"]
  98277c9f_2ef4_8553_dbba_3908c3aeda5e["../../core/config/schemas/index.js"]
  5e4918d2_001e_cdf1_6103_dc17a8a94758 --> 98277c9f_2ef4_8553_dbba_3908c3aeda5e
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  5e4918d2_001e_cdf1_6103_dc17a8a94758 --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  4c453c0b_17bb_ebc3_f7de_e2a632e42c1e["../types/public/integrations.js"]
  5e4918d2_001e_cdf1_6103_dc17a8a94758 --> 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e
  style 5e4918d2_001e_cdf1_6103_dc17a8a94758 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { AstroConfigSchema } from '../core/config/schemas/index.js';
import type { AstroUserConfig } from '../types/public/config.js';
import type { AstroIntegration } from '../types/public/integrations.js';

const EVENT_SESSION = 'ASTRO_CLI_SESSION_STARTED';

interface EventPayload {
	cliCommand: string;
	config?: ConfigInfo;
	configKeys?: string[];
	flags?: string[];
	optionalIntegrations?: number;
}

type ConfigInfoValue = string | boolean | string[] | undefined;
type ConfigInfoRecord = Record<string, ConfigInfoValue>;
type ConfigInfoBase = {
	[alias in keyof AstroUserConfig]: ConfigInfoValue | ConfigInfoRecord;
};
interface ConfigInfo extends ConfigInfoBase {
	build: ConfigInfoRecord;
	image: ConfigInfoRecord;
	markdown: ConfigInfoRecord;
	experimental: ConfigInfoRecord;
	legacy: ConfigInfoRecord;
	vite: ConfigInfoRecord | undefined;
}

function measureIsDefined(val: unknown) {
	// if val is undefined, measure undefined as a value
	if (val === undefined) {
		return undefined;
	}
	// otherwise, convert the value to a boolean
	return Boolean(val);
}

type StringLiteral<T> = T extends string ? (string extends T ? never : T) : never;

/**
 * Measure supports string literal values. Passing a generic `string` type
 * results in an error, to make sure generic user input is never measured directly.
 */
function measureStringLiteral<T extends string>(
	val: StringLiteral<T> | boolean | undefined,
): string | boolean | undefined {
	return val;
}

function measureIntegration(val: AstroIntegration | false | null | undefined): string | undefined {
	if (!val || !val.name) {
		return undefined;
	}
	return val.name;
}

function sanitizeConfigInfo(obj: object | undefined, validKeys: string[]): ConfigInfoRecord {
	if (!obj || validKeys.length === 0) {
		return {};
	}
// ... (82 more lines)

Domain

Subdomains

Dependencies

  • ../../core/config/schemas/index.js
  • ../types/public/config.js
  • ../types/public/integrations.js

Frequently Asked Questions

What does session.ts do?
session.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 session.ts?
session.ts defines 6 function(s): createAnonymousConfigInfo, eventCliSession, measureIntegration, measureIsDefined, measureStringLiteral, sanitizeConfigInfo.
What does session.ts depend on?
session.ts imports 3 module(s): ../../core/config/schemas/index.js, ../types/public/config.js, ../types/public/integrations.js.
Where is session.ts in the architecture?
session.ts is located at packages/astro/src/events/session.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/events).

Analyze Your Own Codebase

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

Try Supermodel Free