wrangler 0.0.0-ee305dd67 → 0.0.0-ee3ef6414
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.
- package/README.md +21 -37
- package/config-schema.json +208 -31
- package/package.json +12 -13
- package/templates/init-tests/test-vitest-new-worker.ts +2 -2
- package/templates/middleware/middleware-patch-console-prefix.d.ts +3 -0
- package/templates/middleware/middleware-patch-console-prefix.ts +21 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +288 -113
- package/wrangler-dist/cli.js +101911 -97612
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -79,23 +79,36 @@ declare type AssetConfig = z.infer<typeof AssetConfigSchema>;
|
|
|
79
79
|
declare const AssetConfigSchema: z.ZodObject<{
|
|
80
80
|
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
|
81
81
|
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
|
|
82
|
+
serve_directly: z.ZodOptional<z.ZodBoolean>;
|
|
82
83
|
}, "strip", z.ZodTypeAny, {
|
|
83
84
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
84
85
|
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
86
|
+
serve_directly?: boolean;
|
|
85
87
|
}, {
|
|
86
88
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
87
89
|
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
90
|
+
serve_directly?: boolean;
|
|
88
91
|
}>;
|
|
89
92
|
|
|
90
93
|
declare type Assets = {
|
|
91
94
|
/** Absolute path to assets directory */
|
|
92
|
-
directory
|
|
95
|
+
directory?: string;
|
|
96
|
+
/** Name of `env` binding property in the User Worker. */
|
|
93
97
|
binding?: string;
|
|
98
|
+
/** How to handle HTML requests. */
|
|
94
99
|
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
|
|
100
|
+
/** How to handle requests that do not match an asset. */
|
|
95
101
|
not_found_handling?: "single-page-application" | "404-page" | "none";
|
|
102
|
+
/**
|
|
103
|
+
* If true, then respond to requests that match an asset with that asset directly.
|
|
104
|
+
* If false, route every request to the User Worker, whether or not it matches an asset.
|
|
105
|
+
* */
|
|
106
|
+
experimental_serve_directly?: boolean;
|
|
96
107
|
};
|
|
97
108
|
|
|
98
|
-
declare type AssetsOptions =
|
|
109
|
+
declare type AssetsOptions = {
|
|
110
|
+
directory: string;
|
|
111
|
+
binding?: string;
|
|
99
112
|
routingConfig: RoutingConfig;
|
|
100
113
|
assetConfig: AssetConfig;
|
|
101
114
|
};
|
|
@@ -449,8 +462,8 @@ declare type CfCapnp = {
|
|
|
449
462
|
|
|
450
463
|
declare interface CfD1Database {
|
|
451
464
|
binding: string;
|
|
452
|
-
database_id
|
|
453
|
-
database_name
|
|
465
|
+
database_id?: string | typeof INHERIT_SYMBOL;
|
|
466
|
+
database_name?: string;
|
|
454
467
|
preview_database_id?: string;
|
|
455
468
|
database_internal_env?: string;
|
|
456
469
|
migrations_table?: string;
|
|
@@ -488,7 +501,7 @@ declare interface CfHyperdrive {
|
|
|
488
501
|
*/
|
|
489
502
|
declare interface CfKvNamespace {
|
|
490
503
|
binding: string;
|
|
491
|
-
id
|
|
504
|
+
id?: string | typeof INHERIT_SYMBOL;
|
|
492
505
|
}
|
|
493
506
|
|
|
494
507
|
declare interface CfLogfwdrBinding {
|
|
@@ -564,7 +577,7 @@ declare interface CfQueue {
|
|
|
564
577
|
|
|
565
578
|
declare interface CfR2Bucket {
|
|
566
579
|
binding: string;
|
|
567
|
-
bucket_name
|
|
580
|
+
bucket_name?: string | typeof INHERIT_SYMBOL;
|
|
568
581
|
jurisdiction?: string;
|
|
569
582
|
}
|
|
570
583
|
|
|
@@ -759,29 +772,6 @@ declare type CloudchamberConfig = {
|
|
|
759
772
|
ipv4?: boolean;
|
|
760
773
|
};
|
|
761
774
|
|
|
762
|
-
/**
|
|
763
|
-
* This is the static type definition for the configuration object.
|
|
764
|
-
*
|
|
765
|
-
* It reflects a normalized and validated version of the configuration that you can write in wrangler.toml,
|
|
766
|
-
* and optionally augment with arguments passed directly to wrangler.
|
|
767
|
-
*
|
|
768
|
-
* For more information about the configuration object, see the
|
|
769
|
-
* documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
|
|
770
|
-
*
|
|
771
|
-
* Notes:
|
|
772
|
-
*
|
|
773
|
-
* - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
|
|
774
|
-
* in the top level config and should not appear in any environments.
|
|
775
|
-
* - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
|
|
776
|
-
* - All top level fields in config and environments are optional in the wrangler.toml file.
|
|
777
|
-
*
|
|
778
|
-
* Legend for the annotations:
|
|
779
|
-
*
|
|
780
|
-
* - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
|
|
781
|
-
* - `@todo`: there's more work to be done (with details attached).
|
|
782
|
-
*/
|
|
783
|
-
declare type Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
|
|
784
|
-
|
|
785
775
|
declare class ConfigController extends Controller<ConfigControllerEventMap> {
|
|
786
776
|
#private;
|
|
787
777
|
latestInput?: StartDevWorkerInput;
|
|
@@ -826,7 +816,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
826
816
|
/**
|
|
827
817
|
* The directory containing your static assets.
|
|
828
818
|
*
|
|
829
|
-
* It must be a path relative to your
|
|
819
|
+
* It must be a path relative to your Wrangler configuration file.
|
|
830
820
|
* Example: bucket = "./public"
|
|
831
821
|
*
|
|
832
822
|
* If there is a `site` field then it must contain this `bucket` field.
|
|
@@ -904,7 +894,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
904
894
|
[key: string]: string;
|
|
905
895
|
} | undefined;
|
|
906
896
|
/**
|
|
907
|
-
* By default,
|
|
897
|
+
* By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
|
|
908
898
|
*
|
|
909
899
|
* If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
|
|
910
900
|
*
|
|
@@ -932,6 +922,32 @@ url: string | URL_2 | UrlObject,
|
|
|
932
922
|
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
|
|
933
923
|
): Promise<Dispatcher.ConnectData>;
|
|
934
924
|
|
|
925
|
+
/**
|
|
926
|
+
* Configuration for a container application
|
|
927
|
+
*/
|
|
928
|
+
declare type ContainerApp = {
|
|
929
|
+
name: string;
|
|
930
|
+
instances: number;
|
|
931
|
+
scheduling_policy?: "regional" | "moon";
|
|
932
|
+
configuration: {
|
|
933
|
+
image: string;
|
|
934
|
+
labels?: {
|
|
935
|
+
name: string;
|
|
936
|
+
value: string;
|
|
937
|
+
}[];
|
|
938
|
+
secrets?: {
|
|
939
|
+
name: string;
|
|
940
|
+
type: "env";
|
|
941
|
+
secret: string;
|
|
942
|
+
}[];
|
|
943
|
+
};
|
|
944
|
+
constraints?: {
|
|
945
|
+
regions?: string[];
|
|
946
|
+
cities?: string[];
|
|
947
|
+
tier?: number;
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
|
|
935
951
|
declare abstract class Controller<EventMap extends ControllerEventMap = ControllerEventMap> extends TypedEventEmitterImpl<EventMap> {
|
|
936
952
|
emitErrorEvent(data: ErrorEvent): void;
|
|
937
953
|
}
|
|
@@ -1006,14 +1022,14 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
1006
1022
|
type: string;
|
|
1007
1023
|
};
|
|
1008
1024
|
latest_stage: {
|
|
1025
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
1009
1026
|
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
1010
|
-
status: "active" | "idle" | "success" | "canceled" | "failure" | "skipped";
|
|
1011
1027
|
started_on: string | null;
|
|
1012
1028
|
ended_on: string | null;
|
|
1013
1029
|
};
|
|
1014
1030
|
stages: {
|
|
1031
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
1015
1032
|
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
1016
|
-
status: "active" | "idle" | "success" | "canceled" | "failure" | "skipped";
|
|
1017
1033
|
started_on: string | null;
|
|
1018
1034
|
ended_on: string | null;
|
|
1019
1035
|
}[];
|
|
@@ -1021,8 +1037,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
1021
1037
|
modified_on: string;
|
|
1022
1038
|
short_id: string;
|
|
1023
1039
|
build_image_major_version: number;
|
|
1040
|
+
kv_namespaces?: any;
|
|
1024
1041
|
source?: {
|
|
1025
|
-
type: "github" | "gitlab";
|
|
1026
1042
|
config: {
|
|
1027
1043
|
owner: string;
|
|
1028
1044
|
repo_name: string;
|
|
@@ -1034,8 +1050,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
1034
1050
|
preview_branch_includes?: string[] | undefined;
|
|
1035
1051
|
preview_branch_excludes?: string[] | undefined;
|
|
1036
1052
|
};
|
|
1053
|
+
type: "github" | "gitlab";
|
|
1037
1054
|
} | undefined;
|
|
1038
|
-
kv_namespaces?: any;
|
|
1039
1055
|
env_vars?: any;
|
|
1040
1056
|
durable_object_namespaces?: any;
|
|
1041
1057
|
is_skipped?: boolean | undefined;
|
|
@@ -1044,6 +1060,30 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
1044
1060
|
} | undefined;
|
|
1045
1061
|
}>;
|
|
1046
1062
|
|
|
1063
|
+
declare interface DeprecatedConfigFields {
|
|
1064
|
+
/**
|
|
1065
|
+
* The project "type". A holdover from Wrangler v1.x.
|
|
1066
|
+
* Valid values were "webpack", "javascript", and "rust".
|
|
1067
|
+
*
|
|
1068
|
+
* @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.
|
|
1069
|
+
* @breaking
|
|
1070
|
+
*/
|
|
1071
|
+
type?: "webpack" | "javascript" | "rust";
|
|
1072
|
+
/**
|
|
1073
|
+
* Path to the webpack config to use when building your worker.
|
|
1074
|
+
* A holdover from Wrangler v1.x, used with `type: "webpack"`.
|
|
1075
|
+
*
|
|
1076
|
+
* @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.
|
|
1077
|
+
* @breaking
|
|
1078
|
+
*/
|
|
1079
|
+
webpack_config?: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* Configuration only used by a standalone use of the miniflare binary.
|
|
1082
|
+
* @deprecated
|
|
1083
|
+
*/
|
|
1084
|
+
miniflare?: unknown;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1047
1087
|
/**
|
|
1048
1088
|
* Deprecated upload configuration.
|
|
1049
1089
|
*/
|
|
@@ -1056,9 +1096,9 @@ declare interface DeprecatedUpload {
|
|
|
1056
1096
|
format?: "modules" | "service-worker";
|
|
1057
1097
|
/**
|
|
1058
1098
|
* The directory you wish to upload your Worker from,
|
|
1059
|
-
* relative to the
|
|
1099
|
+
* relative to the Wrangler configuration file.
|
|
1060
1100
|
*
|
|
1061
|
-
* Defaults to the directory containing the
|
|
1101
|
+
* Defaults to the directory containing the Wrangler configuration file.
|
|
1062
1102
|
*
|
|
1063
1103
|
* @deprecated
|
|
1064
1104
|
*/
|
|
@@ -1468,8 +1508,8 @@ declare interface EnablePagesAssetsServiceBindingOptions {
|
|
|
1468
1508
|
declare type Entry = {
|
|
1469
1509
|
/** A worker's entrypoint */
|
|
1470
1510
|
file: string;
|
|
1471
|
-
/** A worker's directory. Usually where the
|
|
1472
|
-
|
|
1511
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
1512
|
+
projectRoot: string;
|
|
1473
1513
|
/** Is this a module worker or a service worker? */
|
|
1474
1514
|
format: CfScriptFormat;
|
|
1475
1515
|
/** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
|
|
@@ -1491,6 +1531,39 @@ declare type Entry = {
|
|
|
1491
1531
|
declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
|
|
1492
1532
|
}
|
|
1493
1533
|
|
|
1534
|
+
/**
|
|
1535
|
+
* The environment configuration properties that have been deprecated.
|
|
1536
|
+
*/
|
|
1537
|
+
declare interface EnvironmentDeprecated {
|
|
1538
|
+
/**
|
|
1539
|
+
* The zone ID of the zone you want to deploy to. You can find this
|
|
1540
|
+
* in your domain page on the dashboard.
|
|
1541
|
+
*
|
|
1542
|
+
* @deprecated This is unnecessary since we can deduce this from routes directly.
|
|
1543
|
+
*/
|
|
1544
|
+
zone_id?: string;
|
|
1545
|
+
/**
|
|
1546
|
+
* Legacy way of defining KVNamespaces that is no longer supported.
|
|
1547
|
+
*
|
|
1548
|
+
* @deprecated DO NOT USE. This was a legacy bug from Wrangler v1, that we do not want to support.
|
|
1549
|
+
*/
|
|
1550
|
+
"kv-namespaces"?: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* A list of services that your Worker should be bound to.
|
|
1553
|
+
*
|
|
1554
|
+
* @default `[]`
|
|
1555
|
+
* @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.
|
|
1556
|
+
*/
|
|
1557
|
+
experimental_services?: {
|
|
1558
|
+
/** The binding name used to refer to the Service */
|
|
1559
|
+
name: string;
|
|
1560
|
+
/** The name of the Service being bound */
|
|
1561
|
+
service: string;
|
|
1562
|
+
/** The Service's environment */
|
|
1563
|
+
environment: string;
|
|
1564
|
+
}[];
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1494
1567
|
/**
|
|
1495
1568
|
* The `EnvironmentInheritable` interface declares all the configuration fields for an environment
|
|
1496
1569
|
* that can be inherited (and overridden) from the top-level environment.
|
|
@@ -1572,6 +1645,14 @@ declare interface EnvironmentInheritable {
|
|
|
1572
1645
|
* @inheritable
|
|
1573
1646
|
*/
|
|
1574
1647
|
workers_dev: boolean | undefined;
|
|
1648
|
+
/**
|
|
1649
|
+
* Whether we use <version>-<name>.<subdomain>.workers.dev to
|
|
1650
|
+
* serve Preview URLs for your Worker.
|
|
1651
|
+
*
|
|
1652
|
+
* @default `true`
|
|
1653
|
+
* @inheritable
|
|
1654
|
+
*/
|
|
1655
|
+
preview_urls: boolean | undefined;
|
|
1575
1656
|
/**
|
|
1576
1657
|
* A list of routes that your Worker should be published to.
|
|
1577
1658
|
* Only one of `routes` or `route` is required.
|
|
@@ -1769,6 +1850,24 @@ declare interface EnvironmentInheritable {
|
|
|
1769
1850
|
observability: Observability | undefined;
|
|
1770
1851
|
}
|
|
1771
1852
|
|
|
1853
|
+
declare interface EnvironmentMap {
|
|
1854
|
+
/**
|
|
1855
|
+
* The `env` section defines overrides for the configuration for different environments.
|
|
1856
|
+
*
|
|
1857
|
+
* All environment fields can be specified at the top level of the config indicating the default environment settings.
|
|
1858
|
+
*
|
|
1859
|
+
* - Some fields are inherited and overridable in each environment.
|
|
1860
|
+
* - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
|
|
1861
|
+
*
|
|
1862
|
+
* For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
|
|
1863
|
+
*
|
|
1864
|
+
* @default {}
|
|
1865
|
+
*/
|
|
1866
|
+
env?: {
|
|
1867
|
+
[envName: string]: Unstable_RawEnvironment;
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1772
1871
|
/**
|
|
1773
1872
|
* The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
|
|
1774
1873
|
* that cannot be inherited from the top-level environment, and must be defined specifically.
|
|
@@ -1832,6 +1931,21 @@ declare interface EnvironmentNonInheritable {
|
|
|
1832
1931
|
* @nonInheritable
|
|
1833
1932
|
*/
|
|
1834
1933
|
cloudchamber: CloudchamberConfig;
|
|
1934
|
+
/**
|
|
1935
|
+
* Container related configuration
|
|
1936
|
+
*/
|
|
1937
|
+
containers: {
|
|
1938
|
+
/**
|
|
1939
|
+
* Container app configuration
|
|
1940
|
+
*
|
|
1941
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1942
|
+
* and so must be specified in every named environment.
|
|
1943
|
+
*
|
|
1944
|
+
* @default `{}`
|
|
1945
|
+
* @nonInheritable
|
|
1946
|
+
*/
|
|
1947
|
+
app: ContainerApp[];
|
|
1948
|
+
};
|
|
1835
1949
|
/**
|
|
1836
1950
|
* These specify any Workers KV Namespaces you want to
|
|
1837
1951
|
* access from inside your Worker.
|
|
@@ -1849,7 +1963,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1849
1963
|
/** The binding name used to refer to the KV Namespace */
|
|
1850
1964
|
binding: string;
|
|
1851
1965
|
/** The ID of the KV namespace */
|
|
1852
|
-
id
|
|
1966
|
+
id?: string;
|
|
1853
1967
|
/** The ID of the KV namespace used during `wrangler dev` */
|
|
1854
1968
|
preview_id?: string;
|
|
1855
1969
|
}[];
|
|
@@ -1924,7 +2038,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1924
2038
|
/** The binding name used to refer to the R2 bucket in the Worker. */
|
|
1925
2039
|
binding: string;
|
|
1926
2040
|
/** The name of this R2 bucket at the edge. */
|
|
1927
|
-
bucket_name
|
|
2041
|
+
bucket_name?: string;
|
|
1928
2042
|
/** The preview name of this R2 bucket at the edge. */
|
|
1929
2043
|
preview_bucket_name?: string;
|
|
1930
2044
|
/** The jurisdiction that the bucket exists in. Default if not present. */
|
|
@@ -1943,9 +2057,9 @@ declare interface EnvironmentNonInheritable {
|
|
|
1943
2057
|
/** The binding name used to refer to the D1 database in the Worker. */
|
|
1944
2058
|
binding: string;
|
|
1945
2059
|
/** The name of this D1 database. */
|
|
1946
|
-
database_name
|
|
2060
|
+
database_name?: string;
|
|
1947
2061
|
/** The UUID of this D1 database (not required). */
|
|
1948
|
-
database_id
|
|
2062
|
+
database_id?: string;
|
|
1949
2063
|
/** The UUID of this D1 database for Wrangler Dev (if specified). */
|
|
1950
2064
|
preview_database_id?: string;
|
|
1951
2065
|
/** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
|
|
@@ -2151,7 +2265,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
2151
2265
|
}[];
|
|
2152
2266
|
}
|
|
2153
2267
|
|
|
2154
|
-
declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
|
|
2268
|
+
declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
|
|
2155
2269
|
config?: StartDevWorkerOptions;
|
|
2156
2270
|
bundle?: Bundle;
|
|
2157
2271
|
}> | BaseErrorEvent<"BundlerController", {
|
|
@@ -2540,7 +2654,7 @@ declare class FormData_2 {
|
|
|
2540
2654
|
declare type FormDataEntryValue = string | File
|
|
2541
2655
|
|
|
2542
2656
|
/**
|
|
2543
|
-
* By reading from a
|
|
2657
|
+
* By reading from a Wrangler configuration file this function generates proxy binding objects that can be
|
|
2544
2658
|
* used to simulate the interaction with bindings during local development in a Node.js environment
|
|
2545
2659
|
*
|
|
2546
2660
|
* @deprecated use `getPlatformProxy` instead
|
|
@@ -2560,7 +2674,7 @@ declare function getGlobalDispatcher(): Dispatcher;
|
|
|
2560
2674
|
declare function getGlobalOrigin(): URL | undefined;
|
|
2561
2675
|
|
|
2562
2676
|
/**
|
|
2563
|
-
* By reading from a
|
|
2677
|
+
* By reading from a Wrangler configuration file this function generates proxy objects that can be
|
|
2564
2678
|
* used to simulate the interaction with the Cloudflare platform during local development
|
|
2565
2679
|
* in a Node.js environment
|
|
2566
2680
|
*
|
|
@@ -2580,19 +2694,12 @@ export declare type GetPlatformProxyOptions = {
|
|
|
2580
2694
|
/**
|
|
2581
2695
|
* The path to the config file to use.
|
|
2582
2696
|
* If no path is specified the default behavior is to search from the
|
|
2583
|
-
* current directory up the filesystem for a
|
|
2697
|
+
* current directory up the filesystem for a Wrangler configuration file to use.
|
|
2584
2698
|
*
|
|
2585
2699
|
* Note: this field is optional but if a path is specified it must
|
|
2586
2700
|
* point to a valid file on the filesystem
|
|
2587
2701
|
*/
|
|
2588
2702
|
configPath?: string;
|
|
2589
|
-
/**
|
|
2590
|
-
* Flag to indicate the utility to read a json config file (`wrangler.json`/`wrangler.jsonc`)
|
|
2591
|
-
* instead of the toml one (`wrangler.toml`)
|
|
2592
|
-
*
|
|
2593
|
-
* Note: this feature is experimental
|
|
2594
|
-
*/
|
|
2595
|
-
experimentalJsonConfig?: boolean;
|
|
2596
2703
|
/**
|
|
2597
2704
|
* Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
|
|
2598
2705
|
* used by wrangler v3: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
|
|
@@ -2648,6 +2755,11 @@ declare type HttpTerminator = {
|
|
|
2648
2755
|
*/
|
|
2649
2756
|
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
2650
2757
|
|
|
2758
|
+
/**
|
|
2759
|
+
* A symbol to inherit a binding from the deployed worker.
|
|
2760
|
+
*/
|
|
2761
|
+
declare const INHERIT_SYMBOL: unique symbol;
|
|
2762
|
+
|
|
2651
2763
|
declare type InspectorProxyWorkerIncomingWebSocketMessage = {
|
|
2652
2764
|
type: ReloadStartEvent["type"];
|
|
2653
2765
|
} | {
|
|
@@ -2928,29 +3040,35 @@ declare interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
|
2928
3040
|
|
|
2929
3041
|
declare type NameOmit<T> = Omit<T, "name">;
|
|
2930
3042
|
|
|
3043
|
+
declare type NormalizeAndValidateConfigArgs = {
|
|
3044
|
+
name?: string;
|
|
3045
|
+
env?: string;
|
|
3046
|
+
"legacy-env"?: boolean;
|
|
3047
|
+
"dispatch-namespace"?: string;
|
|
3048
|
+
remote?: boolean;
|
|
3049
|
+
localProtocol?: string;
|
|
3050
|
+
upstreamProtocol?: string;
|
|
3051
|
+
};
|
|
3052
|
+
|
|
2931
3053
|
declare interface Observability {
|
|
2932
3054
|
/** If observability is enabled for this Worker */
|
|
2933
|
-
enabled
|
|
3055
|
+
enabled?: boolean;
|
|
2934
3056
|
/** The sampling rate */
|
|
2935
3057
|
head_sampling_rate?: number;
|
|
3058
|
+
logs?: {
|
|
3059
|
+
enabled?: boolean;
|
|
3060
|
+
/** The sampling rate */
|
|
3061
|
+
head_sampling_rate?: number;
|
|
3062
|
+
/** Set to false to disable invocation logs */
|
|
3063
|
+
invocation_logs?: boolean;
|
|
3064
|
+
};
|
|
2936
3065
|
}
|
|
2937
3066
|
|
|
2938
3067
|
declare interface PagesConfigFields {
|
|
2939
3068
|
/**
|
|
2940
3069
|
* The directory of static assets to serve.
|
|
2941
3070
|
*
|
|
2942
|
-
* The presence of this field in
|
|
2943
|
-
* and will prompt the handling of the configuration file according to the
|
|
2944
|
-
* Pages-specific validation rules.
|
|
2945
|
-
*/
|
|
2946
|
-
pages_build_output_dir?: string;
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
declare interface PagesConfigFields {
|
|
2950
|
-
/**
|
|
2951
|
-
* The directory of static assets to serve.
|
|
2952
|
-
*
|
|
2953
|
-
* The presence of this field in `wrangler.toml` indicates a Pages project,
|
|
3071
|
+
* The presence of this field in a Wrangler configuration file indicates a Pages project,
|
|
2954
3072
|
* and will prompt the handling of the configuration file according to the
|
|
2955
3073
|
* Pages-specific validation rules.
|
|
2956
3074
|
*/
|
|
@@ -25569,10 +25687,15 @@ declare type ProxyWorkerOutgoingRequestBody = {
|
|
|
25569
25687
|
args: Parameters<typeof console.debug>;
|
|
25570
25688
|
};
|
|
25571
25689
|
|
|
25572
|
-
declare type QueueConsumer = NonNullable<
|
|
25690
|
+
declare type QueueConsumer = NonNullable<Unstable_Config["queues"]["consumers"]>[number];
|
|
25573
25691
|
|
|
25574
25692
|
declare type RawDevConfig = Partial<DevConfig>;
|
|
25575
25693
|
|
|
25694
|
+
declare type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
|
|
25695
|
+
config?: string;
|
|
25696
|
+
script?: string;
|
|
25697
|
+
};
|
|
25698
|
+
|
|
25576
25699
|
declare type ReadyEvent = {
|
|
25577
25700
|
type: "ready";
|
|
25578
25701
|
proxyWorker: Miniflare;
|
|
@@ -25863,10 +25986,13 @@ declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
|
|
|
25863
25986
|
|
|
25864
25987
|
declare const RoutingConfigSchema: z.ZodObject<{
|
|
25865
25988
|
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
25989
|
+
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
|
|
25866
25990
|
}, "strip", z.ZodTypeAny, {
|
|
25867
25991
|
has_user_worker?: boolean;
|
|
25992
|
+
invoke_user_worker_ahead_of_assets?: boolean;
|
|
25868
25993
|
}, {
|
|
25869
25994
|
has_user_worker?: boolean;
|
|
25995
|
+
invoke_user_worker_ahead_of_assets?: boolean;
|
|
25870
25996
|
}>;
|
|
25871
25997
|
|
|
25872
25998
|
/**
|
|
@@ -25945,7 +26071,7 @@ declare interface StartDevWorkerInput {
|
|
|
25945
26071
|
name?: string;
|
|
25946
26072
|
/**
|
|
25947
26073
|
* The javascript or typescript entry-point of the worker.
|
|
25948
|
-
* This is the `main` property of a
|
|
26074
|
+
* This is the `main` property of a Wrangler configuration file.
|
|
25949
26075
|
* You can specify a file path or provide the contents directly.
|
|
25950
26076
|
*/
|
|
25951
26077
|
entrypoint?: string;
|
|
@@ -25995,7 +26121,7 @@ declare interface StartDevWorkerInput {
|
|
|
25995
26121
|
jsxFactory?: string;
|
|
25996
26122
|
jsxFragment?: string;
|
|
25997
26123
|
tsconfig?: string;
|
|
25998
|
-
nodejsCompatMode?: Hook<NodeJSCompatMode, [
|
|
26124
|
+
nodejsCompatMode?: Hook<NodeJSCompatMode, [Unstable_Config]>;
|
|
25999
26125
|
moduleRoot?: string;
|
|
26000
26126
|
};
|
|
26001
26127
|
/** Options applying to the worker's development preview environment. */
|
|
@@ -26009,7 +26135,7 @@ declare interface StartDevWorkerInput {
|
|
|
26009
26135
|
/** Whether the worker runs on the edge or locally. */
|
|
26010
26136
|
remote?: boolean;
|
|
26011
26137
|
/** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
|
|
26012
|
-
auth?: AsyncHook<CfAccount, [Pick<
|
|
26138
|
+
auth?: AsyncHook<CfAccount, [Pick<Unstable_Config, "account_id">]>;
|
|
26013
26139
|
/** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */
|
|
26014
26140
|
persist?: string;
|
|
26015
26141
|
/** Controls which logs are logged 🤙. */
|
|
@@ -26036,14 +26162,16 @@ declare interface StartDevWorkerInput {
|
|
|
26036
26162
|
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
26037
26163
|
mockFetch?: undici.MockAgent;
|
|
26038
26164
|
/** Describes the registry of other Workers running locally */
|
|
26039
|
-
registry?: WorkerRegistry;
|
|
26165
|
+
registry?: WorkerRegistry | null;
|
|
26040
26166
|
testScheduled?: boolean;
|
|
26041
26167
|
/** Whether to use Vectorize mixed mode -- the worker is run locally but accesses to Vectorize are made remotely */
|
|
26042
26168
|
bindVectorizeToProd?: boolean;
|
|
26169
|
+
/** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
|
|
26170
|
+
multiworkerPrimary?: boolean;
|
|
26043
26171
|
};
|
|
26044
26172
|
legacy?: {
|
|
26045
|
-
site?: Hook<
|
|
26046
|
-
legacyAssets?: Hook<
|
|
26173
|
+
site?: Hook<Unstable_Config["site"], [Unstable_Config]>;
|
|
26174
|
+
legacyAssets?: Hook<Unstable_Config["legacy_assets"], [Unstable_Config]>;
|
|
26047
26175
|
enableServiceEnvironments?: boolean;
|
|
26048
26176
|
};
|
|
26049
26177
|
unsafe?: Omit<CfUnsafe, "bindings">;
|
|
@@ -26051,8 +26179,8 @@ declare interface StartDevWorkerInput {
|
|
|
26051
26179
|
}
|
|
26052
26180
|
|
|
26053
26181
|
declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
26054
|
-
/** A worker's directory. Usually where the
|
|
26055
|
-
|
|
26182
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
26183
|
+
projectRoot: string;
|
|
26056
26184
|
build: StartDevWorkerInput["build"] & {
|
|
26057
26185
|
nodejsCompatMode: NodeJSCompatMode;
|
|
26058
26186
|
format: CfScriptFormat;
|
|
@@ -26064,8 +26192,8 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
|
26064
26192
|
processEntrypoint: boolean;
|
|
26065
26193
|
};
|
|
26066
26194
|
legacy: StartDevWorkerInput["legacy"] & {
|
|
26067
|
-
legacyAssets?:
|
|
26068
|
-
site?:
|
|
26195
|
+
legacyAssets?: Unstable_Config["legacy_assets"];
|
|
26196
|
+
site?: Unstable_Config["site"];
|
|
26069
26197
|
};
|
|
26070
26198
|
dev: StartDevWorkerInput["dev"] & {
|
|
26071
26199
|
persist: string;
|
|
@@ -26073,6 +26201,7 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
|
26073
26201
|
};
|
|
26074
26202
|
entrypoint: string;
|
|
26075
26203
|
assets?: AssetsOptions;
|
|
26204
|
+
name: string;
|
|
26076
26205
|
};
|
|
26077
26206
|
|
|
26078
26207
|
/** A faster version of `request`. */
|
|
@@ -26244,10 +26373,39 @@ declare namespace undici {
|
|
|
26244
26373
|
}
|
|
26245
26374
|
}
|
|
26246
26375
|
|
|
26376
|
+
export declare interface Unstable_ASSETSBindingsOptions {
|
|
26377
|
+
log: Logger;
|
|
26378
|
+
proxyPort?: number;
|
|
26379
|
+
directory?: string;
|
|
26380
|
+
}
|
|
26381
|
+
|
|
26382
|
+
/**
|
|
26383
|
+
* This is the static type definition for the configuration object.
|
|
26384
|
+
*
|
|
26385
|
+
* It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
|
|
26386
|
+
* and optionally augment with arguments passed directly to wrangler.
|
|
26387
|
+
*
|
|
26388
|
+
* For more information about the configuration object, see the
|
|
26389
|
+
* documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
|
|
26390
|
+
*
|
|
26391
|
+
* Notes:
|
|
26392
|
+
*
|
|
26393
|
+
* - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
|
|
26394
|
+
* in the top level config and should not appear in any environments.
|
|
26395
|
+
* - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
|
|
26396
|
+
* - All top level fields in config and environments are optional in the Wrangler configuration file.
|
|
26397
|
+
*
|
|
26398
|
+
* Legend for the annotations:
|
|
26399
|
+
*
|
|
26400
|
+
* - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
|
|
26401
|
+
* - `@todo`: there's more work to be done (with details attached).
|
|
26402
|
+
*/
|
|
26403
|
+
export declare type Unstable_Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
|
|
26404
|
+
|
|
26247
26405
|
/**
|
|
26248
26406
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
26249
26407
|
*/
|
|
26250
|
-
export declare function unstable_dev(script: string, options?:
|
|
26408
|
+
export declare function unstable_dev(script: string, options?: Unstable_DevOptions, apiOptions?: unknown): Promise<Unstable_DevWorker>;
|
|
26251
26409
|
|
|
26252
26410
|
export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
26253
26411
|
config: ConfigController;
|
|
@@ -26265,37 +26423,7 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
|
26265
26423
|
emitErrorEvent(ev: ErrorEvent): void;
|
|
26266
26424
|
}
|
|
26267
26425
|
|
|
26268
|
-
export declare
|
|
26269
|
-
|
|
26270
|
-
export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): {
|
|
26271
|
-
workerOptions: SourcelessWorkerOptions;
|
|
26272
|
-
define: Record<string, string>;
|
|
26273
|
-
main?: string;
|
|
26274
|
-
};
|
|
26275
|
-
|
|
26276
|
-
export declare const unstable_pages: {
|
|
26277
|
-
deploy: typeof deploy;
|
|
26278
|
-
};
|
|
26279
|
-
|
|
26280
|
-
/**
|
|
26281
|
-
* Split an SQLQuery into an array of statements
|
|
26282
|
-
*/
|
|
26283
|
-
export declare function unstable_splitSqlQuery(sql: string): string[];
|
|
26284
|
-
|
|
26285
|
-
export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
26286
|
-
|
|
26287
|
-
export declare const unstable_startWorkerRegistryServer: (port: number) => Promise<{
|
|
26288
|
-
server: Server<IncomingMessage, ServerResponse>;
|
|
26289
|
-
terminator: HttpTerminator;
|
|
26290
|
-
}>;
|
|
26291
|
-
|
|
26292
|
-
export declare interface UnstableASSETSBindingsOptions {
|
|
26293
|
-
log: Logger;
|
|
26294
|
-
proxyPort?: number;
|
|
26295
|
-
directory?: string;
|
|
26296
|
-
}
|
|
26297
|
-
|
|
26298
|
-
export declare interface UnstableDevOptions {
|
|
26426
|
+
export declare interface Unstable_DevOptions {
|
|
26299
26427
|
config?: string;
|
|
26300
26428
|
env?: string;
|
|
26301
26429
|
ip?: string;
|
|
@@ -26318,7 +26446,7 @@ export declare interface UnstableDevOptions {
|
|
|
26318
26446
|
vars?: Record<string, string | Json>;
|
|
26319
26447
|
kv?: {
|
|
26320
26448
|
binding: string;
|
|
26321
|
-
id
|
|
26449
|
+
id?: string;
|
|
26322
26450
|
preview_id?: string;
|
|
26323
26451
|
}[];
|
|
26324
26452
|
durableObjects?: {
|
|
@@ -26335,7 +26463,7 @@ export declare interface UnstableDevOptions {
|
|
|
26335
26463
|
}[];
|
|
26336
26464
|
r2?: {
|
|
26337
26465
|
binding: string;
|
|
26338
|
-
bucket_name
|
|
26466
|
+
bucket_name?: string;
|
|
26339
26467
|
preview_bucket_name?: string;
|
|
26340
26468
|
}[];
|
|
26341
26469
|
ai?: {
|
|
@@ -26370,7 +26498,7 @@ export declare interface UnstableDevOptions {
|
|
|
26370
26498
|
};
|
|
26371
26499
|
}
|
|
26372
26500
|
|
|
26373
|
-
export declare interface
|
|
26501
|
+
export declare interface Unstable_DevWorker {
|
|
26374
26502
|
port: number;
|
|
26375
26503
|
address: string;
|
|
26376
26504
|
stop: () => Promise<void>;
|
|
@@ -26378,6 +26506,53 @@ export declare interface UnstableDevWorker {
|
|
|
26378
26506
|
waitUntilExit: () => Promise<void>;
|
|
26379
26507
|
}
|
|
26380
26508
|
|
|
26509
|
+
export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
|
|
26510
|
+
|
|
26511
|
+
export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): Unstable_MiniflareWorkerOptions;
|
|
26512
|
+
|
|
26513
|
+
export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config): Unstable_MiniflareWorkerOptions;
|
|
26514
|
+
|
|
26515
|
+
export declare interface Unstable_MiniflareWorkerOptions {
|
|
26516
|
+
workerOptions: SourcelessWorkerOptions;
|
|
26517
|
+
define: Record<string, string>;
|
|
26518
|
+
main?: string;
|
|
26519
|
+
}
|
|
26520
|
+
|
|
26521
|
+
export declare const unstable_pages: {
|
|
26522
|
+
deploy: typeof deploy;
|
|
26523
|
+
};
|
|
26524
|
+
|
|
26525
|
+
export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & Unstable_RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
|
|
26526
|
+
$schema?: string;
|
|
26527
|
+
};
|
|
26528
|
+
|
|
26529
|
+
/**
|
|
26530
|
+
* The raw environment configuration that we read from the config file.
|
|
26531
|
+
*
|
|
26532
|
+
* All the properties are optional, and will be replaced with defaults in the configuration that
|
|
26533
|
+
* is used in the rest of the codebase.
|
|
26534
|
+
*/
|
|
26535
|
+
export declare type Unstable_RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
|
|
26536
|
+
|
|
26537
|
+
/**
|
|
26538
|
+
* Get the Wrangler configuration; read it from the give `configPath` if available.
|
|
26539
|
+
*/
|
|
26540
|
+
export declare function unstable_readConfig(args: ReadConfigCommandArgs, options?: {
|
|
26541
|
+
hideWarnings?: boolean;
|
|
26542
|
+
}): Unstable_Config;
|
|
26543
|
+
|
|
26544
|
+
/**
|
|
26545
|
+
* Split an SQLQuery into an array of statements
|
|
26546
|
+
*/
|
|
26547
|
+
export declare function unstable_splitSqlQuery(sql: string): string[];
|
|
26548
|
+
|
|
26549
|
+
export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
26550
|
+
|
|
26551
|
+
export declare const unstable_startWorkerRegistryServer: (port: number) => Promise<{
|
|
26552
|
+
server: Server<IncomingMessage, ServerResponse>;
|
|
26553
|
+
terminator: HttpTerminator;
|
|
26554
|
+
}>;
|
|
26555
|
+
|
|
26381
26556
|
/** Upgrade to a different protocol. */
|
|
26382
26557
|
declare function upgrade(
|
|
26383
26558
|
url: string | URL_2 | UrlObject,
|