@cloudflare/workers-utils 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { T as TailConsumer, av as WorkerMetadata, R as RawConfig } from './config-BH_2HMEf.mjs';
1
+ import { T as TailConsumer, az as WorkerMetadata, R as RawConfig } from './config-CXobNAeT.mjs';
2
2
  import { AssetConfig } from '@cloudflare/workers-shared';
3
3
  import { Cloudflare } from 'cloudflare';
4
4
 
package/dist/browser.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { constructWranglerConfig } from './chunk-BLWXWFJK.mjs';
1
+ export { constructWranglerConfig } from './chunk-AKFE3ND4.mjs';
2
2
  import './chunk-OZQVB3L3.mjs';
3
3
  import './chunk-DCOBXSFB.mjs';
@@ -300,6 +300,23 @@ function mapWorkerMetadataBindings(bindings) {
300
300
  }
301
301
  ];
302
302
  break;
303
+ case "web_search":
304
+ {
305
+ configObj.web_search = {
306
+ binding: binding.name
307
+ };
308
+ }
309
+ break;
310
+ case "agent_memory": {
311
+ configObj.agent_memory = [
312
+ ...configObj.agent_memory ?? [],
313
+ {
314
+ binding: binding.name,
315
+ namespace: binding.namespace
316
+ }
317
+ ];
318
+ break;
319
+ }
303
320
  case "hyperdrive":
