Files
SnowLuma/.pnpm-store/v11/files/d9/3cc18e568082cd011e840654c0982fb1f1c532ee8b35205de90314a6ab9ea3a5a00b3bc1abac08c446e91648c87126abca8e5d9f6423ad4e95ac7fa9455ed7
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

29 lines
1.0 KiB
Plaintext

import { serveStatic as serveStatic$1 } from "../../middleware/serve-static/index.js";
import { getContentFromKVAsset } from "./utils.js";
//#region src/adapter/cloudflare-workers/serve-static.ts
/**
* @deprecated
* `serveStatic` in the Cloudflare Workers adapter is deprecated.
* You can serve static files directly using Cloudflare Static Assets.
* @see https://developers.cloudflare.com/workers/static-assets/
* Cloudflare Static Assets is currently in open beta. If this doesn't work for you,
* please consider using Cloudflare Pages. You can start to create the Cloudflare Pages
* application with the `npm create hono@latest` command.
*/
const serveStatic = (options = {}) => {
return async function serveStatic(c, next) {
const getContent = async (path) => {
return getContentFromKVAsset(path, {
manifest: options.manifest,
namespace: options.namespace ? options.namespace : c.env ? c.env.__STATIC_CONTENT : void 0
});
};
return serveStatic$1({
...options,
getContent
})(c, next);
};
};
//#endregion
export { serveStatic };