index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 15 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3645ae03_e174_ac69_61f8_dccc7510bafb["index.ts"] 520c567a_b741_f105_70ac_c637eacc7f83["../content/utils.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 520c567a_b741_f105_70ac_c637eacc7f83 ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> d3861967_b647_84d2_ff48_15013353bd56 f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> f68003f1_292f_ca44_03ce_21af87a33c7b a370a45c_02f1_30de_445d_47ee08d095a2["../core/viteUtils.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> a370a45c_02f1_30de_445d_47ee08d095a2 df93c329_2f79_6708_fa84_5c5c757a6c19["../runtime/server/shorthash.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> df93c329_2f79_6708_fa84_5c5c757a6c19 e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 6d6c494c_c8df_be75_fbfb_a5f4768e2e5c["../vite-plugin-astro/metadata.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 6d6c494c_c8df_be75_fbfb_a5f4768e2e5c 87530382_6d99_2339_182d_074e3de33bc8["../vite-plugin-utils/index.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 87530382_6d99_2339_182d_074e3de33bc8 121cec22_e164_619d_eac1_58e3509db20f["./images.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 121cec22_e164_619d_eac1_58e3509db20f 7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> d9a92db9_c95e_9165_13ac_24b3d859d946 82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"] 3645ae03_e174_ac69_61f8_dccc7510bafb --> 82f345a2_2234_43f1_c3c4_eea191acdca8 style 3645ae03_e174_ac69_61f8_dccc7510bafb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs';
import { fileURLToPath, pathToFileURL } from 'node:url';
import {
createMarkdownProcessor,
isFrontmatterValid,
type MarkdownProcessor,
} from '@astrojs/markdown-remark';
import type { Plugin } from 'vite';
import { safeParseFrontmatter } from '../content/utils.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import type { Logger } from '../core/logger/core.js';
import { isMarkdownFile, isPage } from '../core/util.js';
import { normalizePath } from '../core/viteUtils.js';
import { shorthash } from '../runtime/server/shorthash.js';
import type { AstroSettings } from '../types/astro.js';
import { createDefaultAstroMetadata } from '../vite-plugin-astro/metadata.js';
import { getFileInfo, specialQueriesRE } from '../vite-plugin-utils/index.js';
import { getMarkdownCodeForImages, type MarkdownImagePath } from './images.js';
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../core/constants.js';
interface AstroPluginOptions {
settings: AstroSettings;
logger: Logger;
}
const astroServerRuntimeModulePath = normalizePath(
fileURLToPath(new URL('../runtime/server/index.js', import.meta.url)),
);
const astroErrorModulePath = normalizePath(
fileURLToPath(new URL('../core/errors/index.js', import.meta.url)),
);
export default function markdown({ settings, logger }: AstroPluginOptions): Plugin {
let processor: Promise<MarkdownProcessor> | undefined;
return {
enforce: 'pre',
name: 'astro:markdown',
buildEnd() {
processor = undefined;
},
resolveId: {
filter: {
// Do not match sources that start with /
id: /^[^/]/,
},
async handler(source, importer, options) {
if (importer?.endsWith('.md')) {
let resolved = await this.resolve(source, importer, options);
if (!resolved) resolved = await this.resolve('./' + source, importer, options);
return resolved;
}
},
},
// Why not the "transform" hook instead of "load" + readFile?
// A: Vite transforms all "import.meta.env" references to their values before
// passing to the transform hook. This lets us get the truly raw value
// to escape "import.meta.env" ourselves.
load: {
// ... (135 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ../content/utils.js
- ../core/constants.js
- ../core/errors/index.js
- ../core/logger/core.js
- ../core/util.js
- ../core/viteUtils.js
- ../runtime/server/shorthash.js
- ../types/astro.js
- ../vite-plugin-astro/metadata.js
- ../vite-plugin-utils/index.js
- ./images.js
- markdown-remark
- node:fs
- node:url
- vite
Source
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, RenderingEngine subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): markdown.
What does index.ts depend on?
index.ts imports 15 module(s): ../content/utils.js, ../core/constants.js, ../core/errors/index.js, ../core/logger/core.js, ../core/util.js, ../core/viteUtils.js, ../runtime/server/shorthash.js, ../types/astro.js, and 7 more.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/vite-plugin-markdown/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-markdown).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free