304
321
  configObj.hyperdrive = [
305
322
  ...configObj.hyperdrive ?? [],
@@ -323,7 +340,9 @@ function mapWorkerMetadataBindings(bindings) {
323
340
  ...configObj.pipelines ?? [],
324
341
  {
325
342
  binding: binding.name,
326
- pipeline: binding.pipeline
343
+ // NOTE: stream is the primary field, but we also support pipeline for backward compatibility
344
+ ...binding.stream && { stream: binding.stream },
345
+ ...binding.pipeline && { pipeline: binding.pipeline }
327
346
  }
328
347
  ];
329
348
  break;
@@ -174,7 +174,7 @@ interface CfWorkflow {
174
174
  limits?: {
175
175
  steps?: number;
176
176
  };
177
- schedule?: string | string[];
177
+ schedules?: string | string[];
178
178
  }
179
179
  interface CfQueue {
180
180
  binding: string;
@@ -217,6 +217,15 @@ interface CfAISearch {
217
217
  instance_name: string;
218
218
  remote?: boolean;
219
219
  }
220
+ interface CfWebSearch {
221
+ binding: string;
222
+ remote?: boolean;
223
+ }
224
+ interface CfAgentMemory {
225
+ binding: string;
226
+ namespace: string | typeof INHERIT_SYMBOL;
227
+ remote?: boolean;
228
+ }
220
229
  interface CfSecretsStoreSecrets {
221
230
  binding: string;
222
231
  store_id: string;
@@ -303,7 +312,8 @@ interface CfAssetsBinding {
303
312
  }
304
313
  interface CfPipeline {
305
314
  binding: string;
306
- pipeline: string;
315
+ stream?: string;
316
+ pipeline?: string;
307
317
  remote?: boolean;
308
318
  }
309
319
  interface CfUnsafeBinding {
@@ -515,6 +525,13 @@ type WorkerMetadataBinding = {
515
525
  type: "ai_search";
516
526
  name: string;
517
527
  instance_name: string;
528
+ } | {
529
+ type: "web_search";
530
+ name: string;
531
+ } | {
532
+ type: "agent_memory";
533
+ name: string;
534
+ namespace: string;
518
535
  } | {
519
536
  type: "kv_namespace";
520
537
  name: string;
@@ -602,7 +619,8 @@ type WorkerMetadataBinding = {
602
619
  } | {
603
620
  type: "pipelines";
604
621
  name: string;
605
- pipeline: string;
622
+ stream?: string;
623
+ pipeline?: string;
606
624
  } | {
607
625
  type: "secrets_store_secret";
608
626
  name: string;
@@ -655,6 +673,38 @@ type AssetConfigMetadata = {
655
673
  _redirects?: string;
656
674
  _headers?: string;
657
675
  };
676
+ type AssetsOptions = {
677
+ directory: string;
678
+ binding?: string;
679
+ routerConfig: RouterConfig;
680
+ assetConfig: AssetConfig;
681
+ _redirects?: string;
682
+ _headers?: string;
683
+ run_worker_first?: boolean | string[];
684
+ };
685
+ /**
686
+ * Information about the assets that should be uploaded
687
+ */
688
+ interface LegacyAssetPaths {
689
+ /**
690
+ * Absolute path to the root of the project.
691
+ *
692
+ * This is the directory containing wrangler.toml or cwd if no config.
693
+ */
694
+ baseDirectory: string;
695
+ /**
696
+ * The path to the assets directory, relative to the `baseDirectory`.
697
+ */
698
+ assetDirectory: string;
699
+ /**
700
+ * An array of patterns that match files that should be uploaded.
701
+ */
702
+ includePatterns: string[];
703
+ /**
704
+ * An array of patterns that match files that should not be uploaded.
705
+ */
706
+ excludePatterns: string[];
707
+ }
658
708
  type WorkerMetadataPut = {
659
709
  /** The name of the entry point module. Only exists when the worker is in the ES module format */
660
710
  main_module?: string;
@@ -808,6 +858,10 @@ type Binding = {
808
858
  } & BindingOmit<CfAISearchNamespace>) | ({
809
859
  type: "ai_search";
810
860
  } & BindingOmit<CfAISearch>) | ({
861
+ type: "web_search";
862
+ } & BindingOmit<CfWebSearch>) | ({
863
+ type: "agent_memory";
864
+ } & BindingOmit<CfAgentMemory>) | ({
811
865
  type: "hyperdrive";
812
866
  } & BindingOmit<CfHyperdrive>) | ({
813
867
  type: "service";
@@ -849,6 +903,29 @@ type Binding = {
849
903
  } | {
850
904
  type: "inherit";
851
905
  };
906
+ /**
907
+ * An entry point for the Worker.
908
+ *
909
+ * It consists not just of a `file`, but also of a `directory` that is used to resolve relative paths.
910
+ */
911
+ type Entry = {
912
+ /** A worker's entrypoint */
913
+ file: string;
914
+ /** A worker's directory. Usually where the Wrangler configuration file is located */
915
+ projectRoot: string;
916
+ /** The path to the config file, if it exists. */
917
+ configPath: string | undefined;
918
+ /** Is this a module worker or a service worker? */
919
+ format: CfScriptFormat;
920
+ /** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
921
+ moduleRoot: string;
922
+ /**
923
+ * A worker's name
924
+ */
925
+ name?: string | undefined;
926
+ /** Export from a Worker's entrypoint */
927
+ exports: string[];
928
+ };
852
929
 
853
930
  /**
854
931
  * The `Environment` interface declares all the configuration fields that
@@ -1499,7 +1576,7 @@ type WorkflowBinding = {
1499
1576
  steps?: number;
1500
1577
  };
1501
1578
  /** Optional cron schedule(s) for automatically triggering workflow instances */
1502
- schedule?: string | string[];
1579
+ schedules?: string | string[];
1503
1580
  };
1504
1581
  /**
1505
1582
  * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
@@ -1797,6 +1874,40 @@ interface EnvironmentNonInheritable {
1797
1874
  /** Whether the AI Search instance binding should be remote in local development */
1798
1875
  remote?: boolean;
1799
1876
  }[];
1877
+ /**
1878
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
1879
+ *
1880
+ * NOTE: This field is not automatically inherited from the top level environment,
1881
+ * and so must be specified in every named environment.
1882
+ *
1883
+ * @default []
1884
+ * @nonInheritable
1885
+ */
1886
+ agent_memory: {
1887
+ /** The binding name used to refer to the Agent Memory namespace in the Worker. */
1888
+ binding: string;
1889
+ /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
1890
+ namespace: string;
1891
+ /** Whether the Agent Memory binding should be remote in local development */
1892
+ remote?: boolean;
1893
+ }[];
1894
+ /**
1895
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the
1896
+ * binding is zero-config -- only the variable name is required, declared as a
1897
+ * single object (not an array).
1898
+ *
1899
+ * NOTE: This field is not automatically inherited from the top level environment,
1900
+ * and so must be specified in every named environment.
1901
+ *
1902
+ * @default {}
1903
+ * @nonInheritable
1904
+ */
1905
+ web_search: {
1906
+ /** The binding name used to refer to Web Search in the Worker. */
1907
+ binding: string;
1908
+ /** Whether the Web Search binding should be remote or not in local development */
1909
+ remote?: boolean;
1910
+ } | undefined;
1800
1911
  /**
1801
1912
  * Specifies Hyperdrive configs that are bound to this Worker environment.
1802
1913
  *
@@ -2058,8 +2169,13 @@ interface EnvironmentNonInheritable {
2058
2169
  pipelines: {
2059
2170
  /** The binding name used to refer to the bound service. */
2060
2171
  binding: string;
2061
- /** Name of the Pipeline to bind */
2062
- pipeline: string;
2172
+ /** Id of the Stream to bind */
2173
+ stream?: string;
2174
+ /**
2175
+ * Id of the Stream to bind
2176
+ * @deprecated Use `stream` instead.
2177
+ */
2178
+ pipeline?: string;
2063
2179
  /** Whether the pipeline should be remote or not in local development */
2064
2180
  remote?: boolean;
2065
2181
  }[];
@@ -2583,4 +2699,4 @@ interface EnvironmentMap {
2583
2699
  }
2584
2700
  declare const defaultWranglerConfig: Config;
2585
2701
 
2586
- export { type CfVectorize as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectMigration as D, type Environment as E, type CfWasmModuleBindings as F, type CfTextBlobBindings as G, type CfBrowserBinding as H, type CfAIBinding as I, type CfImagesBinding as J, type CfMediaBinding as K, type CfStreamBinding as L, type CfVersionMetadataBinding as M, type CfDataBlobBindings as N, type Observability as O, type PreviewsConfig as P, type CfDurableObject as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfWorkflow as V, type WorkerMetadataBinding as W, type CfQueue as X, type CfR2Bucket as Y, type ZoneIdRoute as Z, type CfD1Database as _, type RedirectedRawConfig as a, type CfAISearchNamespace as a0, type CfAISearch as a1, type CfSecretsStoreSecrets as a2, type CfArtifacts as a3, type CfHelloWorld as a4, type CfFlagship as a5, type CfWorkerLoader as a6, type CfRateLimit as a7, type CfHyperdrive as a8, type CfService as a9, type Trigger as aA, INHERIT_SYMBOL as aB, SERVICE_TAG_PREFIX as aC, ENVIRONMENT_TAG_PREFIX as aD, PATH_TO_DEPLOY_CONFIG as aE, JSON_CONFIG_FORMATS as aF, type CfVpcService as aa, type CfVpcNetwork as ab, type CfAnalyticsEngineDataset as ac, type CfDispatchNamespace as ad, type CfMTlsCertificate as ae, type CfLogfwdr as af, type CfLogfwdrBinding as ag, type CfAssetsBinding as ah, type CfPipeline as ai, type CfUnsafeBinding as aj, type CfCapnp as ak, type CfUnsafe as al, type CfDurableObjectMigrations as am, type CfPlacement as an, type CfTailConsumer as ao, type CfUserLimits as ap, type CfWorkerInit as aq, type CfWorkerContext as ar, type CfWorkerSourceMap as as, type Json as at, type AssetConfigMetadata as au, type WorkerMetadata as av, type ServiceMetadataRes as aw, type ServiceFetch as ax, type File as ay, type BinaryFile as az, type Config as b, type RawDevConfig as c, type ConfigFields as d, type RawEnvironment as e, defaultWranglerConfig as f, type ZoneNameRoute as g, type CustomDomainRoute as h, type Route as i, type CloudchamberConfig as j, type ContainerApp as k, type DurableObjectBindings as l, type WorkflowBinding as m, type EnvironmentNonInheritable as n, type Rule as o, type ConfigModuleRuleType as p, type DispatchNamespaceOutbound as q, type CacheOptions as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };
2702
+ export { type CfVectorize as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectMigration as D, type Environment as E, type CfWasmModuleBindings as F, type CfTextBlobBindings as G, type CfBrowserBinding as H, type CfAIBinding as I, type CfImagesBinding as J, type CfMediaBinding as K, type CfStreamBinding as L, type CfVersionMetadataBinding as M, type CfDataBlobBindings as N, type Observability as O, type PreviewsConfig as P, type CfDurableObject as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfWorkflow as V, type WorkerMetadataBinding as W, type CfQueue as X, type CfR2Bucket as Y, type ZoneIdRoute as Z, type CfD1Database as _, type RedirectedRawConfig as a, type CfAISearchNamespace as a0, type CfAISearch as a1, type CfWebSearch as a2, type CfAgentMemory as a3, type CfSecretsStoreSecrets as a4, type CfArtifacts as a5, type CfHelloWorld as a6, type CfFlagship as a7, type CfWorkerLoader as a8, type CfRateLimit as a9, type ServiceMetadataRes as aA, type ServiceFetch as aB, type File as aC, type BinaryFile as aD, type Trigger as aE, type Entry as aF, INHERIT_SYMBOL as aG, SERVICE_TAG_PREFIX as aH, ENVIRONMENT_TAG_PREFIX as aI, PATH_TO_DEPLOY_CONFIG as aJ, JSON_CONFIG_FORMATS as aK, type CfHyperdrive as aa, type CfService as ab, type CfVpcService as ac, type CfVpcNetwork as ad, type CfAnalyticsEngineDataset as ae, type CfDispatchNamespace as af, type CfMTlsCertificate as ag, type CfLogfwdr as ah, type CfLogfwdrBinding as ai, type CfAssetsBinding as aj, type CfPipeline as ak, type CfUnsafeBinding as al, type CfCapnp as am, type CfUnsafe as an, type CfDurableObjectMigrations as ao, type CfPlacement as ap, type CfTailConsumer as aq, type CfUserLimits as ar, type CfWorkerInit as as, type CfWorkerContext as at, type CfWorkerSourceMap as au, type Json as av, type AssetConfigMetadata as aw, type AssetsOptions as ax, type LegacyAssetPaths as ay, type WorkerMetadata as az, type Config as b, type RawDevConfig as c, type ConfigFields as d, type RawEnvironment as e, defaultWranglerConfig as f, type ZoneNameRoute as g, type CustomDomainRoute as h, type Route as i, type CloudchamberConfig as j, type ContainerApp as k, type DurableObjectBindings as l, type WorkflowBinding as m, type EnvironmentNonInheritable as n, type Rule as o, type ConfigModuleRuleType as p, type DispatchNamespaceOutbound as q, type CacheOptions as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, W as WorkerMetadataBinding } from './config-BH_2HMEf.mjs';
2
- export { au as AssetConfigMetadata, A as Assets, az as BinaryFile, r as CacheOptions, I as CfAIBinding, a1 as CfAISearch, a0 as CfAISearchNamespace, ac as CfAnalyticsEngineDataset, a3 as CfArtifacts, ah as CfAssetsBinding, H as CfBrowserBinding, ak as CfCapnp, _ as CfD1Database, N as CfDataBlobBindings, ad as CfDispatchNamespace, Q as CfDurableObject, am as CfDurableObjectMigrations, a5 as CfFlagship, a4 as CfHelloWorld, a8 as CfHyperdrive, J as CfImagesBinding, y as CfKvNamespace, af as CfLogfwdr, ag as CfLogfwdrBinding, ae as CfMTlsCertificate, K as CfMediaBinding, w as CfModule, v as CfModuleType, ai as CfPipeline, an as CfPlacement, X as CfQueue, Y as CfR2Bucket, a7 as CfRateLimit, u as CfScriptFormat, a2 as CfSecretsStoreSecrets, z as CfSendEmailBindings, a9 as CfService, L as CfStreamBinding, ao as CfTailConsumer, G as CfTextBlobBindings, al as CfUnsafe, aj as CfUnsafeBinding, ap as CfUserLimits, x as CfVars, $ as CfVectorize, M as CfVersionMetadataBinding, ab as CfVpcNetwork, aa as CfVpcService, F as CfWasmModuleBindings, ar as CfWorkerContext, aq as CfWorkerInit, a6 as CfWorkerLoader, as as CfWorkerSourceMap, V as CfWorkflow, j as CloudchamberConfig, d as ConfigFields, p as ConfigModuleRuleType, k as ContainerApp, t as ContainerEngine, h as CustomDomainRoute, q as DispatchNamespaceOutbound, s as DockerConfiguration, l as DurableObjectBindings, D as DurableObjectMigration, aD as ENVIRONMENT_TAG_PREFIX, E as Environment, n as EnvironmentNonInheritable, ay as File, aB as INHERIT_SYMBOL, aF as JSON_CONFIG_FORMATS, at as Json, O as Observability, aE as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, c as RawDevConfig, e as RawEnvironment, a as RedirectedRawConfig, i as Route, o as Rule, aC as SERVICE_TAG_PREFIX, ax as ServiceFetch, aw as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, aA as Trigger, U as UserLimits, av as WorkerMetadata, m as WorkflowBinding, Z as ZoneIdRoute, g as ZoneNameRoute, f as defaultWranglerConfig } from './config-BH_2HMEf.mjs';
1
+ import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, W as WorkerMetadataBinding } from './config-CXobNAeT.mjs';
2
+ export { aw as AssetConfigMetadata, A as Assets, ax as AssetsOptions, aD as BinaryFile, r as CacheOptions, I as CfAIBinding, a1 as CfAISearch, a0 as CfAISearchNamespace, a3 as CfAgentMemory, ae as CfAnalyticsEngineDataset, a5 as CfArtifacts, aj as CfAssetsBinding, H as CfBrowserBinding, am as CfCapnp, _ as CfD1Database, N as CfDataBlobBindings, af as CfDispatchNamespace, Q as CfDurableObject, ao as CfDurableObjectMigrations, a7 as CfFlagship, a6 as CfHelloWorld, aa as CfHyperdrive, J as CfImagesBinding, y as CfKvNamespace, ah as CfLogfwdr, ai as CfLogfwdrBinding, ag as CfMTlsCertificate, K as CfMediaBinding, w as CfModule, v as CfModuleType, ak as CfPipeline, ap as CfPlacement, X as CfQueue, Y as CfR2Bucket, a9 as CfRateLimit, u as CfScriptFormat, a4 as CfSecretsStoreSecrets, z as CfSendEmailBindings, ab as CfService, L as CfStreamBinding, aq as CfTailConsumer, G as CfTextBlobBindings, an as CfUnsafe, al as CfUnsafeBinding, ar as CfUserLimits, x as CfVars, $ as CfVectorize, M as CfVersionMetadataBinding, ad as CfVpcNetwork, ac as CfVpcService, F as CfWasmModuleBindings, a2 as CfWebSearch, at as CfWorkerContext, as as CfWorkerInit, a8 as CfWorkerLoader, au as CfWorkerSourceMap, V as CfWorkflow, j as CloudchamberConfig, d as ConfigFields, p as ConfigModuleRuleType, k as ContainerApp, t as ContainerEngine, h as CustomDomainRoute, q as DispatchNamespaceOutbound, s as DockerConfiguration, l as DurableObjectBindings, D as DurableObjectMigration, aI as ENVIRONMENT_TAG_PREFIX, aF as Entry, E as Environment, n as EnvironmentNonInheritable, aC as File, aG as INHERIT_SYMBOL, aK as JSON_CONFIG_FORMATS, av as Json, ay as LegacyAssetPaths, O as Observability, aJ as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, c as RawDevConfig, e as RawEnvironment, a as RedirectedRawConfig, i as Route, o as Rule, aH as SERVICE_TAG_PREFIX, aB as ServiceFetch, aA as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, aE as Trigger, U as UserLimits, az as WorkerMetadata, m as WorkflowBinding, Z as ZoneIdRoute, g as ZoneNameRoute, f as defaultWranglerConfig } from './config-CXobNAeT.mjs';
3
3
  import * as jsoncParser from 'jsonc-parser';
4
4
  export { constructWranglerConfig } from './browser.mjs';
5
5
  export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
@@ -90,7 +90,7 @@ declare const bucketFormatMessage = "Bucket names must begin and end with an alp
90
90
  * Config field names for bindings (e.g., "kv_namespaces", "d1_databases").
91
91
  * These are the keys used in Wrangler's config file
92
92
  */
93
- type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
93
+ type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "web_search" | "agent_memory" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
94
94
  /**
95
95
  * @deprecated new code should use getBindingTypeFriendlyName() instead
96
96
  */
@@ -329,6 +329,22 @@ declare function parseHumanDuration(s: string): number;
329
329
  declare function parseNonHyphenedUuid(uuid: string | null): string | null;
330
330
  declare function parseByteSize(s: string, base?: number | undefined): number;
331
331
 
332
+ /**
333
+ * Local-dev capability of each binding type. Source of truth for
334
+ * `pickRemoteBindings()` and `warnOrError()`.
335
+ *
336
+ * - `local-and-remote`: local simulator; `remote: true` opts into proxying.
337
+ * - `local-only`: local simulator only; `remote: true` is a config error.
338
+ * - `remote`: no local simulator *yet* — requires explicit `remote: true`.
339
+ * Move to `local-and-remote` once a simulator lands.
340
+ * - `DO-NOT-USE-this-resource-will-never-have-a-local-simulator`: no local
341
+ * simulator, *ever* — fundamentally remote-only. Always auto-routed; user
342
+ * is warned about usage charges. Adding here is permanent; prefer any
343
+ * other variant if a simulator is plausible.
344
+ */
345
+ type BindingLocalSupport = "local-and-remote" | "local-only" | "remote" | "DO-NOT-USE-this-resource-will-never-have-a-local-simulator";
346
+ declare function getBindingLocalSupport(type: Binding["type"]): BindingLocalSupport;
347
+
332
348
  /**
333
349
  * Pages now supports configuration via a Wrangler configuration file. As opposed to
334
350
  * Workers however, Pages only supports a limited subset of all available
@@ -569,9 +585,12 @@ declare const getC3CommandFromEnv: () => string;
569
585
  */
570
586
  declare const getWranglerSendMetricsFromEnv: () => boolean | undefined;
571
587
  /**
572
- * `WRANGLER_SEND_ERROR_REPORTS` can override whether we attempt to send error reports to Sentry.
588
+ * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
589
+ *
590
+ * Defaults to `false` to avoid noisy false-positive reports. Users can opt in
591
+ * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
573
592
  */
574
- declare const getWranglerSendErrorReportsFromEnv: () => boolean | undefined;
593
+ declare const getWranglerSendErrorReportsFromEnv: () => boolean;
575
594
  /**
576
595
  * Set `WRANGLER_API_ENVIRONMENT` environment variable to "staging" to tell Wrangler to hit the staging APIs rather than production.
577
596
  */
@@ -838,6 +857,35 @@ declare function removeDir(dirPath: string, options?: {
838
857
  */
839
858
  declare function removeDirSync(dirPath: string): void;
840
859
 
860
+ /**
861
+ * A short-lived directory. Automatically removed when the process exits, but
862
+ * can be removed earlier by calling `remove()`.
863
+ */
864
+ interface EphemeralDirectory {
865
+ path: string;
866
+ remove(): void;
867
+ }
868
+ /**
869
+ * Gets the path to the project's `.wrangler` folder.
870
+ */
871
+ declare function getWranglerHiddenDirPath(projectRoot: string | undefined): string;
872
+ /**
873
+ * Removes stale `.wrangler/tmp/*` entries left behind by previous wrangler
874
+ * sessions that exited abnormally (SIGKILL, OOM, host crash) and so missed
875
+ * the `signal-exit` cleanup. Runs at most once per tmp root per process.
876
+ *
877
+ * Exported for tests.
878
+ */
879
+ declare function sweepStaleWranglerTmpDirs(tmpRoot: string): void;
880
+ /**
881
+ * Gets a temporary directory in the project's `.wrangler` folder with the
882
+ * specified prefix. We create temporary directories in `.wrangler` as opposed
883
+ * to the OS's temporary directory to avoid issues with different drive letters
884
+ * on Windows. For example, when `esbuild` outputs a file to a different drive
885
+ * than the input sources, the generated source maps are incorrect.
886
+ */
887
+ declare function getWranglerTmpDir(projectRoot: string | undefined, prefix: string, cleanup?: boolean): EphemeralDirectory;
888
+
841
889
  /**
842
890
  * cloudflared binary management for Wrangler tunnel commands.
843
891
  *
@@ -895,4 +943,28 @@ interface TunnelOptions {
895
943
  */
896
944
  declare function startTunnel(options: TunnelOptions): Tunnel;
897
945
 
898
- export { APIError, Binding, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CommandLineArgsError, type CompatDate, type ComplianceConfig, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, FatalError, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type PackageJSON, ParseError, type ParseFile, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, friendlyBindingNames, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTodaysCompatDate, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, indexLocation, isCompatDate, isDirectory, isDockerfile, isOptionalProperty, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation, spawnCloudflared, startTunnel, validatePagesConfig };
946
+ type NpmVersionCheckResult = {
947
+ status: "up-to-date";
948
+ } | {
949
+ status: "update-available";
950
+ latest: string;
951
+ } | {
952
+ status: "failed";
953
+ };
954
+ /**
955
+ * Checks if a newer version of a package is available on npm.
956
+ *
957
+ * Uses the `update-check` library to query the npm registry for the latest
958
+ * version. The dist tag used for comparison depends on the current version —
959
+ * "beta" for pre-release versions (0.0.0-*) and "latest" for stable versions.
960
+ *
961
+ * @param name - The npm package name to check
962
+ * @param version - The current version to compare against
963
+ * @returns A discriminated result:
964
+ * - `{ status: "update-available", latest: string }` if a newer version exists
965
+ * - `{ status: "up-to-date" }` if the installed version is already the latest
966
+ * - `{ status: "failed" }` if the check could not be completed (network error, timeout, etc.)
967
+ */
968
+ declare function fetchLatestNpmVersion(name: string, version: string): Promise<NpmVersionCheckResult>;
969
+
970
+ export { APIError, Binding, type BindingLocalSupport, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CommandLineArgsError, type CompatDate, type ComplianceConfig, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, type EphemeralDirectory, FatalError, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type NpmVersionCheckResult, type PackageJSON, ParseError, type ParseFile, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTodaysCompatDate, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, hasProperty, indexLocation, isCompatDate, isDirectory, isDockerfile, isOptionalProperty, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, validatePagesConfig };