Files
agentic-studio/network-poc/frontend/node_modules/astro/dist/vite-plugin-astro-server/trailing-slash.d.ts
Jaakko Vanhala a8c4af0975 Frontend uudelleenrakennettu: Astro-komponentit, Wasm pääsäikeessä, ei Workeria
Vanha frontend siirretty temp/. Uusi rakenne:
- StatusBar.astro, Terminal.astro, Editor.astro, Guide.astro
- global.css erillinen
- Wasm pääsäikeessä (ei Worker — yksinkertainen, debugattava)
- Tab-completion, dropdown, projektikortti, Monaco, GUIDE.md
- Ei tokenisointia eikä koodilaboratoriota

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 20:17:39 +03:00

38 lines
1.6 KiB
TypeScript

import type * as vite from 'vite';
import type { AstroSettings } from '../types/astro.js';
/**
* Outcome of the trailing-slash evaluation for a dev-server request.
*
* - **`next`** — The URL is acceptable. Pass the request through to the next
* middleware / route handler unchanged.
* - **`redirect`** — The URL contains duplicate trailing slashes (e.g.
* `/about//`). The client should be permanently redirected (301) to the
* collapsed form (`/about/`) so crawlers and browsers update their links.
* - **`reject`** — The URL's trailing-slash style conflicts with the project's
* `trailingSlash` config (`'always'` or `'never'`). The dev server responds
* with a 404 and a human-readable error page explaining the mismatch, giving
* the developer immediate feedback that their link is wrong before it reaches
* production.
*/
export type TrailingSlashDecision = {
action: 'next';
} | {
action: 'redirect';
status: 301;
location: string;
} | {
action: 'reject';
status: 404;
pathname: string;
};
/**
* Pure decision function for trailing-slash dev-server behavior.
*
* Evaluates a decoded `pathname`, the query-string portion (including leading
* `?`), and the project's `trailingSlash` config and returns the action the
* middleware should take. The middleware is responsible for translating the
* decision into an HTTP response.
*/
export declare function evaluateTrailingSlash(pathname: string, search: string, trailingSlash: 'always' | 'never' | 'ignore'): TrailingSlashDecision;
export declare function trailingSlashMiddleware(settings: AstroSettings): vite.Connect.NextHandleFunction;