server-islands.ts — astro Source File
Architecture documentation for server-islands.ts, a typescript file in the astro codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR cdac2309_6b88_4855_a8b7_92ab5e67a65d["server-islands.ts"] dd2fe7bd_2244_3ff4_38ec_5e07763d1492["../core/encryption.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> dd2fe7bd_2244_3ff4_38ec_5e07763d1492 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 a7eea85d_ea97_57b1_9a24_f99face6a97d["./escape.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> a7eea85d_ea97_57b1_9a24_f99face6a97d 6c868e3a_5b34_f101_8dd5_f09c50957ba0["./any.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> 6c868e3a_5b34_f101_8dd5_f09c50957ba0 fafd37f7_4f96_f4d7_ed97_94234c7e57aa["./astro/head-and-content.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> fafd37f7_4f96_f4d7_ed97_94234c7e57aa b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb["./common.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb ff0be6cd_e34f_b283_f541_4038fdcadce5["./instruction.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> ff0be6cd_e34f_b283_f541_4038fdcadce5 624e5f97_7f83_f926_3407_b10786361e90["./slot.js"] cdac2309_6b88_4855_a8b7_92ab5e67a65d --> 624e5f97_7f83_f926_3407_b10786361e90 style cdac2309_6b88_4855_a8b7_92ab5e67a65d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { encryptString, generateCspDigest } from '../../../core/encryption.js';
import type { SSRResult } from '../../../types/public/internal.js';
import { markHTMLString } from '../escape.js';
import { renderChild } from './any.js';
import { createThinHead, type ThinHead } from './astro/head-and-content.js';
import type { RenderDestination } from './common.js';
import { createRenderInstruction } from './instruction.js';
import { type ComponentSlots, renderSlotToString } from './slot.js';
const internalProps = new Set([
'server:component-path',
'server:component-export',
'server:component-directive',
'server:defer',
]);
export function containsServerDirective(props: Record<string | number, any>) {
return 'server:component-directive' in props;
}
const SCRIPT_RE = /<\/script/giu;
const COMMENT_RE = /<!--/gu;
const SCRIPT_REPLACER = '<\\/script';
const COMMENT_REPLACER = '\\u003C!--';
/**
* Encodes the script end-tag open (ETAGO) delimiter and opening HTML comment syntax for JSON inside a `<script>` tag.
* @see https://mathiasbynens.be/notes/etago
*/
function safeJsonStringify(obj: any) {
return JSON.stringify(obj)
.replace(SCRIPT_RE, SCRIPT_REPLACER)
.replace(COMMENT_RE, COMMENT_REPLACER);
}
function createSearchParams(
encryptedComponentExport: string,
encryptedProps: string,
slots: string,
) {
const params = new URLSearchParams();
params.set('e', encryptedComponentExport);
params.set('p', encryptedProps);
params.set('s', slots);
return params;
}
function isWithinURLLimit(pathname: string, params: URLSearchParams) {
const url = pathname + '?' + params.toString();
const chars = url.length;
// https://chromium.googlesource.com/chromium/src/+/master/docs/security/url_display_guidelines/url_display_guidelines.md#url-length
return chars < 2048;
}
export class ServerIslandComponent {
result: SSRResult;
props: Record<string | number, any>;
slots: ComponentSlots;
displayName: string;
hostId: string | undefined;
// ... (193 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- ../core/encryption.js
- ../types/public/internal.js
- ./any.js
- ./astro/head-and-content.js
- ./common.js
- ./escape.js
- ./instruction.js
- ./slot.js
Source
Frequently Asked Questions
What does server-islands.ts do?
server-islands.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 server-islands.ts?
server-islands.ts defines 6 function(s): SERVER_ISLAND_REPLACER, containsServerDirective, createSearchParams, isWithinURLLimit, renderServerIslandRuntime, safeJsonStringify.
What does server-islands.ts depend on?
server-islands.ts imports 8 module(s): ../core/encryption.js, ../types/public/internal.js, ./any.js, ./astro/head-and-content.js, ./common.js, ./escape.js, ./instruction.js, ./slot.js.
Where is server-islands.ts in the architecture?
server-islands.ts is located at packages/astro/src/runtime/server/render/server-islands.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