wrangler.ts — astro Source File
Architecture documentation for wrangler.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ff9e7216_f07c_ea5c_54f9_058d9086059e["wrangler.ts"] cd61a25f_49b5_edd2_d556_1f8a13996d51["vite-plugin"] ff9e7216_f07c_ea5c_54f9_058d9086059e --> cd61a25f_49b5_edd2_d556_1f8a13996d51 style ff9e7216_f07c_ea5c_54f9_058d9086059e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { PluginConfig } from '@cloudflare/vite-plugin';
export const DEFAULT_SESSION_KV_BINDING_NAME = 'SESSION';
export const DEFAULT_IMAGES_BINDING_NAME = 'IMAGES';
export const DEFAULT_ASSETS_BINDING_NAME = 'ASSETS';
interface CloudflareConfigOptions {
sessionKVBindingName?: string;
imagesBindingName?: string | false;
}
/**
* Returns a config customizer that sets up the Astro Cloudflare defaults.
* Sets the main entrypoint and adds bindings for auto-provisioning.
*/
export function cloudflareConfigCustomizer(
options?: CloudflareConfigOptions,
): PluginConfig['config'] {
const sessionKVBindingName = options?.sessionKVBindingName ?? DEFAULT_SESSION_KV_BINDING_NAME;
const imagesBindingName =
options?.imagesBindingName === false
? undefined
: (options?.imagesBindingName ?? DEFAULT_IMAGES_BINDING_NAME);
return (config) => {
const hasSessionBinding = config.kv_namespaces?.some(
(kv) => kv.binding === sessionKVBindingName,
);
const hasImagesBinding = config.images?.binding !== undefined;
const hasAssetsBinding = config.assets?.binding !== undefined;
return {
main: config.main ?? '@astrojs/cloudflare/entrypoints/server',
kv_namespaces: hasSessionBinding
? undefined
: [
{
binding: sessionKVBindingName,
},
],
images:
hasImagesBinding || !imagesBindingName
? undefined
: {
binding: imagesBindingName,
},
assets: hasAssetsBinding
? undefined
: {
binding: DEFAULT_ASSETS_BINDING_NAME,
},
};
};
}
Domain
Subdomains
Functions
Types
Dependencies
- vite-plugin
Source
Frequently Asked Questions
What does wrangler.ts do?
wrangler.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in wrangler.ts?
wrangler.ts defines 1 function(s): cloudflareConfigCustomizer.
What does wrangler.ts depend on?
wrangler.ts imports 1 module(s): vite-plugin.
Where is wrangler.ts in the architecture?
wrangler.ts is located at packages/integrations/cloudflare/src/wrangler.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/cloudflare/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free