Home / File/ base.ts — astro Source File

base.ts — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4["base.ts"]
  f9135b22_844a_994a_36b6_f2bdc2b16857["../../src/assets/fonts/config.js"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> f9135b22_844a_994a_36b6_f2bdc2b16857
  3a338670_ef65_2b57_cc61_29c1c222b236["../../env/schema.js"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> 3a338670_ef65_2b57_cc61_29c1c222b236
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  d34ed003_355b_637d_1578_cba29babbd4c["../../core/csp/config.js"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> d34ed003_355b_637d_1578_cba29babbd4c
  8a27b9b6_ce91_6581_3174_c8b0df54e593["../../session/config.js"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> 8a27b9b6_ce91_6581_3174_c8b0df54e593
  c2f6615e_96e9_c4eb_5f71_cf120e271705["node:http"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> c2f6615e_96e9_c4eb_5f71_cf120e271705
  82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> 82f345a2_2234_43f1_c3c4_eea191acdca8
  0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4["shiki"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> 0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4
  21fed27e_530c_dc1d_9c13_6eebedd78776["svgo"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> 21fed27e_530c_dc1d_9c13_6eebedd78776
  f8c9251e_f535_6281_2118_9e79a4155212["v4"]
  0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 --> f8c9251e_f535_6281_2118_9e79a4155212
  style 0bd393e4_9ea8_cd09_8d4b_ad28b661b4e4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { OutgoingHttpHeaders } from 'node:http';
import type {
	RehypePlugin as _RehypePlugin,
	RemarkPlugin as _RemarkPlugin,
	RemarkRehype as _RemarkRehype,
	ShikiConfig,
} from '@astrojs/markdown-remark';
import { markdownConfigDefaults, syntaxHighlightDefaults } from '@astrojs/markdown-remark';
import { type BuiltinTheme, bundledThemes } from 'shiki';
import type { Config as SvgoConfig } from 'svgo';
import * as z from 'zod/v4';
import { FontFamilySchema } from '../../../assets/fonts/config.js';
import { EnvSchema } from '../../../env/schema.js';
import type { AstroUserConfig, ViteUserConfig } from '../../../types/public/config.js';
import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from '../../csp/config.js';
import { SessionSchema } from '../../session/config.js';

// The below types are required boilerplate to workaround a Zod issue since v3.21.2. Since that version,
// Zod's compiled TypeScript would "simplify" certain values to their base representation, causing references
// to transitive dependencies that Astro don't depend on (e.g. `mdast-util-to-hast` or `remark-rehype`). For example:
//
// ```ts
// // input
// type Foo = { bar: string };
// export const value: Foo;
//
// // output
// export const value: { bar: string }; // <-- `Foo` is gone
// ```
//
// The types below will "complexify" the types so that TypeScript would not simplify them. This way it will
// reference the complex type directly, instead of referencing non-existent transitive dependencies.
//
// Also, make sure to not index the complexified type, as it would return a simplified value type, which goes
// back to the issue again. The complexified type should be the base representation that we want to expose.

/** @lintignore */
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface ComplexifyUnionObj {}

type ComplexifyWithUnion<T> = T & ComplexifyUnionObj;
type ComplexifyWithOmit<T> = Omit<T, '__nonExistent'>;

type ShikiLang = ComplexifyWithUnion<NonNullable<ShikiConfig['langs']>[number]>;
type ShikiTheme = ComplexifyWithUnion<NonNullable<ShikiConfig['theme']>>;
type ShikiTransformer = ComplexifyWithUnion<NonNullable<ShikiConfig['transformers']>[number]>;
type RehypePlugin = ComplexifyWithUnion<_RehypePlugin>;
type RemarkPlugin = ComplexifyWithUnion<_RemarkPlugin>;
/** @lintignore */
export type RemarkRehype = ComplexifyWithOmit<_RemarkRehype>;

export const ASTRO_CONFIG_DEFAULTS = {
	root: '.',
	srcDir: './src',
	publicDir: './public',
	outDir: './dist',
	cacheDir: './node_modules/.astro',
	base: '/',
	trailingSlash: 'ignore',
	build: {
// ... (446 more lines)

Domain

Dependencies

  • ../../core/csp/config.js
  • ../../env/schema.js
  • ../../session/config.js
  • ../../src/assets/fonts/config.js
  • ../types/public/config.js
  • markdown-remark
  • node:http
  • shiki
  • svgo
  • v4

Frequently Asked Questions

What does base.ts do?
base.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain.
What does base.ts depend on?
base.ts imports 10 module(s): ../../core/csp/config.js, ../../env/schema.js, ../../session/config.js, ../../src/assets/fonts/config.js, ../types/public/config.js, markdown-remark, node:http, shiki, and 2 more.
Where is base.ts in the architecture?
base.ts is located at packages/astro/src/core/config/schemas/base.ts (domain: CoreAstro, directory: packages/astro/src/core/config/schemas).

Analyze Your Own Codebase

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

Try Supermodel Free