wrangler 0.0.0-c46e02dfd → 0.0.0-c4cf040dc
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 +11 -12
- 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 +293 -113
- package/wrangler-dist/cli.js +102129 -97937
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", {
|
|
@@ -2360,6 +2474,11 @@ declare class ExecutionContext {
|
|
|
2360
2474
|
passThroughOnException(): void;
|
|
2361
2475
|
}
|
|
2362
2476
|
|
|
2477
|
+
export declare const experimental_readRawConfig: (args: ReadConfigCommandArgs) => {
|
|
2478
|
+
rawConfig: Unstable_RawConfig;
|
|
2479
|
+
configPath: string | undefined;
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2363
2482
|
declare function fetch_2 (
|
|
2364
2483
|
input: RequestInfo,
|
|
2365
2484
|
init?: RequestInit_2
|
|
@@ -2540,7 +2659,7 @@ declare class FormData_2 {
|
|
|
2540
2659
|
declare type FormDataEntryValue = string | File
|
|
2541
2660
|
|
|
2542
2661
|
/**
|
|
2543
|
-
* By reading from a
|
|
2662
|
+
* By reading from a Wrangler configuration file this function generates proxy binding objects that can be
|
|
2544
2663
|
* used to simulate the interaction with bindings during local development in a Node.js environment
|
|
2545
2664
|
*
|
|
2546
2665
|
* @deprecated use `getPlatformProxy` instead
|
|
@@ -2560,7 +2679,7 @@ declare function getGlobalDispatcher(): Dispatcher;
|
|
|
2560
2679
|
declare function getGlobalOrigin(): URL | undefined;
|
|
2561
2680
|
|
|
2562
2681
|
/**
|
|
2563
|
-
* By reading from a
|
|
2682
|
+
* By reading from a Wrangler configuration file this function generates proxy objects that can be
|
|
2564
2683
|
* used to simulate the interaction with the Cloudflare platform during local development
|
|
2565
2684
|
* in a Node.js environment
|
|
2566
2685
|
*
|
|
@@ -2580,19 +2699,12 @@ export declare type GetPlatformProxyOptions = {
|
|
|
2580
2699
|
/**
|
|
2581
2700
|
* The path to the config file to use.
|
|
2582
2701
|
* If no path is specified the default behavior is to search from the
|
|
2583
|
-
* current directory up the filesystem for a
|
|
2702
|
+
* current directory up the filesystem for a Wrangler configuration file to use.
|
|
2584
2703
|
*
|
|
2585
2704
|
* Note: this field is optional but if a path is specified it must
|
|
2586
2705
|
* point to a valid file on the filesystem
|
|
2587
2706
|
*/
|
|
2588
2707
|
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
2708
|
/**
|
|
2597
2709
|
* Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
|
|
2598
2710
|
* used by wrangler v3: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
|
|
@@ -2648,6 +2760,11 @@ declare type HttpTerminator = {
|
|
|
2648
2760
|
*/
|
|
2649
2761
|
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
2650
2762
|
|
|
2763
|
+
/**
|
|
2764
|
+
* A symbol to inherit a binding from the deployed worker.
|
|
2765
|
+
*/
|
|
2766
|
+
declare const INHERIT_SYMBOL: unique symbol;
|
|
2767
|
+
|
|
2651
2768
|
declare type InspectorProxyWorkerIncomingWebSocketMessage = {
|
|
2652
2769
|
type: ReloadStartEvent["type"];
|
|
2653
2770
|
} | {
|
|
@@ -2928,29 +3045,35 @@ declare interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
|
2928
3045
|
|
|
2929
3046
|
declare type NameOmit<T> = Omit<T, "name">;
|
|
2930
3047
|
|
|
3048
|
+
declare type NormalizeAndValidateConfigArgs = {
|
|
3049
|
+
name?: string;
|
|
3050
|
+
env?: string;
|
|
3051
|
+
"legacy-env"?: boolean;
|
|
3052
|
+
"dispatch-namespace"?: string;
|
|
3053
|
+
remote?: boolean;
|
|
3054
|
+
localProtocol?: string;
|
|
3055
|
+
upstreamProtocol?: string;
|
|
3056
|
+
};
|
|
3057
|
+
|
|
2931
3058
|
declare interface Observability {
|
|
2932
3059
|
/** If observability is enabled for this Worker */
|
|
2933
|
-
enabled
|
|
3060
|
+
enabled?: boolean;
|
|
2934
3061
|
/** The sampling rate */
|
|
2935
3062
|
head_sampling_rate?: number;
|
|
3063
|
+
logs?: {
|
|
3064
|
+
enabled?: boolean;
|
|
3065
|
+
/** The sampling rate */
|
|
3066
|
+
head_sampling_rate?: number;
|
|
3067
|
+
/** Set to false to disable invocation logs */
|
|
3068
|
+
invocation_logs?: boolean;
|
|
3069
|
+
};
|
|
2936
3070
|
}
|
|
2937
3071
|
|
|
2938
3072
|
declare interface PagesConfigFields {
|
|
2939
3073
|
/**
|
|
2940
3074
|
* The directory of static assets to serve.
|
|
2941
3075
|
*
|
|
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,
|
|
3076
|
+
* The presence of this field in a Wrangler configuration file indicates a Pages project,
|
|
2954
3077
|
* and will prompt the handling of the configuration file according to the
|
|
2955
3078
|
* Pages-specific validation rules.
|
|
2956
3079
|
*/
|
|
@@ -25569,10 +25692,15 @@ declare type ProxyWorkerOutgoingRequestBody = {
|
|
|
25569
25692
|
args: Parameters<typeof console.debug>;
|
|
25570
25693
|
};
|
|
25571
25694
|
|
|
25572
|
-
declare type QueueConsumer = NonNullable<
|
|
25695
|
+
declare type QueueConsumer = NonNullable<Unstable_Config["queues"]["consumers"]>[number];
|
|
25573
25696
|
|
|
25574
25697
|
declare type RawDevConfig = Partial<DevConfig>;
|
|
25575
25698
|
|
|
25699
|
+
declare type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
|
|
25700
|
+
config?: string;
|
|
25701
|
+
script?: string;
|
|
25702
|
+
};
|
|
25703
|
+
|
|
25576
25704
|
declare type ReadyEvent = {
|
|
25577
25705
|
type: "ready";
|
|
25578
25706
|
proxyWorker: Miniflare;
|
|
@@ -25863,10 +25991,13 @@ declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
|
|
|
25863
25991
|
|
|
25864
25992
|
declare const RoutingConfigSchema: z.ZodObject<{
|
|
25865
25993
|
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
25994
|
+
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
|
|
25866
25995
|
}, "strip", z.ZodTypeAny, {
|
|
25867
25996
|
has_user_worker?: boolean;
|
|
25997
|
+
invoke_user_worker_ahead_of_assets?: boolean;
|
|
25868
25998
|
}, {
|
|
25869
25999
|
has_user_worker?: boolean;
|
|
26000
|
+
invoke_user_worker_ahead_of_assets?: boolean;
|
|
25870
26001
|
}>;
|
|
25871
26002
|
|
|
25872
26003
|
/**
|
|
@@ -25945,7 +26076,7 @@ declare interface StartDevWorkerInput {
|
|
|
25945
26076
|
name?: string;
|
|
25946
26077
|
/**
|
|
25947
26078
|
* The javascript or typescript entry-point of the worker.
|
|
25948
|
-
* This is the `main` property of a
|
|
26079
|
+
* This is the `main` property of a Wrangler configuration file.
|
|
25949
26080
|
* You can specify a file path or provide the contents directly.
|
|
25950
26081
|
*/
|
|
25951
26082
|
entrypoint?: string;
|
|
@@ -25995,7 +26126,7 @@ declare interface StartDevWorkerInput {
|
|
|
25995
26126
|
jsxFactory?: string;
|
|
25996
26127
|
jsxFragment?: string;
|
|
25997
26128
|
tsconfig?: string;
|
|
25998
|
-
nodejsCompatMode?: Hook<NodeJSCompatMode, [
|
|
26129
|
+
nodejsCompatMode?: Hook<NodeJSCompatMode, [Unstable_Config]>;
|
|
25999
26130
|
moduleRoot?: string;
|
|
26000
26131
|
};
|
|
26001
26132
|
/** Options applying to the worker's development preview environment. */
|
|
@@ -26009,7 +26140,7 @@ declare interface StartDevWorkerInput {
|
|
|
26009
26140
|
/** Whether the worker runs on the edge or locally. */
|
|
26010
26141
|
remote?: boolean;
|
|
26011
26142
|
/** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
|
|
26012
|
-
auth?: AsyncHook<CfAccount, [Pick<
|
|
26143
|
+
auth?: AsyncHook<CfAccount, [Pick<Unstable_Config, "account_id">]>;
|
|
26013
26144
|
/** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */
|
|
26014
26145
|
persist?: string;
|
|
26015
26146
|
/** Controls which logs are logged 🤙. */
|
|
@@ -26036,14 +26167,16 @@ declare interface StartDevWorkerInput {
|
|
|
26036
26167
|
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
26037
26168
|
mockFetch?: undici.MockAgent;
|
|
26038
26169
|
/** Describes the registry of other Workers running locally */
|
|
26039
|
-
registry?: WorkerRegistry;
|
|
26170
|
+
registry?: WorkerRegistry | null;
|
|
26040
26171
|
testScheduled?: boolean;
|
|
26041
26172
|
/** Whether to use Vectorize mixed mode -- the worker is run locally but accesses to Vectorize are made remotely */
|
|
26042
26173
|
bindVectorizeToProd?: boolean;
|
|
26174
|
+
/** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
|
|
26175
|
+
multiworkerPrimary?: boolean;
|
|
26043
26176
|
};
|
|
26044
26177
|
legacy?: {
|
|
26045
|
-
site?: Hook<
|
|
26046
|
-
legacyAssets?: Hook<
|
|
26178
|
+
site?: Hook<Unstable_Config["site"], [Unstable_Config]>;
|
|
26179
|
+
legacyAssets?: Hook<Unstable_Config["legacy_assets"], [Unstable_Config]>;
|
|
26047
26180
|
enableServiceEnvironments?: boolean;
|
|
26048
26181
|
};
|
|
26049
26182
|
unsafe?: Omit<CfUnsafe, "bindings">;
|
|
@@ -26051,8 +26184,8 @@ declare interface StartDevWorkerInput {
|
|
|
26051
26184
|
}
|
|
26052
26185
|
|
|
26053
26186
|
declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
26054
|
-
/** A worker's directory. Usually where the
|
|
26055
|
-
|
|
26187
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
26188
|
+
projectRoot: string;
|
|
26056
26189
|
build: StartDevWorkerInput["build"] & {
|
|
26057
26190
|
nodejsCompatMode: NodeJSCompatMode;
|
|
26058
26191
|
format: CfScriptFormat;
|
|
@@ -26064,8 +26197,8 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
|
26064
26197
|
processEntrypoint: boolean;
|
|
26065
26198
|
};
|
|
26066
26199
|
legacy: StartDevWorkerInput["legacy"] & {
|
|
26067
|
-
legacyAssets?:
|
|
26068
|
-
site?:
|
|
26200
|
+
legacyAssets?: Unstable_Config["legacy_assets"];
|
|
26201
|
+
site?: Unstable_Config["site"];
|
|
26069
26202
|
};
|
|
26070
26203
|
dev: StartDevWorkerInput["dev"] & {
|
|
26071
26204
|
persist: string;
|
|
@@ -26073,6 +26206,7 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
|
26073
26206
|
};
|
|
26074
26207
|
entrypoint: string;
|
|
26075
26208
|
assets?: AssetsOptions;
|
|
26209
|
+
name: string;
|
|
26076
26210
|
};
|
|
26077
26211
|
|
|
26078
26212
|
/** A faster version of `request`. */
|
|
@@ -26244,10 +26378,39 @@ declare namespace undici {
|
|
|
26244
26378
|
}
|
|
26245
26379
|
}
|
|
26246
26380
|
|
|
26381
|
+
export declare interface Unstable_ASSETSBindingsOptions {
|
|
26382
|
+
log: Logger;
|
|
26383
|
+
proxyPort?: number;
|
|
26384
|
+
directory?: string;
|
|
26385
|
+
}
|
|
26386
|
+
|
|
26387
|
+
/**
|
|
26388
|
+
* This is the static type definition for the configuration object.
|
|
26389
|
+
*
|
|
26390
|
+
* It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
|
|
26391
|
+
* and optionally augment with arguments passed directly to wrangler.
|
|
26392
|
+
*
|
|
26393
|
+
* For more information about the configuration object, see the
|
|
26394
|
+
* documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
|
|
26395
|
+
*
|
|
26396
|
+
* Notes:
|
|
26397
|
+
*
|
|
26398
|
+
* - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
|
|
26399
|
+
* in the top level config and should not appear in any environments.
|
|
26400
|
+
* - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
|
|
26401
|
+
* - All top level fields in config and environments are optional in the Wrangler configuration file.
|
|
26402
|
+
*
|
|
26403
|
+
* Legend for the annotations:
|
|
26404
|
+
*
|
|
26405
|
+
* - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
|
|
26406
|
+
* - `@todo`: there's more work to be done (with details attached).
|
|
26407
|
+
*/
|
|
26408
|
+
export declare type Unstable_Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
|
|
26409
|
+
|
|
26247
26410
|
/**
|
|
26248
26411
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
26249
26412
|
*/
|
|
26250
|
-
export declare function unstable_dev(script: string, options?:
|
|
26413
|
+
export declare function unstable_dev(script: string, options?: Unstable_DevOptions, apiOptions?: unknown): Promise<Unstable_DevWorker>;
|
|
26251
26414
|
|
|
26252
26415
|
export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
26253
26416
|
config: ConfigController;
|
|
@@ -26265,37 +26428,7 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
|
26265
26428
|
emitErrorEvent(ev: ErrorEvent): void;
|
|
26266
26429
|
}
|
|
26267
26430
|
|
|
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 {
|
|
26431
|
+
export declare interface Unstable_DevOptions {
|
|
26299
26432
|
config?: string;
|
|
26300
26433
|
env?: string;
|
|
26301
26434
|
ip?: string;
|
|
@@ -26318,7 +26451,7 @@ export declare interface UnstableDevOptions {
|
|
|
26318
26451
|
vars?: Record<string, string | Json>;
|
|
26319
26452
|
kv?: {
|
|
26320
26453
|
binding: string;
|
|
26321
|
-
id
|
|
26454
|
+
id?: string;
|
|
26322
26455
|
preview_id?: string;
|
|
26323
26456
|
}[];
|
|
26324
26457
|
durableObjects?: {
|
|
@@ -26335,7 +26468,7 @@ export declare interface UnstableDevOptions {
|
|
|
26335
26468
|
}[];
|
|
26336
26469
|
r2?: {
|
|
26337
26470
|
binding: string;
|
|
26338
|
-
bucket_name
|
|
26471
|
+
bucket_name?: string;
|
|
26339
26472
|
preview_bucket_name?: string;
|
|
26340
26473
|
}[];
|
|
26341
26474
|
ai?: {
|
|
@@ -26370,7 +26503,7 @@ export declare interface UnstableDevOptions {
|
|
|
26370
26503
|
};
|
|
26371
26504
|
}
|
|
26372
26505
|
|
|
26373
|
-
export declare interface
|
|
26506
|
+
export declare interface Unstable_DevWorker {
|
|
26374
26507
|
port: number;
|
|
26375
26508
|
address: string;
|
|
26376
26509
|
stop: () => Promise<void>;
|
|
@@ -26378,6 +26511,53 @@ export declare interface UnstableDevWorker {
|
|
|
26378
26511
|
waitUntilExit: () => Promise<void>;
|
|
26379
26512
|
}
|
|
26380
26513
|
|
|
26514
|
+
export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
|
|
26515
|
+
|
|
26516
|
+
export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): Unstable_MiniflareWorkerOptions;
|
|
26517
|
+
|
|
26518
|
+
export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config): Unstable_MiniflareWorkerOptions;
|
|
26519
|
+
|
|
26520
|
+
export declare interface Unstable_MiniflareWorkerOptions {
|
|
26521
|
+
workerOptions: SourcelessWorkerOptions;
|
|
26522
|
+
define: Record<string, string>;
|
|
26523
|
+
main?: string;
|
|
26524
|
+
}
|
|
26525
|
+
|
|
26526
|
+
export declare const unstable_pages: {
|
|
26527
|
+
deploy: typeof deploy;
|
|
26528
|
+
};
|
|
26529
|
+
|
|
26530
|
+
export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & Unstable_RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
|
|
26531
|
+
$schema?: string;
|
|
26532
|
+
};
|
|
26533
|
+
|
|
26534
|
+
/**
|
|
26535
|
+
* The raw environment configuration that we read from the config file.
|
|
26536
|
+
*
|
|
26537
|
+
* All the properties are optional, and will be replaced with defaults in the configuration that
|
|
26538
|
+
* is used in the rest of the codebase.
|
|
26539
|
+
*/
|
|
26540
|
+
export declare type Unstable_RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
|
|
26541
|
+
|
|
26542
|
+
/**
|
|
26543
|
+
* Get the Wrangler configuration; read it from the give `configPath` if available.
|
|
26544
|
+
*/
|
|
26545
|
+
export declare function unstable_readConfig(args: ReadConfigCommandArgs, options?: {
|
|
26546
|
+
hideWarnings?: boolean;
|
|
26547
|
+
}): Unstable_Config;
|
|
26548
|
+
|
|
26549
|
+
/**
|
|
26550
|
+
* Split an SQLQuery into an array of statements
|
|
26551
|
+
*/
|
|
26552
|
+
export declare function unstable_splitSqlQuery(sql: string): string[];
|
|
26553
|
+
|
|
26554
|
+
export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
26555
|
+
|
|
26556
|
+
export declare const unstable_startWorkerRegistryServer: (port: number) => Promise<{
|
|
26557
|
+
server: Server<IncomingMessage, ServerResponse>;
|
|
26558
|
+
terminator: HttpTerminator;
|
|
26559
|
+
}>;
|
|
26560
|
+
|
|
26381
26561
|
/** Upgrade to a different protocol. */
|
|
26382
26562
|
declare function upgrade(
|
|
26383
26563
|
url: string | URL_2 | UrlObject,
|