hydration.ts — astro Source File
Architecture documentation for hydration.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b["hydration.ts"] ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 a7eea85d_ea97_57b1_9a24_f99face6a97d["./escape.js"] 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b --> a7eea85d_ea97_57b1_9a24_f99face6a97d a2af2906_7095_2cba_27c9_a64837c9a056["../serialize.js"] 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b --> a2af2906_7095_2cba_27c9_a64837c9a056 style 5c9b16ff_599b_b1b0_fd4a_a24ff528fd5b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type {
AstroComponentMetadata,
SSRElement,
SSRLoadedRenderer,
SSRResult,
} from '../../types/public/internal.js';
import { escapeHTML } from './escape.js';
import { serializeProps } from './serialize.js';
export interface HydrationMetadata {
directive: string;
value: string;
componentUrl: string;
componentExport: { value: string };
}
type Props = Record<string | number | symbol, any>;
interface ExtractedProps {
isPage: boolean;
hydration: HydrationMetadata | null;
props: Props;
propsWithoutTransitionAttributes: Props;
}
const transitionDirectivesToCopyOnIsland = Object.freeze([
'data-astro-transition-scope',
'data-astro-transition-persist',
'data-astro-transition-persist-props',
]);
// Used to extract the directives, aka `client:load` information about a component.
// Finds these special props and removes them from what gets passed into the component.
export function extractDirectives(
inputProps: Props,
clientDirectives: SSRResult['clientDirectives'],
): ExtractedProps {
let extracted: ExtractedProps = {
isPage: false,
hydration: null,
props: {},
propsWithoutTransitionAttributes: {},
};
for (const [key, value] of Object.entries(inputProps)) {
if (key.startsWith('server:')) {
if (key === 'server:root') {
extracted.isPage = true;
}
}
if (key.startsWith('client:')) {
if (!extracted.hydration) {
extracted.hydration = {
directive: '',
value: '',
componentUrl: '',
componentExport: { value: '' },
};
}
switch (key) {
// ... (128 more lines)
Domain
Subdomains
Dependencies
- ../core/errors/index.js
- ../serialize.js
- ../types/public/internal.js
- ./escape.js
Source
Frequently Asked Questions
What does hydration.ts do?
hydration.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 hydration.ts?
hydration.ts defines 2 function(s): extractDirectives, generateHydrateScript.
What does hydration.ts depend on?
hydration.ts imports 4 module(s): ../core/errors/index.js, ../serialize.js, ../types/public/internal.js, ./escape.js.
Where is hydration.ts in the architecture?
hydration.ts is located at packages/astro/src/runtime/server/hydration.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/runtime/server).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free