@cloudflare/workers-utils 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,14 +2,15 @@ export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate
2
2
  import { getGlobalConfigPath } from './chunk-OTBYAUQ6.mjs';
3
3
  export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-OTBYAUQ6.mjs';
4
4
  export { MetricsRegistry } from './chunk-TJ6ANXA2.mjs';
5
- import { partitionExports, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-27EBTAT2.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, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation } from './chunk-27EBTAT2.mjs';
5
+ import { partitionExports, UserError, dedent, isRedirectedRawConfig, configFileName, formatConfigSnippet, FatalError, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-XPMIK7N6.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, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation } from './chunk-XPMIK7N6.mjs';
7
7
  import { isDirectory, removeDirSync } from './chunk-OC543JY3.mjs';
8
8
  export { isDirectory, removeDir, removeDirSync } from './chunk-OC543JY3.mjs';
9
- import { __commonJS, __require, __name, __toESM } from './chunk-DDRU76YD.mjs';
9
+ import { __commonJS, __name, __require, __toESM } from './chunk-DDRU76YD.mjs';
10
10
  import fs2, { statSync, accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync as readFileSync$1 } from 'node:fs';
11
11
  import assert from 'node:assert';
12
- import path2, { join, dirname, basename, resolve } from 'node:path';
12
+ import * as path2 from 'node:path';
13
+ import path2__default, { join, dirname, basename, resolve } from 'node:path';
13
14
  import { execFileSync, spawn } from 'node:child_process';
14
15
  import { createHash } from 'node:crypto';
15
16
  import { arch } from 'node:os';
@@ -18,13 +19,464 @@ import { URLSearchParams } from 'node:url';
18
19
  import * as timersPromises from 'node:timers/promises';
19
20
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
20
21
 
