diff --git a/packages/wrangler/src/config/environment.ts b/packages/wrangler/src/config/environment.ts index 7d12153104f5..420dd252b7e6 100644 --- a/packages/wrangler/src/config/environment.ts +++ b/packages/wrangler/src/config/environment.ts @@ -42,7 +42,7 @@ export type CloudchamberConfig = { */ interface EnvironmentInheritable { /** - * The name of your worker. Alphanumeric + dashes only. + * The name of your Worker. Alphanumeric + dashes only. * * @inheritable */ @@ -75,18 +75,21 @@ interface EnvironmentInheritable { * * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates * + * @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. + * Any files that match `rules` will be included in the deployed Worker. * Defaults to true if `no_bundle` is true, otherwise false. * * @inheritable @@ -98,12 +101,14 @@ interface EnvironmentInheritable { * 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. + * 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 */ @@ -111,8 +116,9 @@ interface EnvironmentInheritable { /** * Whether we use ..workers.dev to - * test and deploy your worker. + * test and deploy your Worker. * + * // Carmen according to our tests the default is undefined * @default `true` (This is a breaking change from Wrangler v1) * @breaking * @inheritable @@ -120,21 +126,21 @@ interface EnvironmentInheritable { workers_dev: boolean | undefined; /** - * A list of routes that your worker should be published to. + * 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`) + * Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`) * * @inheritable */ routes: Route[] | undefined; /** - * A route that your worker should be published to. Literally + * 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 + * Only required when workers_dev is false, and there's no scheduled Worker * * @inheritable */ @@ -142,6 +148,8 @@ interface EnvironmentInheritable { /** * Path to a custom tsconfig + * + * @inheritable */ tsconfig: string | undefined; @@ -162,9 +170,9 @@ interface EnvironmentInheritable { jsx_fragment: string; /** - * "Cron" definitions to trigger a worker's "scheduled" function. + * "Cron" definitions to trigger a Worker's "scheduled" function. * - * Lets you call workers periodically, much like a cron job. + * Lets you call Workers periodically, much like a cron job. * * More details here https://developers.cloudflare.com/workers/platform/cron-triggers * @@ -210,7 +218,7 @@ interface EnvironmentInheritable { * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build) * for more details. * - * @default {} + * @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. */ @@ -245,25 +253,9 @@ interface EnvironmentInheritable { node_compat: boolean | undefined; /** - * Specifies namespace bindings that are bound to this Worker environment. + * Designates this Worker as an internal-only "first-party" Worker. * - * NOTE: This field is not automatically inherited from the top level environment, - * and so must be specified in every named environment. - * - * @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; - }[]; - - /** - * Designates this worker as an internal-only "first-party" worker. + * @inheritable */ first_party_worker: boolean | undefined; @@ -291,7 +283,7 @@ interface EnvironmentInheritable { }; /** - * Send Trace Events from this worker to Workers Logpush. + * Send Trace Events from this Worker to Workers Logpush. * * This will not configure a corresponding Logpush job automatically. * @@ -309,9 +301,11 @@ interface EnvironmentInheritable { upload_source_maps: boolean | undefined; /** - * Specify how the worker should be located to minimize round-trip time. + * 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" } | undefined; } @@ -321,7 +315,7 @@ export type DurableObjectBindings = { 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) */ + /** 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; @@ -336,7 +330,7 @@ export type DurableObjectBindings = { */ export interface EnvironmentNonInheritable { /** - * A map of values to substitute when deploying your worker. + * 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. @@ -346,7 +340,7 @@ export interface EnvironmentNonInheritable { */ define: Record; /** - * A map of environment variables to set when deploying your worker. + * 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. @@ -357,7 +351,7 @@ export interface EnvironmentNonInheritable { vars: Record; /** - * A list of durable objects that your worker should be bound to. + * A list of durable objects that your Worker should be bound to. * * For more information about Durable Objects, see the documentation at * https://developers.cloudflare.com/workers/learning/using-durable-objects @@ -429,13 +423,13 @@ export interface EnvironmentNonInheritable { * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * - * @default `{}` + * @default `{consumers:[],producers:[]}` * @nonInheritable */ queues: { /** Producer bindings */ producers?: { - /** The binding name used to refer to the Queue in the worker. */ + /** The binding name used to refer to the Queue in the Worker. */ binding: string; /** The name of this Queue. */ @@ -486,7 +480,7 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ r2_buckets: { - /** The binding name used to refer to the R2 bucket in the worker. */ + /** 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; @@ -506,7 +500,7 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ d1_databases: { - /** The binding name used to refer to the D1 database in the worker. */ + /** The binding name used to refer to the D1 database in the Worker. */ binding: string; /** The name of this D1 database. */ database_name: string; @@ -532,12 +526,13 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ vectorize: { - /** The binding name used to refer to the Vectorize index in the worker. */ + /** The binding name used to refer to the Vectorize index in the Worker. */ binding: string; /** The name of the index. */ index_name: string; }[]; + // Q: is this still relevant? what abt the `ai` key? is there a diff between them? /** * Specifies Constellation projects that are bound to this Worker environment. * @@ -548,7 +543,7 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ constellation: { - /** The binding name used to refer to the project in the worker. */ + /** The binding name used to refer to the project in the Worker. */ binding: string; /** The id of the project. */ project_id: string; @@ -564,7 +559,7 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ hyperdrive: { - /** The binding name used to refer to the project in the worker. */ + /** The binding name used to refer to the project in the Worker. */ binding: string; /** The id of the database. */ id: string; @@ -573,7 +568,7 @@ export interface EnvironmentNonInheritable { }[]; /** - * Specifies service bindings (worker-to-worker) that are bound to this Worker environment. + * 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. @@ -604,14 +599,20 @@ export interface EnvironmentNonInheritable { * @nonInheritable */ analytics_engine_datasets: { - /** The binding name used to refer to the dataset in the worker. */ + /** The binding name used to refer to the dataset in the Worker. */ binding: string; /** The name of this dataset to write to. */ dataset?: string; }[]; /** - * A browser that will be usable from the worker. + * 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. + * + * @default `{}` + * @nonInheritable */ browser: | { @@ -621,6 +622,12 @@ export interface EnvironmentNonInheritable { /** * 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. + * + * @default `{}` + * @nonInheritable */ ai: | { @@ -643,6 +650,7 @@ export interface EnvironmentNonInheritable { * NOTE: This field is not automatically inherited from the top level environment, * and so must be specified in every named environment. * + * @default `{}` * @nonInheritable */ unsafe: { @@ -681,14 +689,50 @@ export interface EnvironmentNonInheritable { }; }; + /** + * 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. + * + * @default `[]` + * @nonInheritable + */ mtls_certificates: { - /** The binding name used to refer to the certificate in the worker */ + /** The binding name used to refer to the certificate in the Worker */ binding: string; /** The uuid of the uploaded mTLS certificate */ certificate_id: string; }[]; + /** + * 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 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 + */ + 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; + }[]; } /** @@ -711,7 +755,7 @@ interface EnvironmentDeprecated { "kv-namespaces"?: string; /** - * A list of services that your worker should be bound to. + * A list of services that your Worker should be bound to. * * @default `[]` * @deprecated DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration. @@ -738,7 +782,7 @@ export interface DeprecatedUpload { format?: "modules" | "service-worker"; /** - * The directory you wish to upload your worker from, + * The directory you wish to upload your Worker from, * relative to the wrangler.toml file. * * Defaults to the directory containing the wrangler.toml file. @@ -801,11 +845,11 @@ export interface DispatchNamespaceOutbound { 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 */ + /** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */ parameters?: string[]; } export interface UserLimits { - /** Maximum allowed CPU time for a worker's invocation in milliseconds */ + /** Maximum allowed CPU time for a Worker's invocation in milliseconds */ cpu_ms: number; }