@cloudflare/vitest-pool-workers 0.16.4 → 0.16.5
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/pool/index.mjs +32 -15
- package/dist/pool/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/pool/index.mjs
CHANGED
|
@@ -8083,7 +8083,7 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name((diagnostics, field,
|
|
|
8083
8083
|
}, "validateStreamingTailConsumers");
|
|
8084
8084
|
function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
|
|
8085
8085
|
deprecated(diagnostics, rawEnv, "node_compat", `The "node_compat" field is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`, true, "Removed", "error");
|
|
8086
|
-
experimental(diagnostics, rawEnv, "unsafe");
|
|
8086
|
+
if (topLevelEnv === void 0 || rawConfig?.unsafe === void 0) experimental(diagnostics, rawEnv, "unsafe");
|
|
8087
8087
|
const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
|
|
8088
8088
|
const account_id = inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString, void 0, void 0);
|
|
8089
8089
|
const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
|
|
@@ -8246,9 +8246,11 @@ var validateDefines = /* @__PURE__ */ __name((envName) => (diagnostics, field, v
|
|
|
8246
8246
|
if (configDefines.length > 0) {
|
|
8247
8247
|
if (typeof value === "object" && value !== null) {
|
|
8248
8248
|
const configEnvDefines = config === void 0 ? [] : Object.keys(value);
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8249
|
+
const missingDefines = configDefines.filter((varName) => !(varName in value));
|
|
8250
|
+
if (missingDefines.length > 0) diagnostics.warnings.push(`The following define entries exist at the top level, but not on "${fieldPath}".
|
|
8251
|
+
This is probably not what you want, since "define" configuration is not inherited by environments.
|
|
8252
|
+
Please add these entries to "env.${envName}.define":
|
|
8253
|
+
` + missingDefines.map((varName) => `- ${varName}`).join("\n"));
|
|
8252
8254
|
for (const varName of configEnvDefines) if (!configDefines.includes(varName)) diagnostics.warnings.push(`"${varName}" exists on "env.${envName}", but not on the top level.
|
|
8253
8255
|
This is not what you probably want, since "define" configuration within environments can only override existing top level "define" configuration
|
|
8254
8256
|
Please remove "${fieldPath}.${varName}", or add "define.${varName}".`);
|
|
@@ -8272,9 +8274,11 @@ var validateVars = /* @__PURE__ */ __name((envName) => (diagnostics, field, valu
|
|
|
8272
8274
|
const configVars = Object.keys(config?.vars ?? {});
|
|
8273
8275
|
if (configVars.length > 0) {
|
|
8274
8276
|
if (typeof value === "object" && value !== null) {
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8277
|
+
const missingVars = configVars.filter((varName) => !(varName in value));
|
|
8278
|
+
if (missingVars.length > 0) diagnostics.warnings.push(`The following vars exist at the top level, but not on "${fieldPath}".
|
|
8279
|
+
This is probably not what you want, since "vars" configuration is not inherited by environments.
|
|
8280
|
+
Please add these vars to "env.${envName}.vars":
|
|
8281
|
+
` + missingVars.map((varName) => `- ${varName}`).join("\n"));
|
|
8278
8282
|
}
|
|
8279
8283
|
}
|
|
8280
8284
|
return isValid2;
|
|
@@ -10295,27 +10299,36 @@ function startTunnel(options) {
|
|
|
10295
10299
|
const timeoutMs = options.timeoutMs ?? TUNNEL_STARTUP_TIMEOUT_MS;
|
|
10296
10300
|
const reminderIntervalMs = options.reminderIntervalMs ?? DEFAULT_TUNNEL_REMINDER_INTERVAL_MS;
|
|
10297
10301
|
const defaultExpiryMs = options.expiryMs ?? DEFAULT_TUNNEL_EXPIRY_MS;
|
|
10302
|
+
const isNamedTunnel = options.token !== void 0;
|
|
10298
10303
|
const timeFormatter = new Intl.DateTimeFormat(void 0, { timeStyle: "short" });
|
|
10299
|
-
const readyPromise = spawnCloudflared([
|
|
10304
|
+
const readyPromise = spawnCloudflared(isNamedTunnel ? [
|
|
10305
|
+
"tunnel",
|
|
10306
|
+
"--no-autoupdate",
|
|
10307
|
+
"run"
|
|
10308
|
+
] : [
|
|
10300
10309
|
"tunnel",
|
|
10301
10310
|
"--no-autoupdate",
|
|
10302
10311
|
"--url",
|
|
10303
10312
|
options.origin.href
|
|
10304
10313
|
], {
|
|
10305
10314
|
stdio: "pipe",
|
|
10315
|
+
env: options.token ? { TUNNEL_TOKEN: options.token } : void 0,
|
|
10306
10316
|
skipVersionCheck: true,
|
|
10307
10317
|
logger
|
|
10308
10318
|
}).then((process2) => {
|
|
10309
10319
|
cloudflaredProcess = process2;
|
|
10310
10320
|
if (disposed) terminateCloudflared(process2);
|
|
10311
10321
|
return process2;
|
|
10312
|
-
}).then((process2) =>
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10322
|
+
}).then((process2) => {
|
|
10323
|
+
if (isNamedTunnel) return { mode: "named" };
|
|
10324
|
+
return waitForQuickTunnelReady(process2, timeoutMs, {
|
|
10325
|
+
logger,
|
|
10326
|
+
origin: options.origin
|
|
10327
|
+
});
|
|
10328
|
+
}).then((result) => {
|
|
10316
10329
|
expiresAt = Date.now() + defaultExpiryMs;
|
|
10317
10330
|
scheduleExpiryTimeout();
|
|
10318
|
-
scheduleReminder(result.publicUrl.origin);
|
|
10331
|
+
scheduleReminder(result.mode === "quick" ? result.publicUrl.origin : void 0);
|
|
10319
10332
|
return result;
|
|
10320
10333
|
});
|
|
10321
10334
|
function disposeTunnel() {
|
|
@@ -10341,7 +10354,7 @@ function startTunnel(options) {
|
|
|
10341
10354
|
if (disposed) return;
|
|
10342
10355
|
const remainingMs = expiresAt - Date.now();
|
|
10343
10356
|
if (remainingMs <= 0) return;
|
|
10344
|
-
logger?.log(`The tunnel is still open at ${publicURL}. It expires in ${formatTunnelDuration(remainingMs)}. ${options.extendHint ?? ""}`);
|
|
10357
|
+
logger?.log(`${publicURL ? `The tunnel is still open at ${publicURL}.` : "The tunnel is still open."} It expires in ${formatTunnelDuration(remainingMs)}. ${options.extendHint ?? ""}`);
|
|
10345
10358
|
}, reminderIntervalMs);
|
|
10346
10359
|
reminderInterval.unref?.();
|
|
10347
10360
|
}
|
|
@@ -10375,6 +10388,7 @@ function startTunnel(options) {
|
|
|
10375
10388
|
__name(extendExpiry, "extendExpiry");
|
|
10376
10389
|
return {
|
|
10377
10390
|
ready: /* @__PURE__ */ __name(() => readyPromise, "ready"),
|
|
10391
|
+
isOpen: /* @__PURE__ */ __name(() => !disposed, "isOpen"),
|
|
10378
10392
|
dispose: disposeTunnel,
|
|
10379
10393
|
extendExpiry
|
|
10380
10394
|
};
|
|
@@ -10420,7 +10434,10 @@ function waitForQuickTunnelReady(cloudflared, timeoutMs, options) {
|
|
|
10420
10434
|
if (match && !resolved) {
|
|
10421
10435
|
resolved = true;
|
|
10422
10436
|
clearTimeout(timeoutId);
|
|
10423
|
-
resolve$2({
|
|
10437
|
+
resolve$2({
|
|
10438
|
+
mode: "quick",
|
|
10439
|
+
publicUrl: new URL(match[0])
|
|
10440
|
+
});
|
|
10424
10441
|
}
|
|
10425
10442
|
});
|
|
10426
10443
|
cloudflared.on("error", (error) => {
|