@cloudflare/vitest-pool-workers 0.15.1 → 0.15.2
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 +40 -39
- package/dist/pool/index.mjs.map +1 -1
- package/dist/worker/index.mjs +21 -6
- package/dist/worker/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/pool/index.mjs
CHANGED
|
@@ -461,7 +461,7 @@ var MetricsRegistry = class {
|
|
|
461
461
|
};
|
|
462
462
|
|
|
463
463
|
//#endregion
|
|
464
|
-
//#region ../workers-utils/dist/chunk-
|
|
464
|
+
//#region ../workers-utils/dist/chunk-XXCQEG76.mjs
|
|
465
465
|
var UserError = class extends Error {
|
|
466
466
|
static {
|
|
467
467
|
__name(this, "UserError");
|
|
@@ -470,7 +470,7 @@ var UserError = class extends Error {
|
|
|
470
470
|
constructor(message, options) {
|
|
471
471
|
super(message, options);
|
|
472
472
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
473
|
-
this.telemetryMessage = options?.telemetryMessage ===
|
|
473
|
+
this.telemetryMessage = typeof options?.telemetryMessage === "string" ? options.telemetryMessage : options?.telemetryMessage ? message : void 0;
|
|
474
474
|
}
|
|
475
475
|
};
|
|
476
476
|
var DeprecationError = class extends UserError {
|
|
@@ -483,13 +483,14 @@ ${message}`, options);
|
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
485
|
var FatalError = class extends UserError {
|
|
486
|
-
constructor(message, code, options) {
|
|
487
|
-
super(message, options);
|
|
488
|
-
this.code = code;
|
|
489
|
-
}
|
|
490
486
|
static {
|
|
491
487
|
__name(this, "FatalError");
|
|
492
488
|
}
|
|
489
|
+
code;
|
|
490
|
+
constructor(message, options) {
|
|
491
|
+
super(message, options);
|
|
492
|
+
this.code = options.code;
|
|
493
|
+
}
|
|
493
494
|
};
|
|
494
495
|
var CommandLineArgsError = class extends UserError {
|
|
495
496
|
static {
|
|
@@ -497,10 +498,6 @@ var CommandLineArgsError = class extends UserError {
|
|
|
497
498
|
}
|
|
498
499
|
};
|
|
499
500
|
var JsonFriendlyFatalError = class extends FatalError {
|
|
500
|
-
constructor(message, code, options) {
|
|
501
|
-
super(message, code, options);
|
|
502
|
-
this.code = code;
|
|
503
|
-
}
|
|
504
501
|
static {
|
|
505
502
|
__name(this, "JsonFriendlyFatalError");
|
|
506
503
|
}
|
|
@@ -515,9 +512,9 @@ var MissingConfigError = class extends Error {
|
|
|
515
512
|
this.telemetryMessage = `Missing config value for ${key}`;
|
|
516
513
|
}
|
|
517
514
|
};
|
|
518
|
-
function createFatalError(message, isJson,
|
|
519
|
-
if (isJson) return new JsonFriendlyFatalError(JSON.stringify(message),
|
|
520
|
-
|
|
515
|
+
function createFatalError(message, isJson, options) {
|
|
516
|
+
if (isJson) return new JsonFriendlyFatalError(JSON.stringify(message), options);
|
|
517
|
+
return new FatalError(`${message}`, options);
|
|
521
518
|
}
|
|
522
519
|
__name(createFatalError, "createFatalError");
|
|
523
520
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -2537,7 +2534,8 @@ function readFileSyncToBuffer(file2) {
|
|
|
2537
2534
|
const { message } = err;
|
|
2538
2535
|
throw new ParseError({
|
|
2539
2536
|
text: `Could not read file: ${file2}`,
|
|
2540
|
-
notes: [{ text: message.replace(file2, resolve(file2)) }]
|
|
2537
|
+
notes: [{ text: message.replace(file2, resolve(file2)) }],
|
|
2538
|
+
telemetryMessage: false
|
|
2541
2539
|
});
|
|
2542
2540
|
}
|
|
2543
2541
|
}
|
|
@@ -2829,7 +2827,10 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
2829
2827
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
2830
2828
|
redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
|
|
2831
2829
|
} catch (e) {
|
|
2832
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
|
|
2830
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
|
|
2831
|
+
cause: e,
|
|
2832
|
+
telemetryMessage: false
|
|
2833
|
+
});
|
|
2833
2834
|
}
|
|
2834
2835
|
if (!redirectedConfigPath) throw new UserError(esm_default`
|
|
2835
2836
|
A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
|
|
@@ -2838,17 +2839,17 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
2838
2839
|
\`\`\`
|
|
2839
2840
|
${deployConfigFile}
|
|
2840
2841
|
\`\`\`
|
|
2841
|
-
|
|
2842
|
+
`, { telemetryMessage: false });
|
|
2842
2843
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
|
|
2843
2844
|
There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
|
|
2844
2845
|
But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
|
|
2845
|
-
|
|
2846
|
+
`, { telemetryMessage: false });
|
|
2846
2847
|
if (userConfigPath) {
|
|
2847
2848
|
if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
|
|
2848
2849
|
Found both a user configuration file at "${path.relative(".", userConfigPath)}"
|
|
2849
2850
|
and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
|
|
2850
2851
|
But these do not share the same base path so it is not clear which should be used.
|
|
2851
|
-
|
|
2852
|
+
`, { telemetryMessage: false });
|
|
2852
2853
|
}
|
|
2853
2854
|
return {
|
|
2854
2855
|
configPath: redirectedConfigPath,
|
|
@@ -7199,7 +7200,7 @@ function getBooleanEnvironmentVariableFactory(options) {
|
|
|
7199
7200
|
switch (process.env[options.variableName]?.toLowerCase()) {
|
|
7200
7201
|
case "true": return true;
|
|
7201
7202
|
case "false": return false;
|
|
7202
|
-
default: throw new UserError(`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(process.env[options.variableName])}
|
|
7203
|
+
default: throw new UserError(`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(process.env[options.variableName])}`, { telemetryMessage: false });
|
|
7203
7204
|
}
|
|
7204
7205
|
};
|
|
7205
7206
|
}
|
|
@@ -7225,7 +7226,7 @@ function getProcessEnv(variableName, choices) {
|
|
|
7225
7226
|
}
|
|
7226
7227
|
__name(getProcessEnv, "getProcessEnv");
|
|
7227
7228
|
function assertOneOf(choices, value) {
|
|
7228
|
-
if (Array.isArray(choices) && !choices.includes(value)) throw new UserError(`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}
|
|
7229
|
+
if (Array.isArray(choices) && !choices.includes(value)) throw new UserError(`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`, { telemetryMessage: false });
|
|
7229
7230
|
}
|
|
7230
7231
|
__name(assertOneOf, "assertOneOf");
|
|
7231
7232
|
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
@@ -7249,7 +7250,7 @@ var getCloudflareComplianceRegion = /* @__PURE__ */ __name((complianceConfig) =>
|
|
|
7249
7250
|
The compliance region has been set to different values in two places:
|
|
7250
7251
|
- \`CLOUDFLARE_COMPLIANCE_REGION\` environment variable: \`${complianceRegionFromEnv}\`
|
|
7251
7252
|
- \`compliance_region\` configuration property: \`${complianceConfig.compliance_region}\`
|
|
7252
|
-
|
|
7253
|
+
`, { telemetryMessage: false });
|
|
7253
7254
|
return complianceRegionFromEnv || complianceConfig?.compliance_region || "public";
|
|
7254
7255
|
}, "getCloudflareComplianceRegion");
|
|
7255
7256
|
var getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({
|
|
@@ -7787,7 +7788,7 @@ function applyPythonConfig(config, args) {
|
|
|
7787
7788
|
type: "PythonModule",
|
|
7788
7789
|
globs: ["**/*.py"]
|
|
7789
7790
|
});
|
|
7790
|
-
if (!config.compatibility_flags.includes("python_workers")) throw new UserError("The `python_workers` compatibility flag is required to use Python.");
|
|
7791
|
+
if (!config.compatibility_flags.includes("python_workers")) throw new UserError("The `python_workers` compatibility flag is required to use Python.", { telemetryMessage: false });
|
|
7791
7792
|
}
|
|
7792
7793
|
}
|
|
7793
7794
|
__name(applyPythonConfig, "applyPythonConfig");
|
|
@@ -9786,7 +9787,7 @@ function isDockerfile(imagePath, configPath) {
|
|
|
9786
9787
|
const baseDir = configPath ? path.dirname(configPath) : process.cwd();
|
|
9787
9788
|
const maybeDockerfile = path.resolve(baseDir, imagePath);
|
|
9788
9789
|
if (fs.existsSync(maybeDockerfile)) {
|
|
9789
|
-
if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile
|
|
9790
|
+
if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
|
|
9790
9791
|
return true;
|
|
9791
9792
|
}
|
|
9792
9793
|
const errorPrefix = `The image "${imagePath}" does not appear to be a valid path to a Dockerfile, or a valid image registry path:
|
|
@@ -9794,12 +9795,12 @@ function isDockerfile(imagePath, configPath) {
|
|
|
9794
9795
|
try {
|
|
9795
9796
|
new URL(`https://${imagePath}`);
|
|
9796
9797
|
} catch (e2) {
|
|
9797
|
-
if (e2 instanceof Error) throw new UserError(errorPrefix + e2.message);
|
|
9798
|
+
if (e2 instanceof Error) throw new UserError(errorPrefix + e2.message, { telemetryMessage: false });
|
|
9798
9799
|
throw e2;
|
|
9799
9800
|
}
|
|
9800
9801
|
const imageParts = imagePath.split("/");
|
|
9801
|
-
if (!imageParts[imageParts.length - 1]?.includes(":")) throw new UserError(errorPrefix + `If this is an image registry path, it needs to include at least a tag ':' (e.g: docker.io/httpd:1)
|
|
9802
|
-
if (imagePath.includes("://")) throw new UserError(errorPrefix + `Image reference should not include the protocol part (e.g: docker.io/httpd:1, not https://docker.io/httpd:1)
|
|
9802
|
+
if (!imageParts[imageParts.length - 1]?.includes(":")) throw new UserError(errorPrefix + `If this is an image registry path, it needs to include at least a tag ':' (e.g: docker.io/httpd:1)`, { telemetryMessage: false });
|
|
9803
|
+
if (imagePath.includes("://")) throw new UserError(errorPrefix + `Image reference should not include the protocol part (e.g: docker.io/httpd:1, not https://docker.io/httpd:1)`, { telemetryMessage: false });
|
|
9803
9804
|
return false;
|
|
9804
9805
|
}
|
|
9805
9806
|
__name(isDockerfile, "isDockerfile");
|
|
@@ -9836,7 +9837,7 @@ var supportedPagesConfigFields = [
|
|
|
9836
9837
|
];
|
|
9837
9838
|
function validatePagesConfig(config, envNames, projectName) {
|
|
9838
9839
|
if (!config.pages_build_output_dir) throw new FatalError(`Attempting to validate Pages configuration file, but "pages_build_output_dir" field was not found.
|
|
9839
|
-
"pages_build_output_dir" is required for Pages projects
|
|
9840
|
+
"pages_build_output_dir" is required for Pages projects.`, { telemetryMessage: false });
|
|
9840
9841
|
const diagnostics = new Diagnostics(`Running configuration file validation for Pages:`);
|
|
9841
9842
|
validateMainField(config, diagnostics);
|
|
9842
9843
|
validateProjectName(projectName, diagnostics);
|
|
@@ -9902,7 +9903,7 @@ function getGoArch() {
|
|
|
9902
9903
|
cloudflared supports: x64 (amd64), arm64, arm
|
|
9903
9904
|
|
|
9904
9905
|
You can manually install cloudflared and set the CLOUDFLARED_PATH environment variable.
|
|
9905
|
-
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
9906
|
+
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared unsupported architecture" });
|
|
9906
9907
|
}
|
|
9907
9908
|
}
|
|
9908
9909
|
__name(getGoArch, "getGoArch");
|
|
@@ -9916,7 +9917,7 @@ function getGoOS() {
|
|
|
9916
9917
|
cloudflared supports: darwin (macOS), linux, win32 (Windows)
|
|
9917
9918
|
|
|
9918
9919
|
You can manually install cloudflared and set the CLOUDFLARED_PATH environment variable.
|
|
9919
|
-
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
9920
|
+
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared unsupported platform" });
|
|
9920
9921
|
}
|
|
9921
9922
|
}
|
|
9922
9923
|
__name(getGoOS, "getGoOS");
|
|
@@ -9970,7 +9971,7 @@ The update service did not return results for ${goOS}/${goArch},
|
|
|
9970
9971
|
and the fallback query also failed.
|
|
9971
9972
|
|
|
9972
9973
|
You can manually install cloudflared from:
|
|
9973
|
-
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
9974
|
+
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared version lookup failed" });
|
|
9974
9975
|
const version = fallback.version;
|
|
9975
9976
|
const filename = getAssetFilename(goOS, goArch);
|
|
9976
9977
|
return {
|
|
@@ -10045,7 +10046,7 @@ You can try:
|
|
|
10045
10046
|
errorMessage += ` 3. Manually installing cloudflared: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/
|
|
10046
10047
|
`;
|
|
10047
10048
|
errorMessage += ` 4. Setting CLOUDFLARED_PATH to point to your cloudflared binary`;
|
|
10048
|
-
throw new UserError(errorMessage);
|
|
10049
|
+
throw new UserError(errorMessage, { telemetryMessage: "tunnel cloudflared validation failed" });
|
|
10049
10050
|
}
|
|
10050
10051
|
}
|
|
10051
10052
|
__name(validateBinary, "validateBinary");
|
|
@@ -10139,14 +10140,14 @@ async function downloadCloudflared(versionInfo, binPath, options) {
|
|
|
10139
10140
|
Network error: ${e2 instanceof Error ? e2.message : String(e2)}
|
|
10140
10141
|
|
|
10141
10142
|
Please check your internet connection and try again.
|
|
10142
|
-
If you're behind a proxy, make sure it's configured correctly
|
|
10143
|
+
If you're behind a proxy, make sure it's configured correctly.`, { telemetryMessage: "tunnel cloudflared download network failed" });
|
|
10143
10144
|
}
|
|
10144
10145
|
if (!response.ok) throw new UserError(`[cloudflared] Failed to download cloudflared from ${url}
|
|
10145
10146
|
|
|
10146
10147
|
HTTP ${response.status}: ${response.statusText}
|
|
10147
10148
|
|
|
10148
10149
|
You can manually download cloudflared from:
|
|
10149
|
-
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
10150
|
+
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared download response failed" });
|
|
10150
10151
|
try {
|
|
10151
10152
|
if (compressed) await downloadAndExtractTarball(response, checksum, binPath, cacheDir);
|
|
10152
10153
|
else await downloadBinary(response, checksum, binPath);
|
|
@@ -10159,7 +10160,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
|
|
|
10159
10160
|
|
|
10160
10161
|
Error: ${e2 instanceof Error ? e2.message : String(e2)}
|
|
10161
10162
|
|
|
10162
|
-
Please ensure you have write permissions to: ${cacheDir}
|
|
10163
|
+
Please ensure you have write permissions to: ${cacheDir}`, { telemetryMessage: "tunnel cloudflared save failed" });
|
|
10163
10164
|
}
|
|
10164
10165
|
if (process.platform !== "win32") chmodSync(binPath, 493);
|
|
10165
10166
|
logger?.log(`cloudflared ${version} installed`);
|
|
@@ -10174,7 +10175,7 @@ async function downloadAndExtractTarball(response, expectedChecksum, binPath, ca
|
|
|
10174
10175
|
if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared tarball.
|
|
10175
10176
|
|
|
10176
10177
|
Expected: ${expectedChecksum}
|
|
10177
|
-
Actual: ${actualSha256}
|
|
10178
|
+
Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared tarball checksum mismatch" });
|
|
10178
10179
|
}
|
|
10179
10180
|
writeFileSync(tempTarPath, buffer);
|
|
10180
10181
|
try {
|
|
@@ -10200,7 +10201,7 @@ async function downloadBinary(response, expectedChecksum, binPath) {
|
|
|
10200
10201
|
if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared binary.
|
|
10201
10202
|
|
|
10202
10203
|
Expected: ${expectedChecksum}
|
|
10203
|
-
Actual: ${actualSha256}
|
|
10204
|
+
Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared binary checksum mismatch" });
|
|
10204
10205
|
}
|
|
10205
10206
|
writeFileAtomic(binPath, buffer);
|
|
10206
10207
|
}
|
|
@@ -10211,7 +10212,7 @@ async function getCloudflaredPath(options) {
|
|
|
10211
10212
|
if (envPath) {
|
|
10212
10213
|
if (!existsSync(envPath)) throw new UserError(`CLOUDFLARED_PATH is set to "${envPath}" but the file does not exist.
|
|
10213
10214
|
|
|
10214
|
-
Please ensure the path points to a valid cloudflared binary
|
|
10215
|
+
Please ensure the path points to a valid cloudflared binary.`, { telemetryMessage: "tunnel cloudflared env path missing" });
|
|
10215
10216
|
logger?.debug(`Using cloudflared from CLOUDFLARED_PATH: ${envPath}`);
|
|
10216
10217
|
return envPath;
|
|
10217
10218
|
}
|
|
@@ -10237,7 +10238,7 @@ Please ensure the path points to a valid cloudflared binary.`);
|
|
|
10237
10238
|
You can install it manually from:
|
|
10238
10239
|
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/
|
|
10239
10240
|
|
|
10240
|
-
Then either add it to your PATH or set CLOUDFLARED_PATH
|
|
10241
|
+
Then either add it to your PATH or set CLOUDFLARED_PATH.`, { telemetryMessage: "tunnel cloudflared download declined" });
|
|
10241
10242
|
if (existsSync(binPath)) {
|
|
10242
10243
|
const cacheDir = removeCloudflaredCache(versionInfo.version);
|
|
10243
10244
|
if (cacheDir) logger?.log(`Removed cloudflared cache: ${cacheDir}`);
|
|
@@ -10443,7 +10444,7 @@ ${stderrOutput || "(no output)"}
|
|
|
10443
10444
|
|
|
10444
10445
|
The local dev server started at ${origin.href}.
|
|
10445
10446
|
` + (isQuickTunnelRateLimited ? "Cloudflare Quick Tunnel creation was rate limited. Try again in a few minutes, or use a named tunnel if you need more reliable access." : `Check the cloudflared output above for more details, and verify that ${origin.href} is reachable from this machine if this keeps happening.`);
|
|
10446
|
-
if (isQuickTunnelRateLimited) return new UserError(errorMessage);
|
|
10447
|
+
if (isQuickTunnelRateLimited) return new UserError(errorMessage, { telemetryMessage: false });
|
|
10447
10448
|
return new Error(errorMessage);
|
|
10448
10449
|
}
|
|
10449
10450
|
__name(createTunnelStartupError, "createTunnelStartupError");
|