Home / File/ runtime.ts — astro Source File

runtime.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 8 imports 9 functions

Entity Profile

Dependency Diagram

graph LR
  df14bb08_8e2c_26c3_53bb_884062fbbac0["runtime.ts"]
  e0eab863_6cf9_cc6e_219c_2c937d09a9cd["./config.js"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> e0eab863_6cf9_cc6e_219c_2c937d09a9cd
  ef502ee1_5615_5b2c_7dbc_39c601bb29d5["./heading-ids.js"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> ef502ee1_5615_5b2c_7dbc_39c601bb29d5
  200b5879_f1e8_2b73_ee61_895eb59d1ecf["./html/tagdefs/html.tag.js"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> 200b5879_f1e8_2b73_ee61_895eb59d1ecf
  57d5145b_d383_f4ee_3ff2_e2df842c3ffb["./options.js"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> 57d5145b_d383_f4ee_3ff2_e2df842c3ffb
  82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> 82f345a2_2234_43f1_c3c4_eea191acdca8
  9e63cbe8_497c_4ffa_fe72_98f051e32a00["markdoc"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> 9e63cbe8_497c_4ffa_fe72_98f051e32a00
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  21c9aedb_261f_6744_350a_486c989130ae["index.js"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0 --> 21c9aedb_261f_6744_350a_486c989130ae
  style df14bb08_8e2c_26c3_53bb_884062fbbac0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { MarkdownHeading } from '@astrojs/markdown-remark';
import Markdoc, {
	type ConfigType,
	type Node,
	type NodeType,
	type RenderableTreeNode,
} from '@markdoc/markdoc';
import type { AstroInstance } from 'astro';
import { createComponent, renderComponent } from 'astro/runtime/server/index.js';
import type { AstroMarkdocConfig } from './config.js';
import { setupHeadingConfig } from './heading-ids.js';
import { htmlTag } from './html/tagdefs/html.tag.js';
import type { MarkdocIntegrationOptions } from './options.js';
/**
 * Merge user config with default config and set up context (ex. heading ID slugger)
 * Called on each file's individual transform.
 * TODO: virtual module to merge configs per-build instead of per-file?
 */
export async function setupConfig(
	userConfig: AstroMarkdocConfig = {},
	options: MarkdocIntegrationOptions | undefined,
): Promise<MergedConfig> {
	let defaultConfig: AstroMarkdocConfig = setupHeadingConfig();

	if (userConfig.extends) {
		for (let extension of userConfig.extends) {
			if (extension instanceof Promise) {
				extension = await extension;
			}

			defaultConfig = mergeConfig(defaultConfig, extension);
		}
	}

	let merged = mergeConfig(defaultConfig, userConfig);

	if (options?.allowHTML) {
		merged = mergeConfig(merged, HTML_CONFIG);
	}

	return merged;
}

/** Used for synchronous `getHeadings()` function */
export function setupConfigSync(
	userConfig: AstroMarkdocConfig = {},
	options: MarkdocIntegrationOptions | undefined,
): MergedConfig {
	const defaultConfig: AstroMarkdocConfig = setupHeadingConfig();

	let merged = mergeConfig(defaultConfig, userConfig);

	if (options?.allowHTML) {
		merged = mergeConfig(merged, HTML_CONFIG);
	}

	return merged;
}

type MergedConfig = Required<Omit<AstroMarkdocConfig, 'extends'>>;
// ... (188 more lines)

Domain

Subdomains

Types

Dependencies

  • ./config.js
  • ./heading-ids.js
  • ./html/tagdefs/html.tag.js
  • ./options.js
  • astro
  • index.js
  • markdoc
  • markdown-remark

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, RoutingSystem subdomain.
What functions are defined in runtime.ts?
runtime.ts defines 9 function(s): collectHeadings, createContentComponent, createGetHeadings, getTextContent, mergeConfig, resolveComponentImports, setupConfig, setupConfigSync, transformRespectsRender.
What does runtime.ts depend on?
runtime.ts imports 8 module(s): ./config.js, ./heading-ids.js, ./html/tagdefs/html.tag.js, ./options.js, astro, index.js, markdoc, markdown-remark.
Where is runtime.ts in the architecture?
runtime.ts is located at packages/integrations/markdoc/src/runtime.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