feat: scaffold Astro + Tailwind project

This commit is contained in:
TerryM
2026-05-12 16:16:03 +08:00
parent 906eb5c763
commit 03d3800c6c
12097 changed files with 1266600 additions and 0 deletions

20
node_modules/astro/dist/core/pages/handler.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { APIContext } from '../../types/public/context.js';
import type { FetchState } from '../fetch/fetch-state.js';
import type { Pipeline } from '../base-pipeline.js';
/**
* Handles dispatch of a matched route (endpoint / redirect / page / fallback)
* at the bottom of the middleware chain. This is a pure dispatch layer — it
* renders whatever route the `FetchState` currently points to without any
* rewrite logic. Rewrites are handled upstream: `Rewrites.execute()` for
* `Astro.rewrite()` and `AstroMiddleware` for `next(payload)`.
*
* `PagesHandler` is the `next` callback that `AstroMiddleware` invokes at
* the end of the middleware chain. `AstroHandler` owns a single instance
* and passes its `handle` method as the callback. Error handlers and the
* container also use `PagesHandler` directly for the same dispatch behavior.
*/
export declare class PagesHandler {
#private;
constructor(pipeline: Pipeline);
handle(state: FetchState, ctx: APIContext): Promise<Response>;
}

74
node_modules/astro/dist/core/pages/handler.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
import { renderEndpoint } from "../../runtime/server/endpoint.js";
import { renderPage } from "../../runtime/server/index.js";
import {
ASTRO_ERROR_HEADER,
REROUTE_DIRECTIVE_HEADER,
REWRITE_DIRECTIVE_HEADER_KEY,
REWRITE_DIRECTIVE_HEADER_VALUE,
ROUTE_TYPE_HEADER
} from "../constants.js";
import { getCookiesFromResponse } from "../cookies/response.js";
const EMPTY_SLOTS = Object.freeze({});
class PagesHandler {
#pipeline;
constructor(pipeline) {
this.#pipeline = pipeline;
}
async handle(state, ctx) {
const pipeline = this.#pipeline;
const { logger, streaming } = pipeline;
let response;
const componentInstance = await state.loadComponentInstance();
switch (state.routeData.type) {
case "endpoint": {
response = await renderEndpoint(
componentInstance,
ctx,
state.routeData.prerender,
logger
);
break;
}
case "page": {
const props = await state.getProps();
const actionApiContext = state.getActionAPIContext();
const result = await state.createResult(componentInstance, actionApiContext);
try {
response = await renderPage(
result,
componentInstance?.default,
props,
state.slots ?? EMPTY_SLOTS,
streaming,
state.routeData
);
} catch (e) {
result.cancelled = true;
throw e;
}
response.headers.set(ROUTE_TYPE_HEADER, "page");
if (state.routeData.route === "/404" || state.routeData.route === "/500") {
response.headers.set(REROUTE_DIRECTIVE_HEADER, "no");
}
if (state.isRewriting) {
response.headers.set(REWRITE_DIRECTIVE_HEADER_KEY, REWRITE_DIRECTIVE_HEADER_VALUE);
}
break;
}
case "redirect": {
return new Response(null, { status: 404, headers: { [ASTRO_ERROR_HEADER]: "true" } });
}
case "fallback": {
return new Response(null, { status: 500, headers: { [ROUTE_TYPE_HEADER]: "fallback" } });
}
}
const responseCookies = getCookiesFromResponse(response);
if (responseCookies) {
state.cookies.merge(responseCookies);
}
return response;
}
}
export {
PagesHandler
};