Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  c981b0b6_feec_540f_f993_558bedd71f2c["index.ts"]
  18764c18_2bd1_598e_e2bd_fa2e7fbc1664["./content-entry-type.js"]
  c981b0b6_feec_540f_f993_558bedd71f2c --> 18764c18_2bd1_598e_e2bd_fa2e7fbc1664
  8a412af1_1e46_ac8f_4c97_33dd3645266a["./load-config.js"]
  c981b0b6_feec_540f_f993_558bedd71f2c --> 8a412af1_1e46_ac8f_4c97_33dd3645266a
  57d5145b_d383_f4ee_3ff2_e2df842c3ffb["./options.js"]
  c981b0b6_feec_540f_f993_558bedd71f2c --> 57d5145b_d383_f4ee_3ff2_e2df842c3ffb
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  c981b0b6_feec_540f_f993_558bedd71f2c --> f16d8c76_2866_6150_bd14_0347b59abfe9
  style c981b0b6_feec_540f_f993_558bedd71f2c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { AstroConfig, AstroIntegration, ContentEntryType, HookParameters } from 'astro';
import { getContentEntryType } from './content-entry-type.js';
import {
	loadMarkdocConfig,
	type MarkdocConfigResult,
	SUPPORTED_MARKDOC_CONFIG_FILES,
} from './load-config.js';
import type { MarkdocIntegrationOptions } from './options.js';

type SetupHookParams = HookParameters<'astro:config:setup'> & {
	// `contentEntryType` is not a public API
	// Add type defs here
	addContentEntryType: (contentEntryType: ContentEntryType) => void;
};

export default function markdocIntegration(options?: MarkdocIntegrationOptions): AstroIntegration {
	let markdocConfigResult: MarkdocConfigResult | undefined;
	let astroConfig: AstroConfig;
	return {
		name: '@astrojs/markdoc',
		hooks: {
			'astro:config:setup': async (params) => {
				const { updateConfig, addContentEntryType } = params as SetupHookParams;
				astroConfig = params.config;

				markdocConfigResult = await loadMarkdocConfig(astroConfig);

				addContentEntryType(
					await getContentEntryType({ markdocConfigResult, astroConfig, options }),
				);

				updateConfig({
					vite: {
						ssr: {
							external: ['@astrojs/markdoc/prism', '@astrojs/markdoc/shiki'],
						},
					},
				});
			},
			'astro:server:setup': async ({ server }) => {
				server.watcher.on('all', (_event, entry) => {
					if (SUPPORTED_MARKDOC_CONFIG_FILES.some((f) => entry.endsWith(f))) {
						server.restart();
					}
				});
			},
		},
	};
}

Domain

Subdomains

Dependencies

  • ./content-entry-type.js
  • ./load-config.js
  • ./options.js
  • astro

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, RoutingSystem subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): contentEntryType, markdocIntegration.
What does index.ts depend on?
index.ts imports 4 module(s): ./content-entry-type.js, ./load-config.js, ./options.js, astro.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/markdoc/src/index.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