@cloudflare/workers-utils 0.34.0 → 0.36.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/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-QKX75RGI.mjs → chunk-2I4Q5QJP.mjs} +1 -1
- package/dist/chunk-3IYLA2JH.mjs +73 -0
- package/dist/chunk-7AX24RFK.mjs +265 -0
- package/dist/chunk-C6O4ION7.mjs +42 -0
- package/dist/chunk-MCNIGVAF.mjs +45 -0
- package/dist/{chunk-QFKPUV4H.mjs → chunk-V6JSHOVJ.mjs} +3 -102
- package/dist/chunk-WO2IAW6M.mjs +62 -0
- package/dist/chunk-XUGGRRBO.mjs +178 -0
- package/dist/compatibility-date.d.mts +80 -0
- package/dist/compatibility-date.mjs +2 -0
- package/dist/{config-BnUbzrPY.d.mts → compliance-j3-tqeao.d.mts} +37 -12
- package/dist/compliance.d.mts +4 -0
- package/dist/compliance.mjs +7 -0
- package/dist/docker-path.d.mts +8 -0
- package/dist/docker-path.mjs +3 -0
- package/dist/errors.d.mts +55 -0
- package/dist/errors.mjs +2 -0
- package/dist/index.d.mts +85 -141
- package/dist/index.mjs +1499 -747
- package/dist/local-env.d.mts +54 -0
- package/dist/local-env.mjs +176 -0
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +6 -2
- package/dist/test-helpers/index.mjs +39 -2
- package/dist/zod-format.d.mts +6 -0
- package/dist/zod-format.mjs +2 -0
- package/package.json +28 -1
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MetricsRegistry } from './chunk-Z62CVNHJ.mjs';
|
|
2
|
+
export { _forceColour, formatZodError } from './chunk-7AX24RFK.mjs';
|
|
3
|
+
import { isRedirectedRawConfig, configFileName, formatConfigSnippet, getDurableObjectExports, getContainerNameToClassNameMap, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-V6JSHOVJ.mjs';
|
|
4
|
+
export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, configFileName, configFormat, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, hasDurableObjectExports, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation } from './chunk-V6JSHOVJ.mjs';
|
|
5
|
+
import { assertNever } from './chunk-2I4Q5QJP.mjs';
|
|
6
|
+
export { DEFAULT_COMPAT_DATE, assertNever, constructWranglerConfig, mapWorkerMetadataBindings } from './chunk-2I4Q5QJP.mjs';
|
|
7
|
+
export { NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, getTodaysCompatDate, isCompatDate, isNodejsCompatDefaultOn, resolveNodejsCompat, stripRedundantNodejsCompatFlags } from './chunk-C6O4ION7.mjs';
|
|
8
|
+
import { getCloudflareEnv, getCloudflaredPathFromEnv, getCloudflareApiBaseUrl, getTraceHeader, getOutputFilePathFromEnv, getOutputFileDirectoryFromEnv, getCIOverrideName, getWranglerCacheDirFromEnv } from './chunk-XUGGRRBO.mjs';
|
|
9
|
+
export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getNoSkillsUpdatePromptsFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, isDoNotTrackEnabled } from './chunk-XUGGRRBO.mjs';
|
|
10
|
+
import { dedent } from './chunk-MCNIGVAF.mjs';
|
|
11
|
+
export { getBooleanEnvironmentVariableFactory, getDockerPath, getEnvironmentVariableFactory } from './chunk-3IYLA2JH.mjs';
|
|
12
|
+
import { UserError, FatalError } from './chunk-WO2IAW6M.mjs';
|
|
13
|
+
export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, UserError, createFatalError } from './chunk-WO2IAW6M.mjs';
|
|
2
14
|
import { getGlobalConfigPath } from './chunk-34VZWBGB.mjs';
|
|
3
15
|
export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-34VZWBGB.mjs';
|
|
4
|
-
export { MetricsRegistry } from './chunk-Z62CVNHJ.mjs';
|
|
5
|
-
import { UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, getDurableObjectExports, getContainerNameToClassNameMap, FatalError, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-QFKPUV4H.mjs';
|
|
6
|
-
export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, hasDurableObjectExports, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation } from './chunk-QFKPUV4H.mjs';
|
|
7
16
|
import { isDirectory, removeDirSync } from './chunk-53IMCORZ.mjs';
|
|
8
17
|
export { isDirectory, removeDir, removeDirSync } from './chunk-53IMCORZ.mjs';
|
|
9
18
|
import { __commonJS, __name, __require, __export, __toESM } from './chunk-Q72B4Q5Z.mjs';
|
|
10
19
|
import fs2, { statSync, accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync as readFileSync$1, appendFileSync } from 'node:fs';
|
|
11
20
|
import assert2 from 'node:assert';
|
|
12
|
-
import * as
|
|
13
|
-
import
|
|
21
|
+
import * as path from 'node:path';
|
|
22
|
+
import path__default, { join, dirname, resolve, basename } from 'node:path';
|
|
23
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
24
|
+
import chalk from 'chalk';
|
|
14
25
|
import { execFileSync, spawn } from 'node:child_process';
|
|
15
26
|
import { createHash, randomBytes } from 'node:crypto';
|
|
16
27
|
import { arch } from 'node:os';
|
|
@@ -18,7 +29,6 @@ import { fetch, Headers, FormData, Response } from 'undici';
|
|
|
18
29
|
import { URLSearchParams } from 'node:url';
|
|
19
30
|
import * as timersPromises from 'node:timers/promises';
|
|
20
31
|
import { setTimeout as setTimeout$1 } from 'node:timers/promises';
|
|
21
|
-
import util from 'node:util';
|
|
22
32
|
import { assert as assert$1 } from 'node:console';
|
|
23
33
|
|
|
24
34
|
// ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json
|
|
@@ -478,7 +488,7 @@ var require_command_exists = __commonJS({
|
|
|
478
488
|
var exec = __require("child_process").exec;
|
|
479
489
|
var execSync = __require("child_process").execSync;
|
|
480
490
|
var fs3 = __require("fs");
|
|
481
|
-
var
|
|
491
|
+
var path5 = __require("path");
|
|
482
492
|
var access = fs3.access;
|
|
483
493
|
var accessSync2 = fs3.accessSync;
|
|
484
494
|
var constants2 = fs3.constants || fs3;
|
|
@@ -582,8 +592,8 @@ var require_command_exists = __commonJS({
|
|
|
582
592
|
cleanInput = /* @__PURE__ */ __name(function(s) {
|
|
583
593
|
var isPathName = /[\\]/.test(s);
|
|
584
594
|
if (isPathName) {
|
|
585
|
-
var dirname4 = '"' +
|
|
586
|
-
var basename2 = '"' +
|
|
595
|
+
var dirname4 = '"' + path5.dirname(s) + '"';
|
|
596
|
+
var basename2 = '"' + path5.basename(s) + '"';
|
|
587
597
|
return dirname4 + ":" + basename2;
|
|
588
598
|
}
|
|
589
599
|
return '"' + s + '"';
|
|
@@ -867,7 +877,7 @@ var require_utils = __commonJS({
|
|
|
867
877
|
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
|
|
868
878
|
var fs3 = __require("fs");
|
|
869
879
|
var ini = require_ini();
|
|
870
|
-
var
|
|
880
|
+
var path5 = __require("path");
|
|
871
881
|
var stripJsonComments = require_strip_json_comments();
|
|
872
882
|
var parse3 = exports$1.parse = function(content) {
|
|
873
883
|
if (/^\s*{/.test(content))
|
|
@@ -881,7 +891,7 @@ var require_utils = __commonJS({
|
|
|
881
891
|
for (var i in args)
|
|
882
892
|
if ("string" !== typeof args[i])
|
|
883
893
|
return;
|
|
884
|
-
var file3 =
|
|
894
|
+
var file3 = path5.join.apply(null, args);
|
|
885
895
|
try {
|
|
886
896
|
return fs3.readFileSync(file3, "utf-8");
|
|
887
897
|
} catch (err) {
|
|
@@ -918,15 +928,15 @@ var require_utils = __commonJS({
|
|
|
918
928
|
return obj;
|
|
919
929
|
};
|
|
920
930
|
exports$1.find = function() {
|
|
921
|
-
var rel =
|
|
931
|
+
var rel = path5.join.apply(null, [].slice.call(arguments));
|
|
922
932
|
function find2(start, rel2) {
|
|
923
|
-
var file3 =
|
|
933
|
+
var file3 = path5.join(start, rel2);
|
|
924
934
|
try {
|
|
925
935
|
fs3.statSync(file3);
|
|
926
936
|
return file3;
|
|
927
937
|
} catch (err) {
|
|
928
|
-
if (
|
|
929
|
-
return find2(
|
|
938
|
+
if (path5.dirname(start) !== start)
|
|
939
|
+
return find2(path5.dirname(start), rel2);
|
|
930
940
|
}
|
|
931
941
|
}
|
|
932
942
|
__name(find2, "find");
|
|
@@ -1416,8 +1426,8 @@ var require_registry_auth_token = __commonJS({
|
|
|
1416
1426
|
return void 0;
|
|
1417
1427
|
}
|
|
1418
1428
|
__name(getLegacyAuthInfo, "getLegacyAuthInfo");
|
|
1419
|
-
function normalizePath(
|
|
1420
|
-
return
|
|
1429
|
+
function normalizePath(path5) {
|
|
1430
|
+
return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
|
|
1421
1431
|
}
|
|
1422
1432
|
__name(normalizePath, "normalizePath");
|
|
1423
1433
|
function getAuthInfoForUrl(regUrl, npmrc) {
|
|
@@ -2343,7 +2353,7 @@ var NEVER = /* @__PURE__ */ Object.freeze({
|
|
|
2343
2353
|
});
|
|
2344
2354
|
// @__NO_SIDE_EFFECTS__
|
|
2345
2355
|
function $constructor(name, initializer3, params) {
|
|
2346
|
-
function
|
|
2356
|
+
function init(inst, def) {
|
|
2347
2357
|
if (!inst._zod) {
|
|
2348
2358
|
Object.defineProperty(inst, "_zod", {
|
|
2349
2359
|
value: {
|
|
@@ -2368,7 +2378,7 @@ function $constructor(name, initializer3, params) {
|
|
|
2368
2378
|
}
|
|
2369
2379
|
}
|
|
2370
2380
|
}
|
|
2371
|
-
__name(
|
|
2381
|
+
__name(init, "init");
|
|
2372
2382
|
const Parent = params?.Parent ?? Object;
|
|
2373
2383
|
class Definition extends Parent {
|
|
2374
2384
|
static {
|
|
@@ -2379,7 +2389,7 @@ function $constructor(name, initializer3, params) {
|
|
|
2379
2389
|
function _(def) {
|
|
2380
2390
|
var _a3;
|
|
2381
2391
|
const inst = params?.Parent ? new Definition() : this;
|
|
2382
|
-
|
|
2392
|
+
init(inst, def);
|
|
2383
2393
|
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
2384
2394
|
for (const fn of inst._zod.deferred) {
|
|
2385
2395
|
fn();
|
|
@@ -2387,7 +2397,7 @@ function $constructor(name, initializer3, params) {
|
|
|
2387
2397
|
return inst;
|
|
2388
2398
|
}
|
|
2389
2399
|
__name(_, "_");
|
|
2390
|
-
Object.defineProperty(_, "init", { value:
|
|
2400
|
+
Object.defineProperty(_, "init", { value: init });
|
|
2391
2401
|
Object.defineProperty(_, Symbol.hasInstance, {
|
|
2392
2402
|
value: /* @__PURE__ */ __name((inst) => {
|
|
2393
2403
|
if (params?.Parent && inst instanceof params.Parent)
|
|
@@ -2608,10 +2618,10 @@ function cloneDef(schema) {
|
|
|
2608
2618
|
return mergeDefs(schema._zod.def);
|
|
2609
2619
|
}
|
|
2610
2620
|
__name(cloneDef, "cloneDef");
|
|
2611
|
-
function getElementAtPath(obj,
|
|
2612
|
-
if (!
|
|
2621
|
+
function getElementAtPath(obj, path5) {
|
|
2622
|
+
if (!path5)
|
|
2613
2623
|
return obj;
|
|
2614
|
-
return
|
|
2624
|
+
return path5.reduce((acc, key) => acc?.[key], obj);
|
|
2615
2625
|
}
|
|
2616
2626
|
__name(getElementAtPath, "getElementAtPath");
|
|
2617
2627
|
function promiseAllObject(promisesObj) {
|
|
@@ -3044,11 +3054,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
3044
3054
|
return false;
|
|
3045
3055
|
}
|
|
3046
3056
|
__name(explicitlyAborted, "explicitlyAborted");
|
|
3047
|
-
function prefixIssues(
|
|
3057
|
+
function prefixIssues(path5, issues) {
|
|
3048
3058
|
return issues.map((iss) => {
|
|
3049
3059
|
var _a3;
|
|
3050
3060
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
3051
|
-
iss.path.unshift(
|
|
3061
|
+
iss.path.unshift(path5);
|
|
3052
3062
|
return iss;
|
|
3053
3063
|
});
|
|
3054
3064
|
}
|
|
@@ -3213,16 +3223,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3213
3223
|
__name(flattenError, "flattenError");
|
|
3214
3224
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
3215
3225
|
const fieldErrors = { _errors: [] };
|
|
3216
|
-
const processError = /* @__PURE__ */ __name((error52,
|
|
3226
|
+
const processError = /* @__PURE__ */ __name((error52, path5 = []) => {
|
|
3217
3227
|
for (const issue2 of error52.issues) {
|
|
3218
3228
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3219
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3229
|
+
issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
|
|
3220
3230
|
} else if (issue2.code === "invalid_key") {
|
|
3221
|
-
processError({ issues: issue2.issues }, [...
|
|
3231
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
3222
3232
|
} else if (issue2.code === "invalid_element") {
|
|
3223
|
-
processError({ issues: issue2.issues }, [...
|
|
3233
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
3224
3234
|
} else {
|
|
3225
|
-
const fullpath = [...
|
|
3235
|
+
const fullpath = [...path5, ...issue2.path];
|
|
3226
3236
|
if (fullpath.length === 0) {
|
|
3227
3237
|
fieldErrors._errors.push(mapper(issue2));
|
|
3228
3238
|
} else {
|
|
@@ -3250,17 +3260,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3250
3260
|
__name(formatError, "formatError");
|
|
3251
3261
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
3252
3262
|
const result = { errors: [] };
|
|
3253
|
-
const processError = /* @__PURE__ */ __name((error52,
|
|
3263
|
+
const processError = /* @__PURE__ */ __name((error52, path5 = []) => {
|
|
3254
3264
|
var _a3, _b;
|
|
3255
3265
|
for (const issue2 of error52.issues) {
|
|
3256
3266
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3257
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3267
|
+
issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
|
|
3258
3268
|
} else if (issue2.code === "invalid_key") {
|
|
3259
|
-
processError({ issues: issue2.issues }, [...
|
|
3269
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
3260
3270
|
} else if (issue2.code === "invalid_element") {
|
|
3261
|
-
processError({ issues: issue2.issues }, [...
|
|
3271
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
3262
3272
|
} else {
|
|
3263
|
-
const fullpath = [...
|
|
3273
|
+
const fullpath = [...path5, ...issue2.path];
|
|
3264
3274
|
if (fullpath.length === 0) {
|
|
3265
3275
|
result.errors.push(mapper(issue2));
|
|
3266
3276
|
continue;
|
|
@@ -3293,8 +3303,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3293
3303
|
__name(treeifyError, "treeifyError");
|
|
3294
3304
|
function toDotPath(_path) {
|
|
3295
3305
|
const segs = [];
|
|
3296
|
-
const
|
|
3297
|
-
for (const seg of
|
|
3306
|
+
const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
3307
|
+
for (const seg of path5) {
|
|
3298
3308
|
if (typeof seg === "number")
|
|
3299
3309
|
segs.push(`[${seg}]`);
|
|
3300
3310
|
else if (typeof seg === "symbol")
|
|
@@ -16350,13 +16360,13 @@ function resolveRef(ref, ctx) {
|
|
|
16350
16360
|
if (!ref.startsWith("#")) {
|
|
16351
16361
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
16352
16362
|
}
|
|
16353
|
-
const
|
|
16354
|
-
if (
|
|
16363
|
+
const path5 = ref.slice(1).split("/").filter(Boolean);
|
|
16364
|
+
if (path5.length === 0) {
|
|
16355
16365
|
return ctx.rootSchema;
|
|
16356
16366
|
}
|
|
16357
16367
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
16358
|
-
if (
|
|
16359
|
-
const key =
|
|
16368
|
+
if (path5[0] === defsKey) {
|
|
16369
|
+
const key = path5[1];
|
|
16360
16370
|
if (!key || !ctx.defs[key]) {
|
|
16361
16371
|
throw new Error(`Reference not found: ${ref}`);
|
|
16362
16372
|
}
|
|
@@ -16801,244 +16811,6 @@ external_exports.object({
|
|
|
16801
16811
|
sensitive: external_exports.literal(SENSITIVE_STEP_OUTPUT).optional()
|
|
16802
16812
|
}).strict();
|
|
16803
16813
|
|
|
16804
|
-
// src/environment-variables/factory.ts
|
|
16805
|
-
function getBooleanEnvironmentVariableFactory(options) {
|
|
16806
|
-
return () => {
|
|
16807
|
-
if (!(options.variableName in process.env) || process.env[options.variableName] === void 0) {
|
|
16808
|
-
return typeof options.defaultValue === "function" ? options.defaultValue() : options.defaultValue;
|
|
16809
|
-
}
|
|
16810
|
-
switch (process.env[options.variableName]?.toLowerCase()) {
|
|
16811
|
-
case "true":
|
|
16812
|
-
return true;
|
|
16813
|
-
case "false":
|
|
16814
|
-
return false;
|
|
16815
|
-
default:
|
|
16816
|
-
throw new UserError(
|
|
16817
|
-
`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(
|
|
16818
|
-
process.env[options.variableName]
|
|
16819
|
-
)}`,
|
|
16820
|
-
{ telemetryMessage: false }
|
|
16821
|
-
);
|
|
16822
|
-
}
|
|
16823
|
-
};
|
|
16824
|
-
}
|
|
16825
|
-
__name(getBooleanEnvironmentVariableFactory, "getBooleanEnvironmentVariableFactory");
|
|
16826
|
-
function getEnvironmentVariableFactory({
|
|
16827
|
-
variableName,
|
|
16828
|
-
deprecatedName,
|
|
16829
|
-
choices,
|
|
16830
|
-
defaultValue
|
|
16831
|
-
}) {
|
|
16832
|
-
let hasWarned = false;
|
|
16833
|
-
return () => {
|
|
16834
|
-
if (variableName in process.env) {
|
|
16835
|
-
return getProcessEnv(variableName, choices);
|
|
16836
|
-
}
|
|
16837
|
-
if (deprecatedName && deprecatedName in process.env) {
|
|
16838
|
-
if (!hasWarned) {
|
|
16839
|
-
hasWarned = true;
|
|
16840
|
-
console.warn(
|
|
16841
|
-
`Using "${deprecatedName}" environment variable. This is deprecated. Please use "${variableName}", instead.`
|
|
16842
|
-
);
|
|
16843
|
-
}
|
|
16844
|
-
return getProcessEnv(deprecatedName, choices);
|
|
16845
|
-
}
|
|
16846
|
-
return defaultValue?.();
|
|
16847
|
-
};
|
|
16848
|
-
}
|
|
16849
|
-
__name(getEnvironmentVariableFactory, "getEnvironmentVariableFactory");
|
|
16850
|
-
function getProcessEnv(variableName, choices) {
|
|
16851
|
-
assertOneOf(choices, process.env[variableName]);
|
|
16852
|
-
return process.env[variableName];
|
|
16853
|
-
}
|
|
16854
|
-
__name(getProcessEnv, "getProcessEnv");
|
|
16855
|
-
function assertOneOf(choices, value) {
|
|
16856
|
-
if (Array.isArray(choices) && !choices.includes(value)) {
|
|
16857
|
-
throw new UserError(
|
|
16858
|
-
`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`,
|
|
16859
|
-
{ telemetryMessage: false }
|
|
16860
|
-
);
|
|
16861
|
-
}
|
|
16862
|
-
}
|
|
16863
|
-
__name(assertOneOf, "assertOneOf");
|
|
16864
|
-
|
|
16865
|
-
// src/environment-variables/misc-variables.ts
|
|
16866
|
-
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
16867
|
-
variableName: "WRANGLER_C3_COMMAND",
|
|
16868
|
-
defaultValue: /* @__PURE__ */ __name(() => "create cloudflare", "defaultValue")
|
|
16869
|
-
});
|
|
16870
|
-
var getDoNotTrackFromEnv = getEnvironmentVariableFactory({
|
|
16871
|
-
variableName: "DO_NOT_TRACK"
|
|
16872
|
-
});
|
|
16873
|
-
function isDoNotTrackEnabled() {
|
|
16874
|
-
const value = getDoNotTrackFromEnv()?.toLowerCase();
|
|
16875
|
-
return value === "1" || value === "true";
|
|
16876
|
-
}
|
|
16877
|
-
__name(isDoNotTrackEnabled, "isDoNotTrackEnabled");
|
|
16878
|
-
var getWranglerSendMetricsVariableFromEnv = getBooleanEnvironmentVariableFactory({
|
|
16879
|
-
variableName: "WRANGLER_SEND_METRICS"
|
|
16880
|
-
});
|
|
16881
|
-
function getWranglerSendMetricsFromEnv() {
|
|
16882
|
-
if (isDoNotTrackEnabled()) {
|
|
16883
|
-
return false;
|
|
16884
|
-
}
|
|
16885
|
-
return getWranglerSendMetricsVariableFromEnv();
|
|
16886
|
-
}
|
|
16887
|
-
__name(getWranglerSendMetricsFromEnv, "getWranglerSendMetricsFromEnv");
|
|
16888
|
-
var getNoSkillsUpdatePromptsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
16889
|
-
variableName: "WRANGLER_NO_SKILLS_UPDATE_PROMPTS"
|
|
16890
|
-
});
|
|
16891
|
-
var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
16892
|
-
variableName: "WRANGLER_SEND_ERROR_REPORTS",
|
|
16893
|
-
defaultValue: false
|
|
16894
|
-
});
|
|
16895
|
-
var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(
|
|
16896
|
-
{
|
|
16897
|
-
variableName: "WRANGLER_API_ENVIRONMENT",
|
|
16898
|
-
defaultValue: /* @__PURE__ */ __name(() => "production", "defaultValue"),
|
|
16899
|
-
choices: ["production", "staging"]
|
|
16900
|
-
}
|
|
16901
|
-
);
|
|
16902
|
-
var COMPLIANCE_REGION_CONFIG_PUBLIC = {
|
|
16903
|
-
compliance_region: "public"
|
|
16904
|
-
};
|
|
16905
|
-
var COMPLIANCE_REGION_CONFIG_UNKNOWN = {
|
|
16906
|
-
compliance_region: void 0
|
|
16907
|
-
};
|
|
16908
|
-
var getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({
|
|
16909
|
-
variableName: "CLOUDFLARE_COMPLIANCE_REGION",
|
|
16910
|
-
choices: ["public", "fedramp_high"]
|
|
16911
|
-
});
|
|
16912
|
-
var getCloudflareComplianceRegion = /* @__PURE__ */ __name((complianceConfig) => {
|
|
16913
|
-
const complianceRegionFromEnv = getCloudflareComplianceRegionFromEnv();
|
|
16914
|
-
if (complianceRegionFromEnv !== void 0 && complianceConfig?.compliance_region !== void 0 && complianceRegionFromEnv !== complianceConfig.compliance_region) {
|
|
16915
|
-
throw new UserError(
|
|
16916
|
-
dedent`
|
|
16917
|
-
The compliance region has been set to different values in two places:
|
|
16918
|
-
- \`CLOUDFLARE_COMPLIANCE_REGION\` environment variable: \`${complianceRegionFromEnv}\`
|
|
16919
|
-
- \`compliance_region\` configuration property: \`${complianceConfig.compliance_region}\`
|
|
16920
|
-
`,
|
|
16921
|
-
{ telemetryMessage: false }
|
|
16922
|
-
);
|
|
16923
|
-
}
|
|
16924
|
-
return complianceRegionFromEnv || complianceConfig?.compliance_region || "public";
|
|
16925
|
-
}, "getCloudflareComplianceRegion");
|
|
16926
|
-
var getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({
|
|
16927
|
-
variableName: "CLOUDFLARE_API_BASE_URL",
|
|
16928
|
-
deprecatedName: "CF_API_BASE_URL"
|
|
16929
|
-
});
|
|
16930
|
-
var getCloudflareApiBaseUrl = /* @__PURE__ */ __name((complianceConfig) => getCloudflareApiBaseUrlFromEnv() ?? `https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`, "getCloudflareApiBaseUrl");
|
|
16931
|
-
function getComplianceRegionSubdomain(complianceConfig) {
|
|
16932
|
-
return getCloudflareComplianceRegion(complianceConfig) === "fedramp_high" ? ".fed" : "";
|
|
16933
|
-
}
|
|
16934
|
-
__name(getComplianceRegionSubdomain, "getComplianceRegionSubdomain");
|
|
16935
|
-
function getStagingSubdomain() {
|
|
16936
|
-
return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
|
|
16937
|
-
}
|
|
16938
|
-
__name(getStagingSubdomain, "getStagingSubdomain");
|
|
16939
|
-
var getSanitizeLogs = getBooleanEnvironmentVariableFactory({
|
|
16940
|
-
variableName: "WRANGLER_LOG_SANITIZE",
|
|
16941
|
-
defaultValue: true
|
|
16942
|
-
});
|
|
16943
|
-
var getOutputFileDirectoryFromEnv = getEnvironmentVariableFactory({
|
|
16944
|
-
variableName: "WRANGLER_OUTPUT_FILE_DIRECTORY"
|
|
16945
|
-
});
|
|
16946
|
-
var getOutputFilePathFromEnv = getEnvironmentVariableFactory({
|
|
16947
|
-
variableName: "WRANGLER_OUTPUT_FILE_PATH"
|
|
16948
|
-
});
|
|
16949
|
-
var getCIMatchTag = getEnvironmentVariableFactory({
|
|
16950
|
-
variableName: "WRANGLER_CI_MATCH_TAG"
|
|
16951
|
-
});
|
|
16952
|
-
var getCIOverrideName = getEnvironmentVariableFactory({
|
|
16953
|
-
variableName: "WRANGLER_CI_OVERRIDE_NAME"
|
|
16954
|
-
});
|
|
16955
|
-
var getCIOverrideNetworkModeHost = getEnvironmentVariableFactory({
|
|
16956
|
-
variableName: "WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST"
|
|
16957
|
-
});
|
|
16958
|
-
var getCIGeneratePreviewAlias = getEnvironmentVariableFactory({
|
|
16959
|
-
variableName: "WRANGLER_CI_GENERATE_PREVIEW_ALIAS",
|
|
16960
|
-
defaultValue: /* @__PURE__ */ __name(() => "false", "defaultValue"),
|
|
16961
|
-
choices: ["true", "false"]
|
|
16962
|
-
});
|
|
16963
|
-
var getWorkersCIBranchName = getEnvironmentVariableFactory({
|
|
16964
|
-
variableName: "WORKERS_CI_BRANCH"
|
|
16965
|
-
});
|
|
16966
|
-
var getBuildConditionsFromEnv = getEnvironmentVariableFactory({
|
|
16967
|
-
variableName: "WRANGLER_BUILD_CONDITIONS"
|
|
16968
|
-
});
|
|
16969
|
-
var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
|
|
16970
|
-
variableName: "WRANGLER_BUILD_PLATFORM"
|
|
16971
|
-
});
|
|
16972
|
-
var getRegistryPath = getEnvironmentVariableFactory({
|
|
16973
|
-
variableName: "WRANGLER_REGISTRY_PATH",
|
|
16974
|
-
defaultValue() {
|
|
16975
|
-
return path2__default.join(getGlobalConfigPath(), "registry");
|
|
16976
|
-
}
|
|
16977
|
-
});
|
|
16978
|
-
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
|
|
16979
|
-
variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES"
|
|
16980
|
-
});
|
|
16981
|
-
var getDockerPath = getEnvironmentVariableFactory({
|
|
16982
|
-
variableName: "WRANGLER_DOCKER_BIN",
|
|
16983
|
-
defaultValue() {
|
|
16984
|
-
return "docker";
|
|
16985
|
-
}
|
|
16986
|
-
});
|
|
16987
|
-
var getSubdomainMixedStateCheckDisabled = getBooleanEnvironmentVariableFactory({
|
|
16988
|
-
variableName: "WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK",
|
|
16989
|
-
defaultValue: false
|
|
16990
|
-
});
|
|
16991
|
-
var getCloudflareLoadDevVarsFromDotEnv = getBooleanEnvironmentVariableFactory({
|
|
16992
|
-
variableName: "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV",
|
|
16993
|
-
defaultValue: true
|
|
16994
|
-
});
|
|
16995
|
-
var getCloudflareIncludeProcessEnvFromEnv = getBooleanEnvironmentVariableFactory({
|
|
16996
|
-
variableName: "CLOUDFLARE_INCLUDE_PROCESS_ENV",
|
|
16997
|
-
defaultValue: false
|
|
16998
|
-
});
|
|
16999
|
-
var getTraceHeader = getEnvironmentVariableFactory({
|
|
17000
|
-
variableName: "WRANGLER_TRACE_ID"
|
|
17001
|
-
});
|
|
17002
|
-
var getDisableConfigWatching = getBooleanEnvironmentVariableFactory({
|
|
17003
|
-
variableName: "WRANGLER_CI_DISABLE_CONFIG_WATCHING",
|
|
17004
|
-
defaultValue: false
|
|
17005
|
-
});
|
|
17006
|
-
var getWranglerHideBanner = getBooleanEnvironmentVariableFactory({
|
|
17007
|
-
variableName: "WRANGLER_HIDE_BANNER",
|
|
17008
|
-
defaultValue: false
|
|
17009
|
-
});
|
|
17010
|
-
var getCloudflareEnv = getEnvironmentVariableFactory({
|
|
17011
|
-
variableName: "CLOUDFLARE_ENV"
|
|
17012
|
-
});
|
|
17013
|
-
var getOpenNextDeployFromEnv = getEnvironmentVariableFactory({
|
|
17014
|
-
variableName: "OPEN_NEXT_DEPLOY"
|
|
17015
|
-
});
|
|
17016
|
-
var getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
17017
|
-
variableName: "X_LOCAL_EXPLORER",
|
|
17018
|
-
defaultValue: true
|
|
17019
|
-
});
|
|
17020
|
-
var getLocalObservabilityEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
17021
|
-
variableName: "X_LOCAL_OBSERVABILITY",
|
|
17022
|
-
defaultValue: true
|
|
17023
|
-
});
|
|
17024
|
-
var getBrowserRenderingHeadfulFromEnv = getBooleanEnvironmentVariableFactory({
|
|
17025
|
-
variableName: "X_BROWSER_HEADFUL",
|
|
17026
|
-
defaultValue: false
|
|
17027
|
-
});
|
|
17028
|
-
var getCfFetchEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
17029
|
-
variableName: "CLOUDFLARE_CF_FETCH_ENABLED",
|
|
17030
|
-
defaultValue: true
|
|
17031
|
-
});
|
|
17032
|
-
var getCfFetchPathFromEnv = getEnvironmentVariableFactory({
|
|
17033
|
-
variableName: "CLOUDFLARE_CF_FETCH_PATH"
|
|
17034
|
-
});
|
|
17035
|
-
var getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({
|
|
17036
|
-
variableName: "WRANGLER_CACHE_DIR"
|
|
17037
|
-
});
|
|
17038
|
-
var getCloudflaredPathFromEnv = getEnvironmentVariableFactory({
|
|
17039
|
-
variableName: "CLOUDFLARED_PATH"
|
|
17040
|
-
});
|
|
17041
|
-
|
|
17042
16814
|
// src/config/diagnostics.ts
|
|
17043
16815
|
var Diagnostics = class {
|
|
17044
16816
|
/**
|
|
@@ -17166,9 +16938,9 @@ Please add "${field}" to "env.${envName}".`
|
|
|
17166
16938
|
return rawEnv[field] ?? defaultValue;
|
|
17167
16939
|
}
|
|
17168
16940
|
__name(notInheritable, "notInheritable");
|
|
17169
|
-
function unwindPropertyPath(root,
|
|
16941
|
+
function unwindPropertyPath(root, path5) {
|
|
17170
16942
|
let container = root;
|
|
17171
|
-
const parts =
|
|
16943
|
+
const parts = path5.split(".");
|
|
17172
16944
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
17173
16945
|
if (!hasProperty(container, parts[i])) {
|
|
17174
16946
|
return;
|
|
@@ -17547,7 +17319,7 @@ function isPagesConfig(rawConfig) {
|
|
|
17547
17319
|
__name(isPagesConfig, "isPagesConfig");
|
|
17548
17320
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
17549
17321
|
const diagnostics = new Diagnostics(
|
|
17550
|
-
`Processing ${configPath ?
|
|
17322
|
+
`Processing ${configPath ? path__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`
|
|
17551
17323
|
);
|
|
17552
17324
|
const isRedirectedConfig2 = isRedirectedRawConfig(
|
|
17553
17325
|
rawConfig,
|
|
@@ -17806,13 +17578,13 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
17806
17578
|
// be configured in the Wrangler configuration file, but who knows, that may
|
|
17807
17579
|
// change in the future, so we do a check anyway
|
|
17808
17580
|
command && configPath ? Array.isArray(watch_dir) ? watch_dir.map(
|
|
17809
|
-
(dir2) =>
|
|
17581
|
+
(dir2) => path__default.relative(
|
|
17810
17582
|
process.cwd(),
|
|
17811
|
-
|
|
17583
|
+
path__default.join(path__default.dirname(configPath), `${dir2}`)
|
|
17812
17584
|
)
|
|
17813
|
-
) :
|
|
17585
|
+
) : path__default.relative(
|
|
17814
17586
|
process.cwd(),
|
|
17815
|
-
|
|
17587
|
+
path__default.join(path__default.dirname(configPath), `${watch_dir}`)
|
|
17816
17588
|
) : watch_dir
|
|
17817
17589
|
),
|
|
17818
17590
|
cwd
|
|
@@ -17820,11 +17592,11 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
17820
17592
|
}
|
|
17821
17593
|
__name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
17822
17594
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
17823
|
-
const configDir =
|
|
17595
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
17824
17596
|
if (rawMain !== void 0) {
|
|
17825
17597
|
if (typeof rawMain === "string") {
|
|
17826
|
-
const directory =
|
|
17827
|
-
return
|
|
17598
|
+
const directory = path__default.resolve(configDir);
|
|
17599
|
+
return path__default.resolve(directory, rawMain);
|
|
17828
17600
|
} else {
|
|
17829
17601
|
return rawMain;
|
|
17830
17602
|
}
|
|
@@ -17834,11 +17606,11 @@ function normalizeAndValidateMainField(configPath, rawMain) {
|
|
|
17834
17606
|
}
|
|
17835
17607
|
__name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
17836
17608
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
17837
|
-
const configDir =
|
|
17609
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
17838
17610
|
if (rawDir !== void 0) {
|
|
17839
17611
|
if (typeof rawDir === "string") {
|
|
17840
|
-
const directory =
|
|
17841
|
-
return
|
|
17612
|
+
const directory = path__default.resolve(configDir);
|
|
17613
|
+
return path__default.resolve(directory, rawDir);
|
|
17842
17614
|
} else {
|
|
17843
17615
|
return rawDir;
|
|
17844
17616
|
}
|
|
@@ -17848,11 +17620,11 @@ function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
|
17848
17620
|
}
|
|
17849
17621
|
__name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
17850
17622
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
17851
|
-
const configDir =
|
|
17623
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
17852
17624
|
if (rawPagesDir !== void 0) {
|
|
17853
17625
|
if (typeof rawPagesDir === "string") {
|
|
17854
|
-
const directory =
|
|
17855
|
-
return
|
|
17626
|
+
const directory = path__default.resolve(configDir);
|
|
17627
|
+
return path__default.resolve(directory, rawPagesDir);
|
|
17856
17628
|
} else {
|
|
17857
17629
|
return rawPagesDir;
|
|
17858
17630
|
}
|
|
@@ -18007,9 +17779,9 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
18007
17779
|
`site.entry-point`,
|
|
18008
17780
|
`Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
18009
17781
|
\`\`\`
|
|
18010
|
-
main = "${
|
|
17782
|
+
main = "${path__default.join(
|
|
18011
17783
|
String(legacySiteEntryPoint) || "workers-site",
|
|
18012
|
-
|
|
17784
|
+
path__default.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js"
|
|
18013
17785
|
)}"
|
|
18014
17786
|
\`\`\``,
|
|
18015
17787
|
false,
|
|
@@ -18034,9 +17806,9 @@ Delete the deprecated \`site.entry-point\` field from your config.`
|
|
|
18034
17806
|
);
|
|
18035
17807
|
}
|
|
18036
17808
|
if (configPath && siteEntryPoint) {
|
|
18037
|
-
siteEntryPoint =
|
|
17809
|
+
siteEntryPoint = path__default.relative(
|
|
18038
17810
|
process.cwd(),
|
|
18039
|
-
|
|
17811
|
+
path__default.join(path__default.dirname(configPath), siteEntryPoint)
|
|
18040
17812
|
);
|
|
18041
17813
|
}
|
|
18042
17814
|
return {
|
|
@@ -18082,9 +17854,9 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
18082
17854
|
for (const [name, filePath] of Object.entries(rawMapping)) {
|
|
18083
17855
|
if (isString(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
18084
17856
|
if (configPath) {
|
|
18085
|
-
mapping[name] = configPath ?
|
|
17857
|
+
mapping[name] = configPath ? path__default.relative(
|
|
18086
17858
|
process.cwd(),
|
|
18087
|
-
|
|
17859
|
+
path__default.join(path__default.dirname(configPath), filePath)
|
|
18088
17860
|
) : filePath;
|
|
18089
17861
|
}
|
|
18090
17862
|
}
|
|
@@ -19160,9 +18932,9 @@ function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPa
|
|
|
19160
18932
|
isString,
|
|
19161
18933
|
void 0
|
|
19162
18934
|
);
|
|
19163
|
-
return configPath && tsconfig ?
|
|
18935
|
+
return configPath && tsconfig ? path__default.relative(
|
|
19164
18936
|
process.cwd(),
|
|
19165
|
-
|
|
18937
|
+
path__default.join(path__default.dirname(configPath), tsconfig)
|
|
19166
18938
|
) : tsconfig;
|
|
19167
18939
|
}
|
|
19168
18940
|
__name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
@@ -19623,6 +19395,20 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name((diagnostics, field, v
|
|
|
19623
19395
|
return isValid;
|
|
19624
19396
|
}, "validateDurableObjectBinding");
|
|
19625
19397
|
var workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
|
|
19398
|
+
function validateWorkflowRetentionValue(diagnostics, field, key, value) {
|
|
19399
|
+
const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
19400
|
+
const isValidString = typeof value === "string" && value.length > 0;
|
|
19401
|
+
if (isValidNumber || isValidString) {
|
|
19402
|
+
return true;
|
|
19403
|
+
}
|
|
19404
|
+
diagnostics.errors.push(
|
|
19405
|
+
`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(
|
|
19406
|
+
value
|
|
19407
|
+
)}.`
|
|
19408
|
+
);
|
|
19409
|
+
return false;
|
|
19410
|
+
}
|
|
19411
|
+
__name(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
|
|
19626
19412
|
var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
19627
19413
|
if (typeof value !== "object" || value === null) {
|
|
19628
19414
|
diagnostics.errors.push(
|
|
@@ -19736,13 +19522,69 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
19736
19522
|
);
|
|
19737
19523
|
}
|
|
19738
19524
|
}
|
|
19525
|
+
if (hasProperty(value, "default_retention") && value.default_retention !== void 0) {
|
|
19526
|
+
if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
|
|
19527
|
+
diagnostics.errors.push(
|
|
19528
|
+
`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(
|
|
19529
|
+
value
|
|
19530
|
+
)}.`
|
|
19531
|
+
);
|
|
19532
|
+
isValid = false;
|
|
19533
|
+
} else {
|
|
19534
|
+
const defaultRetention = value.default_retention;
|
|
19535
|
+
for (const key of ["success_retention", "error_retention"]) {
|
|
19536
|
+
if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(
|
|
19537
|
+
diagnostics,
|
|
19538
|
+
field,
|
|
19539
|
+
key,
|
|
19540
|
+
defaultRetention[key]
|
|
19541
|
+
)) {
|
|
19542
|
+
isValid = false;
|
|
19543
|
+
}
|
|
19544
|
+
}
|
|
19545
|
+
validateAdditionalProperties(
|
|
19546
|
+
diagnostics,
|
|
19547
|
+
`${field}.default_retention`,
|
|
19548
|
+
Object.keys(defaultRetention),
|
|
19549
|
+
["success_retention", "error_retention"]
|
|
19550
|
+
);
|
|
19551
|
+
}
|
|
19552
|
+
}
|
|
19553
|
+
if (hasProperty(value, "concurrency") && value.concurrency !== void 0) {
|
|
19554
|
+
if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
|
|
19555
|
+
diagnostics.errors.push(
|
|
19556
|
+
`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(
|
|
19557
|
+
value
|
|
19558
|
+
)}.`
|
|
19559
|
+
);
|
|
19560
|
+
isValid = false;
|
|
19561
|
+
} else {
|
|
19562
|
+
const concurrency = value.concurrency;
|
|
19563
|
+
if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
|
|
19564
|
+
diagnostics.errors.push(
|
|
19565
|
+
`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(
|
|
19566
|
+
concurrency.limit
|
|
19567
|
+
)}.`
|
|
19568
|
+
);
|
|
19569
|
+
isValid = false;
|
|
19570
|
+
}
|
|
19571
|
+
validateAdditionalProperties(
|
|
19572
|
+
diagnostics,
|
|
19573
|
+
`${field}.concurrency`,
|
|
19574
|
+
Object.keys(concurrency),
|
|
19575
|
+
["limit"]
|
|
19576
|
+
);
|
|
19577
|
+
}
|
|
19578
|
+
}
|
|
19739
19579
|
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
19740
19580
|
"binding",
|
|
19741
19581
|
"name",
|
|
19742
19582
|
"class_name",
|
|
19743
19583
|
"script_name",
|
|
19744
19584
|
"limits",
|
|
19745
|
-
"
|
|
19585
|
+
"concurrency",
|
|
19586
|
+
"schedules",
|
|
19587
|
+
"default_retention"
|
|
19746
19588
|
]);
|
|
19747
19589
|
return isValid;
|
|
19748
19590
|
}, "validateWorkflowBinding");
|
|
@@ -20167,9 +20009,9 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
20167
20009
|
let resolvedBuildContextPath = void 0;
|
|
20168
20010
|
try {
|
|
20169
20011
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
20170
|
-
const baseDir = configPath ?
|
|
20171
|
-
resolvedImage =
|
|
20172
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
20012
|
+
const baseDir = configPath ? path__default.dirname(configPath) : process.cwd();
|
|
20013
|
+
resolvedImage = path__default.resolve(baseDir, resolvedImage);
|
|
20014
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path__default.resolve(baseDir, containerAppOptional.image_build_context) : path__default.dirname(resolvedImage);
|
|
20173
20015
|
}
|
|
20174
20016
|
} catch (err) {
|
|
20175
20017
|
if (err instanceof Error && err.message) {
|
|
@@ -22594,6 +22436,13 @@ var validateObservability = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
22594
22436
|
val.head_sampling_rate,
|
|
22595
22437
|
"number"
|
|
22596
22438
|
) && isValid;
|
|
22439
|
+
isValid = validateOptionalProperty(
|
|
22440
|
+
diagnostics,
|
|
22441
|
+
field,
|
|
22442
|
+
"redact_query_string",
|
|
22443
|
+
val.redact_query_string,
|
|
22444
|
+
"boolean"
|
|
22445
|
+
) && isValid;
|
|
22597
22446
|
isValid = validateOptionalProperty(diagnostics, field, "logs", val.logs, "object") && isValid;
|
|
22598
22447
|
isValid = validateOptionalProperty(
|
|
22599
22448
|
diagnostics,
|
|
@@ -22605,6 +22454,7 @@ var validateObservability = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
22605
22454
|
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
|
|
22606
22455
|
"enabled",
|
|
22607
22456
|
"head_sampling_rate",
|
|
22457
|
+
"redact_query_string",
|
|
22608
22458
|
"logs",
|
|
22609
22459
|
"traces"
|
|
22610
22460
|
]) && isValid;
|
|
@@ -22988,8 +22838,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
|
|
|
22988
22838
|
}
|
|
22989
22839
|
__name(isRemoteValid, "isRemoteValid");
|
|
22990
22840
|
function isDockerfile(imagePath, configPath) {
|
|
22991
|
-
const baseDir = configPath ?
|
|
22992
|
-
const maybeDockerfile =
|
|
22841
|
+
const baseDir = configPath ? path__default.dirname(configPath) : process.cwd();
|
|
22842
|
+
const maybeDockerfile = path__default.resolve(baseDir, imagePath);
|
|
22993
22843
|
if (fs2.existsSync(maybeDockerfile)) {
|
|
22994
22844
|
if (isDirectory(maybeDockerfile)) {
|
|
22995
22845
|
throw new UserError(
|
|
@@ -23082,6 +22932,56 @@ function getBindingLocalSupport(type) {
|
|
|
23082
22932
|
return "local-only";
|
|
23083
22933
|
}
|
|
23084
22934
|
__name(getBindingLocalSupport, "getBindingLocalSupport");
|
|
22935
|
+
function validateBindingRemoteSetting(type, remote, warn) {
|
|
22936
|
+
const support = getBindingLocalSupport(type);
|
|
22937
|
+
switch (support) {
|
|
22938
|
+
case "local-and-remote":
|
|
22939
|
+
return;
|
|
22940
|
+
case "local-only":
|
|
22941
|
+
if (remote === true) {
|
|
22942
|
+
throw new UserError(
|
|
22943
|
+
`${getBindingTypeFriendlyName(type)} bindings do not support accessing remote resources.`,
|
|
22944
|
+
{
|
|
22945
|
+
telemetryMessage: "utils bindings unsupported remote resources"
|
|
22946
|
+
}
|
|
22947
|
+
);
|
|
22948
|
+
}
|
|
22949
|
+
return;
|
|
22950
|
+
case "remote":
|
|
22951
|
+
if (remote === false) {
|
|
22952
|
+
throw new UserError(
|
|
22953
|
+
`${getBindingTypeFriendlyName(type)} bindings do not support local development. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`,
|
|
22954
|
+
{
|
|
22955
|
+
telemetryMessage: "utils bindings unsupported local development"
|
|
22956
|
+
}
|
|
22957
|
+
);
|
|
22958
|
+
}
|
|
22959
|
+
if (remote === void 0) {
|
|
22960
|
+
warn(
|
|
22961
|
+
`${getBindingTypeFriendlyName(type)} bindings do not support local development, and so parts of your Worker may not work correctly. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`
|
|
22962
|
+
);
|
|
22963
|
+
}
|
|
22964
|
+
return;
|
|
22965
|
+
case "DO-NOT-USE-this-resource-will-never-have-a-local-simulator":
|
|
22966
|
+
if (remote === false) {
|
|
22967
|
+
throw new UserError(
|
|
22968
|
+
`${getBindingTypeFriendlyName(type)} bindings do not support local development. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`,
|
|
22969
|
+
{
|
|
22970
|
+
telemetryMessage: "utils bindings unsupported local development always remote"
|
|
22971
|
+
}
|
|
22972
|
+
);
|
|
22973
|
+
}
|
|
22974
|
+
if (remote === void 0) {
|
|
22975
|
+
warn(
|
|
22976
|
+
`${getBindingTypeFriendlyName(type)} bindings always access remote resources, and so may incur usage charges even in local dev. To suppress this warning, set \`remote: true\` for the binding definition in your configuration file.`
|
|
22977
|
+
);
|
|
22978
|
+
}
|
|
22979
|
+
return;
|
|
22980
|
+
default:
|
|
22981
|
+
assertNever(support);
|
|
22982
|
+
}
|
|
22983
|
+
}
|
|
22984
|
+
__name(validateBindingRemoteSetting, "validateBindingRemoteSetting");
|
|
23085
22985
|
|
|
23086
22986
|
// src/config/validation-pages.ts
|
|
23087
22987
|
var supportedPagesConfigFields = [
|
|
@@ -23215,7 +23115,7 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
23215
23115
|
__name(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
23216
23116
|
function getPackagePath(packageName, projectPath) {
|
|
23217
23117
|
try {
|
|
23218
|
-
return
|
|
23118
|
+
return path__default.dirname(
|
|
23219
23119
|
__require.resolve(`${packageName}/package.json`, {
|
|
23220
23120
|
paths: [projectPath]
|
|
23221
23121
|
})
|
|
@@ -23223,7 +23123,7 @@ function getPackagePath(packageName, projectPath) {
|
|
|
23223
23123
|
} catch {
|
|
23224
23124
|
}
|
|
23225
23125
|
try {
|
|
23226
|
-
return
|
|
23126
|
+
return path__default.dirname(
|
|
23227
23127
|
__require.resolve(packageName, {
|
|
23228
23128
|
paths: [projectPath]
|
|
23229
23129
|
})
|
|
@@ -23231,14 +23131,14 @@ function getPackagePath(packageName, projectPath) {
|
|
|
23231
23131
|
} catch {
|
|
23232
23132
|
}
|
|
23233
23133
|
try {
|
|
23234
|
-
const candidate =
|
|
23134
|
+
const candidate = path__default.join(
|
|
23235
23135
|
projectPath,
|
|
23236
23136
|
"node_modules",
|
|
23237
23137
|
packageName,
|
|
23238
23138
|
"package.json"
|
|
23239
23139
|
);
|
|
23240
23140
|
if (statSync(candidate).isFile()) {
|
|
23241
|
-
return
|
|
23141
|
+
return path__default.dirname(candidate);
|
|
23242
23142
|
}
|
|
23243
23143
|
} catch {
|
|
23244
23144
|
}
|
|
@@ -23277,9 +23177,9 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
23277
23177
|
__name(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
23278
23178
|
function findFileUp(name, startDir, lastDir) {
|
|
23279
23179
|
let dir2 = startDir;
|
|
23280
|
-
const root =
|
|
23180
|
+
const root = path__default.parse(dir2).root;
|
|
23281
23181
|
while (true) {
|
|
23282
|
-
const candidate =
|
|
23182
|
+
const candidate = path__default.join(dir2, name);
|
|
23283
23183
|
try {
|
|
23284
23184
|
if (statSync(candidate).isFile()) {
|
|
23285
23185
|
return candidate;
|
|
@@ -23289,7 +23189,7 @@ function findFileUp(name, startDir, lastDir) {
|
|
|
23289
23189
|
if (lastDir !== void 0 && dir2 === lastDir) {
|
|
23290
23190
|
break;
|
|
23291
23191
|
}
|
|
23292
|
-
const parent =
|
|
23192
|
+
const parent = path__default.dirname(dir2);
|
|
23293
23193
|
if (parent === dir2 || dir2 === root) {
|
|
23294
23194
|
break;
|
|
23295
23195
|
}
|
|
@@ -23298,159 +23198,1271 @@ function findFileUp(name, startDir, lastDir) {
|
|
|
23298
23198
|
return void 0;
|
|
23299
23199
|
}
|
|
23300
23200
|
__name(findFileUp, "findFileUp");
|
|
23301
|
-
function isCompatDate(str) {
|
|
23302
|
-
return /^\d{4}-\d{2}-\d{2}$/.test(str);
|
|
23303
|
-
}
|
|
23304
|
-
__name(isCompatDate, "isCompatDate");
|
|
23305
|
-
function formatCompatibilityDate(date5) {
|
|
23306
|
-
const compatDate = date5.toISOString().slice(0, 10);
|
|
23307
|
-
assert2(isCompatDate(compatDate));
|
|
23308
|
-
return compatDate;
|
|
23309
|
-
}
|
|
23310
|
-
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
|
23311
|
-
function getTodaysCompatDate() {
|
|
23312
|
-
return formatCompatibilityDate(/* @__PURE__ */ new Date());
|
|
23313
|
-
}
|
|
23314
|
-
__name(getTodaysCompatDate, "getTodaysCompatDate");
|
|
23315
|
-
var NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
23316
|
-
function isNodejsCompatDefaultOn(compatibilityDate) {
|
|
23317
|
-
return compatibilityDate !== void 0 && compatibilityDate >= NODEJS_COMPAT_DEFAULT_ON_DATE;
|
|
23318
|
-
}
|
|
23319
|
-
__name(isNodejsCompatDefaultOn, "isNodejsCompatDefaultOn");
|
|
23320
|
-
var NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
|
|
23321
|
-
function resolveNodejsCompat(compatibilityDate, compatibilityFlags) {
|
|
23322
|
-
const isDefaultOn = isNodejsCompatDefaultOn(compatibilityDate);
|
|
23323
|
-
const isNodejsCompatEnabled = compatibilityFlags.includes("nodejs_compat") || isDefaultOn && !compatibilityFlags.includes("no_nodejs_compat");
|
|
23324
|
-
const isNodejsCompatV2Enabled = compatibilityFlags.includes("nodejs_compat_v2") || !compatibilityFlags.includes("no_nodejs_compat_v2") && (isDefaultOn || isNodejsCompatEnabled && compatibilityDate >= NODEJS_COMPAT_V2_SWITCH_OVER_DATE);
|
|
23325
|
-
return { isNodejsCompatEnabled, isNodejsCompatV2Enabled };
|
|
23326
|
-
}
|
|
23327
|
-
__name(resolveNodejsCompat, "resolveNodejsCompat");
|
|
23328
|
-
function stripRedundantNodejsCompatFlags(compatibilityDate, compatibilityFlags) {
|
|
23329
|
-
if (!isNodejsCompatDefaultOn(compatibilityDate)) {
|
|
23330
|
-
return compatibilityFlags;
|
|
23331
|
-
}
|
|
23332
|
-
const redundantFlags = ["nodejs_compat", "nodejs_compat_v2"].filter(
|
|
23333
|
-
(flag) => !compatibilityFlags.includes(`no_${flag}`)
|
|
23334
|
-
);
|
|
23335
|
-
return compatibilityFlags.filter((flag) => !redundantFlags.includes(flag));
|
|
23336
|
-
}
|
|
23337
|
-
__name(stripRedundantNodejsCompatFlags, "stripRedundantNodejsCompatFlags");
|
|
23338
|
-
|
|
23339
|
-
// src/is-interactive.ts
|
|
23340
|
-
var import_ci_info = __toESM(require_ci_info());
|
|
23341
|
-
function isTtyInteractive() {
|
|
23342
|
-
try {
|
|
23343
|
-
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
23344
|
-
} catch {
|
|
23345
|
-
return false;
|
|
23346
|
-
}
|
|
23347
|
-
}
|
|
23348
|
-
__name(isTtyInteractive, "isTtyInteractive");
|
|
23349
|
-
function isInteractive() {
|
|
23350
|
-
if (import_ci_info.default.CLOUDFLARE_PAGES || import_ci_info.default.CLOUDFLARE_WORKERS) {
|
|
23351
|
-
return false;
|
|
23352
|
-
}
|
|
23353
|
-
return isTtyInteractive();
|
|
23354
|
-
}
|
|
23355
|
-
__name(isInteractive, "isInteractive");
|
|
23356
|
-
function isNonInteractiveOrCI() {
|
|
23357
|
-
return !isInteractive() || import_ci_info.default.isCI;
|
|
23358
|
-
}
|
|
23359
|
-
__name(isNonInteractiveOrCI, "isNonInteractiveOrCI");
|
|
23360
|
-
function isCI() {
|
|
23361
|
-
return import_ci_info.default.isCI;
|
|
23362
|
-
}
|
|
23363
|
-
__name(isCI, "isCI");
|
|
23364
23201
|
|
|
23365
|
-
// src/
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
const
|
|
23373
|
-
|
|
23374
|
-
if (
|
|
23375
|
-
|
|
23376
|
-
if (envCacheDir) {
|
|
23377
|
-
return envCacheDir;
|
|
23378
|
-
}
|
|
23379
|
-
}
|
|
23380
|
-
const closestNodeModulesDirectory = dir("node_modules");
|
|
23381
|
-
const nodeModulesCache = closestNodeModulesDirectory ? path2.join(closestNodeModulesDirectory, ".cache", namespace) : null;
|
|
23382
|
-
const localCache = path2.join(process.cwd(), `.${namespace}`, "cache");
|
|
23383
|
-
if (nodeModulesCache && existsSync(nodeModulesCache)) {
|
|
23384
|
-
return nodeModulesCache;
|
|
23385
|
-
}
|
|
23386
|
-
if (existsSync(localCache)) {
|
|
23387
|
-
return localCache;
|
|
23388
|
-
}
|
|
23389
|
-
if (nodeModulesCache) {
|
|
23390
|
-
return nodeModulesCache;
|
|
23202
|
+
// src/binding-utils.ts
|
|
23203
|
+
function assertNever3(_value) {
|
|
23204
|
+
}
|
|
23205
|
+
__name(assertNever3, "assertNever");
|
|
23206
|
+
function convertConfigToBindings(config2, options) {
|
|
23207
|
+
const { usePreviewIds = false, pages = false } = options ?? {};
|
|
23208
|
+
const output = {};
|
|
23209
|
+
const configIterable = Object.entries(config2);
|
|
23210
|
+
for (const [type, info] of configIterable) {
|
|
23211
|
+
if (info === void 0) {
|
|
23212
|
+
continue;
|
|
23391
23213
|
}
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
);
|
|
23403
|
-
cacheMessageShown = true;
|
|
23214
|
+
switch (type) {
|
|
23215
|
+
case "vars": {
|
|
23216
|
+
for (const [key, value] of Object.entries(info)) {
|
|
23217
|
+
if (typeof value === "string") {
|
|
23218
|
+
output[key] = { type: "plain_text", value };
|
|
23219
|
+
} else {
|
|
23220
|
+
output[key] = { type: "json", value };
|
|
23221
|
+
}
|
|
23222
|
+
}
|
|
23223
|
+
break;
|
|
23404
23224
|
}
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
}
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23225
|
+
case "kv_namespaces": {
|
|
23226
|
+
for (const { binding, ...x } of info) {
|
|
23227
|
+
output[binding] = {
|
|
23228
|
+
type: "kv_namespace",
|
|
23229
|
+
...x,
|
|
23230
|
+
id: usePreviewIds ? x.preview_id ?? x.id : x.id
|
|
23231
|
+
};
|
|
23232
|
+
}
|
|
23233
|
+
break;
|
|
23234
|
+
}
|
|
23235
|
+
case "send_email": {
|
|
23236
|
+
if (pages) {
|
|
23237
|
+
break;
|
|
23238
|
+
}
|
|
23239
|
+
for (const {
|
|
23240
|
+
name,
|
|
23241
|
+
destination_address,
|
|
23242
|
+
allowed_destination_addresses,
|
|
23243
|
+
allowed_sender_addresses,
|
|
23244
|
+
remote
|
|
23245
|
+
} of info) {
|
|
23246
|
+
const shared = {
|
|
23247
|
+
type: "send_email",
|
|
23248
|
+
allowed_sender_addresses,
|
|
23249
|
+
remote
|
|
23250
|
+
};
|
|
23251
|
+
if (destination_address !== void 0) {
|
|
23252
|
+
output[name] = { ...shared, destination_address };
|
|
23253
|
+
} else if (allowed_destination_addresses !== void 0) {
|
|
23254
|
+
output[name] = { ...shared, allowed_destination_addresses };
|
|
23255
|
+
} else {
|
|
23256
|
+
output[name] = shared;
|
|
23257
|
+
}
|
|
23258
|
+
}
|
|
23259
|
+
break;
|
|
23260
|
+
}
|
|
23261
|
+
case "wasm_modules": {
|
|
23262
|
+
if (pages) {
|
|
23263
|
+
break;
|
|
23264
|
+
}
|
|
23265
|
+
for (const [key, value] of Object.entries(info)) {
|
|
23266
|
+
if (typeof value === "string") {
|
|
23267
|
+
output[key] = { type: "wasm_module", source: { path: value } };
|
|
23268
|
+
} else {
|
|
23269
|
+
output[key] = { type: "wasm_module", source: { contents: value } };
|
|
23270
|
+
}
|
|
23271
|
+
}
|
|
23272
|
+
break;
|
|
23273
|
+
}
|
|
23274
|
+
case "text_blobs": {
|
|
23275
|
+
if (pages) {
|
|
23276
|
+
break;
|
|
23277
|
+
}
|
|
23278
|
+
for (const [key, value] of Object.entries(info)) {
|
|
23279
|
+
output[key] = { type: "text_blob", source: { path: value } };
|
|
23280
|
+
}
|
|
23281
|
+
break;
|
|
23282
|
+
}
|
|
23283
|
+
case "data_blobs": {
|
|
23284
|
+
if (pages) {
|
|
23285
|
+
break;
|
|
23286
|
+
}
|
|
23287
|
+
for (const [key, value] of Object.entries(info)) {
|
|
23288
|
+
if (typeof value === "string") {
|
|
23289
|
+
output[key] = { type: "data_blob", source: { path: value } };
|
|
23290
|
+
} else {
|
|
23291
|
+
output[key] = { type: "data_blob", source: { contents: value } };
|
|
23292
|
+
}
|
|
23293
|
+
}
|
|
23294
|
+
break;
|
|
23295
|
+
}
|
|
23296
|
+
case "browser": {
|
|
23297
|
+
const { binding, ...x } = info;
|
|
23298
|
+
output[binding] = { type: "browser", ...x };
|
|
23299
|
+
break;
|
|
23300
|
+
}
|
|
23301
|
+
case "durable_objects": {
|
|
23302
|
+
for (const { name, ...x } of info.bindings ?? []) {
|
|
23303
|
+
output[name] = { type: "durable_object_namespace", ...x };
|
|
23304
|
+
}
|
|
23305
|
+
break;
|
|
23306
|
+
}
|
|
23307
|
+
case "workflows": {
|
|
23308
|
+
for (const { binding, ...x } of info) {
|
|
23309
|
+
output[binding] = { type: "workflow", ...x };
|
|
23310
|
+
}
|
|
23311
|
+
break;
|
|
23312
|
+
}
|
|
23313
|
+
case "queues": {
|
|
23314
|
+
for (const { binding, ...x } of info.producers ?? []) {
|
|
23315
|
+
output[binding] = {
|
|
23316
|
+
type: "queue",
|
|
23317
|
+
queue_name: x.queue,
|
|
23318
|
+
...x
|
|
23319
|
+
};
|
|
23320
|
+
}
|
|
23321
|
+
break;
|
|
23322
|
+
}
|
|
23323
|
+
case "r2_buckets": {
|
|
23324
|
+
for (const { binding, ...x } of info) {
|
|
23325
|
+
output[binding] = {
|
|
23326
|
+
type: "r2_bucket",
|
|
23327
|
+
...x,
|
|
23328
|
+
bucket_name: usePreviewIds ? x.preview_bucket_name ?? x.bucket_name : x.bucket_name
|
|
23329
|
+
};
|
|
23330
|
+
}
|
|
23331
|
+
break;
|
|
23332
|
+
}
|
|
23333
|
+
case "d1_databases": {
|
|
23334
|
+
for (const { binding, ...x } of info) {
|
|
23335
|
+
output[binding] = {
|
|
23336
|
+
type: "d1",
|
|
23337
|
+
...x,
|
|
23338
|
+
database_id: usePreviewIds ? x.preview_database_id ?? x.database_id : x.database_id
|
|
23339
|
+
};
|
|
23340
|
+
}
|
|
23341
|
+
break;
|
|
23342
|
+
}
|
|
23343
|
+
case "services": {
|
|
23344
|
+
for (const { binding, ...x } of info) {
|
|
23345
|
+
output[binding] = { type: "service", ...x };
|
|
23346
|
+
}
|
|
23347
|
+
break;
|
|
23348
|
+
}
|
|
23349
|
+
case "analytics_engine_datasets": {
|
|
23350
|
+
for (const { binding, ...x } of info) {
|
|
23351
|
+
output[binding] = { type: "analytics_engine", ...x };
|
|
23352
|
+
}
|
|
23353
|
+
break;
|
|
23354
|
+
}
|
|
23355
|
+
case "dispatch_namespaces": {
|
|
23356
|
+
if (pages) {
|
|
23357
|
+
break;
|
|
23358
|
+
}
|
|
23359
|
+
for (const { binding, ...x } of info) {
|
|
23360
|
+
output[binding] = { type: "dispatch_namespace", ...x };
|
|
23361
|
+
}
|
|
23362
|
+
break;
|
|
23363
|
+
}
|
|
23364
|
+
case "mtls_certificates": {
|
|
23365
|
+
for (const { binding, ...x } of info) {
|
|
23366
|
+
output[binding] = { type: "mtls_certificate", ...x };
|
|
23367
|
+
}
|
|
23368
|
+
break;
|
|
23369
|
+
}
|
|
23370
|
+
case "logfwdr": {
|
|
23371
|
+
if (pages) {
|
|
23372
|
+
break;
|
|
23373
|
+
}
|
|
23374
|
+
for (const { name, ...x } of info.bindings ?? []) {
|
|
23375
|
+
output[name] = { type: "logfwdr", ...x };
|
|
23376
|
+
}
|
|
23377
|
+
break;
|
|
23378
|
+
}
|
|
23379
|
+
case "ai": {
|
|
23380
|
+
const { binding, ...x } = info;
|
|
23381
|
+
output[binding] = { type: "ai", ...x };
|
|
23382
|
+
break;
|
|
23383
|
+
}
|
|
23384
|
+
case "images": {
|
|
23385
|
+
const { binding, ...x } = info;
|
|
23386
|
+
output[binding] = { type: "images", ...x };
|
|
23387
|
+
break;
|
|
23388
|
+
}
|
|
23389
|
+
case "stream": {
|
|
23390
|
+
const { binding, ...x } = info;
|
|
23391
|
+
output[binding] = { type: "stream", ...x };
|
|
23392
|
+
break;
|
|
23393
|
+
}
|
|
23394
|
+
case "version_metadata": {
|
|
23395
|
+
const { binding, ...x } = info;
|
|
23396
|
+
output[binding] = { type: "version_metadata", ...x };
|
|
23397
|
+
break;
|
|
23398
|
+
}
|
|
23399
|
+
case "hyperdrive": {
|
|
23400
|
+
for (const { binding, ...x } of info) {
|
|
23401
|
+
output[binding] = { type: "hyperdrive", ...x };
|
|
23402
|
+
}
|
|
23403
|
+
break;
|
|
23404
|
+
}
|
|
23405
|
+
case "vectorize": {
|
|
23406
|
+
for (const { binding, ...x } of info) {
|
|
23407
|
+
output[binding] = { type: "vectorize", ...x };
|
|
23408
|
+
}
|
|
23409
|
+
break;
|
|
23410
|
+
}
|
|
23411
|
+
case "ai_search_namespaces": {
|
|
23412
|
+
for (const { binding, ...x } of info) {
|
|
23413
|
+
output[binding] = { type: "ai_search_namespace", ...x };
|
|
23414
|
+
}
|
|
23415
|
+
break;
|
|
23416
|
+
}
|
|
23417
|
+
case "ai_search": {
|
|
23418
|
+
for (const { binding, ...x } of info) {
|
|
23419
|
+
output[binding] = { type: "ai_search", ...x };
|
|
23420
|
+
}
|
|
23421
|
+
break;
|
|
23422
|
+
}
|
|
23423
|
+
case "websearch": {
|
|
23424
|
+
const { binding, ...x } = info;
|
|
23425
|
+
output[binding] = { type: "websearch", ...x };
|
|
23426
|
+
break;
|
|
23427
|
+
}
|
|
23428
|
+
case "agent_memory": {
|
|
23429
|
+
for (const { binding, ...x } of info) {
|
|
23430
|
+
output[binding] = { type: "agent_memory", ...x };
|
|
23431
|
+
}
|
|
23432
|
+
break;
|
|
23433
|
+
}
|
|
23434
|
+
case "unsafe": {
|
|
23435
|
+
if (pages) {
|
|
23436
|
+
break;
|
|
23437
|
+
}
|
|
23438
|
+
for (const { type: unsafeType, name, ...data } of info.bindings ?? []) {
|
|
23439
|
+
output[name] = { type: `unsafe_${unsafeType}`, ...data };
|
|
23440
|
+
}
|
|
23441
|
+
break;
|
|
23442
|
+
}
|
|
23443
|
+
case "assets": {
|
|
23444
|
+
if (pages) {
|
|
23445
|
+
break;
|
|
23446
|
+
}
|
|
23447
|
+
if (info.binding) {
|
|
23448
|
+
output[info.binding] = { type: "assets" };
|
|
23449
|
+
}
|
|
23450
|
+
break;
|
|
23451
|
+
}
|
|
23452
|
+
case "pipelines": {
|
|
23453
|
+
if (pages) {
|
|
23454
|
+
break;
|
|
23455
|
+
}
|
|
23456
|
+
for (const { binding, ...x } of info) {
|
|
23457
|
+
output[binding] = { type: "pipeline", ...x };
|
|
23458
|
+
}
|
|
23459
|
+
break;
|
|
23460
|
+
}
|
|
23461
|
+
case "secrets_store_secrets": {
|
|
23462
|
+
for (const { binding, ...x } of info) {
|
|
23463
|
+
output[binding] = { type: "secrets_store_secret", ...x };
|
|
23464
|
+
}
|
|
23465
|
+
break;
|
|
23466
|
+
}
|
|
23467
|
+
case "artifacts": {
|
|
23468
|
+
for (const { binding, ...x } of info) {
|
|
23469
|
+
output[binding] = { type: "artifacts", ...x };
|
|
23470
|
+
}
|
|
23471
|
+
break;
|
|
23472
|
+
}
|
|
23473
|
+
case "unsafe_hello_world": {
|
|
23474
|
+
if (pages) {
|
|
23475
|
+
break;
|
|
23476
|
+
}
|
|
23477
|
+
for (const { binding, ...x } of info) {
|
|
23478
|
+
output[binding] = { type: "unsafe_hello_world", ...x };
|
|
23479
|
+
}
|
|
23480
|
+
break;
|
|
23481
|
+
}
|
|
23482
|
+
case "flagship": {
|
|
23483
|
+
for (const { binding, ...x } of info) {
|
|
23484
|
+
output[binding] = { type: "flagship", ...x };
|
|
23485
|
+
}
|
|
23486
|
+
break;
|
|
23487
|
+
}
|
|
23488
|
+
case "ratelimits": {
|
|
23489
|
+
for (const { name, ...x } of info) {
|
|
23490
|
+
output[name] = { type: "ratelimit", ...x };
|
|
23491
|
+
}
|
|
23492
|
+
break;
|
|
23493
|
+
}
|
|
23494
|
+
case "worker_loaders": {
|
|
23495
|
+
for (const { binding, ...x } of info) {
|
|
23496
|
+
output[binding] = { type: "worker_loader", ...x };
|
|
23497
|
+
}
|
|
23498
|
+
break;
|
|
23499
|
+
}
|
|
23500
|
+
case "vpc_services": {
|
|
23501
|
+
for (const { binding, ...x } of info) {
|
|
23502
|
+
output[binding] = { type: "vpc_service", ...x };
|
|
23503
|
+
}
|
|
23504
|
+
break;
|
|
23505
|
+
}
|
|
23506
|
+
case "vpc_networks": {
|
|
23507
|
+
for (const { binding, ...x } of info) {
|
|
23508
|
+
output[binding] = { type: "vpc_network", ...x };
|
|
23509
|
+
}
|
|
23510
|
+
break;
|
|
23511
|
+
}
|
|
23512
|
+
case "media": {
|
|
23513
|
+
const { binding, ...x } = info;
|
|
23514
|
+
output[binding] = { type: "media", ...x };
|
|
23515
|
+
break;
|
|
23516
|
+
}
|
|
23517
|
+
}
|
|
23518
|
+
}
|
|
23519
|
+
return output;
|
|
23520
|
+
}
|
|
23521
|
+
__name(convertConfigToBindings, "convertConfigToBindings");
|
|
23522
|
+
function isUnsafeBindingType(type) {
|
|
23523
|
+
return type.startsWith("unsafe_");
|
|
23524
|
+
}
|
|
23525
|
+
__name(isUnsafeBindingType, "isUnsafeBindingType");
|
|
23526
|
+
var nameBindings = [
|
|
23527
|
+
"durable_object_namespace",
|
|
23528
|
+
"logfwdr",
|
|
23529
|
+
"ratelimit",
|
|
23530
|
+
"unsafe_ratelimit",
|
|
23531
|
+
"send_email"
|
|
23532
|
+
];
|
|
23533
|
+
function getBindingKey(type) {
|
|
23534
|
+
if (nameBindings.includes(type)) {
|
|
23535
|
+
return "name";
|
|
23536
|
+
}
|
|
23537
|
+
return "binding";
|
|
23538
|
+
}
|
|
23539
|
+
__name(getBindingKey, "getBindingKey");
|
|
23540
|
+
function extractBindingsOfType(type, bindings) {
|
|
23541
|
+
return Object.entries(bindings ?? {}).filter(
|
|
23542
|
+
(binding) => binding[1].type === type
|
|
23543
|
+
).map((binding) => ({
|
|
23544
|
+
...binding[1],
|
|
23545
|
+
[getBindingKey(type)]: binding[0]
|
|
23546
|
+
}));
|
|
23547
|
+
}
|
|
23548
|
+
__name(extractBindingsOfType, "extractBindingsOfType");
|
|
23549
|
+
function getBindings(config2, options) {
|
|
23550
|
+
if (!config2) {
|
|
23551
|
+
return {};
|
|
23552
|
+
}
|
|
23553
|
+
return convertConfigToBindings(config2, {
|
|
23554
|
+
usePreviewIds: false,
|
|
23555
|
+
pages: options?.pages
|
|
23556
|
+
});
|
|
23557
|
+
}
|
|
23558
|
+
__name(getBindings, "getBindings");
|
|
23559
|
+
var { dim, white } = chalk;
|
|
23560
|
+
var brandColor = chalk.hex("#BD5B08");
|
|
23561
|
+
var isConnectedStatusExplained = false;
|
|
23562
|
+
function printBindings(bindings, options) {
|
|
23563
|
+
const {
|
|
23564
|
+
containers = [],
|
|
23565
|
+
log,
|
|
23566
|
+
streamingTailConsumers = [],
|
|
23567
|
+
tailConsumers = []
|
|
23568
|
+
} = options;
|
|
23569
|
+
const context = options;
|
|
23570
|
+
let hasConnectionStatus = false;
|
|
23571
|
+
const isMultiWorker = context.isMultiWorker ?? false;
|
|
23572
|
+
const getMode = createGetMode({
|
|
23573
|
+
isProvisioning: context.provisioning,
|
|
23574
|
+
isLocalDev: context.local
|
|
23575
|
+
});
|
|
23576
|
+
const truncate2 = /* @__PURE__ */ __name((item, maxLength = 40) => {
|
|
23577
|
+
const s = typeof item === "string" ? item : JSON.stringify(item);
|
|
23578
|
+
if (s.length < maxLength) {
|
|
23579
|
+
return s;
|
|
23580
|
+
}
|
|
23581
|
+
return `${s.substring(0, maxLength - 3)}...`;
|
|
23582
|
+
}, "truncate");
|
|
23583
|
+
const output = [];
|
|
23584
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
23585
|
+
const durable_objects = extractBindingsOfType(
|
|
23586
|
+
"durable_object_namespace",
|
|
23587
|
+
bindings
|
|
23588
|
+
);
|
|
23589
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
23590
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
23591
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
23592
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
23593
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
23594
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
23595
|
+
const ai_search_namespaces = extractBindingsOfType(
|
|
23596
|
+
"ai_search_namespace",
|
|
23597
|
+
bindings
|
|
23598
|
+
);
|
|
23599
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
23600
|
+
const websearch = extractBindingsOfType("websearch", bindings);
|
|
23601
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
23602
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
23603
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
23604
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
23605
|
+
const secrets_store_secrets = extractBindingsOfType(
|
|
23606
|
+
"secrets_store_secret",
|
|
23607
|
+
bindings
|
|
23608
|
+
);
|
|
23609
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
23610
|
+
const services = extractBindingsOfType("service", bindings);
|
|
23611
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
23612
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
23613
|
+
const analytics_engine_datasets = extractBindingsOfType(
|
|
23614
|
+
"analytics_engine",
|
|
23615
|
+
bindings
|
|
23616
|
+
);
|
|
23617
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
23618
|
+
const browser = extractBindingsOfType("browser", bindings);
|
|
23619
|
+
const images = extractBindingsOfType("images", bindings);
|
|
23620
|
+
const stream = extractBindingsOfType("stream", bindings);
|
|
23621
|
+
const ai = extractBindingsOfType("ai", bindings);
|
|
23622
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings);
|
|
23623
|
+
const vars = Object.entries(bindings ?? {}).filter(
|
|
23624
|
+
([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text"
|
|
23625
|
+
).map(([name, binding]) => ({
|
|
23626
|
+
binding: name,
|
|
23627
|
+
...binding
|
|
23628
|
+
}));
|
|
23629
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
23630
|
+
const dispatch_namespaces = extractBindingsOfType(
|
|
23631
|
+
"dispatch_namespace",
|
|
23632
|
+
bindings
|
|
23633
|
+
);
|
|
23634
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
23635
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
23636
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
23637
|
+
const assets = extractBindingsOfType("assets", bindings);
|
|
23638
|
+
const unsafe_hello_world = extractBindingsOfType(
|
|
23639
|
+
"unsafe_hello_world",
|
|
23640
|
+
bindings
|
|
23641
|
+
);
|
|
23642
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
23643
|
+
const media = extractBindingsOfType("media", bindings);
|
|
23644
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
23645
|
+
const unsafe_bindings = Object.entries(bindings ?? {}).filter(
|
|
23646
|
+
([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world"
|
|
23647
|
+
).map(([name, binding]) => ({ name, ...binding }));
|
|
23648
|
+
if (data_blobs.length > 0) {
|
|
23649
|
+
output.push(
|
|
23650
|
+
...data_blobs.map(({ binding, source }) => ({
|
|
23651
|
+
name: binding,
|
|
23652
|
+
type: getBindingTypeFriendlyName("data_blob"),
|
|
23653
|
+
value: "contents" in source ? "<Buffer>" : truncate2(source.path),
|
|
23654
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
23655
|
+
}))
|
|
23656
|
+
);
|
|
23657
|
+
}
|
|
23658
|
+
if (durable_objects.length > 0) {
|
|
23659
|
+
output.push(
|
|
23660
|
+
...durable_objects.map(({ name, class_name, script_name }) => {
|
|
23661
|
+
let value = class_name;
|
|
23662
|
+
let mode = void 0;
|
|
23663
|
+
if (script_name) {
|
|
23664
|
+
if (context.local && context.registry !== null) {
|
|
23665
|
+
const registryDefinition = context.registry?.[script_name];
|
|
23666
|
+
hasConnectionStatus = true;
|
|
23667
|
+
if (registryDefinition && registryDefinition.debugPortAddress) {
|
|
23668
|
+
value += `, defined in ${script_name}`;
|
|
23669
|
+
mode = getMode({ isSimulatedLocally: true, connected: true });
|
|
23670
|
+
} else {
|
|
23671
|
+
value += `, defined in ${script_name}`;
|
|
23672
|
+
mode = getMode({ isSimulatedLocally: true, connected: false });
|
|
23673
|
+
}
|
|
23674
|
+
} else {
|
|
23675
|
+
value += `, defined in ${script_name}`;
|
|
23676
|
+
mode = getMode({ isSimulatedLocally: true });
|
|
23677
|
+
}
|
|
23678
|
+
} else {
|
|
23679
|
+
mode = getMode({ isSimulatedLocally: true });
|
|
23680
|
+
}
|
|
23681
|
+
return {
|
|
23682
|
+
name,
|
|
23683
|
+
type: getBindingTypeFriendlyName("durable_object_namespace"),
|
|
23684
|
+
value,
|
|
23685
|
+
mode
|
|
23686
|
+
};
|
|
23687
|
+
})
|
|
23688
|
+
);
|
|
23689
|
+
}
|
|
23690
|
+
if (workflows.length > 0) {
|
|
23691
|
+
output.push(
|
|
23692
|
+
...workflows.map(({ class_name, script_name, binding }) => {
|
|
23693
|
+
let value = class_name;
|
|
23694
|
+
if (script_name) {
|
|
23695
|
+
value += ` (defined in ${script_name})`;
|
|
23696
|
+
}
|
|
23697
|
+
return {
|
|
23698
|
+
name: binding,
|
|
23699
|
+
type: getBindingTypeFriendlyName("workflow"),
|
|
23700
|
+
value,
|
|
23701
|
+
mode: getMode({
|
|
23702
|
+
isSimulatedLocally: true
|
|
23703
|
+
})
|
|
23704
|
+
};
|
|
23705
|
+
})
|
|
23706
|
+
);
|
|
23707
|
+
}
|
|
23708
|
+
if (kv_namespaces.length > 0) {
|
|
23709
|
+
output.push(
|
|
23710
|
+
...kv_namespaces.map(({ binding, id, remote }) => {
|
|
23711
|
+
return {
|
|
23712
|
+
name: binding,
|
|
23713
|
+
type: getBindingTypeFriendlyName("kv_namespace"),
|
|
23714
|
+
value: id,
|
|
23715
|
+
mode: getMode({
|
|
23716
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
23717
|
+
})
|
|
23718
|
+
};
|
|
23719
|
+
})
|
|
23720
|
+
);
|
|
23721
|
+
}
|
|
23722
|
+
if (send_email.length > 0) {
|
|
23723
|
+
output.push(
|
|
23724
|
+
...send_email.map((emailBinding) => {
|
|
23725
|
+
const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
|
|
23726
|
+
const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
|
|
23727
|
+
const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
|
|
23728
|
+
let value = destination_address || allowed_destination_addresses?.join(", ") || "unrestricted";
|
|
23729
|
+
if (allowed_sender_addresses) {
|
|
23730
|
+
value += ` - senders: ${allowed_sender_addresses.join(", ")}`;
|
|
23731
|
+
}
|
|
23732
|
+
return {
|
|
23733
|
+
name: emailBinding.name,
|
|
23734
|
+
type: getBindingTypeFriendlyName("send_email"),
|
|
23735
|
+
value,
|
|
23736
|
+
mode: getMode({
|
|
23737
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !emailBinding.remote
|
|
23738
|
+
})
|
|
23739
|
+
};
|
|
23740
|
+
})
|
|
23741
|
+
);
|
|
23742
|
+
}
|
|
23743
|
+
if (queues.length > 0) {
|
|
23744
|
+
output.push(
|
|
23745
|
+
...queues.map(({ binding, queue_name, remote }) => {
|
|
23746
|
+
return {
|
|
23747
|
+
name: binding,
|
|
23748
|
+
type: getBindingTypeFriendlyName("queue"),
|
|
23749
|
+
value: queue_name,
|
|
23750
|
+
mode: getMode({
|
|
23751
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
23752
|
+
})
|
|
23753
|
+
};
|
|
23754
|
+
})
|
|
23755
|
+
);
|
|
23756
|
+
}
|
|
23757
|
+
if (d1_databases.length > 0) {
|
|
23758
|
+
output.push(
|
|
23759
|
+
...d1_databases.map(
|
|
23760
|
+
({
|
|
23761
|
+
binding,
|
|
23762
|
+
database_name,
|
|
23763
|
+
database_id,
|
|
23764
|
+
preview_database_id,
|
|
23765
|
+
remote
|
|
23766
|
+
}) => {
|
|
23767
|
+
const value = typeof database_id == "symbol" ? database_id : preview_database_id ?? database_name ?? database_id;
|
|
23768
|
+
return {
|
|
23769
|
+
name: binding,
|
|
23770
|
+
type: getBindingTypeFriendlyName("d1"),
|
|
23771
|
+
mode: getMode({
|
|
23772
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
23773
|
+
}),
|
|
23774
|
+
value
|
|
23775
|
+
};
|
|
23776
|
+
}
|
|
23777
|
+
)
|
|
23778
|
+
);
|
|
23779
|
+
}
|
|
23780
|
+
if (vectorize.length > 0) {
|
|
23781
|
+
output.push(
|
|
23782
|
+
...vectorize.map(({ binding, index_name, remote }) => {
|
|
23783
|
+
return {
|
|
23784
|
+
name: binding,
|
|
23785
|
+
type: getBindingTypeFriendlyName("vectorize"),
|
|
23786
|
+
value: index_name,
|
|
23787
|
+
mode: getMode({
|
|
23788
|
+
isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
|
|
23789
|
+
})
|
|
23790
|
+
};
|
|
23791
|
+
})
|
|
23792
|
+
);
|
|
23793
|
+
}
|
|
23794
|
+
if (ai_search_namespaces.length > 0) {
|
|
23795
|
+
output.push(
|
|
23796
|
+
...ai_search_namespaces.map(({ binding, namespace }) => ({
|
|
23797
|
+
name: binding,
|
|
23798
|
+
type: getBindingTypeFriendlyName("ai_search_namespace"),
|
|
23799
|
+
// Preserve `namespace` as-is so `typeof === "symbol"` handling
|
|
23800
|
+
// downstream can render INHERIT_SYMBOL as `"inherited"`. Using
|
|
23801
|
+
// `String(namespace)` would stringify it to
|
|
23802
|
+
// `"Symbol(inherit_binding)"` and defeat that check.
|
|
23803
|
+
value: namespace ?? void 0,
|
|
23804
|
+
mode: getMode({ isSimulatedLocally: false })
|
|
23805
|
+
}))
|
|
23806
|
+
);
|
|
23807
|
+
}
|
|
23808
|
+
if (ai_search.length > 0) {
|
|
23809
|
+
output.push(
|
|
23810
|
+
...ai_search.map(({ binding, instance_name }) => ({
|
|
23811
|
+
name: binding,
|
|
23812
|
+
type: getBindingTypeFriendlyName("ai_search"),
|
|
23813
|
+
value: instance_name ? String(instance_name) : void 0,
|
|
23814
|
+
mode: getMode({ isSimulatedLocally: false })
|
|
23815
|
+
}))
|
|
23816
|
+
);
|
|
23817
|
+
}
|
|
23818
|
+
if (websearch.length > 0) {
|
|
23819
|
+
output.push(
|
|
23820
|
+
...websearch.map(({ binding }) => ({
|
|
23821
|
+
name: binding,
|
|
23822
|
+
type: getBindingTypeFriendlyName("websearch"),
|
|
23823
|
+
value: void 0,
|
|
23824
|
+
mode: getMode({ isSimulatedLocally: false })
|
|
23825
|
+
}))
|
|
23826
|
+
);
|
|
23827
|
+
}
|
|
23828
|
+
if (agent_memory.length > 0) {
|
|
23829
|
+
output.push(
|
|
23830
|
+
...agent_memory.map(({ binding, namespace }) => ({
|
|
23831
|
+
name: binding,
|
|
23832
|
+
type: getBindingTypeFriendlyName("agent_memory"),
|
|
23833
|
+
value: namespace ?? void 0,
|
|
23834
|
+
mode: getMode({ isSimulatedLocally: false })
|
|
23835
|
+
}))
|
|
23836
|
+
);
|
|
23837
|
+
}
|
|
23838
|
+
if (hyperdrive.length > 0) {
|
|
23839
|
+
output.push(
|
|
23840
|
+
...hyperdrive.map(({ binding, id }) => {
|
|
23841
|
+
return {
|
|
23842
|
+
name: binding,
|
|
23843
|
+
type: getBindingTypeFriendlyName("hyperdrive"),
|
|
23844
|
+
value: id,
|
|
23845
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
23846
|
+
};
|
|
23847
|
+
})
|
|
23848
|
+
);
|
|
23849
|
+
}
|
|
23850
|
+
if (vpc_services.length > 0) {
|
|
23851
|
+
output.push(
|
|
23852
|
+
...vpc_services.map(({ binding, service_id, remote }) => {
|
|
23853
|
+
return {
|
|
23854
|
+
name: binding,
|
|
23855
|
+
type: getBindingTypeFriendlyName("vpc_service"),
|
|
23856
|
+
value: service_id,
|
|
23857
|
+
mode: getMode({
|
|
23858
|
+
isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
|
|
23859
|
+
})
|
|
23860
|
+
};
|
|
23861
|
+
})
|
|
23862
|
+
);
|
|
23863
|
+
}
|
|
23864
|
+
if (vpc_networks.length > 0) {
|
|
23865
|
+
output.push(
|
|
23866
|
+
...vpc_networks.map(({ binding, tunnel_id, network_id, remote }) => {
|
|
23867
|
+
return {
|
|
23868
|
+
name: binding,
|
|
23869
|
+
type: getBindingTypeFriendlyName("vpc_network"),
|
|
23870
|
+
value: tunnel_id ?? network_id,
|
|
23871
|
+
mode: getMode({
|
|
23872
|
+
isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
|
|
23873
|
+
})
|
|
23874
|
+
};
|
|
23875
|
+
})
|
|
23876
|
+
);
|
|
23877
|
+
}
|
|
23878
|
+
if (r2_buckets.length > 0) {
|
|
23879
|
+
output.push(
|
|
23880
|
+
...r2_buckets.map(({ binding, bucket_name, jurisdiction, remote }) => {
|
|
23881
|
+
const value = typeof bucket_name === "symbol" ? bucket_name : bucket_name ? `${bucket_name}${jurisdiction ? ` (${jurisdiction})` : ""}` : void 0;
|
|
23882
|
+
return {
|
|
23883
|
+
name: binding,
|
|
23884
|
+
type: getBindingTypeFriendlyName("r2_bucket"),
|
|
23885
|
+
value,
|
|
23886
|
+
mode: getMode({
|
|
23887
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
23888
|
+
})
|
|
23889
|
+
};
|
|
23890
|
+
})
|
|
23891
|
+
);
|
|
23892
|
+
}
|
|
23893
|
+
if (logfwdr.length > 0) {
|
|
23894
|
+
output.push(
|
|
23895
|
+
...logfwdr.map(({ name, destination }) => {
|
|
23896
|
+
return {
|
|
23897
|
+
name,
|
|
23898
|
+
type: getBindingTypeFriendlyName("logfwdr"),
|
|
23899
|
+
value: destination,
|
|
23900
|
+
mode: getMode()
|
|
23901
|
+
};
|
|
23902
|
+
})
|
|
23903
|
+
);
|
|
23904
|
+
}
|
|
23905
|
+
if (secrets_store_secrets.length > 0) {
|
|
23906
|
+
output.push(
|
|
23907
|
+
...secrets_store_secrets.map(({ binding, store_id, secret_name }) => {
|
|
23908
|
+
return {
|
|
23909
|
+
name: binding,
|
|
23910
|
+
type: getBindingTypeFriendlyName("secrets_store_secret"),
|
|
23911
|
+
value: `${store_id}/${secret_name}`,
|
|
23912
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
23913
|
+
};
|
|
23914
|
+
})
|
|
23915
|
+
);
|
|
23916
|
+
}
|
|
23917
|
+
if (artifacts.length > 0) {
|
|
23918
|
+
output.push(
|
|
23919
|
+
...artifacts.map(({ binding, namespace }) => {
|
|
23920
|
+
return {
|
|
23921
|
+
name: binding,
|
|
23922
|
+
type: getBindingTypeFriendlyName("artifacts"),
|
|
23923
|
+
value: namespace,
|
|
23924
|
+
mode: getMode({ isSimulatedLocally: false })
|
|
23925
|
+
};
|
|
23926
|
+
})
|
|
23927
|
+
);
|
|
23928
|
+
}
|
|
23929
|
+
if (unsafe_hello_world.length > 0) {
|
|
23930
|
+
output.push(
|
|
23931
|
+
...unsafe_hello_world.map(({ binding, enable_timer }) => {
|
|
23932
|
+
return {
|
|
23933
|
+
name: binding,
|
|
23934
|
+
type: getBindingTypeFriendlyName("unsafe_hello_world"),
|
|
23935
|
+
value: enable_timer ? `Timer enabled` : `Timer disabled`,
|
|
23936
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
23937
|
+
};
|
|
23938
|
+
})
|
|
23939
|
+
);
|
|
23940
|
+
}
|
|
23941
|
+
if (flagship.length > 0) {
|
|
23942
|
+
output.push(
|
|
23943
|
+
...flagship.map(({ binding, app_id }) => {
|
|
23944
|
+
return {
|
|
23945
|
+
name: binding,
|
|
23946
|
+
type: getBindingTypeFriendlyName("flagship"),
|
|
23947
|
+
value: app_id,
|
|
23948
|
+
mode: getMode({
|
|
23949
|
+
isSimulatedLocally: !context.remoteBindingsDisabled ? false : void 0
|
|
23950
|
+
})
|
|
23951
|
+
};
|
|
23952
|
+
})
|
|
23953
|
+
);
|
|
23954
|
+
}
|
|
23955
|
+
if (services.length > 0) {
|
|
23956
|
+
output.push(
|
|
23957
|
+
...services.map(({ binding, service, entrypoint, remote, dev }) => {
|
|
23958
|
+
let value = service;
|
|
23959
|
+
let mode = void 0;
|
|
23960
|
+
if (entrypoint) {
|
|
23961
|
+
value += `#${entrypoint}`;
|
|
23962
|
+
}
|
|
23963
|
+
if (dev !== void 0 && context.local) {
|
|
23964
|
+
mode = getMode({ isSimulatedLocally: true });
|
|
23965
|
+
} else if (remote) {
|
|
23966
|
+
mode = getMode({ isSimulatedLocally: false });
|
|
23967
|
+
} else if (context.local && context.registry !== null) {
|
|
23968
|
+
const isSelfBinding = service === context.name;
|
|
23969
|
+
if (isSelfBinding) {
|
|
23970
|
+
hasConnectionStatus = true;
|
|
23971
|
+
mode = getMode({ isSimulatedLocally: true, connected: true });
|
|
23972
|
+
} else {
|
|
23973
|
+
const registryDefinition = context.registry?.[service];
|
|
23974
|
+
hasConnectionStatus = true;
|
|
23975
|
+
if (registryDefinition && registryDefinition.debugPortAddress) {
|
|
23976
|
+
mode = getMode({ isSimulatedLocally: true, connected: true });
|
|
23977
|
+
} else {
|
|
23978
|
+
mode = getMode({ isSimulatedLocally: true, connected: false });
|
|
23979
|
+
}
|
|
23980
|
+
}
|
|
23981
|
+
}
|
|
23982
|
+
return {
|
|
23983
|
+
name: binding,
|
|
23984
|
+
type: getBindingTypeFriendlyName("service"),
|
|
23985
|
+
value,
|
|
23986
|
+
mode
|
|
23987
|
+
};
|
|
23988
|
+
})
|
|
23989
|
+
);
|
|
23990
|
+
}
|
|
23991
|
+
if (analytics_engine_datasets.length > 0) {
|
|
23992
|
+
output.push(
|
|
23993
|
+
...analytics_engine_datasets.map(({ binding, dataset }) => {
|
|
23994
|
+
return {
|
|
23995
|
+
name: binding,
|
|
23996
|
+
type: getBindingTypeFriendlyName("analytics_engine"),
|
|
23997
|
+
value: dataset ?? binding,
|
|
23998
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
23999
|
+
};
|
|
24000
|
+
})
|
|
24001
|
+
);
|
|
24002
|
+
}
|
|
24003
|
+
if (text_blobs.length > 0) {
|
|
24004
|
+
output.push(
|
|
24005
|
+
...text_blobs.map(({ binding, source }) => ({
|
|
24006
|
+
name: binding,
|
|
24007
|
+
type: getBindingTypeFriendlyName("text_blob"),
|
|
24008
|
+
value: "contents" in source ? truncate2(source.contents) : "path" in source ? truncate2(source.path) : void 0,
|
|
24009
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24010
|
+
}))
|
|
24011
|
+
);
|
|
24012
|
+
}
|
|
24013
|
+
if (browser.length > 0) {
|
|
24014
|
+
output.push(
|
|
24015
|
+
...browser.map(({ binding, remote }) => ({
|
|
24016
|
+
name: binding,
|
|
24017
|
+
type: getBindingTypeFriendlyName("browser"),
|
|
24018
|
+
value: void 0,
|
|
24019
|
+
mode: getMode({
|
|
24020
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
24021
|
+
})
|
|
24022
|
+
}))
|
|
24023
|
+
);
|
|
24024
|
+
}
|
|
24025
|
+
if (images.length > 0) {
|
|
24026
|
+
output.push(
|
|
24027
|
+
...images.map(({ binding, remote }) => ({
|
|
24028
|
+
name: binding,
|
|
24029
|
+
type: getBindingTypeFriendlyName("images"),
|
|
24030
|
+
value: void 0,
|
|
24031
|
+
mode: getMode({
|
|
24032
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
24033
|
+
})
|
|
24034
|
+
}))
|
|
24035
|
+
);
|
|
24036
|
+
}
|
|
24037
|
+
if (stream.length > 0) {
|
|
24038
|
+
output.push(
|
|
24039
|
+
...stream.map(({ binding, remote }) => ({
|
|
24040
|
+
name: binding,
|
|
24041
|
+
type: getBindingTypeFriendlyName("stream"),
|
|
24042
|
+
value: void 0,
|
|
24043
|
+
mode: getMode({
|
|
24044
|
+
isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
|
|
24045
|
+
})
|
|
24046
|
+
}))
|
|
24047
|
+
);
|
|
24048
|
+
}
|
|
24049
|
+
if (media.length > 0) {
|
|
24050
|
+
output.push(
|
|
24051
|
+
...media.map(({ binding, remote }) => ({
|
|
24052
|
+
name: binding,
|
|
24053
|
+
type: getBindingTypeFriendlyName("media"),
|
|
24054
|
+
value: void 0,
|
|
24055
|
+
mode: getMode({
|
|
24056
|
+
isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
|
|
24057
|
+
})
|
|
24058
|
+
}))
|
|
24059
|
+
);
|
|
24060
|
+
}
|
|
24061
|
+
if (ai.length > 0) {
|
|
24062
|
+
output.push(
|
|
24063
|
+
...ai.map(({ binding, staging, remote }) => ({
|
|
24064
|
+
name: binding,
|
|
24065
|
+
type: getBindingTypeFriendlyName("ai"),
|
|
24066
|
+
value: staging ? `staging` : void 0,
|
|
24067
|
+
mode: getMode({
|
|
24068
|
+
isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
|
|
24069
|
+
})
|
|
24070
|
+
}))
|
|
24071
|
+
);
|
|
24072
|
+
}
|
|
24073
|
+
if (pipelines.length > 0) {
|
|
24074
|
+
output.push(
|
|
24075
|
+
...pipelines.map(
|
|
24076
|
+
({ binding, stream: pipelineStream, pipeline, remote }) => ({
|
|
24077
|
+
name: binding,
|
|
24078
|
+
type: getBindingTypeFriendlyName("pipeline"),
|
|
24079
|
+
value: pipelineStream || pipeline,
|
|
24080
|
+
mode: getMode({
|
|
24081
|
+
isSimulatedLocally: context.remoteBindingsDisabled || !remote
|
|
24082
|
+
})
|
|
24083
|
+
})
|
|
24084
|
+
)
|
|
24085
|
+
);
|
|
24086
|
+
}
|
|
24087
|
+
if (ratelimits.length > 0) {
|
|
24088
|
+
output.push(
|
|
24089
|
+
...ratelimits.map(({ name, simple }) => ({
|
|
24090
|
+
name,
|
|
24091
|
+
type: getBindingTypeFriendlyName("ratelimit"),
|
|
24092
|
+
value: `${simple.limit} requests/${simple.period}s`,
|
|
24093
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24094
|
+
}))
|
|
24095
|
+
);
|
|
24096
|
+
}
|
|
24097
|
+
if (assets.length > 0) {
|
|
24098
|
+
output.push(
|
|
24099
|
+
...assets.map(({ binding }) => ({
|
|
24100
|
+
name: binding,
|
|
24101
|
+
type: getBindingTypeFriendlyName("assets"),
|
|
24102
|
+
value: void 0,
|
|
24103
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24104
|
+
}))
|
|
24105
|
+
);
|
|
24106
|
+
}
|
|
24107
|
+
if (version_metadata.length > 0) {
|
|
24108
|
+
output.push(
|
|
24109
|
+
...version_metadata.map(({ binding }) => ({
|
|
24110
|
+
name: binding,
|
|
24111
|
+
type: getBindingTypeFriendlyName("version_metadata"),
|
|
24112
|
+
value: void 0,
|
|
24113
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24114
|
+
}))
|
|
24115
|
+
);
|
|
24116
|
+
}
|
|
24117
|
+
if (unsafe_bindings.length > 0) {
|
|
24118
|
+
output.push(
|
|
24119
|
+
...unsafe_bindings.map((binding) => {
|
|
24120
|
+
const dev = "dev" in binding ? binding.dev : void 0;
|
|
24121
|
+
const originalType = binding.type.slice("unsafe_".length);
|
|
24122
|
+
return {
|
|
24123
|
+
name: binding.name,
|
|
24124
|
+
type: dev ? dev.plugin.name : getBindingTypeFriendlyName(binding.type),
|
|
24125
|
+
value: originalType,
|
|
24126
|
+
mode: getMode({
|
|
24127
|
+
isSimulatedLocally: !!dev
|
|
24128
|
+
})
|
|
24129
|
+
};
|
|
24130
|
+
})
|
|
24131
|
+
);
|
|
24132
|
+
}
|
|
24133
|
+
if (vars.length > 0) {
|
|
24134
|
+
output.push(
|
|
24135
|
+
...vars.map((variable) => {
|
|
24136
|
+
const { binding, type: varType, value: varValue } = variable;
|
|
24137
|
+
let parsedValue;
|
|
24138
|
+
if (varType === "plain_text" && variable.hidden !== true) {
|
|
24139
|
+
parsedValue = `"${truncate2(varValue)}"`;
|
|
24140
|
+
} else if (varType === "json") {
|
|
24141
|
+
parsedValue = truncate2(JSON.stringify(varValue));
|
|
24142
|
+
} else {
|
|
24143
|
+
parsedValue = `"(hidden)"`;
|
|
24144
|
+
}
|
|
24145
|
+
return {
|
|
24146
|
+
name: binding,
|
|
24147
|
+
type: getBindingTypeFriendlyName(varType),
|
|
24148
|
+
value: parsedValue,
|
|
24149
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24150
|
+
};
|
|
24151
|
+
})
|
|
24152
|
+
);
|
|
24153
|
+
}
|
|
24154
|
+
if (wasm_modules.length > 0) {
|
|
24155
|
+
output.push(
|
|
24156
|
+
...wasm_modules.map(({ binding, source }) => ({
|
|
24157
|
+
name: binding,
|
|
24158
|
+
type: getBindingTypeFriendlyName("wasm_module"),
|
|
24159
|
+
value: "contents" in source ? "<Wasm>" : truncate2(source.path),
|
|
24160
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24161
|
+
}))
|
|
24162
|
+
);
|
|
24163
|
+
}
|
|
24164
|
+
if (dispatch_namespaces.length > 0) {
|
|
24165
|
+
output.push(
|
|
24166
|
+
...dispatch_namespaces.map(({ binding, namespace, outbound, remote }) => {
|
|
24167
|
+
return {
|
|
24168
|
+
name: binding,
|
|
24169
|
+
type: getBindingTypeFriendlyName("dispatch_namespace"),
|
|
24170
|
+
value: typeof namespace === "symbol" ? namespace : outbound ? `${namespace} (outbound -> ${outbound.service})` : namespace,
|
|
24171
|
+
mode: getMode({
|
|
24172
|
+
isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
|
|
24173
|
+
})
|
|
24174
|
+
};
|
|
24175
|
+
})
|
|
24176
|
+
);
|
|
24177
|
+
}
|
|
24178
|
+
if (mtls_certificates.length > 0) {
|
|
24179
|
+
output.push(
|
|
24180
|
+
...mtls_certificates.map(({ binding, certificate_id, remote }) => {
|
|
24181
|
+
return {
|
|
24182
|
+
name: binding,
|
|
24183
|
+
type: getBindingTypeFriendlyName("mtls_certificate"),
|
|
24184
|
+
value: certificate_id,
|
|
24185
|
+
mode: getMode({
|
|
24186
|
+
isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
|
|
24187
|
+
})
|
|
24188
|
+
};
|
|
24189
|
+
})
|
|
24190
|
+
);
|
|
24191
|
+
}
|
|
24192
|
+
if (worker_loaders.length > 0) {
|
|
24193
|
+
output.push(
|
|
24194
|
+
...worker_loaders.map(({ binding }) => ({
|
|
24195
|
+
name: binding,
|
|
24196
|
+
type: getBindingTypeFriendlyName("worker_loader"),
|
|
24197
|
+
value: void 0,
|
|
24198
|
+
mode: getMode({ isSimulatedLocally: true })
|
|
24199
|
+
}))
|
|
24200
|
+
);
|
|
24201
|
+
}
|
|
24202
|
+
if (output.length === 0) {
|
|
24203
|
+
if (context.warnIfNoBindings) {
|
|
24204
|
+
if (context.name && isMultiWorker) {
|
|
24205
|
+
log(`No bindings found for ${chalk.blue(context.name)}`);
|
|
24206
|
+
} else {
|
|
24207
|
+
log("No bindings found.");
|
|
24208
|
+
}
|
|
24209
|
+
}
|
|
24210
|
+
} else {
|
|
24211
|
+
let title2;
|
|
24212
|
+
if (context.provisioning) {
|
|
24213
|
+
title2 = "The following bindings need to be provisioned:";
|
|
24214
|
+
} else if (context.name && isMultiWorker) {
|
|
24215
|
+
title2 = `${chalk.blue(context.name)} has access to the following bindings:`;
|
|
24216
|
+
} else {
|
|
24217
|
+
title2 = "Your Worker has access to the following bindings:";
|
|
24218
|
+
}
|
|
24219
|
+
const headings = {
|
|
24220
|
+
binding: "Binding",
|
|
24221
|
+
resource: "Resource",
|
|
24222
|
+
mode: "Mode"
|
|
24223
|
+
};
|
|
24224
|
+
const maxValueLength = Math.max(
|
|
24225
|
+
...output.map(
|
|
24226
|
+
(b) => typeof b.value === "symbol" ? "inherited".length : b.value?.length ?? 0
|
|
24227
|
+
)
|
|
24228
|
+
);
|
|
24229
|
+
const maxNameLength = Math.max(...output.map((b) => b.name.length));
|
|
24230
|
+
const maxTypeLength = Math.max(
|
|
24231
|
+
...output.map((b) => b.type.length),
|
|
24232
|
+
headings.resource.length
|
|
24233
|
+
);
|
|
24234
|
+
const maxModeLength = Math.max(
|
|
24235
|
+
...output.map(
|
|
24236
|
+
(b) => b.mode ? stripVTControlCharacters(b.mode).length : headings.mode.length
|
|
24237
|
+
)
|
|
24238
|
+
);
|
|
24239
|
+
const hasMode = output.some((b) => b.mode);
|
|
24240
|
+
const bindingPrefix = `env.`;
|
|
24241
|
+
const bindingLength = bindingPrefix.length + maxNameLength + " (".length + maxValueLength + ")".length;
|
|
24242
|
+
const columnGapSpaces = 6;
|
|
24243
|
+
const columnGapSpacesWrapped = 4;
|
|
24244
|
+
const shouldWrap = bindingLength + columnGapSpaces + maxTypeLength + columnGapSpaces + maxModeLength >= process.stdout.columns;
|
|
24245
|
+
log(title2);
|
|
24246
|
+
const columnGap = shouldWrap ? " ".repeat(columnGapSpacesWrapped) : " ".repeat(columnGapSpaces);
|
|
24247
|
+
log(
|
|
24248
|
+
`${padEndAnsi(dim(headings.binding), shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength)}${columnGap}${padEndAnsi(dim(headings.resource), maxTypeLength)}${columnGap}${hasMode ? dim(headings.mode) : ""}`
|
|
24249
|
+
);
|
|
24250
|
+
for (const binding of output) {
|
|
24251
|
+
const bindingValue = dim(
|
|
24252
|
+
typeof binding.value === "symbol" ? chalk.italic("inherited") : binding.value ?? ""
|
|
24253
|
+
);
|
|
24254
|
+
const bindingString = padEndAnsi(
|
|
24255
|
+
`${white(`env.${binding.name}`)}${binding.value && !shouldWrap ? ` (${bindingValue})` : ""}`,
|
|
24256
|
+
shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength
|
|
24257
|
+
);
|
|
24258
|
+
const suffix = shouldWrap ? binding.value ? `
|
|
24259
|
+
${bindingValue}` : "" : "";
|
|
24260
|
+
log(
|
|
24261
|
+
`${bindingString}${columnGap}${brandColor(binding.type.padEnd(maxTypeLength))}${columnGap}${hasMode ? binding.mode : ""}${suffix}`
|
|
24262
|
+
);
|
|
24263
|
+
}
|
|
24264
|
+
log("");
|
|
24265
|
+
}
|
|
24266
|
+
let title;
|
|
24267
|
+
if (context.name && isMultiWorker) {
|
|
24268
|
+
title = `${chalk.blue(context.name)} is sending Tail events to the following Workers:`;
|
|
24269
|
+
} else {
|
|
24270
|
+
title = "Your Worker is sending Tail events to the following Workers:";
|
|
24271
|
+
}
|
|
24272
|
+
const allTailConsumers = [
|
|
24273
|
+
...(tailConsumers ?? []).map((c) => ({
|
|
24274
|
+
service: c.service,
|
|
24275
|
+
streaming: false
|
|
24276
|
+
})),
|
|
24277
|
+
...(streamingTailConsumers ?? []).map((c) => ({
|
|
24278
|
+
service: c.service,
|
|
24279
|
+
streaming: true
|
|
24280
|
+
}))
|
|
24281
|
+
];
|
|
24282
|
+
if (allTailConsumers.length > 0) {
|
|
24283
|
+
log(
|
|
24284
|
+
`${title}
|
|
24285
|
+
${allTailConsumers.map(({ service, streaming }) => {
|
|
24286
|
+
const displayName = `${service}${streaming ? ` (streaming)` : ""}`;
|
|
24287
|
+
if (context.local && context.registry !== null) {
|
|
24288
|
+
const registryDefinition = context.registry?.[service];
|
|
24289
|
+
hasConnectionStatus = true;
|
|
24290
|
+
if (registryDefinition) {
|
|
24291
|
+
return `- ${displayName} ${chalk.green("[connected]")}`;
|
|
24292
|
+
} else {
|
|
24293
|
+
return `- ${displayName} ${chalk.red("[not connected]")}`;
|
|
24294
|
+
}
|
|
24295
|
+
} else {
|
|
24296
|
+
return `- ${displayName}`;
|
|
24297
|
+
}
|
|
24298
|
+
}).join("\n")}`
|
|
24299
|
+
);
|
|
24300
|
+
}
|
|
24301
|
+
if (containers.length > 0 && !context.provisioning) {
|
|
24302
|
+
let containersTitle = "The following containers are available:";
|
|
24303
|
+
if (context.name && isMultiWorker) {
|
|
24304
|
+
containersTitle = `The following containers are available from ${chalk.blue(context.name)}:`;
|
|
24305
|
+
}
|
|
24306
|
+
log(
|
|
24307
|
+
`${containersTitle}
|
|
24308
|
+
${containers.map((c) => `- ${c.name} (${c.image})`).join("\n")}`
|
|
24309
|
+
);
|
|
24310
|
+
log("");
|
|
24311
|
+
}
|
|
24312
|
+
if (context.unsafeMetadata) {
|
|
24313
|
+
log("The following unsafe metadata will be attached to your Worker:");
|
|
24314
|
+
log(JSON.stringify(context.unsafeMetadata, null, 2));
|
|
24315
|
+
}
|
|
24316
|
+
if (hasConnectionStatus && !isConnectedStatusExplained) {
|
|
24317
|
+
log(
|
|
24318
|
+
dim(
|
|
24319
|
+
`
|
|
24320
|
+
Service bindings, Durable Object bindings, and Tail consumers connect to other Wrangler or Vite dev processes running locally, with their connection status indicated by ${chalk.green("[connected]")} or ${chalk.red("[not connected]")}. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
|
|
24321
|
+
`
|
|
24322
|
+
)
|
|
24323
|
+
);
|
|
24324
|
+
isConnectedStatusExplained = true;
|
|
24325
|
+
}
|
|
24326
|
+
}
|
|
24327
|
+
__name(printBindings, "printBindings");
|
|
24328
|
+
function padEndAnsi(str, length) {
|
|
24329
|
+
return str + " ".repeat(Math.max(0, length - stripVTControlCharacters(str).length));
|
|
24330
|
+
}
|
|
24331
|
+
__name(padEndAnsi, "padEndAnsi");
|
|
24332
|
+
function createGetMode({
|
|
24333
|
+
isProvisioning = false,
|
|
24334
|
+
isLocalDev = false
|
|
24335
|
+
}) {
|
|
24336
|
+
return /* @__PURE__ */ __name(function bindingMode({
|
|
24337
|
+
isSimulatedLocally,
|
|
24338
|
+
connected
|
|
24339
|
+
} = {}) {
|
|
24340
|
+
if (isProvisioning || !isLocalDev) {
|
|
24341
|
+
return void 0;
|
|
24342
|
+
}
|
|
24343
|
+
if (isSimulatedLocally === void 0) {
|
|
24344
|
+
return dim("not supported");
|
|
24345
|
+
}
|
|
24346
|
+
return `${isSimulatedLocally ? chalk.blue("local") : chalk.yellow("remote")}${connected === void 0 ? "" : connected ? chalk.green(" [connected]") : chalk.red(" [not connected]")}`;
|
|
24347
|
+
}, "bindingMode");
|
|
24348
|
+
}
|
|
24349
|
+
__name(createGetMode, "createGetMode");
|
|
24350
|
+
|
|
24351
|
+
// src/is-interactive.ts
|
|
24352
|
+
var import_ci_info = __toESM(require_ci_info());
|
|
24353
|
+
function isTtyInteractive() {
|
|
24354
|
+
try {
|
|
24355
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
24356
|
+
} catch {
|
|
24357
|
+
return false;
|
|
24358
|
+
}
|
|
24359
|
+
}
|
|
24360
|
+
__name(isTtyInteractive, "isTtyInteractive");
|
|
24361
|
+
function isInteractive() {
|
|
24362
|
+
if (import_ci_info.default.CLOUDFLARE_PAGES || import_ci_info.default.CLOUDFLARE_WORKERS) {
|
|
24363
|
+
return false;
|
|
24364
|
+
}
|
|
24365
|
+
return isTtyInteractive();
|
|
24366
|
+
}
|
|
24367
|
+
__name(isInteractive, "isInteractive");
|
|
24368
|
+
function isNonInteractiveOrCI() {
|
|
24369
|
+
return !isInteractive() || import_ci_info.default.isCI;
|
|
24370
|
+
}
|
|
24371
|
+
__name(isNonInteractiveOrCI, "isNonInteractiveOrCI");
|
|
24372
|
+
function isCI() {
|
|
24373
|
+
return import_ci_info.default.isCI;
|
|
24374
|
+
}
|
|
24375
|
+
__name(isCI, "isCI");
|
|
24376
|
+
|
|
24377
|
+
// src/config-cache.ts
|
|
24378
|
+
var arrayFormatter = new Intl.ListFormat("en-US", {
|
|
24379
|
+
style: "long",
|
|
24380
|
+
type: "conjunction"
|
|
24381
|
+
});
|
|
24382
|
+
function createConfigCache(logger, options) {
|
|
24383
|
+
let cacheMessageShown = false;
|
|
24384
|
+
const namespace = options?.namespace ?? "wrangler";
|
|
24385
|
+
function getCacheFolder() {
|
|
24386
|
+
if (namespace === "wrangler") {
|
|
24387
|
+
const envCacheDir = getWranglerCacheDirFromEnv();
|
|
24388
|
+
if (envCacheDir) {
|
|
24389
|
+
return envCacheDir;
|
|
24390
|
+
}
|
|
24391
|
+
}
|
|
24392
|
+
const closestNodeModulesDirectory = dir("node_modules");
|
|
24393
|
+
const nodeModulesCache = closestNodeModulesDirectory ? path.join(closestNodeModulesDirectory, ".cache", namespace) : null;
|
|
24394
|
+
const localCache = path.join(process.cwd(), `.${namespace}`, "cache");
|
|
24395
|
+
if (nodeModulesCache && existsSync(nodeModulesCache)) {
|
|
24396
|
+
return nodeModulesCache;
|
|
24397
|
+
}
|
|
24398
|
+
if (existsSync(localCache)) {
|
|
24399
|
+
return localCache;
|
|
24400
|
+
}
|
|
24401
|
+
if (nodeModulesCache) {
|
|
24402
|
+
return nodeModulesCache;
|
|
24403
|
+
}
|
|
24404
|
+
return localCache;
|
|
24405
|
+
}
|
|
24406
|
+
__name(getCacheFolder, "getCacheFolder");
|
|
24407
|
+
function showCacheMessage(fields, folder) {
|
|
24408
|
+
if (!cacheMessageShown && !isNonInteractiveOrCI()) {
|
|
24409
|
+
if (fields.length > 0) {
|
|
24410
|
+
logger.debug(
|
|
24411
|
+
`Retrieving cached values for ${arrayFormatter.format(
|
|
24412
|
+
fields
|
|
24413
|
+
)} from ${path.relative(process.cwd(), folder)}`
|
|
24414
|
+
);
|
|
24415
|
+
cacheMessageShown = true;
|
|
24416
|
+
}
|
|
24417
|
+
}
|
|
24418
|
+
}
|
|
24419
|
+
__name(showCacheMessage, "showCacheMessage");
|
|
24420
|
+
function getConfigCache(fileName) {
|
|
24421
|
+
try {
|
|
24422
|
+
const cacheFolder = getCacheFolder();
|
|
24423
|
+
const configCacheLocation = path.join(cacheFolder, fileName);
|
|
24424
|
+
const configCache = JSON.parse(
|
|
24425
|
+
readFileSync$1(configCacheLocation, "utf-8")
|
|
24426
|
+
);
|
|
24427
|
+
showCacheMessage(Object.keys(configCache), cacheFolder);
|
|
24428
|
+
return configCache;
|
|
24429
|
+
} catch {
|
|
24430
|
+
return {};
|
|
24431
|
+
}
|
|
24432
|
+
}
|
|
24433
|
+
__name(getConfigCache, "getConfigCache");
|
|
24434
|
+
function saveToConfigCache(fileName, newValues) {
|
|
24435
|
+
const cacheFolder = getCacheFolder();
|
|
24436
|
+
if (cacheFolder) {
|
|
24437
|
+
logger.debug(`Saving to cache: ${JSON.stringify(newValues)}`);
|
|
24438
|
+
const configCacheLocation = path.join(cacheFolder, fileName);
|
|
24439
|
+
const existingValues = getConfigCache(fileName);
|
|
24440
|
+
mkdirSync(path.dirname(configCacheLocation), { recursive: true });
|
|
24441
|
+
writeFileSync(
|
|
24442
|
+
configCacheLocation,
|
|
24443
|
+
JSON.stringify({ ...existingValues, ...newValues }, null, 2)
|
|
24444
|
+
);
|
|
24445
|
+
}
|
|
24446
|
+
}
|
|
24447
|
+
__name(saveToConfigCache, "saveToConfigCache");
|
|
24448
|
+
function purgeConfigCaches() {
|
|
24449
|
+
const cacheFolder = getCacheFolder();
|
|
24450
|
+
if (cacheFolder) {
|
|
24451
|
+
removeDirSync(cacheFolder);
|
|
24452
|
+
}
|
|
24453
|
+
}
|
|
24454
|
+
__name(purgeConfigCaches, "purgeConfigCaches");
|
|
24455
|
+
return {
|
|
24456
|
+
getCacheFolder,
|
|
24457
|
+
getConfigCache,
|
|
24458
|
+
saveToConfigCache,
|
|
24459
|
+
purgeConfigCaches
|
|
24460
|
+
};
|
|
24461
|
+
}
|
|
24462
|
+
__name(createConfigCache, "createConfigCache");
|
|
24463
|
+
|
|
24464
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
24465
|
+
var signals = [];
|
|
23454
24466
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
23455
24467
|
if (process.platform !== "win32") {
|
|
23456
24468
|
signals.push(
|
|
@@ -23715,7 +24727,7 @@ var {
|
|
|
23715
24727
|
// src/wrangler-tmp-dir.ts
|
|
23716
24728
|
function getWranglerHiddenDirPath(projectRoot) {
|
|
23717
24729
|
projectRoot ??= process.cwd();
|
|
23718
|
-
return
|
|
24730
|
+
return path__default.join(projectRoot, ".wrangler");
|
|
23719
24731
|
}
|
|
23720
24732
|
__name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
23721
24733
|
var STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -23736,7 +24748,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
23736
24748
|
if (!entry.isDirectory()) {
|
|
23737
24749
|
continue;
|
|
23738
24750
|
}
|
|
23739
|
-
const entryPath =
|
|
24751
|
+
const entryPath = path__default.join(tmpRoot, entry.name);
|
|
23740
24752
|
try {
|
|
23741
24753
|
if (fs2.statSync(entryPath).mtimeMs < cutoff) {
|
|
23742
24754
|
removeDirSync(entryPath);
|
|
@@ -23747,10 +24759,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
23747
24759
|
}
|
|
23748
24760
|
__name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
23749
24761
|
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
23750
|
-
const tmpRoot =
|
|
24762
|
+
const tmpRoot = path__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
23751
24763
|
fs2.mkdirSync(tmpRoot, { recursive: true });
|
|
23752
24764
|
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
23753
|
-
const tmpPrefix =
|
|
24765
|
+
const tmpPrefix = path__default.join(tmpRoot, `${prefix}-`);
|
|
23754
24766
|
const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
|
|
23755
24767
|
const cleanupDir = /* @__PURE__ */ __name(() => {
|
|
23756
24768
|
if (cleanup) {
|
|
@@ -24556,14 +25568,14 @@ function logHeaders(headers, logger) {
|
|
|
24556
25568
|
);
|
|
24557
25569
|
}
|
|
24558
25570
|
__name(logHeaders, "logHeaders");
|
|
24559
|
-
async function performApiFetchBase(complianceConfig, resource,
|
|
25571
|
+
async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
24560
25572
|
assert2(credentials, "credentials are required for performApiFetch");
|
|
24561
|
-
const method =
|
|
25573
|
+
const method = init.method ?? "GET";
|
|
24562
25574
|
assert2(
|
|
24563
25575
|
resource.startsWith("/"),
|
|
24564
25576
|
`CF API fetch - resource path must start with a "/" but got "${resource}"`
|
|
24565
25577
|
);
|
|
24566
|
-
const headers = cloneHeaders(new Headers(
|
|
25578
|
+
const headers = cloneHeaders(new Headers(init.headers));
|
|
24567
25579
|
addAuthorizationHeader(headers, credentials);
|
|
24568
25580
|
headers.set("User-Agent", userAgent);
|
|
24569
25581
|
maybeAddTraceHeader(headers);
|
|
@@ -24573,11 +25585,11 @@ async function performApiFetchBase(complianceConfig, resource, init2 = {}, userA
|
|
|
24573
25585
|
);
|
|
24574
25586
|
logger.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
24575
25587
|
logHeaders(headers, logger);
|
|
24576
|
-
logger.debugWithSanitization?.("INIT:", JSON.stringify({ ...
|
|
24577
|
-
if (
|
|
25588
|
+
logger.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
25589
|
+
if (init.body instanceof FormData) {
|
|
24578
25590
|
logger.debugWithSanitization?.(
|
|
24579
25591
|
"BODY:",
|
|
24580
|
-
await new Response(
|
|
25592
|
+
await new Response(init.body).text(),
|
|
24581
25593
|
null,
|
|
24582
25594
|
2
|
|
24583
25595
|
);
|
|
@@ -24587,19 +25599,19 @@ async function performApiFetchBase(complianceConfig, resource, init2 = {}, userA
|
|
|
24587
25599
|
`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`,
|
|
24588
25600
|
{
|
|
24589
25601
|
method,
|
|
24590
|
-
...
|
|
25602
|
+
...init,
|
|
24591
25603
|
headers,
|
|
24592
25604
|
signal: abortSignal
|
|
24593
25605
|
}
|
|
24594
25606
|
);
|
|
24595
25607
|
}
|
|
24596
25608
|
__name(performApiFetchBase, "performApiFetchBase");
|
|
24597
|
-
async function fetchInternalBase(complianceConfig, resource,
|
|
24598
|
-
const method =
|
|
25609
|
+
async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
25610
|
+
const method = init.method ?? "GET";
|
|
24599
25611
|
const response = await performApiFetchBase(
|
|
24600
25612
|
complianceConfig,
|
|
24601
25613
|
resource,
|
|
24602
|
-
|
|
25614
|
+
init,
|
|
24603
25615
|
userAgent,
|
|
24604
25616
|
logger,
|
|
24605
25617
|
queryParams,
|
|
@@ -24661,7 +25673,7 @@ async function fetchInternalBase(complianceConfig, resource, init2 = {}, userAge
|
|
|
24661
25673
|
}
|
|
24662
25674
|
}
|
|
24663
25675
|
__name(fetchInternalBase, "fetchInternalBase");
|
|
24664
|
-
async function fetchResultBase(complianceConfig, resource,
|
|
25676
|
+
async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
24665
25677
|
const {
|
|
24666
25678
|
response: json2,
|
|
24667
25679
|
status,
|
|
@@ -24669,7 +25681,7 @@ async function fetchResultBase(complianceConfig, resource, init2 = {}, userAgent
|
|
|
24669
25681
|
} = await fetchInternalBase(
|
|
24670
25682
|
complianceConfig,
|
|
24671
25683
|
resource,
|
|
24672
|
-
|
|
25684
|
+
init,
|
|
24673
25685
|
userAgent,
|
|
24674
25686
|
logger,
|
|
24675
25687
|
queryParams,
|
|
@@ -24683,7 +25695,7 @@ async function fetchResultBase(complianceConfig, resource, init2 = {}, userAgent
|
|
|
24683
25695
|
}
|
|
24684
25696
|
}
|
|
24685
25697
|
__name(fetchResultBase, "fetchResultBase");
|
|
24686
|
-
async function fetchListResultBase(complianceConfig, resource,
|
|
25698
|
+
async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, credentials) {
|
|
24687
25699
|
const results = [];
|
|
24688
25700
|
let getMoreResults = true;
|
|
24689
25701
|
let cursor;
|
|
@@ -24699,7 +25711,7 @@ async function fetchListResultBase(complianceConfig, resource, init2 = {}, userA
|
|
|
24699
25711
|
} = await fetchInternalBase(
|
|
24700
25712
|
complianceConfig,
|
|
24701
25713
|
resource,
|
|
24702
|
-
|
|
25714
|
+
init,
|
|
24703
25715
|
userAgent,
|
|
24704
25716
|
logger,
|
|
24705
25717
|
queryParams,
|
|
@@ -25220,266 +26232,6 @@ function getWorkerNameFromProject(projectPath) {
|
|
|
25220
26232
|
return getWorkerName(packageJsonName, projectPath);
|
|
25221
26233
|
}
|
|
25222
26234
|
__name(getWorkerNameFromProject, "getWorkerNameFromProject");
|
|
25223
|
-
|
|
25224
|
-
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
|
|
25225
|
-
var FORCE_COLOR;
|
|
25226
|
-
var NODE_DISABLE_COLORS;
|
|
25227
|
-
var NO_COLOR;
|
|
25228
|
-
var TERM;
|
|
25229
|
-
var isTTY = true;
|
|
25230
|
-
if (typeof process !== "undefined") {
|
|
25231
|
-
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
25232
|
-
isTTY = process.stdout && process.stdout.isTTY;
|
|
25233
|
-
}
|
|
25234
|
-
var $ = {
|
|
25235
|
-
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
25236
|
-
};
|
|
25237
|
-
function init(x, y) {
|
|
25238
|
-
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
25239
|
-
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
25240
|
-
return function(txt) {
|
|
25241
|
-
if (!$.enabled || txt == null) return txt;
|
|
25242
|
-
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
25243
|
-
};
|
|
25244
|
-
}
|
|
25245
|
-
__name(init, "init");
|
|
25246
|
-
var dim = init(2, 22);
|
|
25247
|
-
var red = init(31, 39);
|
|
25248
|
-
var green = init(32, 39);
|
|
25249
|
-
var yellow = init(33, 39);
|
|
25250
|
-
var blue = init(34, 39);
|
|
25251
|
-
var magenta = init(35, 39);
|
|
25252
|
-
var cyan = init(36, 39);
|
|
25253
|
-
|
|
25254
|
-
// src/zod-format.ts
|
|
25255
|
-
var originalEnabled = $.enabled;
|
|
25256
|
-
function _forceColour(enabled = originalEnabled) {
|
|
25257
|
-
$.enabled = enabled;
|
|
25258
|
-
}
|
|
25259
|
-
__name(_forceColour, "_forceColour");
|
|
25260
|
-
var kMessages = Symbol("kMessages");
|
|
25261
|
-
var kActual = Symbol("kActual");
|
|
25262
|
-
var kGroupId = Symbol("kGroupId");
|
|
25263
|
-
var groupColours = [
|
|
25264
|
-
yellow,
|
|
25265
|
-
/* (green) */
|
|
25266
|
-
cyan,
|
|
25267
|
-
blue,
|
|
25268
|
-
magenta,
|
|
25269
|
-
green
|
|
25270
|
-
];
|
|
25271
|
-
var GroupCountsMap = Map;
|
|
25272
|
-
function isAnnotation(value) {
|
|
25273
|
-
return typeof value === "object" && value !== null && kMessages in value && kActual in value;
|
|
25274
|
-
}
|
|
25275
|
-
__name(isAnnotation, "isAnnotation");
|
|
25276
|
-
function isRecord2(value) {
|
|
25277
|
-
return typeof value === "object" && value !== null;
|
|
25278
|
-
}
|
|
25279
|
-
__name(isRecord2, "isRecord");
|
|
25280
|
-
function arrayShallowEqual(a, b) {
|
|
25281
|
-
if (a.length !== b.length) {
|
|
25282
|
-
return false;
|
|
25283
|
-
}
|
|
25284
|
-
for (let i = 0; i < a.length; i++) {
|
|
25285
|
-
if (a[i] !== b[i]) {
|
|
25286
|
-
return false;
|
|
25287
|
-
}
|
|
25288
|
-
}
|
|
25289
|
-
return true;
|
|
25290
|
-
}
|
|
25291
|
-
__name(arrayShallowEqual, "arrayShallowEqual");
|
|
25292
|
-
function issueEqual(a, b) {
|
|
25293
|
-
return a.message === b.message && arrayShallowEqual(a.path, b.path);
|
|
25294
|
-
}
|
|
25295
|
-
__name(issueEqual, "issueEqual");
|
|
25296
|
-
function hasMultipleDistinctMessages(issues, atDepth) {
|
|
25297
|
-
let firstIssue;
|
|
25298
|
-
for (const issue2 of issues) {
|
|
25299
|
-
if (issue2.path.length < atDepth) {
|
|
25300
|
-
continue;
|
|
25301
|
-
}
|
|
25302
|
-
if (firstIssue === void 0) {
|
|
25303
|
-
firstIssue = issue2;
|
|
25304
|
-
} else if (!issueEqual(firstIssue, issue2)) {
|
|
25305
|
-
return true;
|
|
25306
|
-
}
|
|
25307
|
-
}
|
|
25308
|
-
return false;
|
|
25309
|
-
}
|
|
25310
|
-
__name(hasMultipleDistinctMessages, "hasMultipleDistinctMessages");
|
|
25311
|
-
function annotate(groupCounts, annotated, input, issue2, path6, groupId) {
|
|
25312
|
-
if (path6.length === 0) {
|
|
25313
|
-
if (issue2.code === "invalid_union") {
|
|
25314
|
-
const allBranchIssues = issue2.errors;
|
|
25315
|
-
const unionIssues = allBranchIssues.flat();
|
|
25316
|
-
if (unionIssues.length > 0) {
|
|
25317
|
-
const multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);
|
|
25318
|
-
let newGroupId;
|
|
25319
|
-
if (isRecord2(input) && multipleDistinct) {
|
|
25320
|
-
newGroupId = groupCounts.size;
|
|
25321
|
-
groupCounts.set(newGroupId, 0);
|
|
25322
|
-
}
|
|
25323
|
-
for (const branchIssues of allBranchIssues) {
|
|
25324
|
-
for (const unionIssue of branchIssues) {
|
|
25325
|
-
const unionPath = unionIssue.path;
|
|
25326
|
-
if (multipleDistinct && unionPath.length === 0) {
|
|
25327
|
-
continue;
|
|
25328
|
-
}
|
|
25329
|
-
annotated = annotate(
|
|
25330
|
-
groupCounts,
|
|
25331
|
-
annotated,
|
|
25332
|
-
input,
|
|
25333
|
-
unionIssue,
|
|
25334
|
-
unionPath,
|
|
25335
|
-
newGroupId
|
|
25336
|
-
);
|
|
25337
|
-
}
|
|
25338
|
-
}
|
|
25339
|
-
return annotated;
|
|
25340
|
-
}
|
|
25341
|
-
}
|
|
25342
|
-
const message = issue2.message;
|
|
25343
|
-
if (annotated !== void 0) {
|
|
25344
|
-
if (isAnnotation(annotated) && !annotated[kMessages].includes(message)) {
|
|
25345
|
-
annotated[kMessages].push(message);
|
|
25346
|
-
}
|
|
25347
|
-
return annotated;
|
|
25348
|
-
}
|
|
25349
|
-
if (groupId !== void 0) {
|
|
25350
|
-
const current = groupCounts.get(groupId);
|
|
25351
|
-
assert2(current !== void 0);
|
|
25352
|
-
groupCounts.set(groupId, current + 1);
|
|
25353
|
-
}
|
|
25354
|
-
return {
|
|
25355
|
-
[kMessages]: [message],
|
|
25356
|
-
[kActual]: input,
|
|
25357
|
-
[kGroupId]: groupId
|
|
25358
|
-
};
|
|
25359
|
-
}
|
|
25360
|
-
const [head, ...tail] = path6;
|
|
25361
|
-
assert2(isRecord2(input), "Expected object/array input for nested issue");
|
|
25362
|
-
if (annotated === void 0) {
|
|
25363
|
-
if (Array.isArray(input)) {
|
|
25364
|
-
annotated = new Array(input.length);
|
|
25365
|
-
} else {
|
|
25366
|
-
const entries = Object.keys(input).map((key) => [key, void 0]);
|
|
25367
|
-
annotated = Object.fromEntries(entries);
|
|
25368
|
-
}
|
|
25369
|
-
}
|
|
25370
|
-
assert2(isRecord2(annotated), "Expected object/array for nested issue");
|
|
25371
|
-
annotated[head] = annotate(
|
|
25372
|
-
groupCounts,
|
|
25373
|
-
annotated[head],
|
|
25374
|
-
input[head],
|
|
25375
|
-
issue2,
|
|
25376
|
-
tail,
|
|
25377
|
-
groupId
|
|
25378
|
-
);
|
|
25379
|
-
return annotated;
|
|
25380
|
-
}
|
|
25381
|
-
__name(annotate, "annotate");
|
|
25382
|
-
function print(inspectOptions, groupCounts, annotated, indent = "", extras) {
|
|
25383
|
-
const prefix = extras?.prefix ?? "";
|
|
25384
|
-
const suffix = extras?.suffix ?? "";
|
|
25385
|
-
if (isAnnotation(annotated)) {
|
|
25386
|
-
const prefixIndent = indent + " ".repeat(prefix.length);
|
|
25387
|
-
const actual = util.inspect(annotated[kActual], inspectOptions);
|
|
25388
|
-
const actualIndented = actual.split("\n").map((line, i) => i > 0 ? prefixIndent + line : line).join("\n");
|
|
25389
|
-
let messageColour = red;
|
|
25390
|
-
let messagePrefix = prefixIndent + "^";
|
|
25391
|
-
let groupOr = "";
|
|
25392
|
-
if (annotated[kGroupId] !== void 0) {
|
|
25393
|
-
messageColour = groupColours[annotated[kGroupId] % groupColours.length];
|
|
25394
|
-
messagePrefix += annotated[kGroupId] + 1;
|
|
25395
|
-
const remaining = groupCounts.get(annotated[kGroupId]);
|
|
25396
|
-
assert2(remaining !== void 0);
|
|
25397
|
-
if (remaining > 1) {
|
|
25398
|
-
groupOr = " *or*";
|
|
25399
|
-
}
|
|
25400
|
-
groupCounts.set(annotated[kGroupId], remaining - 1);
|
|
25401
|
-
}
|
|
25402
|
-
messagePrefix += " ";
|
|
25403
|
-
const messageIndent = " ".repeat(messagePrefix.length);
|
|
25404
|
-
const messageIndented = annotated[kMessages].flatMap((m) => m.split("\n")).map((line, i) => i > 0 ? messageIndent + line : line).join("\n");
|
|
25405
|
-
const error51 = messageColour(`${messagePrefix}${messageIndented}${groupOr}`);
|
|
25406
|
-
return `${indent}${dim(prefix)}${actualIndented}${dim(suffix)}
|
|
25407
|
-
${error51}`;
|
|
25408
|
-
} else if (Array.isArray(annotated)) {
|
|
25409
|
-
let result = `${indent}${dim(`${prefix}[`)}
|
|
25410
|
-
`;
|
|
25411
|
-
const arrayIndent = indent + " ";
|
|
25412
|
-
for (let i = 0; i < annotated.length; i++) {
|
|
25413
|
-
const value = annotated[i];
|
|
25414
|
-
if (value === void 0 && (i === 0 || annotated[i - 1] !== void 0)) {
|
|
25415
|
-
result += `${arrayIndent}${dim("...,")}
|
|
25416
|
-
`;
|
|
25417
|
-
}
|
|
25418
|
-
if (value !== void 0) {
|
|
25419
|
-
result += print(inspectOptions, groupCounts, value, arrayIndent, {
|
|
25420
|
-
prefix: `/* [${i}] */ `,
|
|
25421
|
-
suffix: ","
|
|
25422
|
-
});
|
|
25423
|
-
result += "\n";
|
|
25424
|
-
}
|
|
25425
|
-
}
|
|
25426
|
-
result += `${indent}${dim(`]${suffix}`)}`;
|
|
25427
|
-
return result;
|
|
25428
|
-
} else if (isRecord2(annotated)) {
|
|
25429
|
-
let result = `${indent}${dim(`${prefix}{`)}
|
|
25430
|
-
`;
|
|
25431
|
-
const objectIndent = indent + " ";
|
|
25432
|
-
const entries = Object.entries(annotated);
|
|
25433
|
-
for (let i = 0; i < entries.length; i++) {
|
|
25434
|
-
const [key, value] = entries[i];
|
|
25435
|
-
if (value === void 0 && (i === 0 || entries[i - 1][1] !== void 0)) {
|
|
25436
|
-
result += `${objectIndent}${dim("...,")}
|
|
25437
|
-
`;
|
|
25438
|
-
}
|
|
25439
|
-
if (value !== void 0) {
|
|
25440
|
-
result += print(inspectOptions, groupCounts, value, objectIndent, {
|
|
25441
|
-
prefix: `${key}: `,
|
|
25442
|
-
suffix: ","
|
|
25443
|
-
});
|
|
25444
|
-
result += "\n";
|
|
25445
|
-
}
|
|
25446
|
-
}
|
|
25447
|
-
result += `${indent}${dim(`}${suffix}`)}`;
|
|
25448
|
-
return result;
|
|
25449
|
-
}
|
|
25450
|
-
return "";
|
|
25451
|
-
}
|
|
25452
|
-
__name(print, "print");
|
|
25453
|
-
function formatZodError(error51, input) {
|
|
25454
|
-
const sortedIssues = Array.from(error51.issues).sort((a, b) => {
|
|
25455
|
-
if (a.code !== b.code) {
|
|
25456
|
-
if (a.code === "invalid_union") {
|
|
25457
|
-
return -1;
|
|
25458
|
-
}
|
|
25459
|
-
if (b.code === "invalid_union") {
|
|
25460
|
-
return 1;
|
|
25461
|
-
}
|
|
25462
|
-
}
|
|
25463
|
-
return 0;
|
|
25464
|
-
});
|
|
25465
|
-
let annotated;
|
|
25466
|
-
const groupCounts = new GroupCountsMap();
|
|
25467
|
-
for (const issue2 of sortedIssues) {
|
|
25468
|
-
annotated = annotate(
|
|
25469
|
-
groupCounts,
|
|
25470
|
-
annotated,
|
|
25471
|
-
input,
|
|
25472
|
-
issue2,
|
|
25473
|
-
issue2.path
|
|
25474
|
-
);
|
|
25475
|
-
}
|
|
25476
|
-
const inspectOptions = {
|
|
25477
|
-
depth: 0,
|
|
25478
|
-
colors: $.enabled
|
|
25479
|
-
};
|
|
25480
|
-
return print(inspectOptions, groupCounts, annotated);
|
|
25481
|
-
}
|
|
25482
|
-
__name(formatZodError, "formatZodError");
|
|
25483
26235
|
function toUrlPath(filePath) {
|
|
25484
26236
|
assert$1(
|
|
25485
26237
|
!/^[a-z]:/i.test(filePath),
|
|
@@ -25525,4 +26277,4 @@ safe-buffer/index.js:
|
|
|
25525
26277
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
25526
26278
|
*/
|
|
25527
26279
|
|
|
25528
|
-
export { ARTIFACTS_EVENT_TYPES, BunPackageManager,
|
|
26280
|
+
export { ARTIFACTS_EVENT_TYPES, BunPackageManager, Diagnostics, LOGGER_LEVELS, NpmPackageManager, NubPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, clearOutputFilePath, convertConfigToBindings, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractBindingsOfType, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBindings, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasMorePages, hasProperty, isCI, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isUnsafeBindingType, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, parseRetryAfterMs, parseRetryAfterValue, performApiFetchBase, printBindings, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toUrlPath, toValidWorkerName, truncate, validateBindingRemoteSetting, validatePagesConfig, writeOutput };
|