22
+ // ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json
23
+ var require_vendors = __commonJS({
24
+ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports, module) {
25
+ module.exports = [
26
+ {
27
+ name: "Agola CI",
28
+ constant: "AGOLA",
29
+ env: "AGOLA_GIT_REF",
30
+ pr: "AGOLA_PULL_REQUEST_ID"
31
+ },
32
+ {
33
+ name: "Alpic",
34
+ constant: "ALPIC",
35
+ env: "ALPIC_HOST"
36
+ },
37
+ {
38
+ name: "Appcircle",
39
+ constant: "APPCIRCLE",
40
+ env: "AC_APPCIRCLE",
41
+ pr: {
42
+ env: "AC_GIT_PR",
43
+ ne: "false"
44
+ }
45
+ },
46
+ {
47
+ name: "AppVeyor",
48
+ constant: "APPVEYOR",
49
+ env: "APPVEYOR",
50
+ pr: "APPVEYOR_PULL_REQUEST_NUMBER"
51
+ },
52
+ {
53
+ name: "AWS CodeBuild",
54
+ constant: "CODEBUILD",
55
+ env: "CODEBUILD_BUILD_ARN",
56
+ pr: {
57
+ env: "CODEBUILD_WEBHOOK_EVENT",
58
+ any: [
59
+ "PULL_REQUEST_CREATED",
60
+ "PULL_REQUEST_UPDATED",
61
+ "PULL_REQUEST_REOPENED"
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ name: "Azure Pipelines",
67
+ constant: "AZURE_PIPELINES",
68
+ env: "TF_BUILD",
69
+ pr: {
70
+ BUILD_REASON: "PullRequest"
71
+ }
72
+ },
73
+ {
74
+ name: "Bamboo",
75
+ constant: "BAMBOO",
76
+ env: "bamboo_planKey"
77
+ },
78
+ {
79
+ name: "Bitbucket Pipelines",
80
+ constant: "BITBUCKET",
81
+ env: "BITBUCKET_COMMIT",
82
+ pr: "BITBUCKET_PR_ID"
83
+ },
84
+ {
85
+ name: "Bitrise",
86
+ constant: "BITRISE",
87
+ env: "BITRISE_IO",
88
+ pr: "BITRISE_PULL_REQUEST"
89
+ },
90
+ {
91
+ name: "Buddy",
92
+ constant: "BUDDY",
93
+ env: "BUDDY_WORKSPACE_ID",
94
+ pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
95
+ },
96
+ {
97
+ name: "Buildkite",
98
+ constant: "BUILDKITE",
99
+ env: "BUILDKITE",
100
+ pr: {
101
+ env: "BUILDKITE_PULL_REQUEST",
102
+ ne: "false"
103
+ }
104
+ },
105
+ {
106
+ name: "CircleCI",
107
+ constant: "CIRCLE",
108
+ env: "CIRCLECI",
109
+ pr: "CIRCLE_PULL_REQUEST"
110
+ },
111
+ {
112
+ name: "Cirrus CI",
113
+ constant: "CIRRUS",
114
+ env: "CIRRUS_CI",
115
+ pr: "CIRRUS_PR"
116
+ },
117
+ {
118
+ name: "Cloudflare Pages",
119
+ constant: "CLOUDFLARE_PAGES",
120
+ env: "CF_PAGES"
121
+ },
122
+ {
123
+ name: "Cloudflare Workers",
124
+ constant: "CLOUDFLARE_WORKERS",
125
+ env: "WORKERS_CI"
126
+ },
127
+ {
128
+ name: "Codefresh",
129
+ constant: "CODEFRESH",
130
+ env: "CF_BUILD_ID",
131
+ pr: {
132
+ any: [
133
+ "CF_PULL_REQUEST_NUMBER",
134
+ "CF_PULL_REQUEST_ID"
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ name: "Codemagic",
140
+ constant: "CODEMAGIC",
141
+ env: "CM_BUILD_ID",
142
+ pr: "CM_PULL_REQUEST"
143
+ },
144
+ {
145
+ name: "Codeship",
146
+ constant: "CODESHIP",
147
+ env: {
148
+ CI_NAME: "codeship"
149
+ }
150
+ },
151
+ {
152
+ name: "Drone",
153
+ constant: "DRONE",
154
+ env: "DRONE",
155
+ pr: {
156
+ DRONE_BUILD_EVENT: "pull_request"
157
+ }
158
+ },
159
+ {
160
+ name: "dsari",
161
+ constant: "DSARI",
162
+ env: "DSARI"
163
+ },
164
+ {
165
+ name: "Earthly",
166
+ constant: "EARTHLY",
167
+ env: "EARTHLY_CI"
168
+ },
169
+ {
170
+ name: "Expo Application Services",
171
+ constant: "EAS",
172
+ env: "EAS_BUILD"
173
+ },
174
+ {
175
+ name: "Gerrit",
176
+ constant: "GERRIT",
177
+ env: "GERRIT_PROJECT"
178
+ },
179
+ {
180
+ name: "Gitea Actions",
181
+ constant: "GITEA_ACTIONS",
182
+ env: "GITEA_ACTIONS"
183
+ },
184
+ {
185
+ name: "GitHub Actions",
186
+ constant: "GITHUB_ACTIONS",
187
+ env: "GITHUB_ACTIONS",
188
+ pr: {
189
+ GITHUB_EVENT_NAME: "pull_request"
190
+ }
191
+ },
192
+ {
193
+ name: "GitLab CI",
194
+ constant: "GITLAB",
195
+ env: "GITLAB_CI",
196
+ pr: "CI_MERGE_REQUEST_ID"
197
+ },
198
+ {
199
+ name: "GoCD",
200
+ constant: "GOCD",
201
+ env: "GO_PIPELINE_LABEL"
202
+ },
203
+ {
204
+ name: "Google Cloud Build",
205
+ constant: "GOOGLE_CLOUD_BUILD",
206
+ env: "BUILDER_OUTPUT"
207
+ },
208
+ {
209
+ name: "Harness CI",
210
+ constant: "HARNESS",
211
+ env: "HARNESS_BUILD_ID"
212
+ },
213
+ {
214
+ name: "Heroku",
215
+ constant: "HEROKU",
216
+ env: {
217
+ env: "NODE",
218
+ includes: "/app/.heroku/node/bin/node"
219
+ }
220
+ },
221
+ {
222
+ name: "Hudson",
223
+ constant: "HUDSON",
224
+ env: "HUDSON_URL"
225
+ },
226
+ {
227
+ name: "Jenkins",
228
+ constant: "JENKINS",
229
+ env: [
230
+ "JENKINS_URL",
231
+ "BUILD_ID"
232
+ ],
233
+ pr: {
234
+ any: [
235
+ "ghprbPullId",
236
+ "CHANGE_ID"
237
+ ]
238
+ }
239
+ },
240
+ {
241
+ name: "LayerCI",
242
+ constant: "LAYERCI",
243
+ env: "LAYERCI",
244
+ pr: "LAYERCI_PULL_REQUEST"
245
+ },
246
+ {
247
+ name: "Magnum CI",
248
+ constant: "MAGNUM",
249
+ env: "MAGNUM"
250
+ },
251
+ {
252
+ name: "Netlify CI",
253
+ constant: "NETLIFY",
254
+ env: "NETLIFY",
255
+ pr: {
256
+ env: "PULL_REQUEST",
257
+ ne: "false"
258
+ }
259
+ },
260
+ {
261
+ name: "Nevercode",
262
+ constant: "NEVERCODE",
263
+ env: "NEVERCODE",
264
+ pr: {
265
+ env: "NEVERCODE_PULL_REQUEST",
266
+ ne: "false"
267
+ }
268
+ },
269
+ {
270
+ name: "Prow",
271
+ constant: "PROW",
272
+ env: "PROW_JOB_ID"
273
+ },
274
+ {
275
+ name: "ReleaseHub",
276
+ constant: "RELEASEHUB",
277
+ env: "RELEASE_BUILD_ID"
278
+ },
279
+ {
280
+ name: "Render",
281
+ constant: "RENDER",
282
+ env: "RENDER",
283
+ pr: {
284
+ IS_PULL_REQUEST: "true"
285
+ }
286
+ },
287
+ {
288
+ name: "Sail CI",
289
+ constant: "SAIL",
290
+ env: "SAILCI",
291
+ pr: "SAIL_PULL_REQUEST_NUMBER"
292
+ },
293
+ {
294
+ name: "Screwdriver",
295
+ constant: "SCREWDRIVER",
296
+ env: "SCREWDRIVER",
297
+ pr: {
298
+ env: "SD_PULL_REQUEST",
299
+ ne: "false"
300
+ }
301
+ },
302
+ {
303
+ name: "Semaphore",
304
+ constant: "SEMAPHORE",
305
+ env: "SEMAPHORE",
306
+ pr: "PULL_REQUEST_NUMBER"
307
+ },
308
+ {
309
+ name: "Sourcehut",
310
+ constant: "SOURCEHUT",
311
+ env: {
312
+ CI_NAME: "sourcehut"
313
+ }
314
+ },
315
+ {
316
+ name: "Strider CD",
317
+ constant: "STRIDER",
318
+ env: "STRIDER"
319
+ },
320
+ {
321
+ name: "TaskCluster",
322
+ constant: "TASKCLUSTER",
323
+ env: [
324
+ "TASK_ID",
325
+ "RUN_ID"
326
+ ]
327
+ },
328
+ {
329
+ name: "TeamCity",
330
+ constant: "TEAMCITY",
331
+ env: "TEAMCITY_VERSION"
332
+ },
333
+ {
334
+ name: "Travis CI",
335
+ constant: "TRAVIS",
336
+ env: "TRAVIS",
337
+ pr: {
338
+ env: "TRAVIS_PULL_REQUEST",
339
+ ne: "false"
340
+ }
341
+ },
342
+ {
343
+ name: "Vela",
344
+ constant: "VELA",
345
+ env: "VELA",
346
+ pr: {
347
+ VELA_PULL_REQUEST: "1"
348
+ }
349
+ },
350
+ {
351
+ name: "Vercel",
352
+ constant: "VERCEL",
353
+ env: {
354
+ any: [
355
+ "NOW_BUILDER",
356
+ "VERCEL"
357
+ ]
358
+ },
359
+ pr: "VERCEL_GIT_PULL_REQUEST_ID"
360
+ },
361
+ {
362
+ name: "Visual Studio App Center",
363
+ constant: "APPCENTER",
364
+ env: "APPCENTER_BUILD_ID"
365
+ },
366
+ {
367
+ name: "Woodpecker",
368
+ constant: "WOODPECKER",
369
+ env: {
370
+ CI: "woodpecker"
371
+ },
372
+ pr: {
373
+ CI_BUILD_EVENT: "pull_request"
374
+ }
375
+ },
376
+ {
377
+ name: "Xcode Cloud",
378
+ constant: "XCODE_CLOUD",
379
+ env: "CI_XCODE_PROJECT",
380
+ pr: "CI_PULL_REQUEST_NUMBER"
381
+ },
382
+ {
383
+ name: "Xcode Server",
384
+ constant: "XCODE_SERVER",
385
+ env: "XCS"
386
+ }
387
+ ];
388
+ }
389
+ });
390
+
391
+ // ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js
392
+ var require_ci_info = __commonJS({
393
+ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports) {
394
+ var vendors = require_vendors();
395
+ var env = process.env;
396
+ Object.defineProperty(exports, "_vendors", {
397
+ value: vendors.map(function(v) {
398
+ return v.constant;
399
+ })
400
+ });
401
+ exports.name = null;
402
+ exports.isPR = null;
403
+ exports.id = null;
404
+ if (env.CI !== "false") {
405
+ vendors.forEach(function(vendor) {
406
+ const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
407
+ const isCI2 = envs.every(function(obj) {
408
+ return checkEnv(obj);
409
+ });
410
+ exports[vendor.constant] = isCI2;
411
+ if (!isCI2) {
412
+ return;
413
+ }
414
+ exports.name = vendor.name;
415
+ exports.isPR = checkPR(vendor);
416
+ exports.id = vendor.constant;
417
+ });
418
+ }
419
+ exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
420
+ (env.BUILD_ID || // Jenkins, Cloudbees
421
+ env.BUILD_NUMBER || // Jenkins, TeamCity
422
+ env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
423
+ env.CI_APP_ID || // Appflow
424
+ env.CI_BUILD_ID || // Appflow
425
+ env.CI_BUILD_NUMBER || // Appflow
426
+ env.CI_NAME || // Codeship and others
427
+ env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
428
+ env.RUN_ID || // TaskCluster, dsari
429
+ exports.name || false));
430
+ function checkEnv(obj) {
431
+ if (typeof obj === "string") return !!env[obj];
432
+ if ("env" in obj) {
433
+ return env[obj.env] && env[obj.env].includes(obj.includes);
434
+ }
435
+ if ("any" in obj) {
436
+ return obj.any.some(function(k) {
437
+ return !!env[k];
438
+ });
439
+ }
440
+ return Object.keys(obj).every(function(k) {
441
+ return env[k] === obj[k];
442
+ });
443
+ }
444
+ __name(checkEnv, "checkEnv");
445
+ function checkPR(vendor) {
446
+ switch (typeof vendor.pr) {
447
+ case "string":
448
+ return !!env[vendor.pr];
449
+ case "object":
450
+ if ("env" in vendor.pr) {
451
+ if ("any" in vendor.pr) {
452
+ return vendor.pr.any.some(function(key) {
453
+ return env[vendor.pr.env] === key;
454
+ });
455
+ } else {
456
+ return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
457
+ }
458
+ } else if ("any" in vendor.pr) {
459
+ return vendor.pr.any.some(function(key) {
460
+ return !!env[key];
461
+ });
462
+ } else {
463
+ return checkEnv(vendor.pr);
464
+ }
465
+ default:
466
+ return null;
467
+ }
468
+ }
469
+ __name(checkPR, "checkPR");
470
+ }
471
+ });
472
+
21
473
  // ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
22
474
  var require_command_exists = __commonJS({
23
475
  "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports, module) {
24
476
  var exec = __require("child_process").exec;
25
477
  var execSync = __require("child_process").execSync;
26
478
  var fs3 = __require("fs");
27
- var path5 = __require("path");
479
+ var path6 = __require("path");
28
480
  var access = fs3.access;
29
481
  var accessSync2 = fs3.accessSync;
30
482
  var constants2 = fs3.constants || fs3;
@@ -128,9 +580,9 @@ var require_command_exists = __commonJS({
128
580
  cleanInput = /* @__PURE__ */ __name(function(s) {
129
581
  var isPathName = /[\\]/.test(s);
130
582
  if (isPathName) {
131
- var dirname2 = '"' + path5.dirname(s) + '"';
132
- var basename2 = '"' + path5.basename(s) + '"';
133
- return dirname2 + ":" + basename2;
583
+ var dirname3 = '"' + path6.dirname(s) + '"';
584
+ var basename2 = '"' + path6.basename(s) + '"';
585
+ return dirname3 + ":" + basename2;
134
586
  }
135
587
  return '"' + s + '"';
136
588
  }, "cleanInput");
@@ -413,7 +865,7 @@ var require_utils = __commonJS({
413
865
  "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
414
866
  var fs3 = __require("fs");
415
867
  var ini = require_ini();
416
- var path5 = __require("path");
868
+ var path6 = __require("path");
417
869
  var stripJsonComments = require_strip_json_comments();
418
870
  var parse = exports.parse = function(content) {
419
871
  if (/^\s*{/.test(content))
@@ -427,7 +879,7 @@ var require_utils = __commonJS({
427
879
  for (var i in args)
428
880
  if ("string" !== typeof args[i])
429
881
  return;
430
- var file2 = path5.join.apply(null, args);
882
+ var file2 = path6.join.apply(null, args);
431
883
  try {
432
884
  return fs3.readFileSync(file2, "utf-8");
433
885
  } catch (err) {
@@ -464,15 +916,15 @@ var require_utils = __commonJS({
464
916
  return obj;
465
917
  };
466
918
  exports.find = function() {
467
- var rel = path5.join.apply(null, [].slice.call(arguments));
919
+ var rel = path6.join.apply(null, [].slice.call(arguments));
468
920
  function find2(start, rel2) {
469
- var file2 = path5.join(start, rel2);
921
+ var file2 = path6.join(start, rel2);
470
922
  try {
471
923
  fs3.statSync(file2);
472
924
  return file2;
473
925
  } catch (err) {
474
- if (path5.dirname(start) !== start)
475
- return find2(path5.dirname(start), rel2);
926
+ if (path6.dirname(start) !== start)
927
+ return find2(path6.dirname(start), rel2);
476
928
  }
477
929
  }
478
930
  __name(find2, "find");
@@ -773,7 +1225,7 @@ var require_minimist = __commonJS({
773
1225
  var require_rc = __commonJS({
774
1226
  "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
775
1227
  var cc = require_utils();
776
- var join2 = __require("path").join;
1228
+ var join3 = __require("path").join;
777
1229
  var deepExtend = require_deep_extend();
778
1230
  var etc = "/etc";
779
1231
  var win = process.platform === "win32";
@@ -799,15 +1251,15 @@ var require_rc = __commonJS({
799
1251
  __name(addConfigFile, "addConfigFile");
800
1252
  if (!win)
801
1253
  [
802
- join2(etc, name, "config"),
803
- join2(etc, name + "rc")
1254
+ join3(etc, name, "config"),
1255
+ join3(etc, name + "rc")
804
1256
  ].forEach(addConfigFile);
805
1257
  if (home)
806
1258
  [
807
- join2(home, ".config", name, "config"),
808
- join2(home, ".config", name),
809
- join2(home, "." + name, "config"),
810
- join2(home, "." + name + "rc")
1259
+ join3(home, ".config", name, "config"),
1260
+ join3(home, ".config", name),
1261
+ join3(home, "." + name, "config"),
1262
+ join3(home, "." + name + "rc")
811
1263
  ].forEach(addConfigFile);
812
1264
  addConfigFile(cc.find("." + name + "rc"));
813
1265
  if (env.config) addConfigFile(env.config);
@@ -962,8 +1414,8 @@ var require_registry_auth_token = __commonJS({
962
1414
  return void 0;
963
1415
  }
964
1416
  __name(getLegacyAuthInfo, "getLegacyAuthInfo");
965
- function normalizePath(path5) {
966
- return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
1417
+ function normalizePath(path6) {
1418
+ return path6[path6.length - 1] === "/" ? path6 : path6 + "/";
967
1419
  }
968
1420
  __name(normalizePath, "normalizePath");
969
1421
  function getAuthInfoForUrl(regUrl, npmrc) {
@@ -1013,7 +1465,7 @@ var require_registry_auth_token = __commonJS({
1013
1465
  var require_update_check = __commonJS({
1014
1466
  "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports, module) {
1015
1467
  var { URL: URL2 } = __require("url");
1016
- var { join: join2 } = __require("path");
1468
+ var { join: join3 } = __require("path");
1017
1469
  var fs3 = __require("fs");
1018
1470
  var { promisify } = __require("util");
1019
1471
  var { tmpdir } = __require("os");
@@ -1025,7 +1477,7 @@ var require_update_check = __commonJS({
1025
1477
  var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
1026
1478
  var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
1027
1479
  const rootDir = tmpdir();
1028
- const subDir = join2(rootDir, "update-check");
1480
+ const subDir = join3(rootDir, "update-check");
1029
1481
  if (!fs3.existsSync(subDir)) {
1030
1482
  await mkdir(subDir);
1031
1483
  }
@@ -1033,7 +1485,7 @@ var require_update_check = __commonJS({
1033
1485
  if (details.scope) {
1034
1486
  name = `${details.scope}-${name}`;
1035
1487
  }
1036
- return join2(subDir, name);
1488
+ return join3(subDir, name);
1037
1489
  }, "getFile");
1038
1490
  var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
1039
1491
  if (fs3.existsSync(file)) {
@@ -1245,7 +1697,6 @@ var defaultWranglerConfig = {
1245
1697
  /* Fields supported by Workers only */
1246
1698
  /*====================================================*/
1247
1699
  /* TOP-LEVEL ONLY FIELDS */
1248
- legacy_env: true,
1249
1700
  site: void 0,
1250
1701
  wasm_modules: void 0,
1251
1702
  text_blobs: void 0,
@@ -1711,8 +2162,8 @@ function getErrorMap() {
1711
2162
  }
1712
2163
  __name(getErrorMap, "getErrorMap");
1713
2164
  var makeIssue = /* @__PURE__ */ __name((params) => {
1714
- const { data, path: path5, errorMaps, issueData } = params;
1715
- const fullPath = [...path5, ...issueData.path || []];
2165
+ const { data, path: path6, errorMaps, issueData } = params;
2166
+ const fullPath = [...path6, ...issueData.path || []];
1716
2167
  const fullIssue = {
1717
2168
  ...issueData,
1718
2169
  path: fullPath
@@ -1818,11 +2269,11 @@ var ParseInputLazyPath = class {
1818
2269
  static {
1819
2270
  __name(this, "ParseInputLazyPath");
1820
2271
  }
1821
- constructor(parent, value, path5, key) {
2272
+ constructor(parent, value, path6, key) {
1822
2273
  this._cachedPath = [];
1823
2274
  this.parent = parent;
1824
2275
  this.data = value;
1825
- this._path = path5;
2276
+ this._path = path6;
1826
2277
  this._key = key;
1827
2278
  }
1828
2279
  get path() {
@@ -5387,7 +5838,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
5387
5838
  var getRegistryPath = getEnvironmentVariableFactory({
5388
5839
  variableName: "WRANGLER_REGISTRY_PATH",
5389
5840
  defaultValue() {
5390
- return path2.join(getGlobalConfigPath(), "registry");
5841
+ return path2__default.join(getGlobalConfigPath(), "registry");
5391
5842
  }
5392
5843
  });
5393
5844
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
@@ -5561,35 +6012,7 @@ function inheritable(diagnostics, topLevelEnv, rawEnv, field, validate, defaultV
5561
6012
  );
5562
6013
  }
5563
6014
  __name(inheritable, "inheritable");
5564
- function inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, rawEnv, field, validate, transformFn = (v) => v, defaultValue) {
5565
- const usingServiceEnvironments = useServiceEnvironments && topLevelEnv !== void 0;
5566
- return usingServiceEnvironments ? notAllowedInNamedServiceEnvironment(
5567
- diagnostics,
5568
- topLevelEnv,
5569
- rawEnv,
5570
- field
5571
- ) : inheritable(
5572
- diagnostics,
5573
- topLevelEnv,
5574
- rawEnv,
5575
- field,
5576
- validate,
5577
- defaultValue,
5578
- transformFn
5579
- );
5580
- }
5581
- __name(inheritableInWranglerEnvironments, "inheritableInWranglerEnvironments");
5582
6015
  var appendEnvName = /* @__PURE__ */ __name((envName) => (fieldValue) => fieldValue ? `${fieldValue}-${envName}` : void 0, "appendEnvName");
5583
- function notAllowedInNamedServiceEnvironment(diagnostics, topLevelEnv, rawEnv, field) {
5584
- if (field in rawEnv) {
5585
- diagnostics.errors.push(
5586
- `The "${field}" field is not allowed in named service environments.
5587
- Please remove the field from this environment.`
5588
- );
5589
- }
5590
- return topLevelEnv[field];
5591
- }
5592
- __name(notAllowedInNamedServiceEnvironment, "notAllowedInNamedServiceEnvironment");
5593
6016
  function notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, field, validate, defaultValue) {
5594
6017
  if (rawEnv[field] !== void 0) {
5595
6018
  validate(diagnostics, field, rawEnv[field], topLevelEnv);
@@ -5605,9 +6028,9 @@ Please add "${field}" to "env.${envName}".`
5605
6028
  return rawEnv[field] ?? defaultValue;
5606
6029
  }
5607
6030
  __name(notInheritable, "notInheritable");
5608
- function unwindPropertyPath(root, path5) {
6031
+ function unwindPropertyPath(root, path6) {
5609
6032
  let container = root;
5610
- const parts = path5.split(".");
6033
+ const parts = path6.split(".");
5611
6034
  for (let i = 0; i < parts.length - 1; i++) {
5612
6035
  if (!hasProperty(container, parts[i])) {
5613
6036
  return;
@@ -5986,15 +6409,18 @@ function isPagesConfig(rawConfig) {
5986
6409
  __name(isPagesConfig, "isPagesConfig");
5987
6410
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
5988
6411
  const diagnostics = new Diagnostics(
5989
- `Processing ${configPath ? path2.relative(process.cwd(), configPath) : "wrangler"} configuration:`
5990
- );
5991
- validateOptionalProperty(
5992
- diagnostics,
5993
- "",
5994
- "legacy_env",
5995
- rawConfig.legacy_env,
5996
- "boolean"
6412
+ `Processing ${configPath ? path2__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`
5997
6413
  );
6414
+ if ("legacy_env" in rawConfig) {
6415
+ diagnostics.errors.push(
6416
+ dedent`
6417
+ The "legacy_env" field is no longer supported, so please remove it from your configuration file.
6418
+ Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
6419
+ Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
6420
+ `
6421
+ );
6422
+ delete rawConfig.legacy_env;
6423
+ }
5998
6424
  validateOptionalProperty(
5999
6425
  diagnostics,
6000
6426
  "",
@@ -6048,12 +6474,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
6048
6474
  rawConfig.$schema,
6049
6475
  "string"
6050
6476
  );
6051
- const useServiceEnvironments = !(args["legacy-env"] ?? rawConfig.legacy_env ?? true);
6052
- if (useServiceEnvironments) {
6053
- diagnostics.warnings.push(
6054
- "Service environments are deprecated, and will be removed in the future. DO NOT USE IN PRODUCTION."
6055
- );
6056
- }
6057
6477
  const isDispatchNamespace = typeof args["dispatch-namespace"] === "string" && args["dispatch-namespace"].trim() !== "";
6058
6478
  const topLevelEnv = normalizeAndValidateEnvironment(
6059
6479
  diagnostics,
@@ -6107,7 +6527,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
6107
6527
  preserveOriginalMain,
6108
6528
  envName,
6109
6529
  topLevelEnv,
6110
- useServiceEnvironments,
6111
6530
  rawConfig
6112
6531
  );
6113
6532
  diagnostics.addChild(envDiagnostics);
@@ -6121,7 +6540,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
6121
6540
  preserveOriginalMain,
6122
6541
  envName,
6123
6542
  topLevelEnv,
6124
- useServiceEnvironments,
6125
6543
  rawConfig
6126
6544
  );
6127
6545
  const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(
@@ -6152,8 +6570,6 @@ Consider adding an environment configuration section to the ${configFileName(con
6152
6570
  configPath,
6153
6571
  rawConfig.pages_build_output_dir
6154
6572
  ),
6155
- /** Legacy_env is wrangler environments, as opposed to service environments. Wrangler environments is not legacy. */
6156
- legacy_env: !useServiceEnvironments,
6157
6573
  send_metrics: rawConfig.send_metrics,
6158
6574
  dependencies_instrumentation: rawConfig.dependencies_instrumentation,
6159
6575
  keep_vars: rawConfig.keep_vars,
@@ -6237,13 +6653,13 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
6237
6653
  // be configured in the Wrangler configuration file, but who knows, that may
6238
6654
  // change in the future, so we do a check anyway
6239
6655
  command && configPath ? Array.isArray(watch_dir) ? watch_dir.map(
6240
- (dir) => path2.relative(
6656
+ (dir2) => path2__default.relative(
6241
6657
  process.cwd(),
6242
- path2.join(path2.dirname(configPath), `${dir}`)
6658
+ path2__default.join(path2__default.dirname(configPath), `${dir2}`)
6243
6659
  )
6244
- ) : path2.relative(
6660
+ ) : path2__default.relative(
6245
6661
  process.cwd(),
6246
- path2.join(path2.dirname(configPath), `${watch_dir}`)
6662
+ path2__default.join(path2__default.dirname(configPath), `${watch_dir}`)
6247
6663
  ) : watch_dir
6248
6664
  ),
6249
6665
  cwd
@@ -6251,11 +6667,11 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
6251
6667
  }
6252
6668
  __name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
6253
6669
  function normalizeAndValidateMainField(configPath, rawMain) {
6254
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
6670
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
6255
6671
  if (rawMain !== void 0) {
6256
6672
  if (typeof rawMain === "string") {
6257
- const directory = path2.resolve(configDir);
6258
- return path2.resolve(directory, rawMain);
6673
+ const directory = path2__default.resolve(configDir);
6674
+ return path2__default.resolve(directory, rawMain);
6259
6675
  } else {
6260
6676
  return rawMain;
6261
6677
  }
@@ -6265,11 +6681,11 @@ function normalizeAndValidateMainField(configPath, rawMain) {
6265
6681
  }
6266
6682
  __name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
6267
6683
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
6268
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
6684
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
6269
6685
  if (rawDir !== void 0) {
6270
6686
  if (typeof rawDir === "string") {
6271
- const directory = path2.resolve(configDir);
6272
- return path2.resolve(directory, rawDir);
6687
+ const directory = path2__default.resolve(configDir);
6688
+ return path2__default.resolve(directory, rawDir);
6273
6689
  } else {
6274
6690
  return rawDir;
6275
6691
  }
@@ -6279,11 +6695,11 @@ function normalizeAndValidateBaseDirField(configPath, rawDir) {
6279
6695
  }
6280
6696
  __name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
6281
6697
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
6282
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
6698
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
6283
6699
  if (rawPagesDir !== void 0) {
6284
6700
  if (typeof rawPagesDir === "string") {
6285
- const directory = path2.resolve(configDir);
6286
- return path2.resolve(directory, rawPagesDir);
6701
+ const directory = path2__default.resolve(configDir);
6702
+ return path2__default.resolve(directory, rawPagesDir);
6287
6703
  } else {
6288
6704
  return rawPagesDir;
6289
6705
  }
@@ -6438,9 +6854,9 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
6438
6854
  `site.entry-point`,
6439
6855
  `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
6440
6856
  \`\`\`
6441
- main = "${path2.join(
6857
+ main = "${path2__default.join(
6442
6858
  String(legacySiteEntryPoint) || "workers-site",
6443
- path2.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js"
6859
+ path2__default.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js"
6444
6860
  )}"
6445
6861
  \`\`\``,
6446
6862
  false,
@@ -6465,9 +6881,9 @@ Delete the deprecated \`site.entry-point\` field from your config.`
6465
6881
  );
6466
6882
  }
6467
6883
  if (configPath && siteEntryPoint) {
6468
- siteEntryPoint = path2.relative(
6884
+ siteEntryPoint = path2__default.relative(
6469
6885
  process.cwd(),
6470
- path2.join(path2.dirname(configPath), siteEntryPoint)
6886
+ path2__default.join(path2__default.dirname(configPath), siteEntryPoint)
6471
6887
  );
6472
6888
  }
6473
6889
  return {
@@ -6513,9 +6929,9 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
6513
6929
  for (const [name, filePath] of Object.entries(rawMapping)) {
6514
6930
  if (isString(diagnostics, `${field}['${name}']`, filePath, void 0)) {
6515
6931
  if (configPath) {
6516
- mapping[name] = configPath ? path2.relative(
6932
+ mapping[name] = configPath ? path2__default.relative(
6517
6933
  process.cwd(),
6518
- path2.join(path2.dirname(configPath), filePath)
6934
+ path2__default.join(path2__default.dirname(configPath), filePath)
6519
6935
  ) : filePath;
6520
6936
  }
6521
6937
  }
@@ -6845,7 +7261,7 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name((diagnostics, field,
6845
7261
  }
6846
7262
  return isValid2;
6847
7263
  }, "validateStreamingTailConsumers");
6848
- function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
7264
+ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, rawConfig) {
6849
7265
  deprecated(
6850
7266
  diagnostics,
6851
7267
  rawEnv,
@@ -6860,14 +7276,12 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6860
7276
  experimental(diagnostics, rawEnv, "unsafe");
6861
7277
  }
6862
7278
  const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
6863
- const account_id = inheritableInWranglerEnvironments(
7279
+ const account_id = inheritable(
6864
7280
  diagnostics,
6865
- useServiceEnvironments,
6866
7281
  topLevelEnv,
6867
7282
  mutateEmptyStringAccountIDValue(diagnostics, rawEnv),
6868
7283
  "account_id",
6869
7284
  isString,
6870
- void 0,
6871
7285
  void 0
6872
7286
  );
6873
7287
  const routes = validateRoutes(
@@ -6940,15 +7354,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6940
7354
  configPath
6941
7355
  ),
6942
7356
  rules: validateAndNormalizeRules(diagnostics, topLevelEnv, rawEnv, envName),
6943
- name: inheritableInWranglerEnvironments(
7357
+ name: inheritable(
6944
7358
  diagnostics,
6945
- useServiceEnvironments,
6946
7359
  topLevelEnv,
6947
7360
  rawEnv,
6948
7361
  "name",
6949
7362
  isDispatchNamespace ? isString : isValidName,
6950
- appendEnvName(envName),
6951
- void 0
7363
+ void 0,
7364
+ appendEnvName(envName)
6952
7365
  ),
6953
7366
  main: preserveOriginalMain ? inheritable(
6954
7367
  diagnostics,
@@ -7564,9 +7977,9 @@ function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPa
7564
7977
  isString,
7565
7978
  void 0
7566
7979
  );
7567
- return configPath && tsconfig ? path2.relative(
7980
+ return configPath && tsconfig ? path2__default.relative(
7568
7981
  process.cwd(),
7569
- path2.join(path2.dirname(configPath), tsconfig)
7982
+ path2__default.join(path2__default.dirname(configPath), tsconfig)
7570
7983
  ) : tsconfig;
7571
7984
  }
7572
7985
  __name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
@@ -8440,9 +8853,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
8440
8853
  let resolvedBuildContextPath = void 0;
8441
8854
  try {
8442
8855
  if (isDockerfile(resolvedImage, configPath)) {
8443
- const baseDir = configPath ? path2.dirname(configPath) : process.cwd();
8444
- resolvedImage = path2.resolve(baseDir, resolvedImage);
8445
- resolvedBuildContextPath = containerAppOptional.image_build_context ? path2.resolve(baseDir, containerAppOptional.image_build_context) : path2.dirname(resolvedImage);
8856
+ const baseDir = configPath ? path2__default.dirname(configPath) : process.cwd();
8857
+ resolvedImage = path2__default.resolve(baseDir, resolvedImage);
8858
+ resolvedBuildContextPath = containerAppOptional.image_build_context ? path2__default.resolve(baseDir, containerAppOptional.image_build_context) : path2__default.dirname(resolvedImage);
8446
8859
  }
8447
8860
  } catch (err) {
8448
8861
  if (err instanceof Error && err.message) {
@@ -10939,8 +11352,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
10939
11352
  }
10940
11353
  __name(isRemoteValid, "isRemoteValid");
10941
11354
  function isDockerfile(imagePath, configPath) {
10942
- const baseDir = configPath ? path2.dirname(configPath) : process.cwd();
10943
- const maybeDockerfile = path2.resolve(baseDir, imagePath);
11355
+ const baseDir = configPath ? path2__default.dirname(configPath) : process.cwd();
11356
+ const maybeDockerfile = path2__default.resolve(baseDir, imagePath);
10944
11357
  if (fs2.existsSync(maybeDockerfile)) {
10945
11358
  if (isDirectory(maybeDockerfile)) {
10946
11359
  throw new UserError(
@@ -11166,7 +11579,7 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
11166
11579
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
11167
11580
  function getPackagePath(packageName, projectPath) {
11168
11581
  try {
11169
- return path2.dirname(
11582
+ return path2__default.dirname(
11170
11583
  __require.resolve(`${packageName}/package.json`, {
11171
11584
  paths: [projectPath]
11172
11585
  })
@@ -11174,7 +11587,7 @@ function getPackagePath(packageName, projectPath) {
11174
11587
  } catch {
11175
11588
  }
11176
11589
  try {
11177
- return path2.dirname(
11590
+ return path2__default.dirname(
11178
11591
  __require.resolve(packageName, {
11179
11592
  paths: [projectPath]
11180
11593
  })
@@ -11215,29 +11628,142 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
11215
11628
  }
11216
11629
  __name(getInstalledPackageVersion, "getInstalledPackageVersion");
11217
11630
  function findFileUp(name, startDir, lastDir) {
11218
- let dir = startDir;
11219
- const root = path2.parse(dir).root;
11631
+ let dir2 = startDir;
11632
+ const root = path2__default.parse(dir2).root;
11220
11633
  while (true) {
11221
- const candidate = path2.join(dir, name);
11634
+ const candidate = path2__default.join(dir2, name);
11222
11635
  try {
11223
11636
  if (statSync(candidate).isFile()) {
11224
11637
  return candidate;
11225
11638
  }
11226
11639
  } catch {
11227
11640
  }
11228
- if (lastDir !== void 0 && dir === lastDir) {
11641
+ if (lastDir !== void 0 && dir2 === lastDir) {
11229
11642
  break;
11230
11643
  }
11231
- const parent = path2.dirname(dir);
11232
- if (parent === dir || dir === root) {
11644
+ const parent = path2__default.dirname(dir2);
11645
+ if (parent === dir2 || dir2 === root) {
11233
11646
  break;
11234
11647
  }
11235
- dir = parent;
11648
+ dir2 = parent;
11236
11649
  }
11237
11650
  return void 0;
11238
11651
  }
11239
11652
  __name(findFileUp, "findFileUp");
11240
11653
 
11654
+ // src/is-interactive.ts
11655
+ var import_ci_info = __toESM(require_ci_info());
11656
+ function isTtyInteractive() {
11657
+ try {
11658
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
11659
+ } catch {
11660
+ return false;
11661
+ }
11662
+ }
11663
+ __name(isTtyInteractive, "isTtyInteractive");
11664
+ function isInteractive() {
11665
+ if (import_ci_info.default.CLOUDFLARE_PAGES || import_ci_info.default.CLOUDFLARE_WORKERS) {
11666
+ return false;
11667
+ }
11668
+ return isTtyInteractive();
11669
+ }
11670
+ __name(isInteractive, "isInteractive");
11671
+ function isNonInteractiveOrCI() {
11672
+ return !isInteractive() || import_ci_info.default.isCI;
11673
+ }
11674
+ __name(isNonInteractiveOrCI, "isNonInteractiveOrCI");
11675
+ function isCI() {
11676
+ return import_ci_info.default.isCI;
11677
+ }
11678
+ __name(isCI, "isCI");
11679
+
11680
+ // src/config-cache.ts
11681
+ var arrayFormatter = new Intl.ListFormat("en-US", {
11682
+ style: "long",
11683
+ type: "conjunction"
11684
+ });
11685
+ function createConfigCache(logger, options) {
11686
+ let cacheMessageShown = false;
11687
+ const namespace = options?.namespace ?? "wrangler";
11688
+ function getCacheFolder() {
11689
+ if (namespace === "wrangler") {
11690
+ const envCacheDir = getWranglerCacheDirFromEnv();
11691
+ if (envCacheDir) {
11692
+ return envCacheDir;
11693
+ }
11694
+ }
11695
+ const closestNodeModulesDirectory = dir("node_modules");
11696
+ const nodeModulesCache = closestNodeModulesDirectory ? path2.join(closestNodeModulesDirectory, ".cache", namespace) : null;
11697
+ const localCache = path2.join(process.cwd(), `.${namespace}`, "cache");
11698
+ if (nodeModulesCache && existsSync(nodeModulesCache)) {
11699
+ return nodeModulesCache;
11700
+ }
11701
+ if (existsSync(localCache)) {
11702
+ return localCache;
11703
+ }
11704
+ if (nodeModulesCache) {
11705
+ return nodeModulesCache;
11706
+ }
11707
+ return localCache;
11708
+ }
11709
+ __name(getCacheFolder, "getCacheFolder");
11710
+ function showCacheMessage(fields, folder) {
11711
+ if (!cacheMessageShown && !isNonInteractiveOrCI()) {
11712
+ if (fields.length > 0) {
11713
+ logger.debug(
11714
+ `Retrieving cached values for ${arrayFormatter.format(
11715
+ fields
11716
+ )} from ${path2.relative(process.cwd(), folder)}`
11717
+ );
11718
+ cacheMessageShown = true;
11719
+ }
11720
+ }
11721
+ }
11722
+ __name(showCacheMessage, "showCacheMessage");
11723
+ function getConfigCache(fileName) {
11724
+ try {
11725
+ const cacheFolder = getCacheFolder();
11726
+ const configCacheLocation = path2.join(cacheFolder, fileName);
11727
+ const configCache = JSON.parse(
11728
+ readFileSync$1(configCacheLocation, "utf-8")
11729
+ );
11730
+ showCacheMessage(Object.keys(configCache), cacheFolder);
11731
+ return configCache;
11732
+ } catch {
11733
+ return {};
11734
+ }
11735
+ }
11736
+ __name(getConfigCache, "getConfigCache");
11737
+ function saveToConfigCache(fileName, newValues) {
11738
+ const cacheFolder = getCacheFolder();
11739
+ if (cacheFolder) {
11740
+ logger.debug(`Saving to cache: ${JSON.stringify(newValues)}`);
11741
+ const configCacheLocation = path2.join(cacheFolder, fileName);
11742
+ const existingValues = getConfigCache(fileName);
11743
+ mkdirSync(path2.dirname(configCacheLocation), { recursive: true });
11744
+ writeFileSync(
11745
+ configCacheLocation,
11746
+ JSON.stringify({ ...existingValues, ...newValues }, null, 2)
11747
+ );
11748
+ }
11749
+ }
11750
+ __name(saveToConfigCache, "saveToConfigCache");
11751
+ function purgeConfigCaches() {
11752
+ const cacheFolder = getCacheFolder();
11753
+ if (cacheFolder) {
11754
+ removeDirSync(cacheFolder);
11755
+ }
11756
+ }
11757
+ __name(purgeConfigCaches, "purgeConfigCaches");
11758
+ return {
11759
+ getCacheFolder,
11760
+ getConfigCache,
11761
+ saveToConfigCache,
11762
+ purgeConfigCaches
11763
+ };
11764
+ }
11765
+ __name(createConfigCache, "createConfigCache");
11766
+
11241
11767
  // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
11242
11768
  var signals = [];
11243
11769
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
@@ -11504,7 +12030,7 @@ var {
11504
12030
  // src/wrangler-tmp-dir.ts
11505
12031
  function getWranglerHiddenDirPath(projectRoot) {
11506
12032
  projectRoot ??= process.cwd();
11507
- return path2.join(projectRoot, ".wrangler");
12033
+ return path2__default.join(projectRoot, ".wrangler");
11508
12034
  }
11509
12035
  __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
11510
12036
  var STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
@@ -11525,7 +12051,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
11525
12051
  if (!entry.isDirectory()) {
11526
12052
  continue;
11527
12053
  }
11528
- const entryPath = path2.join(tmpRoot, entry.name);
12054
+ const entryPath = path2__default.join(tmpRoot, entry.name);
11529
12055
  try {
11530
12056
  if (fs2.statSync(entryPath).mtimeMs < cutoff) {
11531
12057
  removeDirSync(entryPath);
@@ -11536,10 +12062,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
11536
12062
  }
11537
12063
  __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
11538
12064
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
11539
- const tmpRoot = path2.join(getWranglerHiddenDirPath(projectRoot), "tmp");
12065
+ const tmpRoot = path2__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
11540
12066
  fs2.mkdirSync(tmpRoot, { recursive: true });
11541
12067
  sweepStaleWranglerTmpDirs(tmpRoot);
11542
- const tmpPrefix = path2.join(tmpRoot, `${prefix}-`);
12068
+ const tmpPrefix = path2__default.join(tmpRoot, `${prefix}-`);
11543
12069
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
11544
12070
  const cleanupDir = /* @__PURE__ */ __name(() => {
11545
12071
  if (cleanup) {
@@ -11847,9 +12373,9 @@ Update: https://developers.cloudflare.com/cloudflare-one/networks/connectors/clo
11847
12373
  }
11848
12374
  __name(warnIfOutdated, "warnIfOutdated");
11849
12375
  function writeFileAtomic(filePath, contents) {
11850
- const dir = dirname(filePath);
12376
+ const dir2 = dirname(filePath);
11851
12377
  const tmpPath = join(
11852
- dir,
12378
+ dir2,
11853
12379
  `.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`
11854
12380
  );
11855
12381
  try {
@@ -12723,6 +13249,35 @@ var LOGGER_LEVELS = {
12723
13249
  log: 3,
12724
13250
  debug: 4
12725
13251
  };
13252
+
13253
+ // src/open-in-browser.ts
13254
+ async function openInBrowser(url, logger) {
13255
+ try {
13256
+ const { default: open } = await import('./open-BCHIM4MY.mjs');
13257
+ const childProcess = await open(url);
13258
+ childProcess.on("error", (err) => {
13259
+ handleBrowserOpenError(url, err, logger);
13260
+ });
13261
+ } catch (err) {
13262
+ if (err.code === "ENOENT") {
13263
+ handleBrowserOpenError(url, err, logger);
13264
+ } else {
13265
+ throw err;
13266
+ }
13267
+ }
13268
+ }
13269
+ __name(openInBrowser, "openInBrowser");
13270
+ function handleBrowserOpenError(url, err, logger) {
13271
+ const isEnoent = err.code === "ENOENT";
13272
+ const hint = process.platform === "linux" && isEnoent ? " You may need to install `xdg-utils` (e.g. `apt install xdg-utils`) or set a default browser." : "";
13273
+ logger.warn(
13274
+ `Failed to open a browser automatically.${hint}
13275
+ Please visit the following URL in your browser:
13276
+ ${url}`
13277
+ );
13278
+ logger.debug(err instanceof Error ? err.stack ?? String(err) : String(err));
13279
+ }
13280
+ __name(handleBrowserOpenError, "handleBrowserOpenError");
12726
13281
  var MAX_ATTEMPTS = 3;
12727
13282
  async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
12728
13283
  try {
@@ -12918,4 +13473,4 @@ safe-buffer/index.js:
12918
13473
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
12919
13474
  */
12920
13475
 
12921
- export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };
13476
+ export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isCI, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };