Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 7 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  942f8bed_424f_0805_6c0b_154ed0869816["index.ts"]
  e9868a50_a3db_d2ef_89ae_e9f3592bf265["./defaults.js"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> e9868a50_a3db_d2ef_89ae_e9f3592bf265
  565c0b6a_91f5_c3ce_0d6d_cede687a485c["./store.js"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> 565c0b6a_91f5_c3ce_0d6d_cede687a485c
  b326953c_dc9d_ec9e_dc34_4beead549f6e["node:os"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> b326953c_dc9d_ec9e_dc34_4beead549f6e
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  11492406_d927_cd22_cbdd_09d2c1b03ff4["node:process"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> 11492406_d927_cd22_cbdd_09d2c1b03ff4
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  d9073335_b3f3_9f7a_62f3_5035edaf179b["dlv"]
  942f8bed_424f_0805_6c0b_154ed0869816 --> d9073335_b3f3_9f7a_62f3_5035edaf179b
  style 942f8bed_424f_0805_6c0b_154ed0869816 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import dget from 'dlv';
import { DEFAULT_PREFERENCES, type Preferences, type PublicPreferences } from './defaults.js';
import { PreferenceStore } from './store.js';

type DotKeys<T> = T extends object
	? {
			[K in keyof T]: `${Exclude<K, symbol>}${DotKeys<T[K]> extends never
				? ''
				: `.${DotKeys<T[K]>}`}`;
		}[keyof T]
	: never;

type GetDotKey<
	T extends Record<string | number, any>,
	K extends string,
> = K extends `${infer U}.${infer Rest}` ? GetDotKey<T[U], Rest> : T[K];

type PreferenceLocation = 'global' | 'project';
interface PreferenceOptions {
	location?: PreferenceLocation;
	/**
	 * If `true`, the server will be reloaded after setting the preference.
	 * If `false`, the server will not be reloaded after setting the preference.
	 *
	 * Defaults to `true`.
	 */
	reloadServer?: boolean;
}

type DeepPartial<T> = T extends object
	? {
			[P in keyof T]?: DeepPartial<T[P]>;
		}
	: T;

export type PreferenceKey = DotKeys<Preferences>;
interface PreferenceList extends Record<PreferenceLocation, DeepPartial<PublicPreferences>> {
	fromAstroConfig: DeepPartial<Preferences>;
	defaults: PublicPreferences;
}

export interface AstroPreferences {
	get<Key extends PreferenceKey>(
		key: Key,
		opts?: PreferenceOptions,
	): Promise<GetDotKey<Preferences, Key>>;
	set<Key extends PreferenceKey>(
		key: Key,
		value: GetDotKey<Preferences, Key>,
		opts?: PreferenceOptions,
	): Promise<void>;
	getAll(): Promise<PublicPreferences>;
	list(opts?: PreferenceOptions): Promise<PreferenceList>;
	ignoreNextPreferenceReload: boolean;
}

// ... (97 more lines)

Domain

Subdomains

Dependencies

  • ./defaults.js
  • ./store.js
  • dlv
  • node:os
  • node:path
  • node:process
  • node:url

Frequently Asked Questions

What does index.ts do?
index.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 index.ts?
index.ts defines 4 function(s): coerce, createPreferences, getGlobalPreferenceDir, isValidKey.
What does index.ts depend on?
index.ts imports 7 module(s): ./defaults.js, ./store.js, dlv, node:os, node:path, node:process, node:url.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/preferences/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/preferences).

Analyze Your Own Codebase

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

Try Supermodel Free