@cloudflare/vite-plugin 1.45.0 → 1.46.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.
- package/README.md +2 -2
- package/dist/{chunk-DDRU76YD-DhDoQvwV.mjs → chunk-Q72B4Q5Z-izl5Qmnx.mjs} +9 -3
- package/dist/chunk-Q72B4Q5Z-izl5Qmnx.mjs.map +1 -0
- package/dist/experimental-config.d.mts +138 -48
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/experimental-config.mjs +22 -4
- package/dist/experimental-config.mjs.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +45453 -25999
- package/dist/index.mjs.map +1 -1
- package/dist/{open-BCHIM4MY-d5tZGA6D.mjs → open-PBXRGS4R-7GUxLVbA.mjs} +16 -16
- package/dist/open-PBXRGS4R-7GUxLVbA.mjs.map +1 -0
- package/dist/{package-CkGeuVVA.mjs → package-Cjez0K_t.mjs} +3 -2
- package/dist/package-Cjez0K_t.mjs.map +1 -0
- package/dist/workers/asset-worker/index.js +3 -2
- package/dist/workers/router-worker/index.js +29 -26
- package/package.json +12 -11
- package/dist/chunk-DDRU76YD-DhDoQvwV.mjs.map +0 -1
- package/dist/open-BCHIM4MY-d5tZGA6D.mjs.map +0 -1
- package/dist/package-CkGeuVVA.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -23,14 +23,14 @@ Full documentation can be found [here](https://developers.cloudflare.com/workers
|
|
|
23
23
|
- Uses the Vite [Environment API](https://vite.dev/guide/api-environment) to integrate Vite with the Workers runtime
|
|
24
24
|
- Provides direct access to [Workers runtime APIs](https://developers.cloudflare.com/workers/runtime-apis/) and [bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/)
|
|
25
25
|
- Builds your front-end assets for deployment to Cloudflare, enabling you to build static sites, SPAs, and full-stack applications
|
|
26
|
-
- Official support for [TanStack Start](https://tanstack.com/start/) and [React Router
|
|
26
|
+
- Official support for [TanStack Start](https://tanstack.com/start/) and [React Router v8](https://reactrouter.com/) with server-side rendering
|
|
27
27
|
- Leverages Vite's hot module replacement for consistently fast updates
|
|
28
28
|
- Supports `vite preview` for previewing your build output in the Workers runtime prior to deployment
|
|
29
29
|
|
|
30
30
|
## Use cases
|
|
31
31
|
|
|
32
32
|
- [TanStack Start](https://tanstack.com/start/)
|
|
33
|
-
- [React Router
|
|
33
|
+
- [React Router v8](https://reactrouter.com/)
|
|
34
34
|
- Support for more full-stack frameworks is coming soon
|
|
35
35
|
- Static sites, such as single-page applications, with or without an integrated backend API
|
|
36
36
|
- Standalone Workers
|
|
@@ -27,7 +27,7 @@ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(
|
|
|
27
27
|
var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region ../workers-utils/dist/chunk-
|
|
30
|
+
//#region ../workers-utils/dist/chunk-Q72B4Q5Z.mjs
|
|
31
31
|
var __create = Object.create;
|
|
32
32
|
var __defProp = Object.defineProperty;
|
|
33
33
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -45,6 +45,12 @@ var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __r
|
|
|
45
45
|
var __commonJS = (cb, mod) => function __require2() {
|
|
46
46
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
47
47
|
};
|
|
48
|
+
var __export = (target, all) => {
|
|
49
|
+
for (var name in all) __defProp(target, name, {
|
|
50
|
+
get: all[name],
|
|
51
|
+
enumerable: true
|
|
52
|
+
});
|
|
53
|
+
};
|
|
48
54
|
var __copyProps = (to, from, except, desc) => {
|
|
49
55
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
50
56
|
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
@@ -60,5 +66,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
60
66
|
}) : target, mod));
|
|
61
67
|
|
|
62
68
|
//#endregion
|
|
63
|
-
export {
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
export { __toESM as a, __toESM$1 as c, __require as i, __export as n, __commonJS$1 as o, __name as r, __require$1 as s, __commonJS as t };
|
|
70
|
+
//# sourceMappingURL=chunk-Q72B4Q5Z-izl5Qmnx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-Q72B4Q5Z-izl5Qmnx.mjs","names":[],"sources":["../../workers-utils/dist/chunk-Q72B4Q5Z.mjs"],"sourcesContent":["var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b]\n}) : x)(function(x) {\n if (typeof require !== \"undefined\") return require.apply(this, arguments);\n throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\nexport { __commonJS, __export, __name, __require, __toESM };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,UAAU,QAAQ,UAAU,UAAU,QAAQ,QAAQ;CAAE;CAAO,cAAc;CAAM,CAAC;AACxF,IAAI,YAA4B,kBAAE,MAAM,uBAAmB,4BAAwB,OAAO,UAAU,cAAc,IAAI,MAAM,GAAG,EAC7H,MAAM,GAAG,OAAO,uBAAmB,4BAAwB,GAAG,IAC/D,CAAC,GAAG,GAAG,SAAS,GAAG;AAClB,KAAI,uBAAmB,YAAa,oBAAe,MAAM,MAAM,UAAU;AACzE,OAAM,MAAM,0BAAyB,IAAI,sBAAqB;EAC9D;AACF,IAAI,cAAc,IAAI,QAAQ,SAAS,aAAa;AAClD,QAAO,QAAQ,GAAG,GAAG,kBAAkB,GAAG,CAAC,MAAM,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,IAAI,EAAE,IAAI;;AAE7F,IAAI,YAAY,QAAQ,QAAQ;AAC9B,MAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;EAAM,CAAC;;AAEjE,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,KAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;OAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,KAAI,CAAC,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,CAAC;;AAExH,QAAO;;AAET,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,IAAI,CAAC,GAAG,EAAE,EAAE,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;CAAM,CAAC,GAAG,QACzG,IACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Pipeline, PipelineRecord } from "cloudflare:pipelines";
|
|
2
2
|
|
|
3
|
-
//#region ../config/dist/public-
|
|
3
|
+
//#region ../config/dist/public-myuV_kLK.d.mts
|
|
4
4
|
|
|
5
5
|
//#region src/utils.d.ts
|
|
6
6
|
/**
|
|
@@ -134,7 +134,7 @@ interface D1Binding extends D1BindingOptions {
|
|
|
134
134
|
}
|
|
135
135
|
interface DispatchNamespaceBindingOptions {
|
|
136
136
|
/** The namespace to bind to. */
|
|
137
|
-
namespace
|
|
137
|
+
namespace?: string;
|
|
138
138
|
/** Details about the outbound Worker which will handle outbound requests from your namespace. */
|
|
139
139
|
outbound?: {
|
|
140
140
|
/** Name of the Worker handling the outbound requests. */
|
|
@@ -182,7 +182,7 @@ interface TypedDurableObjectBinding<TConfig$1, TExportName$1 extends string> ext
|
|
|
182
182
|
}
|
|
183
183
|
interface FlagshipBindingOptions {
|
|
184
184
|
/** The Flagship app ID to bind to. */
|
|
185
|
-
id
|
|
185
|
+
id?: string;
|
|
186
186
|
/** Set to `true` to suppress the remote binding warning in local dev. Flagship bindings are always remote. */
|
|
187
187
|
remote?: boolean;
|
|
188
188
|
}
|
|
@@ -295,7 +295,7 @@ interface TypedPipelineBinding<TRecord extends PipelineRecord = PipelineRecord>
|
|
|
295
295
|
}
|
|
296
296
|
interface QueueBindingOptions {
|
|
297
297
|
/** The name of this Queue. */
|
|
298
|
-
name
|
|
298
|
+
name?: string;
|
|
299
299
|
/** The number of seconds to wait before delivering a message. */
|
|
300
300
|
deliveryDelay?: number;
|
|
301
301
|
/** Whether the Queue producer should be remote or not in local development. */
|
|
@@ -602,7 +602,7 @@ interface Bindings {
|
|
|
602
602
|
*
|
|
603
603
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
|
|
604
604
|
*/
|
|
605
|
-
dispatchNamespace(options
|
|
605
|
+
dispatchNamespace(options?: DispatchNamespaceBindingOptions): DispatchNamespaceBinding;
|
|
606
606
|
/**
|
|
607
607
|
* Binding to a Durable Object class. `workerName` is the name of the Worker
|
|
608
608
|
* that defines the class; `exportName` is the exported class name.
|
|
@@ -611,7 +611,7 @@ interface Bindings {
|
|
|
611
611
|
*/
|
|
612
612
|
durableObject(options: DurableObjectBindingOptions): DurableObjectBinding;
|
|
613
613
|
/** Binding to a Flagship feature-flag service. */
|
|
614
|
-
flagship(options
|
|
614
|
+
flagship(options?: FlagshipBindingOptions): FlagshipBinding;
|
|
615
615
|
/**
|
|
616
616
|
* Binding to a Hyperdrive configuration.
|
|
617
617
|
*
|
|
@@ -652,7 +652,7 @@ interface Bindings {
|
|
|
652
652
|
*
|
|
653
653
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
654
654
|
*/
|
|
655
|
-
queue<TBody = unknown>(options
|
|
655
|
+
queue<TBody = unknown>(options?: QueueBindingOptions): TypedQueueBinding<TBody>;
|
|
656
656
|
/**
|
|
657
657
|
* Binding to an R2 bucket.
|
|
658
658
|
*
|
|
@@ -790,10 +790,27 @@ interface ScheduledTriggerOptions {
|
|
|
790
790
|
interface ScheduledTrigger extends ScheduledTriggerOptions {
|
|
791
791
|
type: "scheduled";
|
|
792
792
|
}
|
|
793
|
+
interface EmailTriggerOptions {
|
|
794
|
+
/**
|
|
795
|
+
* Inbound Email Routing addresses handled by this Worker.
|
|
796
|
+
*
|
|
797
|
+
* Each entry is a literal recipient address (e.g. `"support@example.com"`)
|
|
798
|
+
* or a `*@domain` catch-all (e.g. `"*@example.com"`).
|
|
799
|
+
*/
|
|
800
|
+
addresses: string[];
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Email trigger — invokes this Worker for the configured Email Routing
|
|
804
|
+
* addresses.
|
|
805
|
+
*/
|
|
806
|
+
interface EmailTrigger extends EmailTriggerOptions {
|
|
807
|
+
type: "email";
|
|
808
|
+
}
|
|
793
809
|
/**
|
|
794
|
-
* Event triggers — fetch routes, queue consumers,
|
|
795
|
-
* — that invoke this Worker. Construct entries with
|
|
796
|
-
* `triggers.queue(...)`,
|
|
810
|
+
* Event triggers — fetch routes, queue consumers, cron schedules, and Email
|
|
811
|
+
* Routing addresses — that invoke this Worker. Construct entries with
|
|
812
|
+
* `triggers.fetch(...)`, `triggers.queue(...)`, `triggers.scheduled(...)`, or
|
|
813
|
+
* `triggers.email(...)`.
|
|
797
814
|
*
|
|
798
815
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
|
|
799
816
|
*/
|
|
@@ -817,6 +834,11 @@ interface Triggers {
|
|
|
817
834
|
* More details here https://developers.cloudflare.com/workers/platform/cron-triggers
|
|
818
835
|
*/
|
|
819
836
|
scheduled(options: ScheduledTriggerOptions): ScheduledTrigger;
|
|
837
|
+
/**
|
|
838
|
+
* Email trigger — invokes this Worker for the configured Email Routing
|
|
839
|
+
* addresses.
|
|
840
|
+
*/
|
|
841
|
+
email(options: EmailTriggerOptions): EmailTrigger;
|
|
820
842
|
}
|
|
821
843
|
/**
|
|
822
844
|
* Triggers builder for configuring event triggers.
|
|
@@ -831,6 +853,7 @@ interface Triggers {
|
|
|
831
853
|
* triggers.queue({ name: "my-queue" }),
|
|
832
854
|
* triggers.scheduled({ schedule: "0 * * * *" }),
|
|
833
855
|
* triggers.scheduled({ schedule: "30 0 * * *" }),
|
|
856
|
+
* triggers.email({ addresses: ["support@example.com"] }),
|
|
834
857
|
* ],
|
|
835
858
|
* });
|
|
836
859
|
* ```
|
|
@@ -984,6 +1007,32 @@ interface Exports {
|
|
|
984
1007
|
* ```
|
|
985
1008
|
*/
|
|
986
1009
|
declare const exports: Exports;
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region src/definition.d.ts
|
|
1012
|
+
interface ConfigContext {
|
|
1013
|
+
/**
|
|
1014
|
+
* The mode the config is being evaluated in.
|
|
1015
|
+
* Set via the `--mode` CLI flag.
|
|
1016
|
+
* In Vite the mode defaults to `development` in `vite dev` and `production` in `vite build` ([more info](https://vite.dev/guide/env-and-mode.html#modes)).
|
|
1017
|
+
* In Wrangler the mode defaults to `undefined`.
|
|
1018
|
+
*/
|
|
1019
|
+
mode: string | undefined;
|
|
1020
|
+
}
|
|
1021
|
+
declare const DEFINITION: unique symbol;
|
|
1022
|
+
/**
|
|
1023
|
+
* The authored config in any of its supported shapes: a plain value, a promise,
|
|
1024
|
+
* or a function of {@link ConfigContext}.
|
|
1025
|
+
*/
|
|
1026
|
+
type ConfigInput<T$1> = T$1 | Promise<T$1> | ((ctx: ConfigContext) => T$1 | Promise<T$1>);
|
|
1027
|
+
/**
|
|
1028
|
+
* Resolve any `cloudflare.config.ts` export to its plain config value.
|
|
1029
|
+
*
|
|
1030
|
+
* A `define*` helper stores its authored config plus `type` under the
|
|
1031
|
+
* {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
|
|
1032
|
+
* Every other export — a raw object/promise/function — is unwrapped as-is and
|
|
1033
|
+
* already carries its own `type`. Discrimination happens afterwards via `type`.
|
|
1034
|
+
*/
|
|
1035
|
+
|
|
987
1036
|
//#endregion
|
|
988
1037
|
//#region src/types.d.ts
|
|
989
1038
|
/**
|
|
@@ -993,7 +1042,7 @@ type Binding = AgentMemoryBinding | AiBinding | AiSearchBinding | AiSearchNamesp
|
|
|
993
1042
|
/**
|
|
994
1043
|
* Union of all trigger definitions accepted in `triggers`.
|
|
995
1044
|
*/
|
|
996
|
-
type Trigger = FetchTrigger | QueueConsumerTrigger | ScheduledTrigger;
|
|
1045
|
+
type Trigger = EmailTrigger | FetchTrigger | QueueConsumerTrigger | ScheduledTrigger;
|
|
997
1046
|
/**
|
|
998
1047
|
* Union of all export definitions accepted in `exports`. Worker entries
|
|
999
1048
|
* configure WorkerEntrypoint exports. Durable Object entries configure live
|
|
@@ -1007,19 +1056,18 @@ type Export = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableO
|
|
|
1007
1056
|
* Fields are validated at runtime by `InputWorkerSchema` and normalised before
|
|
1008
1057
|
* being passed to downstream tooling.
|
|
1009
1058
|
*/
|
|
1010
|
-
interface
|
|
1059
|
+
interface WorkerConfig {
|
|
1011
1060
|
/**
|
|
1012
|
-
*
|
|
1061
|
+
* Discriminates this config as a Worker config.
|
|
1062
|
+
*
|
|
1063
|
+
* Injected automatically by `defineWorker`; only needs to be written by
|
|
1064
|
+
* hand when authoring a raw config object without the helper.
|
|
1013
1065
|
*/
|
|
1014
|
-
|
|
1066
|
+
type: "worker";
|
|
1015
1067
|
/**
|
|
1016
|
-
*
|
|
1017
|
-
* You might have more than one account, so make sure to use
|
|
1018
|
-
* the ID of the account associated with the zone/route you
|
|
1019
|
-
* provide, if you provide one. It can also be specified through
|
|
1020
|
-
* the CLOUDFLARE_ACCOUNT_ID environment variable.
|
|
1068
|
+
* The name of your Worker.
|
|
1021
1069
|
*/
|
|
1022
|
-
|
|
1070
|
+
name: string;
|
|
1023
1071
|
/**
|
|
1024
1072
|
* A date in the form yyyy-mm-dd, which will be used to determine
|
|
1025
1073
|
* which version of the Workers runtime is used.
|
|
@@ -1075,9 +1123,10 @@ interface UserConfig {
|
|
|
1075
1123
|
*/
|
|
1076
1124
|
domains?: string[];
|
|
1077
1125
|
/**
|
|
1078
|
-
* Event triggers — fetch routes, queue consumers,
|
|
1126
|
+
* Event triggers — fetch routes, queue consumers, cron schedules, and Email
|
|
1127
|
+
* Routing addresses
|
|
1079
1128
|
* — that invoke this Worker. Construct entries with `triggers.fetch(...)`,
|
|
1080
|
-
* `triggers.queue(...)`, or `triggers.
|
|
1129
|
+
* `triggers.queue(...)`, `triggers.scheduled(...)`, or `triggers.email(...)`.
|
|
1081
1130
|
*
|
|
1082
1131
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
|
|
1083
1132
|
*/
|
|
@@ -1207,13 +1256,6 @@ interface UserConfig {
|
|
|
1207
1256
|
* @default false
|
|
1208
1257
|
*/
|
|
1209
1258
|
previewUrls?: boolean;
|
|
1210
|
-
/**
|
|
1211
|
-
* Specify the compliance region mode of the Worker.
|
|
1212
|
-
*
|
|
1213
|
-
* Although if the user does not specify a compliance region, the default is `public`,
|
|
1214
|
-
* it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
|
|
1215
|
-
*/
|
|
1216
|
-
complianceRegion?: "public" | "fedramp-high";
|
|
1217
1259
|
/**
|
|
1218
1260
|
* Designates this Worker as an internal-only "first-party" Worker.
|
|
1219
1261
|
*
|
|
@@ -1265,29 +1307,51 @@ interface UserConfig {
|
|
|
1265
1307
|
*/
|
|
1266
1308
|
exports?: Record<string, Export>;
|
|
1267
1309
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1310
|
+
/**
|
|
1311
|
+
* Settings shared by the other exports.
|
|
1312
|
+
* Authored as a named `settings` export via
|
|
1313
|
+
* `defineSettings`.
|
|
1314
|
+
*/
|
|
1315
|
+
interface SettingsConfig {
|
|
1271
1316
|
/**
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1317
|
+
* Discriminates this config as a settings config.
|
|
1318
|
+
*
|
|
1319
|
+
* Injected automatically by `defineSettings`; only needs to be written by
|
|
1320
|
+
* hand when authoring a raw config object without the helper.
|
|
1276
1321
|
*/
|
|
1277
|
-
|
|
1322
|
+
type: "settings";
|
|
1323
|
+
/**
|
|
1324
|
+
* This is the ID of the account associated with your zone.
|
|
1325
|
+
* You might have more than one account, so make sure to use
|
|
1326
|
+
* the ID of the account associated with the zone/route you
|
|
1327
|
+
* provide, if you provide one. It can also be specified through
|
|
1328
|
+
* the CLOUDFLARE_ACCOUNT_ID environment variable.
|
|
1329
|
+
*/
|
|
1330
|
+
accountId?: string;
|
|
1331
|
+
/**
|
|
1332
|
+
* Specify the compliance region mode of the Worker.
|
|
1333
|
+
*
|
|
1334
|
+
* Although if the user does not specify a compliance region, the default is `public`,
|
|
1335
|
+
* it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
|
|
1336
|
+
*/
|
|
1337
|
+
complianceRegion?: "public" | "fedramp-high";
|
|
1278
1338
|
}
|
|
1279
|
-
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/worker-definition.d.ts
|
|
1280
1341
|
/**
|
|
1281
|
-
* Base shape of a Worker definition. Carries the
|
|
1282
|
-
* untyped cross-worker binding helpers.
|
|
1342
|
+
* Base shape of a Worker definition. Carries the authored config (under
|
|
1343
|
+
* {@link DEFINITION}) and the untyped cross-worker binding helpers.
|
|
1283
1344
|
*/
|
|
1284
|
-
interface WorkerDefinition<TConfig$1 extends
|
|
1285
|
-
[
|
|
1345
|
+
interface WorkerDefinition<TConfig$1 extends WorkerConfig = WorkerConfig> extends Pick<Bindings, "durableObject" | "worker"> {
|
|
1346
|
+
[DEFINITION]: {
|
|
1347
|
+
config: ConfigInput<Omit<TConfig$1, "type">>;
|
|
1348
|
+
type: "worker";
|
|
1349
|
+
};
|
|
1286
1350
|
}
|
|
1287
1351
|
/**
|
|
1288
1352
|
* Worker definition with typed cross-worker binding helpers.
|
|
1289
1353
|
*/
|
|
1290
|
-
interface TypedWorkerDefinition<TConfig$1 extends
|
|
1354
|
+
interface TypedWorkerDefinition<TConfig$1 extends WorkerConfig, TWorkerName extends string = InferWorkerName<TConfig$1>> extends WorkerDefinition<TConfig$1> {
|
|
1291
1355
|
/**
|
|
1292
1356
|
* Binding to a Durable Object class. `workerName` is the name of the Worker
|
|
1293
1357
|
* that defines the class; `exportName` is the exported class name.
|
|
@@ -1312,9 +1376,18 @@ interface TypedWorkerDefinition<TConfig$1 extends UserConfig, TWorkerName extend
|
|
|
1312
1376
|
remote?: boolean;
|
|
1313
1377
|
}): TypedWorkerBinding<TConfig$1, TExportName$1 extends string ? TExportName$1 : "default">;
|
|
1314
1378
|
}
|
|
1315
|
-
type
|
|
1316
|
-
|
|
1317
|
-
|
|
1379
|
+
type WorkerConfigExport<T$1 extends WorkerConfig = WorkerConfig> = ConfigInput<T$1>;
|
|
1380
|
+
/**
|
|
1381
|
+
* Authored Worker config shape — {@link WorkerConfig} without the `type`
|
|
1382
|
+
* discriminant, which `defineWorker` injects.
|
|
1383
|
+
*/
|
|
1384
|
+
type WorkerConfigInput = Omit<WorkerConfig, "type">;
|
|
1385
|
+
declare function defineWorker<const T$1 extends WorkerConfigInput>(config: (ctx: ConfigContext) => (WorkerConfigInput & T$1) | Promise<WorkerConfigInput & T$1>): TypedWorkerDefinition<T$1 & {
|
|
1386
|
+
type: "worker";
|
|
1387
|
+
}>;
|
|
1388
|
+
declare function defineWorker<const T$1 extends WorkerConfigInput>(config: (WorkerConfigInput & T$1) | Promise<WorkerConfigInput & T$1>): TypedWorkerDefinition<T$1 & {
|
|
1389
|
+
type: "worker";
|
|
1390
|
+
}>;
|
|
1318
1391
|
//#endregion
|
|
1319
1392
|
//#region src/inference.d.ts
|
|
1320
1393
|
/**
|
|
@@ -1452,7 +1525,7 @@ type InferWorkerEntrypointExports<TUnwrappedConfig$1> = Exclude<keyof InferMainM
|
|
|
1452
1525
|
* Unwrap function and promise types to get the underlying config.
|
|
1453
1526
|
* Use this to normalize a config before passing it to other inference utilities.
|
|
1454
1527
|
*/
|
|
1455
|
-
type UnwrapConfig<TConfig$1> = TConfig$1 extends WorkerDefinition<infer TUnwrappedConfig> ? TUnwrappedConfig : TConfig$1 extends
|
|
1528
|
+
type UnwrapConfig<TConfig$1> = TConfig$1 extends WorkerDefinition<infer TUnwrappedConfig> ? TUnwrappedConfig : TConfig$1 extends WorkerConfigExport<infer TUnwrappedConfig> ? TUnwrappedConfig : never;
|
|
1456
1529
|
/**
|
|
1457
1530
|
* Infer the `Env` interface type from a Worker config.
|
|
1458
1531
|
*
|
|
@@ -1522,6 +1595,23 @@ type InferMainModule<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
|
1522
1595
|
entrypoint: infer TModule extends WorkerModule;
|
|
1523
1596
|
} ? TModule : DefaultModule;
|
|
1524
1597
|
//#endregion
|
|
1598
|
+
//#region src/settings-definition.d.ts
|
|
1599
|
+
/**
|
|
1600
|
+
* Authored settings config shape — {@link SettingsConfig} without the `type`
|
|
1601
|
+
* discriminant, which `defineSettings` injects.
|
|
1602
|
+
*/
|
|
1603
|
+
type SettingsConfigInput = Omit<SettingsConfig, "type">;
|
|
1604
|
+
/**
|
|
1605
|
+
* Declare shared settings.
|
|
1606
|
+
* Authored as a named `settings` export.
|
|
1607
|
+
*/
|
|
1608
|
+
declare function defineSettings(config: ConfigInput<SettingsConfigInput>): {
|
|
1609
|
+
[DEFINITION]: {
|
|
1610
|
+
config: ConfigInput<SettingsConfigInput>;
|
|
1611
|
+
type: string;
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1614
|
+
//#endregion
|
|
1525
1615
|
//#endregion
|
|
1526
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding$1 as ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding$1 as MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, StreamBinding$1 as StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig,
|
|
1616
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding$1 as ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding$1 as MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigInput, StreamBinding$1 as StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, defineSettings, defineWorker, exports, triggers };
|
|
1527
1617
|
//# sourceMappingURL=experimental-config.d.mts.map
|