Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  0672f845_9adf_2937_66ed_1ac9db7b7fdd["index.ts"]
  82e29a4c_6d66_66b2_ac26_4839b44d7121["./escape.js"]
  0672f845_9adf_2937_66ed_1ac9db7b7fdd --> 82e29a4c_6d66_66b2_ac26_4839b44d7121
  6083cfb6_f253_2121_912e_b72dce06cc7f["./slots.js"]
  0672f845_9adf_2937_66ed_1ac9db7b7fdd --> 6083cfb6_f253_2121_912e_b72dce06cc7f
  57045b72_8cbd_6e93_7687_5176cbcd502d["magic-string"]
  0672f845_9adf_2937_66ed_1ac9db7b7fdd --> 57045b72_8cbd_6e93_7687_5176cbcd502d
  0fe9f611_2ed0_7e85_0796_143fcc40fe18["rehype"]
  0672f845_9adf_2937_66ed_1ac9db7b7fdd --> 0fe9f611_2ed0_7e85_0796_143fcc40fe18
  b909a1d2_5b96_acd8_d198_1f106f44e2c3["vfile"]
  0672f845_9adf_2937_66ed_1ac9db7b7fdd --> b909a1d2_5b96_acd8_d198_1f106f44e2c3
  style 0672f845_9adf_2937_66ed_1ac9db7b7fdd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import MagicString from 'magic-string';
import { rehype } from 'rehype';
import { VFile } from 'vfile';
import escape from './escape.js';
import slots, { SLOT_PREFIX } from './slots.js';

export async function transform(code: string, id: string) {
	const s = new MagicString(code, { filename: id });
	const parser = rehype().data('settings', { fragment: true }).use(escape, { s }).use(slots, { s });

	const vfile = new VFile({ value: code, path: id });
	await parser.process(vfile);
	s.prepend(`function render({ slots: ${SLOT_PREFIX} }) {\n\t\treturn \``);
	s.append('`\n\t}\nrender["astro:html"] = true;\nexport default render;');

	return {
		code: s.toString(),
		map: s.generateMap({ hires: 'boundary' }),
	};
}

Domain

Subdomains

Functions

Dependencies

  • ./escape.js
  • ./slots.js
  • magic-string
  • rehype
  • vfile

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): transform.
What does index.ts depend on?
index.ts imports 5 module(s): ./escape.js, ./slots.js, magic-string, rehype, vfile.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/vite-plugin-html/transform/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-html/transform).

Analyze Your Own Codebase

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

Try Supermodel Free