Home / Function/ getPrescripts() — astro Function Reference

getPrescripts() — astro Function Reference

Architecture documentation for the getPrescripts() function in scripts.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  cf35fbda_f098_09ca_b464_4ea610fb0825["getPrescripts()"]
  7d939579_ff24_6e88_6d95_2d48a8dbe011["scripts.ts"]
  cf35fbda_f098_09ca_b464_4ea610fb0825 -->|defined in| 7d939579_ff24_6e88_6d95_2d48a8dbe011
  5bd1f38e_d9ec_d821_510e_5b00dc744d01["getDirectiveScriptText()"]
  cf35fbda_f098_09ca_b464_4ea610fb0825 -->|calls| 5bd1f38e_d9ec_d821_510e_5b00dc744d01
  style cf35fbda_f098_09ca_b464_4ea610fb0825 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/scripts.ts lines 32–45

export function getPrescripts(result: SSRResult, type: PrescriptType, directive: string): string {
	// Note that this is a classic script, not a module script.
	// This is so that it executes immediately, and when the browser encounters
	// an astro-island element, the callbacks will fire immediately, causing the JS
	// deps to be loaded immediately.
	switch (type) {
		case 'both':
			return `<style>${ISLAND_STYLES}</style><script>${getDirectiveScriptText(result, directive)}</script><script>${
				process.env.NODE_ENV === 'development' ? islandScriptDev : islandScript
			}</script>`;
		case 'directive':
			return `<script>${getDirectiveScriptText(result, directive)}</script>`;
	}
}

Domain

Subdomains

Frequently Asked Questions

What does getPrescripts() do?
getPrescripts() is a function in the astro codebase, defined in packages/astro/src/runtime/server/scripts.ts.
Where is getPrescripts() defined?
getPrescripts() is defined in packages/astro/src/runtime/server/scripts.ts at line 32.
What does getPrescripts() call?
getPrescripts() calls 1 function(s): getDirectiveScriptText.

Analyze Your Own Codebase

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

Try Supermodel Free