@cloudflare/vitest-pool-workers 0.14.8 → 0.15.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.
@@ -89,7 +89,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
89
89
  }) : target, mod));
90
90
 
91
91
  //#endregion
92
- //#region ../workers-utils/dist/chunk-L6UDSO24.mjs
92
+ //#region ../workers-utils/dist/chunk-BLWXWFJK.mjs
93
93
  function isCompatDate(str) {
94
94
  return /^\d{4}-\d{2}-\d{2}$/.test(str);
95
95
  }
@@ -358,7 +358,9 @@ function convertWorkerToWranglerConfig(config) {
358
358
  })), ...config.domains.map((c) => ({
359
359
  pattern: c.hostname,
360
360
  zone_name: c.zone_name,
361
- custom_domain: true
361
+ custom_domain: true,
362
+ enabled: c.enabled,
363
+ previews_enabled: c.previews_enabled
362
364
  }))];
363
365
  return {
364
366
  name: config.name,
@@ -7824,12 +7826,21 @@ function isValidRouteValue(item) {
7824
7826
  if (typeof item === "string") return true;
7825
7827
  if (typeof item === "object") {
7826
7828
  if (!hasProperty(item, "pattern") || typeof item.pattern !== "string") return false;
7827
- const otherKeys = Object.keys(item).length - 1;
7828
7829
  const hasZoneId = hasProperty(item, "zone_id") && typeof item.zone_id === "string";
7829
7830
  const hasZoneName = hasProperty(item, "zone_name") && typeof item.zone_name === "string";
7830
7831
  const hasCustomDomainFlag = hasProperty(item, "custom_domain") && typeof item.custom_domain === "boolean";
7831
- if (otherKeys === 2 && hasCustomDomainFlag && (hasZoneId || hasZoneName)) return true;
7832
- else if (otherKeys === 1 && (hasZoneId || hasZoneName || hasCustomDomainFlag)) return true;
7832
+ const hasEnabled = hasProperty(item, "enabled") && typeof item.enabled === "boolean";
7833
+ const hasPreviewsEnabled = hasProperty(item, "previews_enabled") && typeof item.previews_enabled === "boolean";
7834
+ if ([
7835
+ hasZoneId,
7836
+ hasZoneName,
7837
+ hasCustomDomainFlag,
7838
+ hasEnabled,
7839
+ hasPreviewsEnabled
7840
+ ].filter(Boolean).length !== Object.keys(item).length - 1) return false;
7841
+ if (hasZoneId && hasZoneName) return false;
7842
+ if ((hasEnabled || hasPreviewsEnabled) && !hasCustomDomainFlag) return false;
7843
+ if (hasZoneId || hasZoneName || hasCustomDomainFlag) return true;
7833
7844
  }
7834
7845
  return false;
7835
7846
  }
@@ -7854,7 +7865,7 @@ Please remove the "route" field from your configuration.`);
7854
7865
  __name(mutateEmptyStringRouteValue, "mutateEmptyStringRouteValue");
7855
7866
  var isRoute = /* @__PURE__ */ __name((diagnostics, field, value) => {
7856
7867
  if (value !== void 0 && !isValidRouteValue(value)) {
7857
- diagnostics.errors.push(`Expected "${field}" to be either a string, or an object with shape { pattern, custom_domain, zone_id | zone_name }, but got ${JSON.stringify(value)}.`);
7868
+ diagnostics.errors.push(`Expected "${field}" to be either a string, or an object with shape { pattern, custom_domain, zone_id | zone_name, enabled, previews_enabled }, but got ${JSON.stringify(value)}.`);
7858
7869
  return false;
7859
7870
  }
7860
7871
  return true;
@@ -7867,7 +7878,7 @@ var isRouteArray = /* @__PURE__ */ __name((diagnostics, field, value) => {
7867
7878
  }
7868
7879
  const invalidRoutes = [];
7869
7880
  for (const item of value) if (!isValidRouteValue(item)) invalidRoutes.push(item);
7870
- if (invalidRoutes.length > 0) diagnostics.errors.push(`Expected "${field}" to be an array of either strings or objects with the shape { pattern, custom_domain, zone_id | zone_name }, but these weren't valid: ${JSON.stringify(invalidRoutes, null, 2)}.`);
7881
+ if (invalidRoutes.length > 0) diagnostics.errors.push(`Expected "${field}" to be an array of either strings or objects with the shape { pattern, custom_domain, zone_id | zone_name, enabled, previews_enabled }, but these weren't valid: ${JSON.stringify(invalidRoutes, null, 2)}.`);
7871
7882
  return invalidRoutes.length === 0;
7872
7883
  }, "isRouteArray");
7873
7884
  function normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv) {