content-entry-type.ts — astro Source File
Architecture documentation for content-entry-type.ts, a typescript file in the astro codebase. 16 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b46411b3_6535_0116_92ac_cd60b744df11["content-entry-type.ts"] e0eab863_6cf9_cc6e_219c_2c937d09a9cd["./config.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> e0eab863_6cf9_cc6e_219c_2c937d09a9cd bff4306e_e0a2_0dc6_dc0a_8f555d3acc13["./html/transform/html-token-transform.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> bff4306e_e0a2_0dc6_dc0a_8f555d3acc13 8a412af1_1e46_ac8f_4c97_33dd3645266a["./load-config.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> 8a412af1_1e46_ac8f_4c97_33dd3645266a 57d5145b_d383_f4ee_3ff2_e2df842c3ffb["./options.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> 57d5145b_d383_f4ee_3ff2_e2df842c3ffb c0b052b1_7d58_3445_73aa_2da99d2edfaa["./runtime.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> c0b052b1_7d58_3445_73aa_2da99d2edfaa c637085e_e9fa_249d_5cd6_2004f65bdd5b["./tokenizer.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> c637085e_e9fa_249d_5cd6_2004f65bdd5b 3349dcf7_c535_1ef1_37f1_278fa9b42d6d["./utils.js"] b46411b3_6535_0116_92ac_cd60b744df11 --> 3349dcf7_c535_1ef1_37f1_278fa9b42d6d e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] b46411b3_6535_0116_92ac_cd60b744df11 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"] b46411b3_6535_0116_92ac_cd60b744df11 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] b46411b3_6535_0116_92ac_cd60b744df11 --> d9a92db9_c95e_9165_13ac_24b3d859d946 82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"] b46411b3_6535_0116_92ac_cd60b744df11 --> 82f345a2_2234_43f1_c3c4_eea191acdca8 9e63cbe8_497c_4ffa_fe72_98f051e32a00["markdoc"] b46411b3_6535_0116_92ac_cd60b744df11 --> 9e63cbe8_497c_4ffa_fe72_98f051e32a00 f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] b46411b3_6535_0116_92ac_cd60b744df11 --> f16d8c76_2866_6150_bd14_0347b59abfe9 f8ab2297_5406_4f9e_e15c_c4eb026871f9["utils"] b46411b3_6535_0116_92ac_cd60b744df11 --> f8ab2297_5406_4f9e_e15c_c4eb026871f9 style b46411b3_6535_0116_92ac_cd60b744df11 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { parseFrontmatter } from '@astrojs/markdown-remark';
import type { Config as MarkdocConfig, Node } from '@markdoc/markdoc';
import Markdoc from '@markdoc/markdoc';
import type { AstroConfig, ContentEntryType } from 'astro';
import { emitClientAsset } from 'astro/assets/utils';
import { emitImageMetadata } from 'astro/assets/utils/node';
import type { Rollup, ErrorPayload as ViteErrorPayload } from 'vite';
import type { ComponentConfig } from './config.js';
import { htmlTokenTransform } from './html/transform/html-token-transform.js';
import type { MarkdocConfigResult } from './load-config.js';
import type { MarkdocIntegrationOptions } from './options.js';
import { setupConfig } from './runtime.js';
import { getMarkdocTokenizer } from './tokenizer.js';
import { isComponentConfig, isValidUrl, MarkdocError, prependForwardSlash } from './utils.js';
export async function getContentEntryType({
markdocConfigResult,
astroConfig,
options,
}: {
astroConfig: AstroConfig;
markdocConfigResult?: MarkdocConfigResult;
options?: MarkdocIntegrationOptions;
}): Promise<ContentEntryType> {
return {
extensions: ['.mdoc'],
getEntryInfo({ fileUrl, contents }) {
const parsed = safeParseFrontmatter(contents, fileURLToPath(fileUrl));
return {
data: parsed.frontmatter,
body: parsed.content.trim(),
slug: parsed.frontmatter.slug,
rawData: parsed.rawFrontmatter,
};
},
handlePropagation: true,
async getRenderModule({ contents, fileUrl, viteId }) {
const parsed = safeParseFrontmatter(contents, fileURLToPath(fileUrl));
const tokenizer = getMarkdocTokenizer(options);
let tokens = tokenizer.tokenize(parsed.content);
if (options?.allowHTML) {
tokens = htmlTokenTransform(tokenizer, tokens);
}
const ast = Markdoc.parse(tokens);
const userMarkdocConfig = markdocConfigResult?.config ?? {};
const markdocConfigUrl = markdocConfigResult?.fileUrl;
const pluginContext = this;
const markdocConfig = await setupConfig(userMarkdocConfig, options);
const filePath = fileURLToPath(fileUrl);
raiseValidationErrors({
ast,
/* Raised generics issue with Markdoc core https://github.com/markdoc/markdoc/discussions/400 */
markdocConfig: markdocConfig as MarkdocConfig,
viteId,
astroConfig,
// ... (368 more lines)
Domain
Subdomains
Functions
Dependencies
- ./config.js
- ./html/transform/html-token-transform.js
- ./load-config.js
- ./options.js
- ./runtime.js
- ./tokenizer.js
- ./utils.js
- astro
- markdoc
- markdown-remark
- node
- node:fs
- node:path
- node:url
- utils
- vite
Source
Frequently Asked Questions
What does content-entry-type.ts do?
content-entry-type.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 content-entry-type.ts?
content-entry-type.ts defines 10 function(s): emitOptimizedImages, getContentEntryType, getStringifiedImports, getStringifiedMap, getUsedTags, raiseValidationErrors, resolvePartials, safeParseFrontmatter, shouldOptimizeImage, toImportName.
What does content-entry-type.ts depend on?
content-entry-type.ts imports 16 module(s): ./config.js, ./html/transform/html-token-transform.js, ./load-config.js, ./options.js, ./runtime.js, ./tokenizer.js, ./utils.js, astro, and 8 more.
Where is content-entry-type.ts in the architecture?
content-entry-type.ts is located at packages/integrations/markdoc/src/content-entry-type.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