Home / File/ script.ts — astro Source File

script.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  dbae44e0_72f6_7459_1fe0_1ce37c323cc1["script.ts"]
  10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"]
  dbae44e0_72f6_7459_1fe0_1ce37c323cc1 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05
  ff0be6cd_e34f_b283_f541_4038fdcadce5["./instruction.js"]
  dbae44e0_72f6_7459_1fe0_1ce37c323cc1 --> ff0be6cd_e34f_b283_f541_4038fdcadce5
  style dbae44e0_72f6_7459_1fe0_1ce37c323cc1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { SSRResult } from '../../../types/public/internal.js';
import { createRenderInstruction } from './instruction.js';

/**
 * Relies on the `renderScript: true` compiler option
 * @experimental
 */
export async function renderScript(result: SSRResult, id: string) {
	const inlined = result.inlinedScripts.get(id);
	let content = '';
	if (inlined != null) {
		// The inlined script may actually be empty, so skip rendering it altogether if so
		if (inlined) {
			content = `<script type="module">${inlined}</script>`;
		}
	} else {
		const resolved = await result.resolve(id);
		content = `<script type="module" src="${result.userAssetsBase ? (result.base === '/' ? '' : result.base) + result.userAssetsBase : ''}${resolved}"></script>`;
	}

	return createRenderInstruction({ type: 'script', id, content });
}

Domain

Subdomains

Functions

Dependencies

  • ../types/public/internal.js
  • ./instruction.js

Frequently Asked Questions

What does script.ts do?
script.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 script.ts?
script.ts defines 1 function(s): renderScript.
What does script.ts depend on?
script.ts imports 2 module(s): ../types/public/internal.js, ./instruction.js.
Where is script.ts in the architecture?
script.ts is located at packages/astro/src/runtime/server/render/script.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/runtime/server/render).

Analyze Your Own Codebase

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

Try Supermodel Free