feat: scaffold Astro + Tailwind project
This commit is contained in:
21
node_modules/astro/dist/core/hono/index.d.ts
generated
vendored
Normal file
21
node_modules/astro/dist/core/hono/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { FetchState } from '../fetch/index.js';
|
||||
export { FetchState };
|
||||
export type { AstroFetchState } from '../fetch/index.js';
|
||||
type HonoContextLike = {
|
||||
req: {
|
||||
raw: Request;
|
||||
};
|
||||
res: Response;
|
||||
get?: (key: string) => unknown;
|
||||
set?: (key: string, value: unknown) => void;
|
||||
};
|
||||
type HonoMiddlewareHandler = (context: HonoContextLike, next: () => Promise<void>) => Promise<Response | void>;
|
||||
export declare function astro(): HonoMiddlewareHandler;
|
||||
export declare function trailingSlash(): HonoMiddlewareHandler;
|
||||
export declare function middleware(): HonoMiddlewareHandler;
|
||||
export declare function redirects(): HonoMiddlewareHandler;
|
||||
export declare function actions(): HonoMiddlewareHandler;
|
||||
export declare function pages(): HonoMiddlewareHandler;
|
||||
export declare function sessions(): HonoMiddlewareHandler;
|
||||
export declare function cache(next: () => Promise<Response>): HonoMiddlewareHandler;
|
||||
export declare function i18n(): HonoMiddlewareHandler;
|
||||
98
node_modules/astro/dist/core/hono/index.js
generated
vendored
Normal file
98
node_modules/astro/dist/core/hono/index.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
import {
|
||||
FetchState,
|
||||
actions as fetchActions,
|
||||
astro as fetchAstro,
|
||||
cache as fetchCache,
|
||||
i18n as fetchI18n,
|
||||
middleware as fetchMiddleware,
|
||||
pages as fetchPages,
|
||||
redirects as fetchRedirects,
|
||||
sessions as fetchSessions,
|
||||
trailingSlash as fetchTrailingSlash
|
||||
} from "../fetch/index.js";
|
||||
const FETCH_STATE_KEY = "fetchState";
|
||||
function getFetchState(context) {
|
||||
const state = context.get?.(FETCH_STATE_KEY);
|
||||
if (state) {
|
||||
return state;
|
||||
}
|
||||
const nextState = new FetchState(context.req.raw);
|
||||
context.set?.(FETCH_STATE_KEY, nextState);
|
||||
return nextState;
|
||||
}
|
||||
function astro() {
|
||||
return async (context, _next) => {
|
||||
return fetchAstro(getFetchState(context));
|
||||
};
|
||||
}
|
||||
function trailingSlash() {
|
||||
return async (context, honoNext) => {
|
||||
const redirect = fetchTrailingSlash(getFetchState(context));
|
||||
if (redirect) return redirect;
|
||||
await honoNext();
|
||||
};
|
||||
}
|
||||
function middleware() {
|
||||
return async (context, honoNext) => {
|
||||
return fetchMiddleware(getFetchState(context), async () => {
|
||||
await honoNext();
|
||||
return context.res;
|
||||
});
|
||||
};
|
||||
}
|
||||
function redirects() {
|
||||
return async (context, honoNext) => {
|
||||
const response = fetchRedirects(getFetchState(context));
|
||||
if (response) return response;
|
||||
await honoNext();
|
||||
};
|
||||
}
|
||||
function actions() {
|
||||
return async (context, honoNext) => {
|
||||
const result = fetchActions(getFetchState(context));
|
||||
if (result) {
|
||||
const response = await result;
|
||||
if (response) return response;
|
||||
}
|
||||
await honoNext();
|
||||
};
|
||||
}
|
||||
function pages() {
|
||||
return async (context, _honoNext) => {
|
||||
return fetchPages(getFetchState(context));
|
||||
};
|
||||
}
|
||||
function sessions() {
|
||||
return async (context, honoNext) => {
|
||||
const state = getFetchState(context);
|
||||
await fetchSessions(state);
|
||||
try {
|
||||
await honoNext();
|
||||
} finally {
|
||||
await state.finalizeAll();
|
||||
}
|
||||
};
|
||||
}
|
||||
function cache(next) {
|
||||
return async (context, _honoNext) => {
|
||||
return fetchCache(getFetchState(context), next);
|
||||
};
|
||||
}
|
||||
function i18n() {
|
||||
return async (context, honoNext) => {
|
||||
await honoNext();
|
||||
context.res = await fetchI18n(getFetchState(context), context.res);
|
||||
};
|
||||
}
|
||||
export {
|
||||
FetchState,
|
||||
actions,
|
||||
astro,
|
||||
cache,
|
||||
i18n,
|
||||
middleware,
|
||||
pages,
|
||||
redirects,
|
||||
sessions,
|
||||
trailingSlash
|
||||
};
|
||||
Reference in New Issue
Block a user