import { r as ExcludePattern } from "./index-BWZ_Xo1e.js"; import "./construct-BGlPfWMF.js"; import { c as IslandEmitter, i as registerIslandEmitter, l as IslandInfo, s as IslandEmission, t as getRequestRouteData } from "./route-store-fIZy4iN0.js"; import { t as BootContext } from "./types-D0uMBi2M.js"; import { n as BootEventName, t as BootEventHandler } from "./events-Cisz6kn6.js"; import { AstroIntegration } from "astro"; //#region src/types.d.ts interface NodeBootOptions { /** * Path to the boot file relative to the project root. * @default "src/boot.ts" (or "src/boot/index.ts" if present) */ entry?: string | undefined; /** * Restart the dev server when the boot file (or any of its dependencies) changes. * Dev-only — has no effect in production. * @default true */ watch?: boolean | undefined; } /** * Structurally compatible with `ProbePaths` from `health-probes`. */ interface HealthProbePaths { live?: string | undefined; startup?: string | undefined; ready?: string | undefined; health?: string | undefined; } interface NodeHealthOptions { /** * Host to bind the health server to. * Falls back to the `HEALTH_HOST` env var, then `'0.0.0.0'` for kubelet probes */ host?: string | undefined; /** * Port to bind the health server to. * Falls back to the `HEALTH_PORT` env var, then `9090`. */ port?: number | undefined; /** * Custom paths for probe endpoints. * @default K8sPaths (from health-probes) */ paths?: HealthProbePaths | undefined; } interface NodeLoggingOptions { /** * Paths excluded from request logging. Replaces the default * (`RECOMMENDED_EXCLUDES`) entirely when provided. */ exclude?: ExcludePattern[] | undefined; /** * Extended request logging: query string, headers, client address. * May capture sensitive data (auth tokens, PII in query strings). * @default false */ extended?: boolean | undefined; /** * Also log requests in dev at the connect level. Off by default — astro's * dev server already narrates requests; the `log` proxy works regardless. * @default false */ dev?: boolean | undefined; } interface NodePrometheusOptions { /** * Host to bind the Prometheus reader to. * Falls back to the `OTEL_EXPORTER_PROMETHEUS_HOST` env var, then `'0.0.0.0'`. */ host?: string | undefined; /** * Port for the Prometheus reader. * Falls back to the `OTEL_EXPORTER_PROMETHEUS_PORT` env var, then `9464`. */ port?: number | undefined; } interface NodeTelemetryOptions { /** * Paths excluded from request tracing and metrics. Replaces the default * (`RECOMMENDED_EXCLUDES`) entirely when provided. */ exclude?: ExcludePattern[] | undefined; /** * Prometheus metrics reader on its own port; `false` disables it. * @default { host: '0.0.0.0', port: 9464 } */ prometheus?: NodePrometheusOptions | false | undefined; /** * Also start the telemetry SDK in dev (once per process). Off by default — * several apps share localhost and would fight over the Prometheus port. * @default false */ dev?: boolean | undefined; } interface NodeOptions { /** * Boot lifecycle configuration. The boot file's `onStartup` runs before the * server starts listening; `onShutdown` runs on SIGTERM/SIGINT after in-flight * requests drained. Set to `false` to disable the lifecycle entirely. * * When left at the default and no boot file exists, the lifecycle is skipped. */ boot?: NodeBootOptions | false | undefined; /** * Request logging at the native handler (real status, response size, * aborted-vs-completed) plus the request-scoped `log` proxy exported from * `@astroscope/node/log`. Enabled by default in production; `false` disables * request logging (the `log` proxy keeps working). */ logging?: NodeLoggingOptions | false | undefined; /** * Platform telemetry: server spans and request metrics at the native * handler, fetch instrumentation via undici, runtime + host metrics, and a * Prometheus reader. Trace exporters are driven by standard `OTEL_*` env * vars. Enabled by default in production, off in dev; `false` disables. */ telemetry?: NodeTelemetryOptions | false | undefined; /** * Kubernetes-style health probes served on a separate port, driven around the * boot lifecycle (live before startup, ready after listen, draining on shutdown). * Enabled by default in production (never active in dev); set to `false` to disable. */ health?: NodeHealthOptions | false | undefined; /** * CSRF protection: rejects cross-origin POST/PUT/PATCH/DELETE requests by * comparing the Origin header against the request origin. Replaces Astro's * built-in `security.checkOrigin` (which supports no exclusions). * Enabled by default; set to `false` to keep Astro's built-in behavior. */ csrf?: false | { exclude?: ExcludePattern[] | undefined; } | undefined; /** * Island dependency preloading: streams html responses through a rewriter that * emits `modulepreload` links (and preload data for deferred islands, fired by a * small gate runtime with the directive's own scheduling) for each island's * chunk closure, removing the hydration request waterfall. Production-only — * dev has no chunk graph. Set to `false` to disable the preloading; the islands * middleware itself stays active for packages that registered island or document * emitters (e.g. `@astroscope/i18n`, `@astroscope/wormhole`). */ islands?: false | undefined; /** * On-demand image processing (`astro:assets` through the `/_image` * endpoint). `'auto'`: enabled only when the astro config sets * `image.service` itself; otherwise processing is disabled — any * ``/`getImage()` use throws with an explanation and `/_image` * answers 404, as if the endpoint did not exist. `'on'` keeps astro's default sharp service; `'off'` disables * even over an explicit `image.service`. Off unless configured because the * sharp endpoint is an on-demand decode+encode amplification surface most * SSR apps (serving pre-generated variants) don't need. * @default 'auto' */ imageService?: 'on' | 'off' | 'auto' | undefined; /** * Maximum request body size in bytes, for every request astro handles: a body announced * larger is refused with 413 before anything reads it, a chunked one is cut off at the limit * while being read. Native mounts are not covered. `0` or `Infinity` disables the limit. * @default 1048576 (1 MiB, astro's own default for action bodies) */ bodySizeLimit?: number | undefined; /** * How long to wait (ms) for in-flight requests to finish on shutdown before * remaining connections are closed forcefully. * @default 10000 */ shutdownTimeout?: number | undefined; } //#endregion //#region src/integration/integration.d.ts /** * Node adapter for Astro with a first-class server entrypoint: the boot * lifecycle, module warmup, health probes, request logging and telemetry run * as plain code around `server.listen()` instead of being injected into the * build output. */ export default function node(options?: NodeOptions): AstroIntegration; //#endregion //#region src/platform/prepare.d.ts interface InstrumentationContext { dev: boolean; } //#endregion //#region src/lifecycle/lifecycle.d.ts interface BootModule { onStartup?: ((context: BootContext) => Promise | void) | undefined; onShutdown?: ((context: BootContext) => Promise | void) | undefined; } //#endregion export { type BootContext, type BootEventHandler, type BootEventName, type BootModule, type HealthProbePaths, type InstrumentationContext, type IslandEmission, type IslandEmitter, type IslandInfo, type NodeBootOptions, type NodeHealthOptions, type NodeLoggingOptions, type NodeOptions, type NodePrometheusOptions, type NodeTelemetryOptions, getRequestRouteData, registerIslandEmitter }; //# sourceMappingURL=index.d.ts.map