/// import { URL as URL$1 } from "node:url"; import { EventEmitter } from "node:events"; import { Duplex, Readable } from "node:stream"; import { Socket } from "node:net"; declare module 'node:buffer' { interface File { readonly [Symbol.toStringTag]: string; } } type Json = string | number | boolean | null | Json[] | { [id: string]: Json; }; /** * Wrangler configuration types. The JSDoc on these fields is also the source * of truth for the equivalent fields in `@cloudflare/config` * (`packages/config/src/types.ts` — `WorkerConfig` — and the binding option * interfaces in `packages/config/src/config.ts`). When editing prose here, * mirror the changes there. */ /** * The `Environment` interface declares all the configuration fields that * can be specified for an environment. * * This could be the top-level default environment, or a specific named environment. */ interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {} type SimpleRoute = string; /** AWS SigV4 credentials for miniflare's local S3-compatible endpoint */ interface LocalS3Credentials { accessKeyId: string; secretAccessKey: string; } type ZoneIdRoute = { pattern: string; zone_id: string; custom_domain?: boolean; }; type ZoneNameRoute = { pattern: string; zone_name: string; custom_domain?: boolean; }; type CustomDomainRoute = { pattern: string; custom_domain: boolean; enabled?: boolean; previews_enabled?: boolean; }; type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute; /** * Configuration in wrangler for Cloudchamber */ type CloudchamberConfig = { image?: string; location?: string; instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4"; vcpu?: number; memory?: string; ipv4?: boolean; }; type UnsafeBinding = { /** * The name of the binding provided to the Worker */ name: string; /** * The 'type' of the unsafe binding. */ type: string; dev?: { plugin: { /** * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export. * @example "@cloudflare/my-external-miniflare-plugin" */ package: string; /** * Plugin is the name of the plugin exposed by the package. * @example "MY_UNSAFE_PLUGIN" */ name: string; }; /** * Optional mapping of unsafe bindings names to options provided for the plugin. */ options?: Record; }; [key: string]: unknown; }; /** * An image Wrangler prepares for a Durable Object-managed container. */ type DurableObjectContainerImage = { /** * Path to the Dockerfile Wrangler builds and pushes. */ dockerfile: string; /** * Build context, relative to the Wrangler configuration file. * Defaults to the Dockerfile's directory. */ build_context?: string; /** Variables available to the image only while it is being built. */ build_vars?: Record; image?: never; } | { /** * Digest-pinned image in the account's managed registry. */ image: string; dockerfile?: never; build_context?: never; build_vars?: never; }; /** * Configuration for a container application. */ type ContainerObservability = { /** If observability is enabled for this container application */ enabled?: boolean; logs?: { enabled?: boolean; }; /** * Percentage of instances to target with application-level observability hot reloads. * Mutually exclusive with `target_instance_count`. */ target_instance_percentage?: number; /** * Number of instances to target with application-level observability hot reloads. * Mutually exclusive with `target_instance_percentage`. */ target_instance_count?: number; }; type ContainerApp = { /** * Name of the application. * * This is also the identifier used to reference the container from a Durable * Object's `exports` entry via its `container` field. * * @optional Defaults to `worker_name-class_name` if not specified. A name is * required when `class_name` is not set, since there is no class name to * derive the default from. */ name?: string; /** * Number of application instances * @deprecated * @hidden */ instances?: number; /** * Number of maximum application instances. * @optional */ max_instances?: number; /** * The path to a Dockerfile, or an image URI for the Cloudflare registry. */ image?: string; /** * Named images available to a Durable Object-managed container through * `ctx.container.images`. * * Only supported when `scheduling_policy` is `"durable_object"`. * When omitted, run `wrangler deploy` to provision the application before * uploading versions. Version deployments use its existing application. */ images?: Record; /** * Build context of the application. * @optional - defaults to the directory of `image`. */ image_build_context?: string; /** * Image variables available to the image at build-time only. * For runtime env vars, refer to https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/ * @optional */ image_vars?: Record; /** * The class name of the Durable Object the container is connected to. * * @optional Instead of naming the Durable Object here, you can reference this * container from the Durable Object's `exports` entry via its `container` * field. Exactly one of the two directions must be configured. */ class_name?: string; /** * Specify the observability behavior of this container application. * * When set, this overrides the root `observability` config for this container. * Durable Object-managed Containers only support enabling or disabling logs. * Their settings are application-wide, and omitted settings preserve the * existing application rather than inheriting root Worker observability. */ observability?: ContainerObservability; /** * The scheduling policy of the application * @optional * `"durable_object"` makes each Durable Object instance own its Container. * In that mode, `name`, `class_name`, `scheduling_policy`, `images`, * application-wide log `observability`, `ssh`, and `authorized_keys` are * supported on this entry. * * @default "default" */ scheduling_policy?: "default" | "durable_object" | "moon" | "regional"; /** * The instance type to be used for the container. * Select from one of the following named instance types: * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk * - dev: 1/16 vCPU, 256 MiB memory, and 2 GB disk (deprecated, use "lite" instead) * - standard: 1 vCPU, 4 GiB memory, and 4 GB disk (deprecated, use "standard-1" instead) * * Customers on an enterprise plan have the additional option to set custom limits. * * @optional * @default "dev" */ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | { /** @defaults to 0.0625 (1/16 vCPU) */ vcpu?: number; /** @defaults to 256 MiB */ memory_mib?: number; /** @defaults to 2 GB */ disk_mb?: number; }; ssh?: { /** * If enabled, those with write access to a container will be able to SSH into it through Wrangler. * @default false */ enabled: boolean; /** * Port that the SSH service is running on * @defaults to 22 */ port?: number; }; /** * @deprecated Use `ssh` instead. * @hidden */ wrangler_ssh?: { enabled: boolean; port?: number; }; /** * SSH public keys to put in the container's authorized_keys file. */ authorized_keys?: { name: string; public_key: string; }[]; /** * Trusted user CA keys to put in the container's trusted_user_ca_keys file. */ trusted_user_ca_keys?: { name?: string; public_key: string; }[]; /** * @deprecated Use top level `containers` fields instead. * `configuration.image` should be `image` * limits should be set via `instance_type` * @hidden */ configuration?: { image?: string; labels?: { name: string; value: string; }[]; secrets?: { name: string; type: "env"; secret: string; }[]; disk?: { size_mb: number; }; vcpu?: number; memory_mib?: number; }; /** * Scheduling constraints for container placement. */ constraints?: { /** * Limit container placement to specific geographic regions. */ regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[]; /** * Restrict containers to compliance boundaries. */ jurisdiction?: "eu" | "fedramp" | "us"; /** * @hidden */ cities?: string[]; /** * @deprecated Use `tiers` instead * @hidden */ tier?: number; /** * @hidden */ tiers?: number[]; }; /** * Scheduling affinities * @hidden */ affinities?: { colocation?: "datacenter"; hardware_generation?: "highest-overall-performance"; }; /** * @deprecated use the `class_name` field instead. * @hidden */ durable_objects?: { namespace_id: string; }; /** * Configures what percentage of instances should be updated at each step of a rollout. * You can specify this as a single number, or an array of numbers. * * If this is a single number, each step will progress by that percentage. * The options are 5, 10, 20, 25, 50 or 100. * * If this is an array, each step specifies the cumulative rollout progress. * The final step must be 100. * * This can be overridden adhoc by deploying with the `--containers-rollout=immediate` flag, * which will roll out to 100% of instances in one step. * * @optional * @default [10,100] * */ rollout_step_percentage?: number | number[]; /** * How a rollout should be created. It supports the following modes: * - full_auto: The container application will be rolled out fully automatically. * - none: The container application won't have a roll out or update. * - manual: The container application will be rollout fully by manually actioning progress steps. * @optional * @default "full_auto" * @hidden */ rollout_kind?: "full_auto" | "none" | "full_manual"; /** * Configures the grace period (in seconds) for active instances before being shutdown during a rollout. * @optional * @default 0 */ rollout_active_grace_period?: number; /** * Directly passed to the API without wrangler-side validation or transformation. * @hidden */ unsafe?: Record; }; /** * Configuration in wrangler for Durable Object Migrations */ type DurableObjectMigration = { /** A unique identifier for this migration. */ tag: string; /** The new Durable Objects being defined. */ new_classes?: string[]; /** The new SQLite Durable Objects being defined. */ new_sqlite_classes?: string[]; /** The Durable Objects being renamed. */ renamed_classes?: { from: string; to: string; }[]; /** The Durable Objects being transferred from another Worker. */ transferred_classes?: { from: string; from_script: string; to: string; }[]; /** The Durable Objects being removed. */ deleted_classes?: string[]; }; /** * Storage backend for a declarative Durable Object export. See * {@link DurableObjectExport}. */ type DurableObjectExportStorage = "sqlite" | "legacy-kv"; /** * A single declarative Durable Object export entry in the `exports` config * map. `type` is reserved for the export kind. `state` carries the Durable * Object lifecycle and defaults to `"created"` (live) when omitted. * * Mutually exclusive with {@link DurableObjectMigration} at the config- * validation boundary. * * - `created` (default, live): `storage` is required. * - `deleted` (tombstone): retire a provisioned namespace whose class has * been removed from code. * - `renamed` (tombstone): rewrite a provisioned namespace's class name to * `renamed_to`. The target name must also appear as a live (state * `"created"`) `durable-object` entry in the same map. * - `transferred` (tombstone): hand ownership of the namespace to another * script in the same account (`transferred_to`). Two-phase commit; * the target must first deploy an `expecting-transfer` entry naming this * script via `transfer_from`. * - `expecting-transfer` (live): receiving side of a two-phase transfer; * `storage` and `transfer_from` are both required. * * The live states may additionally attach a container via `container`, which * names an entry in the top-level `containers` array. Tombstones cannot. */ type DurableObjectExport = { type: "durable-object"; state?: "created"; storage: DurableObjectExportStorage; /** * Attach a container to this Durable Object. Must match the `name` of an * entry in the top-level `containers` array, and requires * `storage: "sqlite"`. * * @optional */ container?: string; } | { type: "durable-object"; state: "deleted"; } | { type: "durable-object"; state: "renamed"; renamed_to: string; } | { type: "durable-object"; state: "transferred"; transferred_to: string; } | { type: "durable-object"; state: "expecting-transfer"; storage: DurableObjectExportStorage; transfer_from: string; /** * Attach a container to this Durable Object. Must match the `name` of an * entry in the top-level `containers` array, and requires * `storage: "sqlite"`. * * @optional */ container?: string; }; interface WorkerEntrypointExport { type: "worker"; cache?: { /** Whether cache is enabled for this entrypoint. */ enabled: boolean; }; } /** * A single declarative Workflow export entry in the `exports` config map. The * map key is the exported class name (the class extending `WorkflowEntrypoint`); * `name` is the workflow's stable identity, used for instance and storage * namespacing, and is required. The remaining settings match the ones accepted * by `workflows` bindings. */ interface WorkflowExport extends Pick { type: "workflow"; name: string; } type ConfiguredExport = DurableObjectExport | WorkerEntrypointExport | WorkflowExport; /** * The declarative `exports` map keyed by export name. Durable Object exports * are mutually exclusive with `migrations` at the wrangler config layer. */ type Exports = Record; /** * The `EnvironmentInheritable` interface declares all the configuration fields for an environment * that can be inherited (and overridden) from the top-level environment. */ interface EnvironmentInheritable { /** * The name of your Worker. Alphanumeric + dashes only. * * @inheritable */ name: string | undefined; /** * This is the ID of the account associated with your zone. * You might have more than one account, so make sure to use * the ID of the account associated with the zone/route you * provide, if you provide one. It can also be specified through * the CLOUDFLARE_ACCOUNT_ID environment variable. * * @inheritable */ account_id: string | undefined; /** * A date in the form yyyy-mm-dd, which will be used to determine * which version of the Workers runtime is used. * * More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates * * @inheritable */ compatibility_date: string | undefined; /** * A list of flags that enable features from upcoming features of * the Workers runtime, usually used together with compatibility_date. * * More details at https://developers.cloudflare.com/workers/configuration/compatibility-flags/ * * @default [] * @inheritable */ compatibility_flags: string[]; /** * The entrypoint/path to the JavaScript file that will be executed. * * @inheritable */ main: string | undefined; /** * If true then Wrangler will traverse the file tree below `base_dir`; * Any files that match `rules` will be included in the deployed Worker. * Defaults to true if `no_bundle` is true, otherwise false. * * @inheritable */ find_additional_modules: boolean | undefined; /** * Determines whether Wrangler will preserve bundled file names. * Defaults to false. * If left unset, files will be named using the pattern ${fileHash}-${basename}, * for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`. * * @inheritable */ preserve_file_names: boolean | undefined; /** * The directory in which module rules should be evaluated when including additional files into a Worker deployment. * This defaults to the directory containing the `main` entry point of the Worker if not specified. * * @inheritable */ base_dir: string | undefined; /** * Whether we use ..workers.dev to * test and deploy your Worker. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev * * @default true * @breaking * @inheritable */ workers_dev: boolean | undefined; /** * Whether we use -..workers.dev to * serve Preview URLs for your Worker. * * @default false * @inheritable */ preview_urls: boolean | undefined; /** * A list of routes that your Worker should be published to. * Only one of `routes` or `route` is required. * * Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`) * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes * * @inheritable */ routes: Route[] | undefined; /** * A route that your Worker should be published to. Literally * the same as routes, but only one. * Only one of `routes` or `route` is required. * * Only required when workers_dev is false, and there's no scheduled Worker * * @inheritable */ route: Route | undefined; /** * Path to a custom tsconfig * * @inheritable */ tsconfig: string | undefined; /** * The function to use to replace jsx syntax. * * @default "React.createElement" * @inheritable */ jsx_factory: string; /** * The function to use to replace jsx fragment syntax. * * @default "React.Fragment" * @inheritable */ jsx_fragment: string; /** * A list of migrations that should be uploaded with your Worker. * * These define changes in your Durable Object declarations. * * More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations * * @default [] * @inheritable */ migrations: DurableObjectMigration[]; /** * Declarative exports configuration — a map of class name to export configuration. * * The configuration of Durable Objects via `exports` is mutually exclusive with `migrations`. * * @default {} * @inheritable */ exports: Exports; /** * Definitions that trigger a Worker from a schedule or a Cloudflare event. * * More details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers * * More details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/ * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers * * @default {crons:[]} * @inheritable */ triggers: { crons?: string[]; events?: ArtifactsEventTrigger[]; }; /** * Specify limits for runtime behavior. * Only supported for the "standard" Usage Model * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#limits * * @inheritable */ limits: UserLimits | undefined; /** * An ordered list of rules that define which modules to import, * and what type to import them as. You will need to specify rules * to use Text, Data, and CompiledWasm modules, or when you wish to * have a .js file be treated as an ESModule instead of CommonJS. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#bundling * * @inheritable */ rules: Rule[]; /** * Configures a custom build step to be run by Wrangler when building your Worker. * * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build) * for more details. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds * * @default {watch_dir:"./src"} */ build: { /** The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. */ command?: string; /** The directory in which the command is executed. */ cwd?: string; /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */ watch_dir?: string | string[]; }; /** * Skip internal build steps and directly deploy script * @inheritable */ no_bundle: boolean | undefined; /** * Minify the script before uploading. * @inheritable */ minify: boolean | undefined; /** * Set the `name` property to the original name for functions and classes renamed during minification. * * See https://esbuild.github.io/api/#keep-names * * @default true * @inheritable */ keep_names: boolean | undefined; /** * Designates this Worker as an internal-only "first-party" Worker. * * @inheritable */ first_party_worker: boolean | undefined; /** * List of bindings that you will send to logfwdr * * @default {bindings:[]} * @inheritable */ logfwdr: { bindings: { /** The binding name used to refer to logfwdr */ name: string; /** The destination for this logged message */ destination: string; }[]; }; /** * Send Trace Events from this Worker to Workers Logpush. * * This will not configure a corresponding Logpush job automatically. * * For more information about Workers Logpush, see: * https://blog.cloudflare.com/logpush-for-workers/ * * @inheritable */ logpush: boolean | undefined; /** * Include source maps when uploading this worker. * * Defaults to `true` for `wrangler deploy`, `wrangler versions upload`, * `wrangler preview` and `wrangler build --experimental-cf-build-output`, * where source maps that can't be resolved are skipped rather than failing * the upload. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#source-maps * * @inheritable */ upload_source_maps: boolean | undefined; /** * Specify how the Worker should be located to minimize round-trip time. * * More details: https://developers.cloudflare.com/workers/platform/smart-placement/ * * @inheritable */ placement: { mode: "off" | "smart"; hint?: string; } | { mode?: "targeted"; region: string; } | { mode?: "targeted"; host: string; } | { mode?: "targeted"; hostname: string; } | undefined; /** * Specify the directory of static assets to deploy/serve * * More details at https://developers.cloudflare.com/workers/frameworks/ * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#assets * * @inheritable */ assets: Assets | undefined; /** * Specify the observability behavior of the Worker. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#observability * * @inheritable */ observability: Observability | undefined; /** * Specify the Cloudflare Access authentication behavior of the Worker. * * @inheritable */ access: Access | undefined; /** * Specify the cache behavior of the Worker. * * @inheritable */ cache: CacheOptions$1 | undefined; /** * Specify the compliance region mode of the Worker. * * Although if the user does not specify a compliance region, the default is `public`, * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable. */ compliance_region: "public" | "fedramp_high" | undefined; /** * Configuration for Python modules. * * @inheritable */ python_modules: { /** * A list of glob patterns to exclude files from the python_modules directory when bundling. * * Patterns are relative to the python_modules directory and use glob syntax. * * @default ["**\*.pyc"] */ exclude: string[]; }; /** * Configuration for Worker Previews. * * Previews are branches of your Worker's main instance used to test features * in development outside of production. This block defines the settings * used when creating Preview deployments via `wrangler preview`. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews * * @inheritable */ previews: PreviewsConfig | undefined; } type DurableObjectBindings = { /** The name of the binding used to refer to the Durable Object */ name: string; /** The exported class name of the Durable Object */ class_name: string; /** The script where the Durable Object is defined (if it's external to this Worker) */ script_name?: string; /** The service environment of the script_name to bind to */ environment?: string; }[]; type DurableObjectCodeUpdateStrategy = { /** How Durable Object code updates should be applied. */ mode: "immediate" | "deferred"; /** * Maximum time, in seconds, to wait for Durable Objects to hibernate. * Defaults to 300 (5 minutes) and cannot exceed 86400 (24 hours). * @minimum 0 * @maximum 86400 * @multipleOf 0.001 * @default 300 */ max_delay?: number; }; type DurableObjectsConfig = { bindings: DurableObjectBindings; code_update_strategy?: DurableObjectCodeUpdateStrategy; }; type RawDurableObjectsConfig = Omit & { bindings?: DurableObjectBindings; }; declare const ARTIFACTS_EVENT_TYPES: readonly ["cf.artifacts.repo.created", "cf.artifacts.repo.deleted", "cf.artifacts.repo.forked", "cf.artifacts.repo.imported", "cf.artifacts.repo.pushed", "cf.artifacts.repo.cloned", "cf.artifacts.repo.fetched", "cf.artifacts.repo.token.created", "cf.artifacts.repo.token.revoked"]; type ArtifactsEventType = (typeof ARTIFACTS_EVENT_TYPES)[number]; type ArtifactsEventTrigger = { type: ArtifactsEventType; filter?: { namespace?: string; repo_name?: string; }; targets: { type: "workflow"; workflow_name: string; }[]; }; declare const WORKFLOW_JURISDICTIONS: readonly ["eu", "fedramp", "us"]; type WorkflowJurisdiction = (typeof WORKFLOW_JURISDICTIONS)[number]; type WorkflowBinding = { /** The name of the binding used to refer to the Workflow */ binding: string; /** The name of the Workflow */ name: string; /** The exported class name of the Workflow */ class_name: string; /** The script where the Workflow is defined (if it's external to this Worker) */ script_name?: string; /** Optional limits for the Workflow */ limits?: { /** Maximum number of steps a Workflow instance can execute */ steps?: number; }; /** Optional concurrency configuration for the Workflow */ concurrency?: { /** Maximum number of Workflow instances that can run concurrently */ limit?: number; }; /** Optional cron schedule(s) for automatically triggering workflow instances */ schedules?: string | string[]; /** * Optional default retention for instances of this Workflow, applied when an instance does not * set its own retention. Accepts milliseconds or a duration string such as `"3 days"`, and is * validated by the Workflows API at deploy time. */ default_retention?: { /** How long to retain instances that completed successfully or were terminated */ success_retention?: number | string; /** How long to retain errored instances */ error_retention?: number | string; }; /** * Optional jurisdiction that the Workflow's instances run and store their data in. It is set * when the Workflow is created and cannot be changed afterwards. */ jurisdiction?: WorkflowJurisdiction; }; type ConnectHandlerConfigBase = { /** The port to listen on. */ port: number; /** The address to bind to. Defaults to `127.0.0.1`. */ address?: string; }; type TcpConnectHandlerConfig = ConnectHandlerConfigBase & { protocol: "tcp"; }; type UdpConnectHandlerConfig = ConnectHandlerConfigBase & { protocol: "udp"; /** The idle timeout in milliseconds after which a peer flow is closed. */ idle_timeout_ms?: number; /** The maximum number of pending datagram bytes per peer flow. */ max_pending_bytes?: number; }; type ConnectHandlerConfig = TcpConnectHandlerConfig | UdpConnectHandlerConfig; /** * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment * that cannot be inherited from the top-level environment, and must be defined specifically. * * If any of these fields are defined at the top-level then they should also be specifically defined * for each named environment. */ interface EnvironmentNonInheritable { /** * A map of values to substitute when deploying your Worker. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ define: Record; /** * A map of environment variables to set when deploying your Worker. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables * * @default {} * @nonInheritable */ vars: Record; /** * Secrets configuration. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#secrets-configuration-property * * @nonInheritable */ secrets?: { /** * List of secret names that are required by your Worker. * When defined, this property: * - Replaces .dev.vars/.env/process.env inference for type generation * - Enables local dev validation with warnings for missing secrets */ required?: string[]; }; /** * Durable Object bindings and code update strategy for your Worker. * * For more information about Durable Objects, see the documentation at * https://developers.cloudflare.com/workers/learning/using-durable-objects * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects * * @default {bindings:[]} * @nonInheritable */ durable_objects: DurableObjectsConfig; /** * A list of workflows that your Worker should be bound to. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ workflows: WorkflowBinding[]; /** * Cloudchamber configuration * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ cloudchamber: CloudchamberConfig; /** * Container related configuration * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ containers?: ContainerApp[]; /** * These specify any Workers KV Namespaces you want to * access from inside your Worker. * * To learn more about KV Namespaces, * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces * * @default [] * @nonInheritable */ kv_namespaces: { /** The binding name used to refer to the KV Namespace */ binding: string; /** The ID of the KV namespace */ id?: string; /** The ID of the KV namespace used during `wrangler dev` */ preview_id?: string; /** Whether the KV namespace should be remote or not in local development */ remote?: boolean; }[]; /** * These specify bindings to send email from inside your Worker. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#email-bindings * * @default [] * @nonInheritable */ send_email: { /** The binding name used to refer to the this binding */ name: string; /** If this binding should be restricted to a specific verified address */ destination_address?: string; /** If this binding should be restricted to a set of verified addresses */ allowed_destination_addresses?: string[]; /** If this binding should be restricted to a set of sender addresses */ allowed_sender_addresses?: string[]; /** Whether the binding should be remote or not in local development */ remote?: boolean; }[]; /** * Specifies Queues that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues * * @default {consumers:[],producers:[]} * @nonInheritable */ queues: { /** Producer bindings */ producers?: { /** The binding name used to refer to the Queue in the Worker. */ binding: string; /** The name of this Queue. */ queue?: string; /** The number of seconds to wait before delivering a message */ delivery_delay?: number; /** Whether the Queue producer should be remote or not in local development */ remote?: boolean; }[]; /** Consumer configuration */ consumers?: { /** The name of the queue from which this consumer should consume. */ queue: string; /** The consumer type. Only "worker" is supported in wrangler config. Default is "worker". */ type?: "worker"; /** The maximum number of messages per batch */ max_batch_size?: number; /** The maximum number of seconds to wait to fill a batch with messages. */ max_batch_timeout?: number; /** The maximum number of retries for each message. */ max_retries?: number; /** The queue to send messages that failed to be consumed. */ dead_letter_queue?: string; /** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */ max_concurrency?: number | null; /** The number of milliseconds to wait for pulled messages to become visible again */ visibility_timeout_ms?: number; /** The number of seconds to wait before retrying a message */ retry_delay?: number; }[]; }; /** * Specifies raw sockets that this Worker should listen on. * Each entry opens a listening socket on the * given port that delivers incoming connections directly to the Worker's * `connect(socket, env, ctx)` handler. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ connect: ConnectHandlerConfig[]; /** * Specifies R2 buckets that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets * * @default [] * @nonInheritable */ r2_buckets: { /** The binding name used to refer to the R2 bucket in the Worker. */ binding: string; /** The name of this R2 bucket at the edge. */ bucket_name?: string; /** The preview name of this R2 bucket at the edge. */ preview_bucket_name?: string; /** The jurisdiction that the bucket exists in. Default if not present. */ jurisdiction?: string; /** Whether the R2 bucket should be remote or not in local development */ remote?: boolean; /** Settings that only apply to local development */ local_dev?: { /** * EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible * endpoint. When set, the bucket is served at * `/cdn-cgi/local/r2/s3/` during local development. * Ignored when the bucket runs remotely. */ experimental_s3_credentials?: LocalS3Credentials; }; }[]; /** * Specifies D1 databases that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases * * @default [] * @nonInheritable */ d1_databases: { /** The binding name used to refer to the D1 database in the Worker. */ binding: string; /** The name of this D1 database. */ database_name?: string; /** The UUID of this D1 database (not required). */ database_id?: string; /** The UUID of this D1 database for Wrangler Dev (if specified). */ preview_database_id?: string; /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */ migrations_table?: string; /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */ migrations_dir?: string; /** * A glob pattern (relative to the Wrangler config file) used to discover * migration files for this D1 database. Defaults to `${migrations_dir}/*.sql` * if not specified. * * Use this to opt in to nested layouts such as `migrations/*\/migration.sql` * (as produced by some ORMs). * * When `migrations_pattern` is set, `migrations_dir` must also be set, and * `migrations_pattern` must start with `${migrations_dir}/`. This keeps the * relationship between the two settings explicit and lets Wrangler record * each migration's name in the migrations table as a path relative to * `migrations_dir`. */ migrations_pattern?: string; /** Internal use only. */ database_internal_env?: string; /** Whether the D1 database should be remote or not in local development */ remote?: boolean; }[]; /** * Specifies Vectorize indexes that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes * * @default [] * @nonInheritable */ vectorize: { /** The binding name used to refer to the Vectorize index in the Worker. */ binding: string; /** The name of the index. */ index_name: string; /** Whether the Vectorize index should be remote or not in local development */ remote?: boolean; }[]; /** * Specifies AI Search namespace bindings that are bound to this Worker environment. * Each binding is scoped to a namespace and allows dynamic instance CRUD within it. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ ai_search_namespaces: { /** The binding name used to refer to the AI Search namespace in the Worker. */ binding: string; /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */ namespace: string; /** Whether the AI Search namespace binding should be remote in local development */ remote?: boolean; }[]; /** * Specifies AI Search instance bindings that are bound to this Worker environment. * Each binding is bound directly to a single pre-existing instance within the "default" namespace. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ ai_search: { /** The binding name used to refer to the AI Search instance in the Worker. */ binding: string; /** The user-chosen instance name. Must exist in Cloudflare at deploy time. */ instance_name: string; /** Whether the AI Search instance binding should be remote in local development */ remote?: boolean; }[]; /** * Specifies Agent Memory namespace bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ agent_memory: { /** The binding name used to refer to the Agent Memory namespace in the Worker. */ binding: string; /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */ namespace: string; /** Whether the Agent Memory binding should be remote in local development */ remote?: boolean; }[]; /** * Specifies Hyperdrive configs that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive * * @default [] * @nonInheritable */ hyperdrive: { /** The binding name used to refer to the project in the Worker. */ binding: string; /** The id of the database. */ id: string; /** The local database connection string for `wrangler dev` */ localConnectionString?: string; /** * Connect to the deployed Hyperdrive configuration during local development * instead of a local database. */ remote?: boolean; }[]; /** * Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings * * @default [] * @nonInheritable */ services: { /** The binding name used to refer to the bound service. */ binding: string; /** * The name of the service. * To bind to a worker in a specific environment, * you should use the format `-`. */ service: string; /** * @hidden * @deprecated you should use `service: -` instead. * This refers to the deprecated concept of 'service environments'. * The environment of the service (e.g. production, staging, etc). */ environment?: string; /** Optionally, the entrypoint (named export) of the service to bind to. */ entrypoint?: string; /** Optional properties that will be made available to the service via ctx.props. */ props?: Record; /** Whether the service binding should be remote or not in local development */ remote?: boolean; }[] | undefined; /** * Specifies analytics engine datasets that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets * * @default [] * @nonInheritable */ analytics_engine_datasets: { /** The binding name used to refer to the dataset in the Worker. */ binding: string; /** The name of this dataset to write to. */ dataset?: string; /** Whether the dataset should be remote or not in local development */ remote?: boolean; }[]; /** * A browser that will be usable from the Worker. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering * * @default {} * @nonInheritable */ browser: { binding: string; /** Whether the Browser binding should be remote or not in local development */ remote?: boolean; } | undefined; /** * An Analytics SQL binding. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ analytics: { binding: string; /** Whether the binding should connect to the remote service during local development. */ remote?: boolean; } | undefined; /** * Binding to the AI project. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai * * @default {} * @nonInheritable */ ai: { binding: string; staging?: boolean; /** Whether the AI binding should be remote or not in local development */ remote?: boolean; } | undefined; /** * Binding to Cloudflare Images * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images * * @default {} * @nonInheritable */ images: { binding: string; /** Whether the Images binding should be remote or not in local development */ remote?: boolean; } | undefined; /** * Binding to Cloudflare Media Transformations * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ media: { binding: string; /** Whether the Media binding should be remote or not */ remote?: boolean; } | undefined; /** * Binding to Cloudflare Stream * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ stream: { binding: string; /** Whether the Stream binding should be remote or not in local development */ remote?: boolean; } | undefined; /** * Binding to the Worker Version's metadata */ version_metadata: { binding: string; } | undefined; /** * "Unsafe" tables for features that aren't directly supported by wrangler. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default {} * @nonInheritable */ unsafe: { /** * A set of bindings that should be put into a Worker's upload metadata without changes. These * can be used to implement bindings for features that haven't released and aren't supported * directly by wrangler or miniflare. */ bindings?: UnsafeBinding[]; /** * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified * here will always be applied to metadata last, so can add new or override existing fields. */ metadata?: { [key: string]: unknown; }; /** * Used for internal capnp uploads for the Workers runtime */ capnp?: { base_path: string; source_schemas: string[]; compiled_schema?: never; } | { base_path?: never; source_schemas?: never; compiled_schema: string; }; }; /** * Specifies a list of mTLS certificates that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates * * @default [] * @nonInheritable */ mtls_certificates: { /** The binding name used to refer to the certificate in the Worker */ binding: string; /** The uuid of the uploaded mTLS certificate */ certificate_id: string; /** Whether the mtls fetcher should be remote or not in local development */ remote?: boolean; }[]; /** * Specifies a list of Tail Workers that are bound to this Worker environment * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ tail_consumers?: TailConsumer[]; /** * Specifies a list of Streaming Tail Workers that are bound to this Worker environment * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ streaming_tail_consumers?: StreamingTailConsumer[]; /** * Specifies namespace bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms * * @default [] * @nonInheritable */ dispatch_namespaces: { /** The binding name used to refer to the bound service. */ binding: string; /** The namespace to bind to. */ namespace?: string; /** Details about the outbound Worker which will handle outbound requests from your namespace */ outbound?: DispatchNamespaceOutbound; /** Whether the Dispatch Namespace should be remote or not in local development */ remote?: boolean; }[]; /** * Specifies list of Pipelines bound to this Worker environment * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ pipelines: { /** The binding name used to refer to the bound service. */ binding: string; /** Id of the Stream to bind */ stream?: string; /** * Id of the Stream to bind * @deprecated Use `stream` instead. */ pipeline?: string; /** Whether the pipeline should be remote or not in local development */ remote?: boolean; }[]; /** * K2 producer bindings. Create streams using the Dashboard or API. * * This field must be specified separately in each named environment. * @default [] * @nonInheritable */ k2: { /** The binding name exposed on the Worker's env object. */ binding: string; /** The ID of the K2 stream. */ stream: string; /** Always uses the real stream in development. Set true to suppress the usage warning; false is unsupported. */ remote?: boolean; }[]; /** * Specifies Secret Store bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ secrets_store_secrets: { /** The binding name used to refer to the bound service. */ binding: string; /** Id of the secret store */ store_id: string; /** Name of the secret */ secret_name: string; }[]; /** * Specifies Artifacts bindings that are bound to this Worker environment. * Artifacts provides git-compatible file storage on Cloudflare Workers. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ artifacts: { /** The binding name used to refer to the Artifacts instance. */ binding: string; /** The namespace to use. */ namespace: string; /** Whether to use the remote Artifacts service in local dev. */ remote?: boolean; }[]; /** * **DO NOT USE**. Hello World Binding Config to serve as an explanatory example. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ unsafe_hello_world: { /** The binding name used to refer to the bound service. */ binding: string; /** Whether the timer is enabled */ enable_timer?: boolean; }[]; /** * Specifies Flagship feature flag bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ flagship: { /** The binding name used to refer to the bound Flagship service. */ binding: string; /** The Flagship app ID to bind to. */ app_id?: string; /** Set to `true` to evaluate flags against the remote Flagship app during local dev, instead of the local simulator. */ remote?: boolean; }[]; /** * Specifies rate limit bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ ratelimits: { /** The binding name used to refer to the rate limiter in the Worker. */ name: string; /** The namespace ID for this rate limiter. */ namespace_id: string; /** Simple rate limiting configuration. */ simple: { /** The maximum number of requests allowed in the time period. */ limit: number; /** The time period in seconds (10 for ten seconds, 60 for one minute). */ period: 10 | 60; }; }[]; /** * Specifies Worker Loader bindings that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ worker_loaders: { /** The binding name used to refer to the Worker Loader in the Worker. */ binding: string; }[]; /** * Specifies VPC services that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ vpc_services: { /** The binding name used to refer to the VPC service in the Worker. */ binding: string; /** The service ID of the VPC connectivity service. */ service_id: string; /** Whether the VPC service is remote or not */ remote?: boolean; }[]; /** * Specifies VPC networks that are bound to this Worker environment. * * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * * @default [] * @nonInheritable */ vpc_networks: ({ /** The binding name used to refer to the VPC network in the Worker. */ binding: string; /** The tunnel ID of the Cloudflare Tunnel to route traffic through. Mutually exclusive with network_id. */ tunnel_id: string; /** Whether the VPC network is remote or not */ remote?: boolean; } | { /** The binding name used to refer to the VPC network in the Worker. */ binding: string; /** The network ID to route traffic through. Mutually exclusive with tunnel_id. */ network_id: string; /** Whether the VPC network is remote or not */ remote?: boolean; })[]; } /** * The raw environment configuration that we read from the config file. * * All the properties are optional, and will be replaced with defaults in the configuration that * is used in the rest of the codebase. */ type RawEnvironment = Partial> & { durable_objects?: RawDurableObjectsConfig; }; /** * A bundling resolver rule, defining the modules type for paths that match the specified globs. */ type Rule = { type: ConfigModuleRuleType; globs: string[]; fallthrough?: boolean; }; /** * The possible types for a `Rule`. */ type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement"; type TailConsumer = { /** The name of the service tail events will be forwarded to. */ service: string; /** (Optional) The environment of the service. */ environment?: string; }; type StreamingTailConsumer = { /** The name of the service streaming tail events will be forwarded to. */ service: string; }; interface DispatchNamespaceOutbound { /** Name of the service handling the outbound requests */ service: string; /** (Optional) Name of the environment handling the outbound requests. */ environment?: string; /** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */ parameters?: string[]; } interface UserLimits { /** Maximum allowed CPU time for a Worker's invocation in milliseconds */ cpu_ms?: number; /** Maximum allowed number of fetch requests that a Worker's invocation can execute */ subrequests?: number; } type Assets = { /** Absolute path to assets directory */ directory?: string; /** Name of `env` binding property in the User Worker. */ binding?: string; /** How to handle HTML requests. */ html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none"; /** How to handle requests that do not match an asset. */ not_found_handling?: "single-page-application" | "404-page" | "none"; /** * The public URL prefix under which the application is served, e.g. `/subpath/`. */ base_path?: string; /** * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker. * * Can also be `true`, indicating that every request should be routed to the User Worker. */ run_worker_first?: string[] | boolean; }; interface Observability { /** If observability is enabled for this Worker */ enabled?: boolean; /** The sampling rate */ head_sampling_rate?: number; /** * Whether query strings are removed from request URLs in logs and traces. * * @default false */ redact_query_string?: boolean; /** Real-time Issues settings for this Worker. */ issues?: { /** Whether real-time Issues are enabled. */ enabled?: boolean; }; logs?: { enabled?: boolean; /** The sampling rate */ head_sampling_rate?: number; /** Set to false to disable invocation logs */ invocation_logs?: boolean; /** * If logs should be persisted to the Cloudflare observability platform where they can be queried in the dashboard. * * @default true */ persist?: boolean; /** * What destinations logs emitted from the Worker should be sent to. * * @default [] */ destinations?: string[]; }; traces?: { enabled?: boolean; /** The sampling rate */ head_sampling_rate?: number; /** * If traces should be persisted to the Cloudflare observability platform where they can be queried in the dashboard. * * @default true */ persist?: boolean; /** * What destinations traces emitted from the Worker should be sent to. * * @default [] */ destinations?: string[]; }; } interface Access { /** Local dev simulation of Cloudflare Access authentication */ dev?: { /** The Access application audience tag (aud) */ aud: string; /** Mock identity object returned by ctx.access.getIdentity() */ identity?: Record; }; } interface CacheOptions$1 { /** If cache is enabled for this Worker */ enabled: boolean; /** Whether cached assets may be reused across Worker versions. */ cross_version_cache?: boolean; } type DockerConfiguration = { /** Socket used by miniflare to communicate with Docker */ socketPath: string; /** Docker image name for the container egress interceptor sidecar */ containerEgressInterceptorImage?: string; }; type ContainerEngine = { localDocker: DockerConfiguration; } | string; /** * Configuration for Worker Previews. * * This defines the settings used when creating Preview deployments. * Previews are branches of your Worker's main instance used to test features * during feature development outside of production. * * The `previews` block contains any intentionally divergent configuration intended solely for Previews, including: * - All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.) * - Select inheritable properties: `logpush`, `observability`, `limits`, `placement`, `cache` * * @inheritable */ interface PreviewsConfig extends Partial>, Partial> { durable_objects?: { bindings: DurableObjectBindings; }; } type RawConfig = Partial> & PagesConfigFields & RawEnvironment & EnvironmentMap & { $schema?: string; }; interface ConfigFields { /** * Whether Wrangler should send usage metrics to Cloudflare for this project. * * When defined this will override any user settings. * Otherwise, Wrangler will use the user's preference. */ send_metrics: boolean | undefined; /** * Configuration for npm package dependency instrumentation. * * Controls whether Wrangler should collect and send npm package dependency * metadata when deploying or uploading a Worker version. * * When `enabled` is set to `false`, Wrangler will not include * `package_dependencies` in the upload payload. Defaults to enabled when * not specified. * * Note: This is considered build metadata, so managed separately from the * telemetry one and not disabled when * `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false` */ dependencies_instrumentation: { /** Whether dependency instrumentation is enabled. Defaults to `true`. */ enabled: boolean; /** * An optional list of package name patterns to exclude from the * collected dependency metadata. * * Each entry can be an exact package name (e.g. `"lodash"`) or a glob * pattern using `*` as a wildcard (e.g. `"@internal/*"` to exclude all * packages under the `@internal` scope). */ exclude_packages?: string[]; } | undefined; /** * Options to configure the development server that your worker will use. * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings */ dev: Dev; /** * The definition of a Worker Site, a feature that lets you upload * static assets with your Worker. * * More details at https://developers.cloudflare.com/workers/platform/sites * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-sites */ site: { /** * The directory containing your static assets. * * It must be a path relative to your Wrangler configuration file. * Example: bucket = "./public" * * If there is a `site` field then it must contain this `bucket` field. */ bucket: string; /** * The location of your Worker script. * * @deprecated DO NOT use this (it's a holdover from Wrangler v1.x). Either use the top level `main` field, or pass the path to your entry file as a command line argument. * @breaking */ "entry-point"?: string; /** * An exclusive list of .gitignore-style patterns that match file * or directory names from your bucket location. Only matched * items will be uploaded. Example: include = ["upload_dir"] * * @optional * @default [] */ include?: string[]; /** * A list of .gitignore-style patterns that match files or * directories in your bucket that should be excluded from * uploads. Example: exclude = ["ignore_dir"] * * @optional * @default [] */ exclude?: string[]; } | undefined; /** * A list of wasm modules that your worker should be bound to. This is * the "legacy" way of binding to a wasm module. ES module workers should * do proper module imports. */ wasm_modules: { [key: string]: string; } | undefined; /** * A list of text files that your worker should be bound to. This is * the "legacy" way of binding to a text file. ES module workers should * do proper module imports. */ text_blobs: { [key: string]: string; } | undefined; /** * A list of data files that your worker should be bound to. This is * the "legacy" way of binding to a data file. ES module workers should * do proper module imports. */ data_blobs: { [key: string]: string; } | undefined; /** * A map of module aliases. Lets you swap out a module for any others. * Corresponds with esbuild's `alias` config * * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#module-aliasing */ alias: { [key: string]: string; } | undefined; /** * By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file. * * If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy. * * If you want to keep your dashboard vars when wrangler deploys, set this field to true. * * @default false * @nonInheritable */ keep_vars?: boolean; /** * The inbound email addresses handled by the Worker being deployed. * * Each entry is a literal recipient address (e.g. `"support@example.com"`) * or a `*@domain` catch-all (e.g. `"*@example.com"`). Every entry creates an * Email Routing rule whose action routes mail to this Worker. * * A `*@domain` catch-all must use the zone apex (e.g. `"*@example.com"`, * not `"*@mail.example.com"`). The zone catch-all also receives mail for * every subdomain in the zone that has no literal rule. * * This field is top-level only and applies to every environment of the * Worker; it cannot be set under `env.*`. * * @nonInheritable */ addresses?: string[]; } interface PagesConfigFields { /** * The directory of static assets to serve. * * The presence of this field in a Wrangler configuration file indicates a Pages project, * and will prompt the handling of the configuration file according to the * Pages-specific validation rules. */ pages_build_output_dir?: string; } interface DevConfig { /** * IP address for the local dev server to listen on, * * @default localhost */ ip: string; /** * Port for the local dev server to listen on * * @default 8787 */ port: number | undefined; /** * Port for the local dev server's inspector to listen on * * @default 9229 */ inspector_port: number | undefined; /** * IP address for the local dev server's inspector to listen on * * @default 127.0.0.1 */ inspector_ip: string | undefined; /** * Protocol that local wrangler dev server listens to requests on. * * @default http */ local_protocol: "http" | "https"; /** * Protocol that wrangler dev forwards requests on * * Setting this to `http` is not currently implemented for remote mode. * See https://github.com/cloudflare/workers-sdk/issues/583 * * @default https */ upstream_protocol: "https" | "http"; /** * Host to forward requests to, defaults to the host of the first route of project */ host: string | undefined; /** * When developing, whether to build and connect to containers. This requires a Docker daemon to be running. * Defaults to `true`. * * @default true */ enable_containers: boolean; /** * Either the Docker unix socket i.e. `unix:///var/run/docker.sock` or a full configuration. * Note that windows is only supported via WSL at the moment */ container_engine: ContainerEngine | undefined; /** * Re-generate your worker types when your Wrangler configuration file changes. * * @default false */ generate_types: boolean; } type RawDevConfig = Partial; interface EnvironmentMap { /** * The `env` section defines overrides for the configuration for different environments. * * All environment fields can be specified at the top level of the config indicating the default environment settings. * * - Some fields are inherited and overridable in each environment. * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level. * * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments * * @default {} */ env?: { [envName: string]: RawEnvironment; }; } export { RawConfig };