wrangler 0.0.0-e0efb6f17 → 0.0.0-e101451a2

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.
@@ -221,6 +221,8 @@ declare type Assets = {
221
221
  * If false, then respond to requests that match an asset with that asset directly.
222
222
  * */
223
223
  run_worker_first?: boolean;
224
+ /** Deprecated; Inverse of run_worker_first. Should use run_worker_first instead */
225
+ experimental_serve_directly?: boolean;
224
226
  };
225
227
 
226
228
  declare type AssetsOptions = {
@@ -323,6 +325,16 @@ declare type Binding = {
323
325
 
324
326
  declare type BindingOmit<T> = Omit<T, "binding">;
325
327
 
328
+ /**
329
+ * Result of the `getBindingsProxy` utility
330
+ */
331
+ export declare type BindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties> = Omit<PlatformProxy<Bindings, CfProperties>, "env"> & {
332
+ /**
333
+ * Object containing the various proxies
334
+ */
335
+ bindings: Bindings;
336
+ };
337
+
326
338
  declare interface BlobPropertyBag {
327
339
  type?: string
328
340
  endings?: 'native' | 'transparent'
@@ -972,6 +984,20 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
972
984
  */
973
985
  exclude?: string[];
974
986
  } | undefined;
987
+ /**
988
+ * Old behaviour of serving a folder of static assets with your Worker,
989
+ * without any additional code.
990
+ * This can either be a string, or an object with additional config
991
+ * fields.
992
+ * Will be deprecated in the near future in favor of `assets`.
993
+ */
994
+ legacy_assets: {
995
+ bucket: string;
996
+ include: string[];
997
+ exclude: string[];
998
+ browser_TTL: number | undefined;
999
+ serve_single_page_app: boolean;
1000
+ } | string | undefined;
975
1001
  /**
976
1002
  * A list of wasm modules that your worker should be bound to. This is
977
1003
  * the "legacy" way of binding to a wasm module. ES module workers should
@@ -1038,8 +1064,6 @@ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin'
1038
1064
  declare type ContainerApp = {
1039
1065
  name: string;
1040
1066
  instances: number;
1041
- image?: string;
1042
- class_name: string;
1043
1067
  scheduling_policy?: "regional" | "moon";
1044
1068
  configuration: {
1045
1069
  image: string;
@@ -1152,6 +1176,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1152
1176
  build_image_major_version: number;
1153
1177
  kv_namespaces?: any;
1154
1178
  source?: {
1179
+ type: "github" | "gitlab";
1155
1180
  config: {
1156
1181
  owner: string;
1157
1182
  repo_name: string;
@@ -1163,7 +1188,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1163
1188
  preview_branch_includes?: string[] | undefined;
1164
1189
  preview_branch_excludes?: string[] | undefined;
1165
1190
  };
1166
- type: "github" | "gitlab";
1167
1191
  } | undefined;
1168
1192
  env_vars?: any;
1169
1193
  durable_object_namespaces?: any;
@@ -1175,6 +1199,61 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1175
1199
  formData: FormData_2;
1176
1200
  }>;
1177
1201
 
1202
+ declare interface DeprecatedConfigFields {
1203
+ /**
1204
+ * The project "type". A holdover from Wrangler v1.x.
1205
+ * Valid values were "webpack", "javascript", and "rust".
1206
+ *
1207
+ * @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
1208
+ * @breaking
1209
+ */
1210
+ type?: "webpack" | "javascript" | "rust";
1211
+ /**
1212
+ * Path to the webpack config to use when building your worker.
1213
+ * A holdover from Wrangler v1.x, used with `type: "webpack"`.
1214
+ *
1215
+ * @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
1216
+ * @breaking
1217
+ */
1218
+ webpack_config?: string;
1219
+ /**
1220
+ * Configuration only used by a standalone use of the miniflare binary.
1221
+ * @deprecated
1222
+ */
1223
+ miniflare?: unknown;
1224
+ }
1225
+
1226
+ /**
1227
+ * Deprecated upload configuration.
1228
+ */
1229
+ declare interface DeprecatedUpload {
1230
+ /**
1231
+ * The format of the Worker script.
1232
+ *
1233
+ * @deprecated We infer the format automatically now.
1234
+ */
1235
+ format?: "modules" | "service-worker";
1236
+ /**
1237
+ * The directory you wish to upload your Worker from,
1238
+ * relative to the Wrangler configuration file.
1239
+ *
1240
+ * Defaults to the directory containing the Wrangler configuration file.
1241
+ *
1242
+ * @deprecated
1243
+ */
1244
+ dir?: string;
1245
+ /**
1246
+ * The path to the Worker script, relative to `upload.dir`.
1247
+ *
1248
+ * @deprecated This will be replaced by a command line argument.
1249
+ */
1250
+ main?: string;
1251
+ /**
1252
+ * @deprecated This is now defined at the top level `rules` field.
1253
+ */
1254
+ rules?: Environment["rules"];
1255
+ }
1256
+
1178
1257
  declare interface DevConfig {
1179
1258
  /**
1180
1259
  * IP address for the local dev server to listen on,
@@ -1570,6 +1649,8 @@ declare type Entry = {
1570
1649
  file: string;
1571
1650
  /** A worker's directory. Usually where the Wrangler configuration file is located */
1572
1651
  projectRoot: string;
1652
+ /** The path to the config file, if it exists. */
1653
+ configPath: string | undefined;
1573
1654
  /** Is this a module worker or a service worker? */
1574
1655
  format: CfScriptFormat;
1575
1656
  /** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
@@ -1591,6 +1672,39 @@ declare type Entry = {
1591
1672
  declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
1592
1673
  }
1593
1674
 
1675
+ /**
1676
+ * The environment configuration properties that have been deprecated.
1677
+ */
1678
+ declare interface EnvironmentDeprecated {
1679
+ /**
1680
+ * The zone ID of the zone you want to deploy to. You can find this
1681
+ * in your domain page on the dashboard.
1682
+ *
1683
+ * @deprecated This is unnecessary since we can deduce this from routes directly.
1684
+ */
1685
+ zone_id?: string;
1686
+ /**
1687
+ * Legacy way of defining KVNamespaces that is no longer supported.
1688
+ *
1689
+ * @deprecated DO NOT USE. This was a legacy bug from Wrangler v1, that we do not want to support.
1690
+ */
1691
+ "kv-namespaces"?: string;
1692
+ /**
1693
+ * A list of services that your Worker should be bound to.
1694
+ *
1695
+ * @default []
1696
+ * @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.
1697
+ */
1698
+ experimental_services?: {
1699
+ /** The binding name used to refer to the Service */
1700
+ name: string;
1701
+ /** The name of the Service being bound */
1702
+ service: string;
1703
+ /** The Service's environment */
1704
+ environment: string;
1705
+ }[];
1706
+ }
1707
+
1594
1708
  /**
1595
1709
  * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
1596
1710
  * that can be inherited (and overridden) from the top-level environment.
@@ -1736,12 +1850,26 @@ declare interface EnvironmentInheritable {
1736
1850
  *
1737
1851
  * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
1738
1852
  *
1739
- * @default {crons:[]}
1853
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
1854
+ *
1855
+ * @default {crons: undefined}
1740
1856
  * @inheritable
1741
1857
  */
1742
1858
  triggers: {
1743
- crons: string[];
1859
+ crons: string[] | undefined;
1744
1860
  };
1861
+ /**
1862
+ * Specifies the Usage Model for your Worker. There are two options -
1863
+ * [bundled](https://developers.cloudflare.com/workers/platform/limits#bundled-usage-model) and
1864
+ * [unbound](https://developers.cloudflare.com/workers/platform/limits#unbound-usage-model).
1865
+ * For newly created Workers, if the Usage Model is omitted
1866
+ * it will be set to the [default Usage Model set on the account](https://dash.cloudflare.com/?account=workers/default-usage-model).
1867
+ * For existing Workers, if the Usage Model is omitted, it will be
1868
+ * set to the Usage Model configured in the dashboard for that Worker.
1869
+ *
1870
+ * @inheritable
1871
+ */
1872
+ usage_model: "bundled" | "unbound" | undefined;
1745
1873
  /**
1746
1874
  * Specify limits for runtime behavior.
1747
1875
  * Only supported for the "standard" Usage Model
@@ -1773,6 +1901,11 @@ declare interface EnvironmentInheritable {
1773
1901
  cwd?: string;
1774
1902
  /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
1775
1903
  watch_dir?: string | string[];
1904
+ /**
1905
+ * Deprecated field previously used to configure the build and upload of the script.
1906
+ * @deprecated
1907
+ */
1908
+ upload?: DeprecatedUpload;
1776
1909
  };
1777
1910
  /**
1778
1911
  * Skip internal build steps and directly deploy script
@@ -1784,12 +1917,24 @@ declare interface EnvironmentInheritable {
1784
1917
  * @inheritable
1785
1918
  */
1786
1919
  minify: boolean | undefined;
1920
+ /**
1921
+ * Add polyfills for node builtin modules and globals
1922
+ * @inheritable
1923
+ */
1924
+ node_compat: boolean | undefined;
1787
1925
  /**
1788
1926
  * Designates this Worker as an internal-only "first-party" Worker.
1789
1927
  *
1790
1928
  * @inheritable
1791
1929
  */
1792
1930
  first_party_worker: boolean | undefined;
1931
+ /**
1932
+ * TODO: remove this as it has been deprecated.
1933
+ *
1934
+ * This is just here for now because the `route` commands use it.
1935
+ * So we need to include it in this type so it is available.
1936
+ */
1937
+ zone_id?: string;
1793
1938
  /**
1794
1939
  * List of bindings that you will send to logfwdr
1795
1940
  *
@@ -1930,11 +2075,19 @@ declare interface EnvironmentNonInheritable {
1930
2075
  cloudchamber: CloudchamberConfig;
1931
2076
  /**
1932
2077
  * Container related configuration
1933
- *
1934
- * @default []
1935
- * @nonInheritable
1936
2078
  */
1937
- containers?: ContainerApp[];
2079
+ containers: {
2080
+ /**
2081
+ * Container app configuration
2082
+ *
2083
+ * NOTE: This field is not automatically inherited from the top level environment,
2084
+ * and so must be specified in every named environment.
2085
+ *
2086
+ * @default {}
2087
+ * @nonInheritable
2088
+ */
2089
+ app: ContainerApp[];
2090
+ };
1938
2091
  /**
1939
2092
  * These specify any Workers KV Namespaces you want to
1940
2093
  * access from inside your Worker.
@@ -2473,6 +2626,7 @@ declare type EventTarget_2 = typeof globalThis extends { EventTarget: infer T }
2473
2626
  declare class ExecutionContext {
2474
2627
  waitUntil(promise: Promise<any>): void;
2475
2628
  passThroughOnException(): void;
2629
+ props: any;
2476
2630
  }
2477
2631
 
2478
2632
  export declare const experimental_patchConfig: (configPath: string, patch: Unstable_RawConfig, isArrayInsertion?: boolean) => string;
@@ -2662,6 +2816,20 @@ declare class FormData_2 {
2662
2816
  */
2663
2817
  declare type FormDataEntryValue = string | File
2664
2818
 
2819
+ /**
2820
+ * By reading from a Wrangler configuration file this function generates proxy binding objects that can be
2821
+ * used to simulate the interaction with bindings during local development in a Node.js environment
2822
+ *
2823
+ * @deprecated use `getPlatformProxy` instead
2824
+ *
2825
+ * @param options The various options that can tweak this function's behavior
2826
+ * @returns An Object containing the generated proxies alongside other related utilities
2827
+ */
2828
+ export declare function getBindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties>(options?: GetBindingsProxyOptions): Promise<BindingsProxy<Bindings, CfProperties>>;
2829
+
2830
+ /** Options for the `getBindingsProxy` utility */
2831
+ export declare type GetBindingsProxyOptions = GetPlatformProxyOptions;
2832
+
2665
2833
  declare function getCookies (headers: Headers_2): Record<string, string>
2666
2834
 
2667
2835
  declare function getGlobalDispatcher(): Dispatcher;
@@ -26071,7 +26239,6 @@ declare interface StartDevWorkerInput {
26071
26239
  /**
26072
26240
  * The javascript or typescript entry-point of the worker.
26073
26241
  * This is the `main` property of a Wrangler configuration file.
26074
- * You can specify a file path or provide the contents directly.
26075
26242
  */
26076
26243
  entrypoint?: string;
26077
26244
  /** The configuration of the worker. */
@@ -26172,6 +26339,7 @@ declare interface StartDevWorkerInput {
26172
26339
  };
26173
26340
  legacy?: {
26174
26341
  site?: Hook<Unstable_Config["site"], [Unstable_Config]>;
26342
+ legacyAssets?: Hook<Unstable_Config["legacy_assets"], [Unstable_Config]>;
26175
26343
  enableServiceEnvironments?: boolean;
26176
26344
  };
26177
26345
  unsafe?: Omit<CfUnsafe, "bindings">;
@@ -26192,6 +26360,7 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
26192
26360
  processEntrypoint: boolean;
26193
26361
  };
26194
26362
  legacy: StartDevWorkerInput["legacy"] & {
26363
+ legacyAssets?: Unstable_Config["legacy_assets"];
26195
26364
  site?: Unstable_Config["site"];
26196
26365
  };
26197
26366
  dev: StartDevWorkerInput["dev"] & {
@@ -26433,9 +26602,11 @@ export declare interface Unstable_DevOptions {
26433
26602
  httpsKeyPath?: string;
26434
26603
  httpsCertPath?: string;
26435
26604
  assets?: string;
26605
+ legacyAssets?: string;
26436
26606
  site?: string;
26437
26607
  siteInclude?: string[];
26438
26608
  siteExclude?: string[];
26609
+ nodeCompat?: boolean;
26439
26610
  compatibilityDate?: string;
26440
26611
  compatibilityFlags?: string[];
26441
26612
  persist?: boolean;
@@ -26506,13 +26677,9 @@ export declare interface Unstable_DevWorker {
26506
26677
 
26507
26678
  export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
26508
26679
 
26509
- export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
26510
- imagesLocalMode: boolean;
26511
- }): Unstable_MiniflareWorkerOptions;
26680
+ export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): Unstable_MiniflareWorkerOptions;
26512
26681
 
26513
- export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string, options?: {
26514
- imagesLocalMode: boolean;
26515
- }): Unstable_MiniflareWorkerOptions;
26682
+ export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string): Unstable_MiniflareWorkerOptions;
26516
26683
 
26517
26684
  export declare interface Unstable_MiniflareWorkerOptions {
26518
26685
  workerOptions: SourcelessWorkerOptions;
@@ -26525,7 +26692,7 @@ export declare const unstable_pages: {
26525
26692
  deploy: typeof deploy;
26526
26693
  };
26527
26694
 
26528
- export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & Unstable_RawEnvironment & EnvironmentMap & {
26695
+ export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & Unstable_RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
26529
26696
  $schema?: string;
26530
26697
  };
26531
26698
 
@@ -26535,7 +26702,7 @@ export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & P
26535
26702
  * All the properties are optional, and will be replaced with defaults in the configuration that
26536
26703
  * is used in the rest of the codebase.
26537
26704
  */
26538
- export declare type Unstable_RawEnvironment = Partial<Environment>;
26705
+ export declare type Unstable_RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
26539
26706
 
26540
26707
  /**
26541
26708
  * Get the Wrangler configuration; read it from the give `configPath` if available.