feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
declare global {
const __STATIC_CONTENT: KVNamespace | undefined;
const __STATIC_CONTENT_MANIFEST: Record<string, string> | undefined;
}
type CacheControl = {
browserTTL: number;
edgeTTL: number;
bypassCache: boolean;
};
type AssetManifestType = Record<string, string>;
type Options = {
cacheControl: ((req: Request) => Partial<CacheControl>) | Partial<CacheControl>;
ASSET_NAMESPACE: KVNamespace;
ASSET_MANIFEST: AssetManifestType | string;
mapRequestToAsset?: (req: Request, options?: Partial<Options>) => Request;
defaultMimeType: string;
defaultDocument: string;
pathIsEncoded: boolean;
defaultETag: "strong" | "weak";
};
declare class KVError extends Error {
constructor(message?: string, status?: number);
status: number;
}
declare class MethodNotAllowedError extends KVError {
constructor(message?: string, status?: number);
}
declare class NotFoundError extends KVError {
constructor(message?: string, status?: number);
}
declare class InternalError extends KVError {
constructor(message?: string, status?: number);
}
/**
* maps the path of incoming request to the request pathKey to look up
* in bucket and in cache
* e.g. for a path '/' returns '/index.html' which serves
* the content of bucket/index.html
* @param {Request} request incoming request
*/
declare const mapRequestToAsset: (request: Request, options?: Partial<Options>) => Request<unknown, CfProperties<unknown>>;
/**
* maps the path of incoming request to /index.html if it evaluates to
* any HTML file.
* @param {Request} request incoming request
*/
declare function serveSinglePageApp(request: Request, options?: Partial<Options>): Request;
/**
* takes the path of the incoming request, gathers the appropriate content from KV, and returns
* the response
*
* @param {FetchEvent} event the fetch event of the triggered request
* @param {{mapRequestToAsset: (string: Request) => Request, cacheControl: {bypassCache:boolean, edgeTTL: number, browserTTL:number}, ASSET_NAMESPACE: any, ASSET_MANIFEST:any}} [options] configurable options
* @param {CacheControl} [options.cacheControl] determine how to cache on Cloudflare and the browser
* @param {typeof(options.mapRequestToAsset)} [options.mapRequestToAsset] maps the path of incoming request to the request pathKey to look up
* @param {Object | string} [options.ASSET_NAMESPACE] the binding to the namespace that script references
* @param {any} [options.ASSET_MANIFEST] the map of the key to cache and store in KV
* */
type Evt = {
request: Request;
waitUntil: (promise: Promise<unknown>) => void;
};
declare const getAssetFromKV: (event: Evt, options?: Partial<Options>) => Promise<Response>;
export { type CacheControl, InternalError, MethodNotAllowedError, NotFoundError, type Options, getAssetFromKV, mapRequestToAsset, serveSinglePageApp };

369
node_modules/@cloudflare/kv-asset-handler/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"inputs":{"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/Mime.js":{"bytes":2892,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/standard.js":{"bytes":9530,"imports":[],"format":"cjs"},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/other.js":{"bytes":25894,"imports":[],"format":"cjs"},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/index.js":{"bytes":127,"imports":[{"path":"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/Mime.js","kind":"require-call","original":"./Mime"},{"path":"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/standard.js","kind":"require-call","original":"./types/standard"},{"path":"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/other.js","kind":"require-call","original":"./types/other"}],"format":"cjs"},"src/types.ts":{"bytes":1545,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":11207,"imports":[{"path":"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/index.js","kind":"import-statement","original":"mime"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":86404},"dist/index.js":{"imports":[],"exports":["CacheControl","InternalError","MethodNotAllowedError","NotFoundError","Options","getAssetFromKV","mapRequestToAsset","serveSinglePageApp"],"entryPoint":"src/index.ts","inputs":{"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/Mime.js":{"bytesInOutput":2066},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/standard.js":{"bytesInOutput":10389},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/types/other.js":{"bytesInOutput":27486},"../../node_modules/.pnpm/mime@3.0.0/node_modules/mime/index.js":{"bytesInOutput":243},"src/index.ts":{"bytesInOutput":7759},"src/types.ts":{"bytesInOutput":881}},"bytes":50698}}}