Home / File/ config.ts — astro Source File

config.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 5 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  52b07c51_0c97_ccad_b66e_5d6344c6252a["config.ts"]
  ef502ee1_5615_5b2c_7dbc_39c601bb29d5["./heading-ids.js"]
  52b07c51_0c97_ccad_b66e_5d6344c6252a --> ef502ee1_5615_5b2c_7dbc_39c601bb29d5
  3349dcf7_c535_1ef1_37f1_278fa9b42d6d["./utils.js"]
  52b07c51_0c97_ccad_b66e_5d6344c6252a --> 3349dcf7_c535_1ef1_37f1_278fa9b42d6d
  e4df8f29_fb2f_3d70_a962_fdf6a3670b22["path"]
  52b07c51_0c97_ccad_b66e_5d6344c6252a --> e4df8f29_fb2f_3d70_a962_fdf6a3670b22
  9e63cbe8_497c_4ffa_fe72_98f051e32a00["markdoc"]
  52b07c51_0c97_ccad_b66e_5d6344c6252a --> 9e63cbe8_497c_4ffa_fe72_98f051e32a00
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  52b07c51_0c97_ccad_b66e_5d6344c6252a --> f16d8c76_2866_6150_bd14_0347b59abfe9
  style 52b07c51_0c97_ccad_b66e_5d6344c6252a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isRelativePath } from '@astrojs/internal-helpers/path';
import type {
	Config,
	ConfigType as MarkdocConfig,
	MaybePromise,
	NodeType,
	Schema,
} from '@markdoc/markdoc';
import _Markdoc from '@markdoc/markdoc';
import type { AstroInstance } from 'astro';
import { heading } from './heading-ids.js';
import { componentConfigSymbol } from './utils.js';

export type Render = ComponentConfig | AstroInstance['default'] | string;
export type ComponentConfig = {
	type: 'package' | 'local';
	path: string;
	namedExport?: string;
	[componentConfigSymbol]: true;
};

export type AstroMarkdocConfig<C extends Record<string, any> = Record<string, any>> = Omit<
	MarkdocConfig,
	'tags' | 'nodes'
> &
	Partial<{
		tags: Record<string, Schema<Config, Render>>;
		nodes: Partial<Record<NodeType, Schema<Config, Render>>>;
		ctx: C;
		extends: MaybePromise<ResolvedAstroMarkdocConfig>[];
	}>;

export type ResolvedAstroMarkdocConfig = Omit<AstroMarkdocConfig, 'extends'>;

export const Markdoc = _Markdoc;
export const nodes = { ...Markdoc.nodes, heading };

export function defineMarkdocConfig(config: AstroMarkdocConfig): AstroMarkdocConfig {
	return config;
}

export function component(pathnameOrPkgName: string, namedExport?: string): ComponentConfig {
	return {
		type: isNpmPackageName(pathnameOrPkgName) ? 'package' : 'local',
		path: pathnameOrPkgName,
		namedExport,
		[componentConfigSymbol]: true,
	};
}

function isNpmPackageName(pathname: string) {
	return !isRelativePath(pathname) && !pathname.startsWith('/');
}

Domain

Subdomains

Dependencies

  • ./heading-ids.js
  • ./utils.js
  • astro
  • markdoc
  • path

Frequently Asked Questions

What does config.ts do?
config.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in config.ts?
config.ts defines 3 function(s): component, defineMarkdocConfig, isNpmPackageName.
What does config.ts depend on?
config.ts imports 5 module(s): ./heading-ids.js, ./utils.js, astro, markdoc, path.
Where is config.ts in the architecture?
config.ts is located at packages/integrations/markdoc/src/config.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/markdoc/src).

Analyze Your Own Codebase

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

Try Supermodel Free