@cloudflare/vite-plugin 1.60.2 → 1.62.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/index.mjs +44 -30
- package/dist/index.mjs.map +1 -1
- package/dist/{package-1XXLbMvc.mjs → package-BRwjRjKq.mjs} +6 -12
- package/dist/package-BRwjRjKq.mjs.map +1 -0
- package/package.json +12 -16
- package/dist/experimental-config.d.mts +0 -1834
- package/dist/experimental-config.d.mts.map +0 -1
- package/dist/experimental-config.mjs +0 -276
- package/dist/experimental-config.mjs.map +0 -1
- package/dist/package-1XXLbMvc.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -45376,7 +45376,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
45376
45376
|
}, {});
|
|
45377
45377
|
}
|
|
45378
45378
|
__name$6(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
45379
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
45379
|
+
var DEFAULT_COMPAT_DATE = "2026-09-26";
|
|
45380
45380
|
function constructWranglerConfig(config$2) {
|
|
45381
45381
|
const mappedBindings = mapWorkerMetadataBindings(config$2.bindings);
|
|
45382
45382
|
const durableObjectClassNames = config$2.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$2.name).map((durableObject) => durableObject.class_name);
|
|
@@ -51602,7 +51602,7 @@ function getWorkerNameToDurableObjectExportsMap(workers) {
|
|
|
51602
51602
|
return workerNameToDurableObjectExportsMap;
|
|
51603
51603
|
}
|
|
51604
51604
|
function getWorkerNameToWorkflowEntrypointExportsMap(workers) {
|
|
51605
|
-
const workerNameToWorkflowEntrypointExportsMap = new Map(workers.map((worker) => [worker.config.name,
|
|
51605
|
+
const workerNameToWorkflowEntrypointExportsMap = new Map(workers.map((worker) => [worker.config.name, new Set(Object.keys(partitionExports(worker.config.exports).workflow))]));
|
|
51606
51606
|
for (const worker of workers) for (const value of worker.config.workflows) if (value.script_name) workerNameToWorkflowEntrypointExportsMap.get(value.script_name)?.add(value.class_name);
|
|
51607
51607
|
else workerNameToWorkflowEntrypointExportsMap.get(worker.config.name)?.add(value.class_name);
|
|
51608
51608
|
return workerNameToWorkflowEntrypointExportsMap;
|
|
@@ -56320,6 +56320,12 @@ const WorkerBindingSchema = strictObject({
|
|
|
56320
56320
|
props: record(string(), unknown()).optional(),
|
|
56321
56321
|
dev: RemoteBindingDevSchema.optional()
|
|
56322
56322
|
});
|
|
56323
|
+
const WorkflowBindingSchema = strictObject({
|
|
56324
|
+
type: literal$1("workflow"),
|
|
56325
|
+
name: string(),
|
|
56326
|
+
worker: string(),
|
|
56327
|
+
exportName: string()
|
|
56328
|
+
});
|
|
56323
56329
|
const D1BindingSchema = strictObject({
|
|
56324
56330
|
type: literal$1("d1"),
|
|
56325
56331
|
name: string().optional(),
|
|
@@ -56484,7 +56490,8 @@ const KnownBindingSchema = discriminatedUnion("type", [
|
|
|
56484
56490
|
return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
|
|
56485
56491
|
} }),
|
|
56486
56492
|
WorkerBindingSchema,
|
|
56487
|
-
strictObject({ type: literal$1("worker-loader") })
|
|
56493
|
+
strictObject({ type: literal$1("worker-loader") }),
|
|
56494
|
+
WorkflowBindingSchema
|
|
56488
56495
|
]);
|
|
56489
56496
|
const UnsafeBindingSchema = looseObject({
|
|
56490
56497
|
type: templateLiteral(["unsafe:", string().min(1)]),
|
|
@@ -57471,6 +57478,14 @@ function convertBindingsAndAssets(config$2, result) {
|
|
|
57471
57478
|
case "worker-loader":
|
|
57472
57479
|
workerLoaders.push({ binding: name });
|
|
57473
57480
|
break;
|
|
57481
|
+
case "workflow":
|
|
57482
|
+
workflows.push({
|
|
57483
|
+
binding: name,
|
|
57484
|
+
name: binding.name,
|
|
57485
|
+
class_name: binding.exportName,
|
|
57486
|
+
script_name: binding.worker
|
|
57487
|
+
});
|
|
57488
|
+
break;
|
|
57474
57489
|
}
|
|
57475
57490
|
}
|
|
57476
57491
|
if (kvNamespaces.length) result.kv_namespaces = kvNamespaces;
|
|
@@ -65796,7 +65811,7 @@ function resolveWorker(workerConfig, devOnly, parsedNewWorkerConfig) {
|
|
|
65796
65811
|
}
|
|
65797
65812
|
const NEW_CONFIG_FILENAME = "cloudflare.config.ts";
|
|
65798
65813
|
const TYPES_OUTPUT_PATH = ".cloudflare/types/index.d.ts";
|
|
65799
|
-
const
|
|
65814
|
+
const CONFIG_PACKAGE = "cf/config";
|
|
65800
65815
|
/**
|
|
65801
65816
|
* Load and convert a `cloudflare.config.ts` file via `@cloudflare/config`. Returns
|
|
65802
65817
|
* the resulting Wrangler `RawConfig`, the parsed new-config shape (for
|
|
@@ -65834,9 +65849,8 @@ async function loadNewConfig(options) {
|
|
|
65834
65849
|
}
|
|
65835
65850
|
/**
|
|
65836
65851
|
* Write `.cloudflare/types/index.d.ts` using
|
|
65837
|
-
* `@cloudflare/config`'s `generateTypes`, targeting the
|
|
65838
|
-
*
|
|
65839
|
-
* `@cloudflare/config`).
|
|
65852
|
+
* `@cloudflare/config`'s `generateTypes`, targeting the public `cf/config`
|
|
65853
|
+
* package used by `cloudflare.config.ts`.
|
|
65840
65854
|
*
|
|
65841
65855
|
* When `includeRuntime` is true, appends the Workers runtime types (generated
|
|
65842
65856
|
* from the project's compatibility date/flags) after the inference block. The
|
|
@@ -65858,7 +65872,7 @@ async function writeCloudflareTypes(options) {
|
|
|
65858
65872
|
} catch {}
|
|
65859
65873
|
let content = generateTypes({
|
|
65860
65874
|
configPath: configImportPath,
|
|
65861
|
-
packageName:
|
|
65875
|
+
packageName: CONFIG_PACKAGE
|
|
65862
65876
|
});
|
|
65863
65877
|
if (options.includeRuntime) {
|
|
65864
65878
|
const { runtimeHeader, runtimeTypes } = await generateRuntimeTypes({
|
|
@@ -80285,43 +80299,43 @@ function createContainerCleanup() {
|
|
|
80285
80299
|
}
|
|
80286
80300
|
};
|
|
80287
80301
|
}
|
|
80302
|
+
const containerCleanupKey = Symbol("vite-plugin-cloudflare:container-cleanup");
|
|
80288
80303
|
/**
|
|
80289
|
-
* Retains Container cleanup across config reloads
|
|
80290
|
-
* The state belongs to this server, not the re-evaluated cloudflare() factory.
|
|
80304
|
+
* Retains Container cleanup across config reloads for one server session.
|
|
80291
80305
|
*/
|
|
80292
80306
|
function getDevContainerCleanup(server) {
|
|
80293
|
-
|
|
80294
|
-
|
|
80295
|
-
|
|
80296
|
-
|
|
80297
|
-
const plugin = {
|
|
80298
|
-
name: pluginName,
|
|
80299
|
-
api: cleanup,
|
|
80300
|
-
configureServer(nextServer) {
|
|
80301
|
-
attachContainerCleanup(nextServer, cleanup);
|
|
80302
|
-
}
|
|
80303
|
-
};
|
|
80304
|
-
server.config = {
|
|
80305
|
-
...server.config,
|
|
80306
|
-
inlineConfig: {
|
|
80307
|
+
let cleanup = server.config.inlineConfig[containerCleanupKey];
|
|
80308
|
+
if (!cleanup) {
|
|
80309
|
+
cleanup = createContainerCleanup();
|
|
80310
|
+
const inlineConfig = {
|
|
80307
80311
|
...server.config.inlineConfig,
|
|
80308
|
-
|
|
80309
|
-
}
|
|
80310
|
-
|
|
80312
|
+
[containerCleanupKey]: cleanup
|
|
80313
|
+
};
|
|
80314
|
+
server.config = {
|
|
80315
|
+
...server.config,
|
|
80316
|
+
inlineConfig
|
|
80317
|
+
};
|
|
80318
|
+
}
|
|
80311
80319
|
attachContainerCleanup(server, cleanup);
|
|
80312
80320
|
return cleanup;
|
|
80313
80321
|
}
|
|
80314
80322
|
function attachContainerCleanup(server, cleanup) {
|
|
80323
|
+
if (server.close[containerCleanupKey] === cleanup) return;
|
|
80315
80324
|
const restartServer = server.restart.bind(server);
|
|
80316
|
-
server.restart = (...args) => cleanup.restart(() =>
|
|
80325
|
+
server.restart = (...args) => cleanup.restart(async () => {
|
|
80326
|
+
await restartServer(...args);
|
|
80327
|
+
if (!server.config.plugins.some((plugin) => plugin.name === "vite-plugin-cloudflare:dev")) attachContainerCleanup(server, cleanup);
|
|
80328
|
+
});
|
|
80317
80329
|
const closeServer = server.close.bind(server);
|
|
80318
|
-
|
|
80330
|
+
const closeWithCleanup = async () => {
|
|
80319
80331
|
try {
|
|
80320
80332
|
await closeServer();
|
|
80321
80333
|
} finally {
|
|
80322
80334
|
if (!cleanup.isRestarting) cleanup.cleanup();
|
|
80323
80335
|
}
|
|
80324
80336
|
};
|
|
80337
|
+
closeWithCleanup[containerCleanupKey] = cleanup;
|
|
80338
|
+
server.close = closeWithCleanup;
|
|
80325
80339
|
}
|
|
80326
80340
|
|
|
80327
80341
|
//#endregion
|
|
@@ -85367,7 +85381,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
85367
85381
|
//#endregion
|
|
85368
85382
|
//#region ../remote-bindings/dist/index.mjs
|
|
85369
85383
|
var import_undici = require_undici();
|
|
85370
|
-
var version$2 = "0.0.
|
|
85384
|
+
var version$2 = "0.0.37";
|
|
85371
85385
|
var NoDefaultValueProvided = class extends UserError {
|
|
85372
85386
|
constructor() {
|
|
85373
85387
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|