@cloudflare/vite-plugin 1.42.3 → 1.43.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/dist/experimental-config.d.mts +128 -40
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/experimental-config.mjs +21 -5
- package/dist/experimental-config.mjs.map +1 -1
- package/dist/index.mjs +769 -426
- package/dist/index.mjs.map +1 -1
- package/dist/{package-5od-l3GL.mjs → package-BAfwsu0Q.mjs} +2 -2
- package/dist/{package-5od-l3GL.mjs.map → package-BAfwsu0Q.mjs.map} +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Pipeline, PipelineRecord } from "cloudflare:pipelines";
|
|
2
2
|
|
|
3
|
-
//#region ../config/dist/public-
|
|
3
|
+
//#region ../config/dist/public-cHlOGnI4.d.mts
|
|
4
4
|
|
|
5
5
|
//#region src/utils.d.ts
|
|
6
6
|
/**
|
|
@@ -838,7 +838,16 @@ interface Triggers {
|
|
|
838
838
|
declare const triggers: Triggers;
|
|
839
839
|
//#endregion
|
|
840
840
|
//#region src/exports.d.ts
|
|
841
|
-
|
|
841
|
+
/**
|
|
842
|
+
* Declares a provisioned Durable Object class exported from this Worker.
|
|
843
|
+
*
|
|
844
|
+
* For more information about Durable Objects, see the documentation at
|
|
845
|
+
* https://developers.cloudflare.com/workers/learning/using-durable-objects
|
|
846
|
+
*
|
|
847
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
848
|
+
*/
|
|
849
|
+
interface DurableObjectCreatedExportOptions {
|
|
850
|
+
state?: "created";
|
|
842
851
|
/**
|
|
843
852
|
* Storage backend for the Durable Object.
|
|
844
853
|
*
|
|
@@ -849,30 +858,75 @@ interface DurableObjectExportOptions {
|
|
|
849
858
|
storage: "sqlite" | "legacy-kv";
|
|
850
859
|
}
|
|
851
860
|
/**
|
|
852
|
-
*
|
|
861
|
+
* Retire a provisioned Durable Object namespace whose class has
|
|
862
|
+
* been removed from code.
|
|
853
863
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
864
|
+
* During deploy, the class must not be exported in the uploaded code, and no
|
|
865
|
+
* other Worker may hold a `durableObject` binding to the namespace.
|
|
858
866
|
*/
|
|
859
|
-
interface
|
|
867
|
+
interface DurableObjectDeletedExportOptions {
|
|
868
|
+
state: "deleted";
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Rename a provisioned Durable Object namespace's class. The
|
|
872
|
+
* `renamedTo` value must also appear as a live (`state: "created"`)
|
|
873
|
+
* `durableObject` entry in the same `exports` map.
|
|
874
|
+
*/
|
|
875
|
+
interface DurableObjectRenamedExportOptions {
|
|
876
|
+
state: "renamed";
|
|
877
|
+
/**
|
|
878
|
+
* The destination class name. Must be a valid JavaScript identifier and
|
|
879
|
+
* must appear as a live (`state: "created"`) `durableObject` entry in the
|
|
880
|
+
* same `exports` map.
|
|
881
|
+
*/
|
|
882
|
+
renamedTo: string;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Transfer ownership of a Durable Object namespace to another Worker in the same account.
|
|
886
|
+
* The target Worker must first deploy an `expectingTransfer` entry naming this Worker via `transferFrom`.
|
|
887
|
+
*/
|
|
888
|
+
interface DurableObjectTransferredExportOptions {
|
|
889
|
+
state: "transferred";
|
|
890
|
+
/**
|
|
891
|
+
* The destination Worker. Must reference a Worker in the same account.
|
|
892
|
+
*/
|
|
893
|
+
transferredTo: string;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Prepare to receive cross-Worker Durable Object transfer.
|
|
897
|
+
* Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
|
|
898
|
+
*/
|
|
899
|
+
interface DurableObjectExpectingTransferExportOptions {
|
|
900
|
+
state: "expecting-transfer";
|
|
901
|
+
storage: "sqlite" | "legacy-kv";
|
|
902
|
+
/**
|
|
903
|
+
* The source Worker for the two-phase cross-Worker transfer.
|
|
904
|
+
*/
|
|
905
|
+
transferFrom: string;
|
|
906
|
+
}
|
|
907
|
+
interface DurableObjectCreatedExport extends DurableObjectCreatedExportOptions {
|
|
860
908
|
type: "durable-object";
|
|
861
909
|
}
|
|
862
|
-
interface
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
910
|
+
interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
|
|
911
|
+
type: "durable-object";
|
|
912
|
+
}
|
|
913
|
+
interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
|
|
914
|
+
type: "durable-object";
|
|
915
|
+
}
|
|
916
|
+
interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
|
|
917
|
+
type: "durable-object";
|
|
918
|
+
}
|
|
919
|
+
interface DurableObjectExpectingTransferExport extends DurableObjectExpectingTransferExportOptions {
|
|
920
|
+
type: "durable-object";
|
|
921
|
+
}
|
|
922
|
+
interface WorkerEntrypointExportOptions {
|
|
923
|
+
cache?: {
|
|
924
|
+
/** Whether cache is enabled for this entrypoint. */
|
|
925
|
+
enabled: boolean;
|
|
869
926
|
};
|
|
870
|
-
/** Optional cron schedules for automatically triggering workflow instances. */
|
|
871
|
-
schedules?: string[];
|
|
872
927
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
type: "workflow";
|
|
928
|
+
interface WorkerEntrypointExport extends WorkerEntrypointExportOptions {
|
|
929
|
+
type: "worker";
|
|
876
930
|
}
|
|
877
931
|
/**
|
|
878
932
|
* Configuration for named exports declared by the Worker. Each entry's
|
|
@@ -887,7 +941,26 @@ interface Exports {
|
|
|
887
941
|
*
|
|
888
942
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
889
943
|
*/
|
|
890
|
-
durableObject(options:
|
|
944
|
+
durableObject(options: DurableObjectCreatedExportOptions): DurableObjectCreatedExport;
|
|
945
|
+
/**
|
|
946
|
+
* Retire a provisioned Durable Object namespace whose class has been removed from code.
|
|
947
|
+
*/
|
|
948
|
+
durableObject(options: DurableObjectDeletedExportOptions): DurableObjectDeletedExport;
|
|
949
|
+
/**
|
|
950
|
+
* Rename a provisioned Durable Object namespace's class.
|
|
951
|
+
*/
|
|
952
|
+
durableObject(options: DurableObjectRenamedExportOptions): DurableObjectRenamedExport;
|
|
953
|
+
/**
|
|
954
|
+
* Transfer ownership of a Durable Object namespace to another Worker in the same account.
|
|
955
|
+
*/
|
|
956
|
+
durableObject(options: DurableObjectTransferredExportOptions): DurableObjectTransferredExport;
|
|
957
|
+
/**
|
|
958
|
+
* Prepare to receive cross-Worker Durable Object transfer.
|
|
959
|
+
* The source Worker must follow up with a deployment containing a `transferred` export to commit the transfer.
|
|
960
|
+
*/
|
|
961
|
+
durableObject(options: DurableObjectExpectingTransferExportOptions): DurableObjectExpectingTransferExport;
|
|
962
|
+
/** Declares a WorkerEntrypoint export defined by this Worker. */
|
|
963
|
+
worker(options?: WorkerEntrypointExportOptions): WorkerEntrypointExport;
|
|
891
964
|
}
|
|
892
965
|
/**
|
|
893
966
|
* Exports builder for configuring Worker exports.
|
|
@@ -899,6 +972,10 @@ interface Exports {
|
|
|
899
972
|
* export default defineWorker({
|
|
900
973
|
* exports: {
|
|
901
974
|
* MyDurableObject: exports.durableObject({ storage: "sqlite" }),
|
|
975
|
+
* OldClass: exports.durableObject({ state: "deleted" }),
|
|
976
|
+
* OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
|
|
977
|
+
* Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
|
|
978
|
+
* Incoming: exports.durableObject({ state: "expecting-transfer", storage: "sqlite", transferFrom: "source-worker" }),
|
|
902
979
|
* },
|
|
903
980
|
* });
|
|
904
981
|
* ```
|
|
@@ -915,9 +992,11 @@ type Binding = AgentMemoryBinding | AiBinding | AiSearchBinding | AiSearchNamesp
|
|
|
915
992
|
*/
|
|
916
993
|
type Trigger = FetchTrigger | QueueConsumerTrigger | ScheduledTrigger;
|
|
917
994
|
/**
|
|
918
|
-
* Union of all export definitions accepted in `exports`.
|
|
995
|
+
* Union of all export definitions accepted in `exports`. Worker entries
|
|
996
|
+
* configure WorkerEntrypoint exports. Durable Object entries configure live
|
|
997
|
+
* classes and tombstone lifecycle operations.
|
|
919
998
|
*/
|
|
920
|
-
type Export =
|
|
999
|
+
type Export = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport | WorkerEntrypointExport;
|
|
921
1000
|
/**
|
|
922
1001
|
* Worker configuration. This is the input shape passed to
|
|
923
1002
|
* [`defineWorker`](https://developers.cloudflare.com/workers/wrangler/configuration/).
|
|
@@ -1020,6 +1099,8 @@ interface UserConfig {
|
|
|
1020
1099
|
cache?: {
|
|
1021
1100
|
/** If cache is enabled for this Worker. */
|
|
1022
1101
|
enabled: boolean;
|
|
1102
|
+
/** Whether cached assets may be reused across Worker versions. */
|
|
1103
|
+
crossVersionCache?: boolean;
|
|
1023
1104
|
};
|
|
1024
1105
|
/**
|
|
1025
1106
|
* Specify how the Worker should be located to minimize round-trip time.
|
|
@@ -1170,19 +1251,14 @@ interface UserConfig {
|
|
|
1170
1251
|
/**
|
|
1171
1252
|
* Configuration for named exports declared by the Worker. Each entry's
|
|
1172
1253
|
* key is the exported class name; the value configures the export.
|
|
1173
|
-
* Construct entries with `exports.durableObject(...)` or
|
|
1174
|
-
* `exports.workflow(...)`.
|
|
1175
1254
|
*
|
|
1176
|
-
*
|
|
1255
|
+
* Only one export kind is currently supported:
|
|
1177
1256
|
*
|
|
1178
|
-
* -
|
|
1179
|
-
*
|
|
1180
|
-
* documentation at
|
|
1181
|
-
* https://developers.cloudflare.com/workers/learning/using-durable-objects
|
|
1182
|
-
*
|
|
1183
|
-
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
1184
|
-
*
|
|
1185
|
-
* - `workflow`: declares a Workflow defined by this Worker.
|
|
1257
|
+
* - Construct entries with `exports.durableObject(...)`.
|
|
1258
|
+
* - Declares Durable Object classes exported from this Worker.
|
|
1259
|
+
* For more information about Durable Objects, see the documentation at
|
|
1260
|
+
* https://developers.cloudflare.com/workers/learning/using-durable-objects.
|
|
1261
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects.
|
|
1186
1262
|
*/
|
|
1187
1263
|
exports?: Record<string, Export>;
|
|
1188
1264
|
}
|
|
@@ -1215,7 +1291,7 @@ interface TypedWorkerDefinition<TConfig$1 extends UserConfig, TWorkerName extend
|
|
|
1215
1291
|
*
|
|
1216
1292
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
1217
1293
|
*/
|
|
1218
|
-
durableObject<TExportName$1 extends
|
|
1294
|
+
durableObject<TExportName$1 extends InferDurableNamespaces<TConfig$1>>(options: {
|
|
1219
1295
|
workerName: TWorkerName;
|
|
1220
1296
|
exportName: TExportName$1;
|
|
1221
1297
|
}): TypedDurableObjectBinding<TConfig$1, TExportName$1>;
|
|
@@ -1402,7 +1478,11 @@ type InferEnv<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
|
1402
1478
|
} ? { [K in keyof TEnv]: InferBindingType<TEnv[K]> } : never;
|
|
1403
1479
|
/**
|
|
1404
1480
|
* Infer the Durable Object namespace names from a Worker config's exports.
|
|
1405
|
-
* Returns a union of export names that
|
|
1481
|
+
* Returns a union of export names that declare a *live* Durable Object —
|
|
1482
|
+
* `type: "durable-object"` with `state` either omitted, `"created"`, or
|
|
1483
|
+
* `"expecting-transfer"`. Tombstone entries (`deleted`, `renamed`,
|
|
1484
|
+
* `transferred`) are excluded because they retire the namespace and a
|
|
1485
|
+
* binding to a tombstoned class would fail at deploy time.
|
|
1406
1486
|
*
|
|
1407
1487
|
* @example
|
|
1408
1488
|
* ```typescript
|
|
@@ -1412,16 +1492,24 @@ type InferEnv<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
|
1412
1492
|
* const config = defineWorker({
|
|
1413
1493
|
* exports: {
|
|
1414
1494
|
* MyDurableObject: { type: "durable-object", storage: "sqlite" },
|
|
1415
|
-
*
|
|
1495
|
+
* OldGone: { type: "durable-object", state: "deleted" },
|
|
1416
1496
|
* },
|
|
1417
1497
|
* });
|
|
1418
1498
|
*
|
|
1419
1499
|
* type WorkerConfig = UnwrapConfig<typeof config>;
|
|
1420
|
-
* // Inferred as: "MyDurableObject"
|
|
1500
|
+
* // Inferred as: "MyDurableObject" (the deleted tombstone is excluded)
|
|
1421
1501
|
* type DurableNamespaces = InferDurableNamespaces<WorkerConfig>;
|
|
1422
1502
|
* ```
|
|
1423
1503
|
*/
|
|
1424
|
-
type InferDurableNamespaces<TUnwrappedConfig$1> =
|
|
1504
|
+
type InferDurableNamespaces<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
1505
|
+
exports: infer TExports extends Record<string, {
|
|
1506
|
+
type: string;
|
|
1507
|
+
}>;
|
|
1508
|
+
} ? { [K in keyof TExports]: TExports[K] extends {
|
|
1509
|
+
type: "durable-object";
|
|
1510
|
+
} ? TExports[K] extends {
|
|
1511
|
+
state: "deleted" | "renamed" | "transferred";
|
|
1512
|
+
} ? never : K & string : never }[keyof TExports] : never;
|
|
1425
1513
|
/**
|
|
1426
1514
|
* Infer the main module type from a Worker config's entrypoint.
|
|
1427
1515
|
* If entrypoint is a module namespace object, returns that type.
|
|
@@ -1432,5 +1520,5 @@ type InferMainModule<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
|
1432
1520
|
} ? TModule : DefaultModule;
|
|
1433
1521
|
//#endregion
|
|
1434
1522
|
//#endregion
|
|
1435
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding,
|
|
1523
|
+
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, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, defineWorker, exports, triggers };
|
|
1436
1524
|
//# sourceMappingURL=experimental-config.d.mts.map
|