wrangler 3.114.11 → 3.114.13

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/wrangler-dist/cli.js +664 -340
@@ -17658,7 +17658,7 @@ var require_OSPaths = __commonJS({
17658
17658
  }
17659
17659
  __name(isEmpty, "isEmpty");
17660
17660
  function Adapt(adapter_) {
17661
- var env6 = adapter_.env, os12 = adapter_.os, path72 = adapter_.path;
17661
+ var env6 = adapter_.env, os13 = adapter_.os, path72 = adapter_.path;
17662
17662
  var isWinOS = /^win/i.test(adapter_.process.platform);
17663
17663
  function normalizePath2(path_) {
17664
17664
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
@@ -17666,11 +17666,11 @@ var require_OSPaths = __commonJS({
17666
17666
  __name(normalizePath2, "normalizePath");
17667
17667
  function home() {
17668
17668
  var posix2 = /* @__PURE__ */ __name(function() {
17669
- return normalizePath2((typeof os12.homedir === "function" ? os12.homedir() : void 0) || env6.get("HOME"));
17669
+ return normalizePath2((typeof os13.homedir === "function" ? os13.homedir() : void 0) || env6.get("HOME"));
17670
17670
  }, "posix");
17671
17671
  var windows = /* @__PURE__ */ __name(function() {
17672
17672
  var priorityList = [
17673
- typeof os12.homedir === "function" ? os12.homedir() : void 0,
17673
+ typeof os13.homedir === "function" ? os13.homedir() : void 0,
17674
17674
  env6.get("USERPROFILE"),
17675
17675
  env6.get("HOME"),
17676
17676
  env6.get("HOMEDRIVE") || env6.get("HOMEPATH") ? path72.join(env6.get("HOMEDRIVE") || "", env6.get("HOMEPATH") || "") : void 0
@@ -17690,7 +17690,7 @@ var require_OSPaths = __commonJS({
17690
17690
  function posix2() {
17691
17691
  var fallback = "/tmp";
17692
17692
  var priorityList = [
17693
- typeof os12.tmpdir === "function" ? os12.tmpdir() : void 0,
17693
+ typeof os13.tmpdir === "function" ? os13.tmpdir() : void 0,
17694
17694
  env6.get("TMPDIR"),
17695
17695
  env6.get("TEMP"),
17696
17696
  env6.get("TMP")
@@ -17703,7 +17703,7 @@ var require_OSPaths = __commonJS({
17703
17703
  function windows() {
17704
17704
  var fallback = "C:\\Temp";
17705
17705
  var priorityListLazy = [
17706
- typeof os12.tmpdir === "function" ? os12.tmpdir : function() {
17706
+ typeof os13.tmpdir === "function" ? os13.tmpdir : function() {
17707
17707
  return void 0;
17708
17708
  },
17709
17709
  function() {
@@ -17795,7 +17795,7 @@ var require_node = __commonJS({
17795
17795
  };
17796
17796
  exports2.__esModule = true;
17797
17797
  exports2.adapter = void 0;
17798
- var os12 = __importStar(require("os"));
17798
+ var os13 = __importStar(require("os"));
17799
17799
  var path72 = __importStar(require("path"));
17800
17800
  exports2.adapter = {
17801
17801
  atImportPermissions: { env: true },
@@ -17804,7 +17804,7 @@ var require_node = __commonJS({
17804
17804
  return process.env[s5];
17805
17805
  }
17806
17806
  },
17807
- os: os12,
17807
+ os: os13,
17808
17808
  path: path72,
17809
17809
  process
17810
17810
  };
@@ -18502,7 +18502,7 @@ var require_supports_colors = __commonJS({
18502
18502
  "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module3) {
18503
18503
  "use strict";
18504
18504
  init_import_meta_url();
18505
- var os12 = require("os");
18505
+ var os13 = require("os");
18506
18506
  var hasFlag3 = require_has_flag();
18507
18507
  var env6 = process.env;
18508
18508
  var forceColor = void 0;
@@ -18541,7 +18541,7 @@ var require_supports_colors = __commonJS({
18541
18541
  }
18542
18542
  var min = forceColor ? 1 : 0;
18543
18543
  if (process.platform === "win32") {
18544
- var osRelease = os12.release().split(".");
18544
+ var osRelease = os13.release().split(".");
18545
18545
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
18546
18546
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
18547
18547
  }
@@ -22715,7 +22715,7 @@ var require_main2 = __commonJS({
22715
22715
  init_import_meta_url();
22716
22716
  var fs27 = require("fs");
22717
22717
  var path72 = require("path");
22718
- var os12 = require("os");
22718
+ var os13 = require("os");
22719
22719
  var crypto8 = require("crypto");
22720
22720
  var packageJson = require_package();
22721
22721
  var version4 = packageJson.version;
@@ -22821,7 +22821,7 @@ var require_main2 = __commonJS({
22821
22821
  }
22822
22822
  __name(_vaultPath, "_vaultPath");
22823
22823
  function _resolveHome(envPath) {
22824
- return envPath[0] === "~" ? path72.join(os12.homedir(), envPath.slice(1)) : envPath;
22824
+ return envPath[0] === "~" ? path72.join(os13.homedir(), envPath.slice(1)) : envPath;
22825
22825
  }
22826
22826
  __name(_resolveHome, "_resolveHome");
22827
22827
  function _configVault(options32) {
@@ -28833,14 +28833,14 @@ var require_is_wsl = __commonJS({
28833
28833
  "../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module3) {
28834
28834
  "use strict";
28835
28835
  init_import_meta_url();
28836
- var os12 = require("os");
28836
+ var os13 = require("os");
28837
28837
  var fs27 = require("fs");
28838
28838
  var isDocker = require_is_docker();
28839
28839
  var isWsl = /* @__PURE__ */ __name(() => {
28840
28840
  if (process.platform !== "linux") {
28841
28841
  return false;
28842
28842
  }
28843
- if (os12.release().toLowerCase().includes("microsoft")) {
28843
+ if (os13.release().toLowerCase().includes("microsoft")) {
28844
28844
  if (isDocker()) {
28845
28845
  return false;
28846
28846
  }
@@ -29224,8 +29224,8 @@ var require_homedir = __commonJS({
29224
29224
  "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js"(exports2, module3) {
29225
29225
  "use strict";
29226
29226
  init_import_meta_url();
29227
- var os12 = require("os");
29228
- module3.exports = os12.homedir || /* @__PURE__ */ __name(function homedir3() {
29227
+ var os13 = require("os");
29228
+ module3.exports = os13.homedir || /* @__PURE__ */ __name(function homedir3() {
29229
29229
  var home = process.env.HOME;
29230
29230
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
29231
29231
  if (process.platform === "win32") {
@@ -53853,7 +53853,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
53853
53853
  return min;
53854
53854
  }
53855
53855
  if (import_node_process7.default.platform === "win32") {
53856
- const osRelease = import_node_os4.default.release().split(".");
53856
+ const osRelease = import_node_os5.default.release().split(".");
53857
53857
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
53858
53858
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
53859
53859
  }
@@ -53901,12 +53901,12 @@ function createSupportsColor2(stream2, options32 = {}) {
53901
53901
  });
53902
53902
  return translateLevel2(level);
53903
53903
  }
53904
- var import_node_process7, import_node_os4, import_node_tty3, env3, flagForceColor2, supportsColor2, supports_color_default2;
53904
+ var import_node_process7, import_node_os5, import_node_tty3, env3, flagForceColor2, supportsColor2, supports_color_default2;
53905
53905
  var init_supports_color = __esm({
53906
53906
  "../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js"() {
53907
53907
  init_import_meta_url();
53908
53908
  import_node_process7 = __toESM(require("node:process"), 1);
53909
- import_node_os4 = __toESM(require("node:os"), 1);
53909
+ import_node_os5 = __toESM(require("node:os"), 1);
53910
53910
  import_node_tty3 = __toESM(require("node:tty"), 1);
53911
53911
  __name(hasFlag2, "hasFlag");
53912
53912
  ({ env: env3 } = import_node_process7.default);
@@ -81432,7 +81432,7 @@ var source_default = chalk;
81432
81432
  // src/api/startDevWorker/MultiworkerRuntimeController.ts
81433
81433
  var import_miniflare10 = require("miniflare");
81434
81434
 
81435
- // src/dev/miniflare.ts
81435
+ // src/dev/miniflare/index.ts
81436
81436
  init_import_meta_url();
81437
81437
  var import_node_assert5 = __toESM(require("node:assert"));
81438
81438
  var import_node_crypto4 = require("node:crypto");
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
81450
81450
 
81451
81451
  // package.json
81452
81452
  var name = "wrangler";
81453
- var version = "3.114.11";
81453
+ var version = "3.114.13";
81454
81454
 
81455
81455
  // src/environment-variables/misc-variables.ts
81456
81456
  init_import_meta_url();
@@ -81637,6 +81637,30 @@ var import_node_path4 = __toESM(require("node:path"));
81637
81637
  var import_miniflare = require("miniflare");
81638
81638
  var import_signal_exit = __toESM(require_signal_exit());
81639
81639
 
81640
+ // ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
81641
+ init_import_meta_url();
81642
+
81643
+ // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
81644
+ init_import_meta_url();
81645
+ function ansiRegex({ onlyFirst = false } = {}) {
81646
+ const pattern = [
81647
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
81648
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
81649
+ ].join("|");
81650
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
81651
+ }
81652
+ __name(ansiRegex, "ansiRegex");
81653
+
81654
+ // ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
81655
+ var regex = ansiRegex();
81656
+ function stripAnsi2(string) {
81657
+ if (typeof string !== "string") {
81658
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
81659
+ }
81660
+ return string.replace(regex, "");
81661
+ }
81662
+ __name(stripAnsi2, "stripAnsi");
81663
+
81640
81664
  // src/utils/filesystem.ts
81641
81665
  init_import_meta_url();
81642
81666
  var import_fs5 = require("fs");
@@ -81756,7 +81780,7 @@ var hasSeenErrorMessage = false;
81756
81780
  async function appendToDebugLogFile(messageLevel, message) {
81757
81781
  const entry = `
81758
81782
  --- ${(/* @__PURE__ */ new Date()).toISOString()} ${messageLevel}
81759
- ${message}
81783
+ ${stripAnsi2(message)}
81760
81784
  ---
81761
81785
  `;
81762
81786
  if (!hasLoggedLocation) {
@@ -83496,8 +83520,12 @@ function readFileSyncToBuffer(file) {
83496
83520
  __name(readFileSyncToBuffer, "readFileSyncToBuffer");
83497
83521
  function readFileSync6(file) {
83498
83522
  try {
83499
- return fs2.readFileSync(file, { encoding: "utf-8" });
83523
+ const buffer = fs2.readFileSync(file);
83524
+ return removeBOMAndValidate(buffer, file);
83500
83525
  } catch (err) {
83526
+ if (err instanceof ParseError) {
83527
+ throw err;
83528
+ }
83501
83529
  const { message } = err;
83502
83530
  throw new ParseError({
83503
83531
  text: `Could not read file: ${file}`,
@@ -83599,6 +83627,46 @@ function parseNonHyphenedUuid(uuid) {
83599
83627
  return hyphenated.slice(0, 36);
83600
83628
  }
83601
83629
  __name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
83630
+ var UNSUPPORTED_BOMS = [
83631
+ {
83632
+ buffer: Buffer.from([0, 0, 254, 255]),
83633
+ encoding: "UTF-32 BE"
83634
+ },
83635
+ {
83636
+ buffer: Buffer.from([255, 254, 0, 0]),
83637
+ encoding: "UTF-32 LE"
83638
+ },
83639
+ {
83640
+ buffer: Buffer.from([254, 255]),
83641
+ encoding: "UTF-16 BE"
83642
+ },
83643
+ {
83644
+ buffer: Buffer.from([255, 254]),
83645
+ encoding: "UTF-16 LE"
83646
+ }
83647
+ ];
83648
+ function removeBOMAndValidate(buffer, file) {
83649
+ for (const bom of UNSUPPORTED_BOMS) {
83650
+ if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) {
83651
+ throw new ParseError({
83652
+ text: `Configuration file contains ${bom.encoding} byte order marker`,
83653
+ notes: [
83654
+ {
83655
+ text: `The file "${file}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`
83656
+ }
83657
+ ],
83658
+ location: { file, line: 1, column: 0 },
83659
+ telemetryMessage: `${bom.encoding} BOM detected`
83660
+ });
83661
+ }
83662
+ }
83663
+ const content = buffer.toString("utf-8");
83664
+ if (content.charCodeAt(0) === 65279) {
83665
+ return content.slice(1);
83666
+ }
83667
+ return content;
83668
+ }
83669
+ __name(removeBOMAndValidate, "removeBOMAndValidate");
83602
83670
 
83603
83671
  // src/user/index.ts
83604
83672
  init_import_meta_url();
@@ -88098,8 +88166,67 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name((diagnostics, field, v
88098
88166
  ]);
88099
88167
  return isValid2;
88100
88168
  }, "validateDurableObjectBinding");
88101
- var validateWorkflowBinding = /* @__PURE__ */ __name((_diagnostics, _field, _value) => {
88102
- return true;
88169
+ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
88170
+ if (typeof value !== "object" || value === null) {
88171
+ diagnostics.errors.push(
88172
+ `"workflows" bindings should be objects, but got ${JSON.stringify(value)}`
88173
+ );
88174
+ return false;
88175
+ }
88176
+ let isValid2 = true;
88177
+ if (!isRequiredProperty(value, "binding", "string")) {
88178
+ diagnostics.errors.push(
88179
+ `"${field}" bindings should have a string "binding" field but got ${JSON.stringify(
88180
+ value
88181
+ )}.`
88182
+ );
88183
+ isValid2 = false;
88184
+ }
88185
+ if (!isRequiredProperty(value, "name", "string")) {
88186
+ diagnostics.errors.push(
88187
+ `"${field}" bindings should have a string "name" field but got ${JSON.stringify(
88188
+ value
88189
+ )}.`
88190
+ );
88191
+ isValid2 = false;
88192
+ } else if (value.name.length > 64) {
88193
+ diagnostics.errors.push(
88194
+ `"${field}" binding "name" field must be 64 characters or less, but got ${value.name.length} characters.`
88195
+ );
88196
+ isValid2 = false;
88197
+ }
88198
+ if (!isRequiredProperty(value, "class_name", "string")) {
88199
+ diagnostics.errors.push(
88200
+ `"${field}" bindings should have a string "class_name" field but got ${JSON.stringify(
88201
+ value
88202
+ )}.`
88203
+ );
88204
+ isValid2 = false;
88205
+ }
88206
+ if (!isOptionalProperty(value, "script_name", "string")) {
88207
+ diagnostics.errors.push(
88208
+ `"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(
88209
+ value
88210
+ )}.`
88211
+ );
88212
+ isValid2 = false;
88213
+ }
88214
+ if (!isOptionalProperty(value, "experimental_remote", "boolean")) {
88215
+ diagnostics.errors.push(
88216
+ `"${field}" bindings should, optionally, have a boolean "experimental_remote" field but got ${JSON.stringify(
88217
+ value
88218
+ )}.`
88219
+ );
88220
+ isValid2 = false;
88221
+ }
88222
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
88223
+ "binding",
88224
+ "name",
88225
+ "class_name",
88226
+ "script_name",
88227
+ "experimental_remote"
88228
+ ]);
88229
+ return isValid2;
88103
88230
  }, "validateWorkflowBinding");
88104
88231
  var validateCflogfwdrObject = /* @__PURE__ */ __name((envName) => (diagnostics, field, value, topLevelEnv) => {
88105
88232
  const bindingsValidation = validateBindingsProperty(
@@ -90321,32 +90448,6 @@ init_import_meta_url();
90321
90448
 
90322
90449
  // ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
90323
90450
  init_import_meta_url();
90324
-
90325
- // ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
90326
- init_import_meta_url();
90327
-
90328
- // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
90329
- init_import_meta_url();
90330
- function ansiRegex({ onlyFirst = false } = {}) {
90331
- const pattern = [
90332
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
90333
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
90334
- ].join("|");
90335
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
90336
- }
90337
- __name(ansiRegex, "ansiRegex");
90338
-
90339
- // ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
90340
- var regex = ansiRegex();
90341
- function stripAnsi2(string) {
90342
- if (typeof string !== "string") {
90343
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
90344
- }
90345
- return string.replace(regex, "");
90346
- }
90347
- __name(stripAnsi2, "stripAnsi");
90348
-
90349
- // ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
90350
90451
  var import_eastasianwidth = __toESM(require_eastasianwidth(), 1);
90351
90452
  var import_emoji_regex = __toESM(require_emoji_regex2(), 1);
90352
90453
  function stringWidth(string, options32 = {}) {
@@ -90991,6 +91092,78 @@ var stderr = process.stderr;
90991
91092
  // ../cli/index.ts
90992
91093
  init_import_meta_url();
90993
91094
  var import_process = require("process");
91095
+
91096
+ // ../cli/check-macos-version.ts
91097
+ init_import_meta_url();
91098
+ var import_node_os3 = __toESM(require("node:os"));
91099
+ var MINIMUM_MACOS_VERSION = "13.5.0";
91100
+ function checkMacOSVersion(options32) {
91101
+ if (process.platform !== "darwin") {
91102
+ return;
91103
+ }
91104
+ if (process.env.CI) {
91105
+ return;
91106
+ }
91107
+ const release3 = import_node_os3.default.release();
91108
+ const macOSVersion = darwinVersionToMacOSVersion(release3);
91109
+ if (macOSVersion && isVersionLessThan(macOSVersion, MINIMUM_MACOS_VERSION)) {
91110
+ if (options32.shouldThrow) {
91111
+ throw new Error(
91112
+ `Unsupported macOS version: The Cloudflare Workers runtime cannot run on the current version of macOS (${macOSVersion}). The minimum requirement is macOS ${MINIMUM_MACOS_VERSION}+. See https://github.com/cloudflare/workerd?tab=readme-ov-file#running-workerd If you cannot upgrade your version of macOS, you could try running in a DevContainer setup with a supported version of Linux (glibc 2.35+ required).`
91113
+ );
91114
+ } else {
91115
+ console.warn(
91116
+ `\u26A0\uFE0F Warning: Unsupported macOS version detected (${macOSVersion}). The Cloudflare Workers runtime may not work correctly on macOS versions below ${MINIMUM_MACOS_VERSION}. Consider upgrading to macOS ${MINIMUM_MACOS_VERSION}+ or using a DevContainer setup with a supported version of Linux (glibc 2.35+ required).`
91117
+ );
91118
+ }
91119
+ }
91120
+ }
91121
+ __name(checkMacOSVersion, "checkMacOSVersion");
91122
+ function darwinVersionToMacOSVersion(darwinVersion) {
91123
+ const match2 = darwinVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
91124
+ if (!match2) {
91125
+ return null;
91126
+ }
91127
+ const major = parseInt(match2[1], 10);
91128
+ if (major >= 20) {
91129
+ const macOSMajor = major - 9;
91130
+ const minor = parseInt(match2[2], 10);
91131
+ const patch = parseInt(match2[3], 10);
91132
+ return `${macOSMajor}.${minor}.${patch}`;
91133
+ }
91134
+ return null;
91135
+ }
91136
+ __name(darwinVersionToMacOSVersion, "darwinVersionToMacOSVersion");
91137
+ function isVersionLessThan(version1, version22) {
91138
+ const versionRegex = /^(\d+)\.(\d+)\.(\d+)$/;
91139
+ const match1 = version1.match(versionRegex);
91140
+ const match2 = version22.match(versionRegex);
91141
+ if (!match1 || !match2) {
91142
+ throw new Error(
91143
+ `Invalid version format. Expected M.m.p format, got: ${version1}, ${version22}`
91144
+ );
91145
+ }
91146
+ const [major1, minor1, patch1] = [
91147
+ parseInt(match1[1], 10),
91148
+ parseInt(match1[2], 10),
91149
+ parseInt(match1[3], 10)
91150
+ ];
91151
+ const [major2, minor2, patch2] = [
91152
+ parseInt(match2[1], 10),
91153
+ parseInt(match2[2], 10),
91154
+ parseInt(match2[3], 10)
91155
+ ];
91156
+ if (major1 !== major2) {
91157
+ return major1 < major2;
91158
+ }
91159
+ if (minor1 !== minor2) {
91160
+ return minor1 < minor2;
91161
+ }
91162
+ return patch1 < patch2;
91163
+ }
91164
+ __name(isVersionLessThan, "isVersionLessThan");
91165
+
91166
+ // ../cli/index.ts
90994
91167
  var shapes = {
90995
91168
  diamond: "\u25C7",
90996
91169
  dash: "\u2500",
@@ -93925,11 +94098,132 @@ async function imagesRemoteFetcher(request4) {
93925
94098
  }
93926
94099
  __name(imagesRemoteFetcher, "imagesRemoteFetcher");
93927
94100
 
94101
+ // src/update-check.ts
94102
+ init_import_meta_url();
94103
+ var import_update_check = __toESM(require_update_check());
94104
+ async function doUpdateCheck() {
94105
+ let update = null;
94106
+ const pkg = { name, version };
94107
+ try {
94108
+ update = await (0, import_update_check.default)(pkg, {
94109
+ distTag: pkg.version.startsWith("0.0.0") ? "beta" : "latest"
94110
+ });
94111
+ } catch (err) {
94112
+ }
94113
+ return update?.latest;
94114
+ }
94115
+ __name(doUpdateCheck, "doUpdateCheck");
94116
+ var updateCheckPromise;
94117
+ function updateCheck() {
94118
+ return updateCheckPromise ??= doUpdateCheck();
94119
+ }
94120
+ __name(updateCheck, "updateCheck");
94121
+
94122
+ // src/vectorize/fetcher.ts
94123
+ init_import_meta_url();
94124
+ var import_miniflare6 = require("miniflare");
94125
+ var EXTERNAL_VECTORIZE_WORKER_NAME = "__WRANGLER_EXTERNAL_VECTORIZE_WORKER";
94126
+ var EXTERNAL_VECTORIZE_WORKER_SCRIPT = `
94127
+ import makeBinding from 'cloudflare-internal:vectorize-api'
94128
+
94129
+ export default function (env) {
94130
+ return makeBinding({
94131
+ fetcher: env.FETCHER,
94132
+ indexId: env.INDEX_ID,
94133
+ indexVersion: env.INDEX_VERSION,
94134
+ useNdJson: true,
94135
+ });
94136
+ }
94137
+ `;
94138
+ var URL_SUBSTITUTIONS = /* @__PURE__ */ new Map([
94139
+ ["getByIds", "get_by_ids"],
94140
+ ["deleteByIds", "delete_by_ids"]
94141
+ ]);
94142
+ function MakeVectorizeFetcher(indexId) {
94143
+ return async function(request4) {
94144
+ const accountId = await getAccountId();
94145
+ request4.headers.delete("Host");
94146
+ request4.headers.delete("Content-Length");
94147
+ let op = request4.url.split("/").pop() || "";
94148
+ op = URL_SUBSTITUTIONS.get(op) || op;
94149
+ const base = `/accounts/${accountId}/vectorize/v2/indexes/${indexId}/`;
94150
+ const url4 = base + op;
94151
+ const res = await performApiFetch(url4, {
94152
+ method: request4.method,
94153
+ headers: Object.fromEntries(request4.headers.entries()),
94154
+ body: request4.body,
94155
+ duplex: "half"
94156
+ });
94157
+ const respHeaders = new import_miniflare6.Headers(res.headers);
94158
+ respHeaders.delete("Host");
94159
+ respHeaders.delete("Content-Length");
94160
+ const apiResponse = await res.json();
94161
+ const newResponse = apiResponse.success ? apiResponse.result : {
94162
+ error: apiResponse.errors[0].message,
94163
+ code: apiResponse.errors[0].code
94164
+ };
94165
+ return new import_miniflare6.Response(JSON.stringify(newResponse), {
94166
+ status: res.status,
94167
+ headers: respHeaders
94168
+ });
94169
+ };
94170
+ }
94171
+ __name(MakeVectorizeFetcher, "MakeVectorizeFetcher");
94172
+
94173
+ // src/dev/class-names-sqlite.ts
94174
+ init_import_meta_url();
94175
+ function getClassNamesWhichUseSQLite(migrations) {
94176
+ const classNamesWhichUseSQLite = /* @__PURE__ */ new Map();
94177
+ (migrations || []).forEach((migration) => {
94178
+ migration.deleted_classes?.forEach((deleted_class) => {
94179
+ if (!classNamesWhichUseSQLite.delete(deleted_class)) {
94180
+ throw new UserError(
94181
+ `Cannot apply deleted_classes migration to non-existent class ${deleted_class}`
94182
+ );
94183
+ }
94184
+ });
94185
+ migration.renamed_classes?.forEach(({ from, to }) => {
94186
+ const useSQLite = classNamesWhichUseSQLite.get(from);
94187
+ if (useSQLite === void 0) {
94188
+ throw new UserError(
94189
+ `Cannot apply renamed_classes migration to non-existent class ${from}`
94190
+ );
94191
+ } else {
94192
+ classNamesWhichUseSQLite.delete(from);
94193
+ classNamesWhichUseSQLite.set(to, useSQLite);
94194
+ }
94195
+ });
94196
+ migration.new_classes?.forEach((new_class) => {
94197
+ if (classNamesWhichUseSQLite.has(new_class)) {
94198
+ throw new UserError(
94199
+ `Cannot apply new_classes migration to existing class ${new_class}`
94200
+ );
94201
+ } else {
94202
+ classNamesWhichUseSQLite.set(new_class, false);
94203
+ }
94204
+ });
94205
+ migration.new_sqlite_classes?.forEach((new_class) => {
94206
+ if (classNamesWhichUseSQLite.has(new_class)) {
94207
+ throw new UserError(
94208
+ `Cannot apply new_sqlite_classes migration to existing class ${new_class}`
94209
+ );
94210
+ } else {
94211
+ classNamesWhichUseSQLite.set(new_class, true);
94212
+ }
94213
+ });
94214
+ });
94215
+ return classNamesWhichUseSQLite;
94216
+ }
94217
+ __name(getClassNamesWhichUseSQLite, "getClassNamesWhichUseSQLite");
94218
+
94219
+ // src/dev/miniflare/stdio.ts
94220
+ init_import_meta_url();
94221
+
93928
94222
  // src/sourcemap.ts
93929
94223
  init_import_meta_url();
93930
94224
  var import_node_assert4 = __toESM(require("node:assert"));
93931
94225
  var import_node_url6 = __toESM(require("node:url"));
93932
- var import_miniflare6 = require("miniflare");
94226
+ var import_miniflare7 = require("miniflare");
93933
94227
  function maybeRetrieveFileSourceMap(filePath) {
93934
94228
  if (filePath === void 0) {
93935
94229
  return null;
@@ -93966,7 +94260,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
93966
94260
  if (sourceMappingPrepareStackTrace !== void 0) {
93967
94261
  return sourceMappingPrepareStackTrace;
93968
94262
  }
93969
- const support = (0, import_miniflare6.getFreshSourceMapSupport)();
94263
+ const support = (0, import_miniflare7.getFreshSourceMapSupport)();
93970
94264
  const originalPrepareStackTrace = Error.prepareStackTrace;
93971
94265
  support.install({
93972
94266
  environment: "node",
@@ -94150,125 +94444,125 @@ var CallSite = class {
94150
94444
  };
94151
94445
  __name(CallSite, "CallSite");
94152
94446
 
94153
- // src/update-check.ts
94154
- init_import_meta_url();
94155
- var import_update_check = __toESM(require_update_check());
94156
- async function doUpdateCheck() {
94157
- let update = null;
94158
- const pkg = { name, version };
94159
- try {
94160
- update = await (0, import_update_check.default)(pkg, {
94161
- distTag: pkg.version.startsWith("0.0.0") ? "beta" : "latest"
94162
- });
94163
- } catch (err) {
94164
- }
94165
- return update?.latest;
94166
- }
94167
- __name(doUpdateCheck, "doUpdateCheck");
94168
- var updateCheckPromise;
94169
- function updateCheck() {
94170
- return updateCheckPromise ??= doUpdateCheck();
94171
- }
94172
- __name(updateCheck, "updateCheck");
94173
-
94174
- // src/vectorize/fetcher.ts
94175
- init_import_meta_url();
94176
- var import_miniflare7 = require("miniflare");
94177
- var EXTERNAL_VECTORIZE_WORKER_NAME = "__WRANGLER_EXTERNAL_VECTORIZE_WORKER";
94178
- var EXTERNAL_VECTORIZE_WORKER_SCRIPT = `
94179
- import makeBinding from 'cloudflare-internal:vectorize-api'
94180
-
94181
- export default function (env) {
94182
- return makeBinding({
94183
- fetcher: env.FETCHER,
94184
- indexId: env.INDEX_ID,
94185
- indexVersion: env.INDEX_VERSION,
94186
- useNdJson: true,
94187
- });
94447
+ // src/dev/miniflare/stdio.ts
94448
+ function handleRuntimeStdioWithStructuredLogs(stdout2, stderr2) {
94449
+ stdout2.on("data", getProcessStreamDataListener("stdout"));
94450
+ stderr2.on("data", getProcessStreamDataListener("stderr"));
94451
+ }
94452
+ __name(handleRuntimeStdioWithStructuredLogs, "handleRuntimeStdioWithStructuredLogs");
94453
+ function getProcessStreamDataListener(processStream) {
94454
+ let streamAccumulator = "";
94455
+ return (chunk) => {
94456
+ const fullStreamOutput = `${streamAccumulator}${chunk}`;
94457
+ let currentLogsStr = "";
94458
+ const lastNewlineIdx = fullStreamOutput.lastIndexOf("\n");
94459
+ if (lastNewlineIdx > 0) {
94460
+ currentLogsStr = fullStreamOutput.slice(0, lastNewlineIdx);
94461
+ streamAccumulator = fullStreamOutput.slice(lastNewlineIdx + 1);
94462
+ } else {
94463
+ streamAccumulator = fullStreamOutput;
94464
+ }
94465
+ const lines = currentLogsStr.split("\n");
94466
+ for (const line of lines) {
94467
+ const structuredLog = parseStructuredLog(line);
94468
+ if (structuredLog) {
94469
+ logStructuredLog(structuredLog, processStream);
94470
+ } else {
94471
+ const level = processStream === "stdout" ? "log" : "error";
94472
+ logger[level](line);
94473
+ }
94474
+ }
94475
+ };
94188
94476
  }
94189
- `;
94190
- var URL_SUBSTITUTIONS = /* @__PURE__ */ new Map([
94191
- ["getByIds", "get_by_ids"],
94192
- ["deleteByIds", "delete_by_ids"]
94193
- ]);
94194
- function MakeVectorizeFetcher(indexId) {
94195
- return async function(request4) {
94196
- const accountId = await getAccountId();
94197
- request4.headers.delete("Host");
94198
- request4.headers.delete("Content-Length");
94199
- let op = request4.url.split("/").pop() || "";
94200
- op = URL_SUBSTITUTIONS.get(op) || op;
94201
- const base = `/accounts/${accountId}/vectorize/v2/indexes/${indexId}/`;
94202
- const url4 = base + op;
94203
- const res = await performApiFetch(url4, {
94204
- method: request4.method,
94205
- headers: Object.fromEntries(request4.headers.entries()),
94206
- body: request4.body,
94207
- duplex: "half"
94208
- });
94209
- const respHeaders = new import_miniflare7.Headers(res.headers);
94210
- respHeaders.delete("Host");
94211
- respHeaders.delete("Content-Length");
94212
- const apiResponse = await res.json();
94213
- const newResponse = apiResponse.success ? apiResponse.result : {
94214
- error: apiResponse.errors[0].message,
94215
- code: apiResponse.errors[0].code
94477
+ __name(getProcessStreamDataListener, "getProcessStreamDataListener");
94478
+ function parseStructuredLog(str) {
94479
+ try {
94480
+ const maybeStructuredLog = JSON.parse(str);
94481
+ if (typeof maybeStructuredLog !== "object" || maybeStructuredLog === null) {
94482
+ return null;
94483
+ }
94484
+ const timestamp = parseInt(maybeStructuredLog.timestamp);
94485
+ if (isNaN(timestamp) || typeof maybeStructuredLog.level !== "string" || typeof maybeStructuredLog.message !== "string") {
94486
+ return null;
94487
+ }
94488
+ return {
94489
+ timestamp,
94490
+ level: maybeStructuredLog.level,
94491
+ message: maybeStructuredLog.message
94216
94492
  };
94217
- return new import_miniflare7.Response(JSON.stringify(newResponse), {
94218
- status: res.status,
94219
- headers: respHeaders
94220
- });
94221
- };
94493
+ } catch {
94494
+ return null;
94495
+ }
94222
94496
  }
94223
- __name(MakeVectorizeFetcher, "MakeVectorizeFetcher");
94224
-
94225
- // src/dev/class-names-sqlite.ts
94226
- init_import_meta_url();
94227
- function getClassNamesWhichUseSQLite(migrations) {
94228
- const classNamesWhichUseSQLite = /* @__PURE__ */ new Map();
94229
- (migrations || []).forEach((migration) => {
94230
- migration.deleted_classes?.forEach((deleted_class) => {
94231
- if (!classNamesWhichUseSQLite.delete(deleted_class)) {
94232
- throw new UserError(
94233
- `Cannot apply deleted_classes migration to non-existent class ${deleted_class}`
94234
- );
94235
- }
94236
- });
94237
- migration.renamed_classes?.forEach(({ from, to }) => {
94238
- const useSQLite = classNamesWhichUseSQLite.get(from);
94239
- if (useSQLite === void 0) {
94240
- throw new UserError(
94241
- `Cannot apply renamed_classes migration to non-existent class ${from}`
94242
- );
94243
- } else {
94244
- classNamesWhichUseSQLite.delete(from);
94245
- classNamesWhichUseSQLite.set(to, useSQLite);
94246
- }
94247
- });
94248
- migration.new_classes?.forEach((new_class) => {
94249
- if (classNamesWhichUseSQLite.has(new_class)) {
94250
- throw new UserError(
94251
- `Cannot apply new_classes migration to existing class ${new_class}`
94252
- );
94253
- } else {
94254
- classNamesWhichUseSQLite.set(new_class, false);
94255
- }
94256
- });
94257
- migration.new_sqlite_classes?.forEach((new_class) => {
94258
- if (classNamesWhichUseSQLite.has(new_class)) {
94259
- throw new UserError(
94260
- `Cannot apply new_sqlite_classes migration to existing class ${new_class}`
94261
- );
94262
- } else {
94263
- classNamesWhichUseSQLite.set(new_class, true);
94497
+ __name(parseStructuredLog, "parseStructuredLog");
94498
+ function logStructuredLog({ level, message }, processStream) {
94499
+ if (messageClassifiers.isBarf(message)) {
94500
+ if (messageClassifiers.isAddressInUse(message)) {
94501
+ const address = message.match(
94502
+ /Address already in use; toString\(\) = (.+)\n/
94503
+ )?.[1];
94504
+ logger.error(
94505
+ `Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`
94506
+ );
94507
+ return logger.debug(message);
94508
+ }
94509
+ if (messageClassifiers.isAccessViolation(message)) {
94510
+ let error2 = "There was an access violation in the runtime.";
94511
+ if (process.platform === "win32") {
94512
+ error2 += "\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\nCheck that you have the latest version installed.\nSee https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.";
94264
94513
  }
94265
- });
94266
- });
94267
- return classNamesWhichUseSQLite;
94514
+ logger.error(error2);
94515
+ return logger.debug(message);
94516
+ }
94517
+ return logger.debug(message);
94518
+ }
94519
+ if ((level === "info" || level === "error") && messageClassifiers.isCodeMovedWarning(message)) {
94520
+ return;
94521
+ }
94522
+ if (level === "warn") {
94523
+ return logger.warn(message);
94524
+ }
94525
+ if (level === "info") {
94526
+ return logger.info(message);
94527
+ }
94528
+ if (level === "debug") {
94529
+ return logger.debug(message);
94530
+ }
94531
+ if (level === "error") {
94532
+ return logger.error(getSourceMappedString(message));
94533
+ }
94534
+ if (processStream === "stderr") {
94535
+ return logger.error(getSourceMappedString(message));
94536
+ } else {
94537
+ return logger.log(getSourceMappedString(message));
94538
+ }
94268
94539
  }
94269
- __name(getClassNamesWhichUseSQLite, "getClassNamesWhichUseSQLite");
94540
+ __name(logStructuredLog, "logStructuredLog");
94541
+ var messageClassifiers = {
94542
+ // Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
94543
+ isBarf(chunk) {
94544
+ const containsLlvmSymbolizerWarning = chunk.includes(
94545
+ "Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
94546
+ );
94547
+ const containsRecursiveIsolateLockWarning = chunk.includes(
94548
+ "took recursive isolate lock"
94549
+ );
94550
+ const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
94551
+ return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
94552
+ },
94553
+ // Is this chunk an Address In Use error?
94554
+ isAddressInUse(chunk) {
94555
+ return chunk.includes("Address already in use; toString() = ");
94556
+ },
94557
+ isCodeMovedWarning(chunk) {
94558
+ return /CODE_MOVED for unknown code block/.test(chunk);
94559
+ },
94560
+ isAccessViolation(chunk) {
94561
+ return chunk.includes("access violation;");
94562
+ }
94563
+ };
94270
94564
 
94271
- // src/dev/miniflare.ts
94565
+ // src/dev/miniflare/index.ts
94272
94566
  var EXTERNAL_SERVICE_WORKER_NAME = "__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER";
94273
94567
  var EXTERNAL_SERVICE_WORKER_SCRIPT = `
94274
94568
  import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
@@ -94846,73 +95140,6 @@ function buildSitesOptions({
94846
95140
  }
94847
95141
  }
94848
95142
  __name(buildSitesOptions, "buildSitesOptions");
94849
- function handleRuntimeStdio(stdout2, stderr2) {
94850
- const classifiers = {
94851
- // Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
94852
- isBarf(chunk) {
94853
- const containsLlvmSymbolizerWarning = chunk.includes(
94854
- "Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
94855
- );
94856
- const containsRecursiveIsolateLockWarning = chunk.includes(
94857
- "took recursive isolate lock"
94858
- );
94859
- const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
94860
- return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
94861
- },
94862
- // Is this chunk an Address In Use error?
94863
- isAddressInUse(chunk) {
94864
- return chunk.includes("Address already in use; toString() = ");
94865
- },
94866
- isWarning(chunk) {
94867
- return /\.c\+\+:\d+: warning:/.test(chunk);
94868
- },
94869
- isCodeMovedWarning(chunk) {
94870
- return /CODE_MOVED for unknown code block/.test(chunk);
94871
- },
94872
- isAccessViolation(chunk) {
94873
- return chunk.includes("access violation;");
94874
- }
94875
- };
94876
- stdout2.on("data", (chunk) => {
94877
- chunk = chunk.toString().trim();
94878
- if (classifiers.isBarf(chunk)) {
94879
- logger.debug(chunk);
94880
- } else if (classifiers.isWarning(chunk)) {
94881
- logger.warn(chunk);
94882
- } else {
94883
- logger.info(getSourceMappedString(chunk));
94884
- }
94885
- });
94886
- stderr2.on("data", (chunk) => {
94887
- chunk = chunk.toString().trim();
94888
- if (classifiers.isBarf(chunk)) {
94889
- if (classifiers.isAddressInUse(chunk)) {
94890
- const address = chunk.match(
94891
- /Address already in use; toString\(\) = (.+)\n/
94892
- )?.[1];
94893
- logger.error(
94894
- `Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`
94895
- );
94896
- logger.debug(chunk);
94897
- } else if (classifiers.isAccessViolation(chunk)) {
94898
- let error2 = "There was an access violation in the runtime.";
94899
- if (process.platform === "win32") {
94900
- error2 += "\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\nCheck that you have the latest version installed.\nSee https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.";
94901
- }
94902
- logger.error(error2);
94903
- logger.debug(chunk);
94904
- } else {
94905
- logger.debug(chunk);
94906
- }
94907
- } else if (classifiers.isWarning(chunk)) {
94908
- logger.warn(chunk);
94909
- } else if (classifiers.isCodeMovedWarning(chunk)) {
94910
- } else {
94911
- logger.error(getSourceMappedString(chunk));
94912
- }
94913
- });
94914
- }
94915
- __name(handleRuntimeStdio, "handleRuntimeStdio");
94916
95143
  var didWarnMiniflareCronSupport = false;
94917
95144
  var didWarnMiniflareVectorizeSupport = false;
94918
95145
  var didWarnAiAccountUsage = false;
@@ -94978,7 +95205,8 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
94978
95205
  unsafeEnableAssetsRpc: getFlag("ASSETS_RPC"),
94979
95206
  log: log2,
94980
95207
  verbose: logger.loggerLevel === "debug",
94981
- handleRuntimeStdio,
95208
+ handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
95209
+ structuredWorkerdLogs: true,
94982
95210
  ...persistOptions,
94983
95211
  workers: [
94984
95212
  {
@@ -95815,7 +96043,7 @@ var wrapper_default = import_websocket.default;
95815
96043
  // src/dev/inspect.ts
95816
96044
  init_import_meta_url();
95817
96045
  var import_fs7 = require("fs");
95818
- var import_node_os3 = __toESM(require("node:os"));
96046
+ var import_node_os4 = __toESM(require("node:os"));
95819
96047
  var import_node_url8 = require("node:url");
95820
96048
  var import_path6 = __toESM(require("path"));
95821
96049
  var import_open2 = __toESM(require_open());
@@ -96067,7 +96295,7 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
96067
96295
  const url4 = `https://devtools.devprod.cloudflare.dev/js_app?${query.toString()}`;
96068
96296
  const errorMessage = "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
96069
96297
  let braveBrowser;
96070
- switch (import_node_os3.default.platform()) {
96298
+ switch (import_node_os4.default.platform()) {
96071
96299
  case "darwin":
96072
96300
  case "win32":
96073
96301
  braveBrowser = "Brave";
@@ -96307,7 +96535,8 @@ var ProxyController = class extends Controller {
96307
96535
  logger.loggerLevel === "debug" ? "wrangler-ProxyWorker" : "wrangler"
96308
96536
  )
96309
96537
  }),
96310
- handleRuntimeStdio,
96538
+ handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
96539
+ structuredWorkerdLogs: true,
96311
96540
  liveReload: false
96312
96541
  };
96313
96542
  const proxyWorkerOptionsChanged = didMiniflareOptionsChange(
@@ -102080,7 +102309,7 @@ var normalizeStdio = /* @__PURE__ */ __name((options32) => {
102080
102309
 
102081
102310
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
102082
102311
  init_import_meta_url();
102083
- var import_node_os5 = __toESM(require("node:os"), 1);
102312
+ var import_node_os6 = __toESM(require("node:os"), 1);
102084
102313
  var import_signal_exit4 = __toESM(require_signal_exit(), 1);
102085
102314
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
102086
102315
  var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options32 = {}) => {
@@ -102101,7 +102330,7 @@ var setKillTimeout = /* @__PURE__ */ __name((kill, signal, options32, killResult
102101
102330
  }
102102
102331
  }, "setKillTimeout");
102103
102332
  var shouldForceKill = /* @__PURE__ */ __name((signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult, "shouldForceKill");
102104
- var isSigterm = /* @__PURE__ */ __name((signal) => signal === import_node_os5.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
102333
+ var isSigterm = /* @__PURE__ */ __name((signal) => signal === import_node_os6.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
102105
102334
  var getForceKillAfterTimeout = /* @__PURE__ */ __name(({ forceKillAfterTimeout = true }) => {
102106
102335
  if (forceKillAfterTimeout === true) {
102107
102336
  return DEFAULT_FORCE_KILL_TIMEOUT;
@@ -102547,7 +102776,10 @@ async function getPackageManager(cwd2) {
102547
102776
  return { ...PnpmPackageManager, cwd: cwd2 };
102548
102777
  } else {
102549
102778
  throw new UserError(
102550
- "Unable to find a package manager. Supported managers are: npm, yarn, and pnpm."
102779
+ "Unable to find a package manager. Supported managers are: npm, yarn, and pnpm.",
102780
+ {
102781
+ telemetryMessage: true
102782
+ }
102551
102783
  );
102552
102784
  }
102553
102785
  }
@@ -102646,13 +102878,13 @@ __name(sniffUserAgent, "sniffUserAgent");
102646
102878
 
102647
102879
  // src/metrics/helpers.ts
102648
102880
  init_import_meta_url();
102649
- var import_node_os6 = __toESM(require("node:os"));
102881
+ var import_node_os7 = __toESM(require("node:os"));
102650
102882
  function getWranglerVersion() {
102651
102883
  return version;
102652
102884
  }
102653
102885
  __name(getWranglerVersion, "getWranglerVersion");
102654
102886
  function getPlatform() {
102655
- const platform3 = import_node_os6.default.platform();
102887
+ const platform3 = import_node_os7.default.platform();
102656
102888
  switch (platform3) {
102657
102889
  case "win32":
102658
102890
  return "Windows";
@@ -102670,7 +102902,7 @@ function getOS() {
102670
102902
  }
102671
102903
  __name(getOS, "getOS");
102672
102904
  function getOSVersion() {
102673
- return import_node_os6.default.version();
102905
+ return import_node_os7.default.version();
102674
102906
  }
102675
102907
  __name(getOSVersion, "getOSVersion");
102676
102908
  function getNodeVersion() {
@@ -104391,27 +104623,6 @@ async function printBundleSize(main2, modules) {
104391
104623
  logger.log(`Total Upload: ${colorizedReport}`);
104392
104624
  }
104393
104625
  __name(printBundleSize, "printBundleSize");
104394
- function printOffendingDependencies(dependencies) {
104395
- const warning = [];
104396
- const dependenciesSorted = Object.entries(dependencies);
104397
- dependenciesSorted.sort(
104398
- ([_adep, aData], [_bdep, bData]) => bData.bytesInOutput - aData.bytesInOutput
104399
- );
104400
- const topLargest = dependenciesSorted.slice(0, 5);
104401
- if (topLargest.length > 0) {
104402
- warning.push(
104403
- `Here are the ${topLargest.length} largest dependencies included in your script:`
104404
- );
104405
- for (const [dep, data] of topLargest) {
104406
- warning.push(
104407
- `- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES).toFixed(2)} KiB`
104408
- );
104409
- }
104410
- warning.push("If these are unnecessary, consider removing them");
104411
- logger.warn(warning.join("\n"));
104412
- }
104413
- }
104414
- __name(printOffendingDependencies, "printOffendingDependencies");
104415
104626
 
104416
104627
  // src/deployment-bundle/create-worker-upload-form.ts
104417
104628
  init_import_meta_url();
@@ -106012,7 +106223,7 @@ var import_miniflare22 = require("miniflare");
106012
106223
 
106013
106224
  // src/index.ts
106014
106225
  init_import_meta_url();
106015
- var import_node_os8 = __toESM(require("node:os"));
106226
+ var import_node_os9 = __toESM(require("node:os"));
106016
106227
  var import_promises34 = require("node:timers/promises");
106017
106228
  var import_undici20 = __toESM(require_undici());
106018
106229
 
@@ -119867,6 +120078,10 @@ function isUsedAsServiceBinding(references) {
119867
120078
  return (references.services?.incoming.length || 0) > 0;
119868
120079
  }
119869
120080
  __name(isUsedAsServiceBinding, "isUsedAsServiceBinding");
120081
+ function isUsedByPagesFunction(references) {
120082
+ return references.services?.pages_function === true;
120083
+ }
120084
+ __name(isUsedByPagesFunction, "isUsedByPagesFunction");
119870
120085
  function isUsedAsDurableObjectNamespace(references, scriptName) {
119871
120086
  return (references.durable_objects?.filter((ref) => ref.service !== scriptName)?.length || 0) > 0;
119872
120087
  }
@@ -119886,7 +120101,7 @@ async function checkAndConfirmForceDeleteIfNecessary(scriptName, accountId) {
119886
120101
  const tailProducers = await fetchResult(
119887
120102
  `/accounts/${accountId}/workers/tails/by-consumer/${scriptName}`
119888
120103
  );
119889
- const isDependentService = isUsedAsServiceBinding(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
120104
+ const isDependentService = isUsedAsServiceBinding(references) || isUsedByPagesFunction(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
119890
120105
  if (!isDependentService) {
119891
120106
  return false;
119892
120107
  }
@@ -119897,6 +120112,11 @@ async function checkAndConfirmForceDeleteIfNecessary(scriptName, accountId) {
119897
120112
  `- Worker ${dependentScript} uses this Worker as a Service Binding`
119898
120113
  );
119899
120114
  }
120115
+ if (isUsedByPagesFunction(references)) {
120116
+ dependentMessages.push(
120117
+ `- A Pages project has a Service Binding to this Worker`
120118
+ );
120119
+ }
119900
120120
  for (const implementedDOBindingReference of references.durable_objects || []) {
119901
120121
  if (implementedDOBindingReference.service === scriptName) {
119902
120122
  continue;
@@ -120163,7 +120383,8 @@ async function getEntry(args, config, command2) {
120163
120383
  } else {
120164
120384
  if (config.pages_build_output_dir && command2 === "dev") {
120165
120385
  throw new UserError(
120166
- "It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages dev` instead."
120386
+ "It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages dev` instead.",
120387
+ { telemetryMessage: true }
120167
120388
  );
120168
120389
  }
120169
120390
  const compatibilityDateStr = [
@@ -120226,7 +120447,8 @@ async function getEntry(args, config, command2) {
120226
120447
  ${addScriptName}
120227
120448
  ${addScriptNameExamples}
120228
120449
  ${migrateText}
120229
- ${migrateUrl}`
120450
+ ${migrateUrl}`,
120451
+ { telemetryMessage: "tried to use DO with service worker" }
120230
120452
  );
120231
120453
  }
120232
120454
  return {
@@ -121152,7 +121374,7 @@ var import_node_path38 = __toESM(require("node:path"));
121152
121374
  // src/git-client.ts
121153
121375
  init_import_meta_url();
121154
121376
  var import_node_fs19 = __toESM(require("node:fs"));
121155
- var import_node_os7 = __toESM(require("node:os"));
121377
+ var import_node_os8 = __toESM(require("node:os"));
121156
121378
  var import_node_path36 = __toESM(require("node:path"));
121157
121379
 
121158
121380
  // ../../node_modules/.pnpm/semiver@1.1.0/node_modules/semiver/dist/semiver.mjs
@@ -121223,7 +121445,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
121223
121445
  args.push(remote.substring(0, tagIndex));
121224
121446
  }
121225
121447
  const tempDir = import_node_fs19.default.mkdtempSync(
121226
- import_node_path36.default.join(import_node_os7.default.tmpdir(), `wrangler-generate-repo-`)
121448
+ import_node_path36.default.join(import_node_os8.default.tmpdir(), `wrangler-generate-repo-`)
121227
121449
  );
121228
121450
  args.push(tempDir);
121229
121451
  await execa("git", args);
@@ -126703,10 +126925,18 @@ To silence this warning, pass in --commit-dirty=true`
126703
126925
  );
126704
126926
  const failureMessage = logs.data[logs.total - 1].line.replace("Error:", "").trim();
126705
126927
  if (failureMessage.includes("Script startup exceeded CPU time limit")) {
126928
+ const startupError = new ParseError({ text: failureMessage });
126929
+ Object.assign(startupError, { code: 10021 });
126706
126930
  const workerBundle = formData.get("_worker.bundle");
126707
126931
  const filePath = import_node_path53.default.join(getPagesTmpDir(), "_worker.bundle");
126708
126932
  await (0, import_promises22.writeFile)(filePath, workerBundle.stream());
126709
- await handleStartupError(filePath, getPagesProjectRoot());
126933
+ throw new UserError(
126934
+ await diagnoseStartupError(
126935
+ startupError,
126936
+ filePath,
126937
+ getPagesProjectRoot()
126938
+ )
126939
+ );
126710
126940
  }
126711
126941
  throw new FatalError(
126712
126942
  `Deployment failed!
@@ -136702,6 +136932,11 @@ var r2ObjectGetCommand = createCommand({
136702
136932
  type: "string"
136703
136933
  }
136704
136934
  },
136935
+ behaviour: {
136936
+ printBanner({ pipe }) {
136937
+ return !pipe;
136938
+ }
136939
+ },
136705
136940
  positionalArgs: ["objectPath"],
136706
136941
  async handler(objectGetYargs, { config }) {
136707
136942
  const { objectPath, pipe, jurisdiction } = objectGetYargs;
@@ -144253,7 +144488,7 @@ __name(wrapResolver, "wrapResolver");
144253
144488
 
144254
144489
  // ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js
144255
144490
  init_import_meta_url();
144256
- var os8 = __toESM(require("os"));
144491
+ var os9 = __toESM(require("os"));
144257
144492
  var import_util15 = require("util");
144258
144493
  var NodeClient = class extends ServerRuntimeClient {
144259
144494
  /**
@@ -144280,7 +144515,7 @@ var NodeClient = class extends ServerRuntimeClient {
144280
144515
  ...options32,
144281
144516
  platform: "node",
144282
144517
  runtime: { name: "node", version: global.process.version },
144283
- serverName: options32.serverName || global.process.env.SENTRY_NAME || os8.hostname()
144518
+ serverName: options32.serverName || global.process.env.SENTRY_NAME || os9.hostname()
144284
144519
  };
144285
144520
  super(clientOptions);
144286
144521
  }
@@ -145325,7 +145560,7 @@ __name(_readSourceFile, "_readSourceFile");
145325
145560
  init_import_meta_url();
145326
145561
  var import_child_process4 = require("child_process");
145327
145562
  var import_fs21 = require("fs");
145328
- var os9 = __toESM(require("os"));
145563
+ var os10 = __toESM(require("os"));
145329
145564
  var import_path22 = require("path");
145330
145565
  var import_util16 = require("util");
145331
145566
  var readFileAsync = (0, import_util16.promisify)(import_fs21.readFile);
@@ -145386,7 +145621,7 @@ var Context = class {
145386
145621
  contexts.app.app_memory = process.memoryUsage().rss;
145387
145622
  }
145388
145623
  if (_optionalChain([contexts, "optionalAccess", (_13) => _13.device, "optionalAccess", (_14) => _14.free_memory])) {
145389
- contexts.device.free_memory = os9.freemem();
145624
+ contexts.device.free_memory = os10.freemem();
145390
145625
  }
145391
145626
  return contexts;
145392
145627
  }
@@ -145419,7 +145654,7 @@ var Context = class {
145419
145654
  __name(Context, "Context");
145420
145655
  Context.__initStatic();
145421
145656
  async function getOsContext() {
145422
- const platformId = os9.platform();
145657
+ const platformId = os10.platform();
145423
145658
  switch (platformId) {
145424
145659
  case "darwin":
145425
145660
  return getDarwinInfo();
@@ -145428,7 +145663,7 @@ async function getOsContext() {
145428
145663
  default:
145429
145664
  return {
145430
145665
  name: PLATFORM_NAMES[platformId] || platformId,
145431
- version: os9.release()
145666
+ version: os10.release()
145432
145667
  };
145433
145668
  }
145434
145669
  }
@@ -145462,19 +145697,19 @@ function getDeviceContext(deviceOpt) {
145462
145697
  const device = {};
145463
145698
  let uptime3;
145464
145699
  try {
145465
- uptime3 = os9.uptime && os9.uptime();
145700
+ uptime3 = os10.uptime && os10.uptime();
145466
145701
  } catch (e7) {
145467
145702
  }
145468
145703
  if (typeof uptime3 === "number") {
145469
145704
  device.boot_time = new Date(Date.now() - uptime3 * 1e3).toISOString();
145470
145705
  }
145471
- device.arch = os9.arch();
145706
+ device.arch = os10.arch();
145472
145707
  if (deviceOpt === true || deviceOpt.memory) {
145473
- device.memory_size = os9.totalmem();
145474
- device.free_memory = os9.freemem();
145708
+ device.memory_size = os10.totalmem();
145709
+ device.free_memory = os10.freemem();
145475
145710
  }
145476
145711
  if (deviceOpt === true || deviceOpt.cpu) {
145477
- const cpuInfo = os9.cpus();
145712
+ const cpuInfo = os10.cpus();
145478
145713
  if (cpuInfo && cpuInfo.length) {
145479
145714
  const firstCpu = cpuInfo[0];
145480
145715
  device.processor_count = cpuInfo.length;
@@ -145523,9 +145758,9 @@ function matchFirst(regex2, text) {
145523
145758
  __name(matchFirst, "matchFirst");
145524
145759
  async function getDarwinInfo() {
145525
145760
  const darwinInfo = {
145526
- kernel_version: os9.release(),
145761
+ kernel_version: os10.release(),
145527
145762
  name: "Mac OS X",
145528
- version: `10.${Number(os9.release().split(".")[0]) - 4}`
145763
+ version: `10.${Number(os10.release().split(".")[0]) - 4}`
145529
145764
  };
145530
145765
  try {
145531
145766
  const output = await new Promise((resolve25, reject) => {
@@ -145551,7 +145786,7 @@ function getLinuxDistroId(name2) {
145551
145786
  __name(getLinuxDistroId, "getLinuxDistroId");
145552
145787
  async function getLinuxInfo() {
145553
145788
  const linuxInfo = {
145554
- kernel_version: os9.release(),
145789
+ kernel_version: os10.release(),
145555
145790
  name: "Linux"
145556
145791
  };
145557
145792
  try {
@@ -147512,13 +147747,23 @@ function printTokenPermissions(user) {
147512
147747
  `\u{1F513} To see token permissions visit https://dash.cloudflare.com/${user.authType === "User API Token" ? "profile" : user.accounts[0].id}/api-tokens.`
147513
147748
  );
147514
147749
  }
147515
- logger.log(
147516
- `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
147517
- );
147750
+ logger.log(`\u{1F513} Token Permissions:`);
147518
147751
  logger.log(`Scope (Access)`);
147752
+ const expectedScopes = new Set(DefaultScopeKeys);
147519
147753
  for (const [scope, access4] of permissions) {
147754
+ expectedScopes.delete(`${scope}:${access4}`);
147520
147755
  logger.log(`- ${scope} ${access4 ? `(${access4})` : ``}`);
147521
147756
  }
147757
+ if (expectedScopes.size > 0) {
147758
+ logger.log("");
147759
+ logger.log(
147760
+ formatMessage({
147761
+ text: "Wrangler is missing some expected Oauth scopes. To fix this, run `wrangler login` to refresh your token. The missing scopes are:",
147762
+ kind: "warning",
147763
+ notes: [...expectedScopes.values()].map((s5) => ({ text: `- ${s5}` }))
147764
+ })
147765
+ );
147766
+ }
147522
147767
  }
147523
147768
  __name(printTokenPermissions, "printTokenPermissions");
147524
147769
  async function printMembershipInfo(user, accountFilter) {
@@ -150992,12 +151237,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150992
151237
  if (!bindingsPrinted) {
150993
151238
  printBindings({ ...bindings, vars: maskedVars });
150994
151239
  }
150995
- await helpIfErrorIsSizeOrScriptStartup(
151240
+ const message = await helpIfErrorIsSizeOrScriptStartup(
150996
151241
  err,
150997
151242
  dependencies,
150998
151243
  workerBundle,
150999
151244
  props.projectRoot
151000
151245
  );
151246
+ if (message) {
151247
+ logger.error(message);
151248
+ }
151001
151249
  if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
151002
151250
  const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
151003
151251
  if (bundleType === "commonjs") {
@@ -153356,6 +153604,7 @@ function createCLIParser(argv) {
153356
153604
  __name(createCLIParser, "createCLIParser");
153357
153605
  async function main(argv) {
153358
153606
  setupSentry();
153607
+ checkMacOSVersion({ shouldThrow: false });
153359
153608
  const startTime = Date.now();
153360
153609
  const wrangler = createCLIParser(argv);
153361
153610
  let command2;
@@ -153440,7 +153689,7 @@ async function main(argv) {
153440
153689
  logger.log(e7.message);
153441
153690
  } else if (e7 instanceof Error && e7.message.includes("Raw mode is not supported on")) {
153442
153691
  mayReport = false;
153443
- const currentPlatform = import_node_os8.default.platform();
153692
+ const currentPlatform = import_node_os9.default.platform();
153444
153693
  const thisTerminalIsUnsupported = "This terminal doesn't support raw mode.";
153445
153694
  const soWranglerWontWork = "Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it.";
153446
153695
  const tryRunningItIn = "Try running your previous command in a terminal that supports raw mode";
@@ -153641,11 +153890,13 @@ function getModuleType(entry) {
153641
153890
  __name(getModuleType, "getModuleType");
153642
153891
  async function convertWorkerBundleToModules(workerBundle) {
153643
153892
  return await Promise.all(
153644
- [...workerBundle.entries()].map(async (m6) => ({
153645
- type: getModuleType(m6[1]),
153646
- path: m6[0],
153647
- contents: await getEntryValue(m6[1])
153648
- }))
153893
+ [...workerBundle.entries()].map(
153894
+ async (m6) => ({
153895
+ type: getModuleType(m6[1]),
153896
+ path: m6[0],
153897
+ contents: await getEntryValue(m6[1])
153898
+ })
153899
+ )
153649
153900
  );
153650
153901
  }
153651
153902
  __name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
@@ -153720,52 +153971,106 @@ async function analyseBundle(workerBundle) {
153720
153971
  __name(analyseBundle, "analyseBundle");
153721
153972
 
153722
153973
  // src/utils/friendly-validator-errors.ts
153974
+ async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
153975
+ if (errIsScriptSize(err)) {
153976
+ return await diagnoseScriptSizeError(err, dependencies);
153977
+ }
153978
+ if (errIsStartupErr(err)) {
153979
+ return await diagnoseStartupError(err, workerBundle, projectRoot);
153980
+ }
153981
+ return null;
153982
+ }
153983
+ __name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
153984
+ function diagnoseScriptSizeError(err, dependencies) {
153985
+ let message = esm_default2`
153986
+ Your Worker failed validation because it exceeded size limits.
153987
+
153988
+ ${err.text}
153989
+ ${err.notes.map((note) => ` - ${note.text}`).join("\n")}
153990
+ `;
153991
+ const dependenciesMessage = getOffendingDependenciesMessage(dependencies);
153992
+ if (dependenciesMessage) {
153993
+ message += dependenciesMessage;
153994
+ }
153995
+ return message;
153996
+ }
153997
+ __name(diagnoseScriptSizeError, "diagnoseScriptSizeError");
153998
+ async function diagnoseStartupError(err, workerBundle, projectRoot) {
153999
+ let errorMessage = esm_default2`
154000
+ Your Worker failed validation because it exceeded startup limits.
154001
+
154002
+ ${err.text}
154003
+ ${err.notes.map((note) => ` - ${note.text}`).join("\n")}
154004
+
154005
+ To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
154006
+
154007
+ Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`;
154008
+ try {
154009
+ const cpuProfile = await analyseBundle(workerBundle);
154010
+ const tmpDir = await getWranglerTmpDir(
154011
+ projectRoot,
154012
+ "startup-profile",
154013
+ false
154014
+ );
154015
+ const profile = import_node_path60.default.relative(
154016
+ projectRoot ?? process.cwd(),
154017
+ import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
154018
+ );
154019
+ await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
154020
+ errorMessage += esm_default2`
154021
+
154022
+ A CPU Profile of your Worker's startup phase has been written to ${profile} - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`;
154023
+ } catch (profilingError) {
154024
+ logger.debug(
154025
+ `An error occurred while trying to locally profile the Worker: ${profilingError}`
154026
+ );
154027
+ }
154028
+ return errorMessage;
154029
+ }
154030
+ __name(diagnoseStartupError, "diagnoseStartupError");
154031
+ function getOffendingDependenciesMessage(dependencies) {
154032
+ const dependenciesSorted = Object.entries(dependencies);
154033
+ if (dependenciesSorted.length === 0) {
154034
+ return null;
154035
+ }
154036
+ dependenciesSorted.sort(
154037
+ ([, aData], [, bData]) => bData.bytesInOutput - aData.bytesInOutput
154038
+ );
154039
+ const topLargest = dependenciesSorted.slice(0, 5);
154040
+ const ONE_KIB_BYTES2 = 1024;
154041
+ return [
154042
+ "",
154043
+ `Here are the ${topLargest.length} largest dependencies included in your script:`,
154044
+ "",
154045
+ ...topLargest.map(
154046
+ ([dep, data]) => `- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES2).toFixed(2)} KiB`
154047
+ ),
154048
+ "",
154049
+ "If these are unnecessary, consider removing them",
154050
+ ""
154051
+ ].join("\n");
154052
+ }
154053
+ __name(getOffendingDependenciesMessage, "getOffendingDependenciesMessage");
153723
154054
  function errIsScriptSize(err) {
153724
- if (!err) {
154055
+ if (!(err instanceof ParseError)) {
153725
154056
  return false;
153726
154057
  }
153727
- if (err.code === 10027) {
154058
+ if ("code" in err && err.code === 10027) {
153728
154059
  return true;
153729
154060
  }
153730
154061
  return false;
153731
154062
  }
153732
154063
  __name(errIsScriptSize, "errIsScriptSize");
153733
- var scriptStartupErrorRegex = /startup/i;
153734
154064
  function errIsStartupErr(err) {
153735
- if (!err) {
154065
+ if (!(err instanceof ParseError)) {
153736
154066
  return false;
153737
154067
  }
153738
- if (err.code === 10021 && err instanceof ParseError && scriptStartupErrorRegex.test(err.notes[0]?.text)) {
154068
+ if ("code" in err && err.code === 10021 && /startup/i.test(err.notes[0]?.text)) {
153739
154069
  return true;
153740
154070
  }
153741
154071
  return false;
153742
154072
  }
153743
154073
  __name(errIsStartupErr, "errIsStartupErr");
153744
- async function handleStartupError(workerBundle, projectRoot) {
153745
- const cpuProfile = await analyseBundle(workerBundle);
153746
- const tmpDir = await getWranglerTmpDir(projectRoot, "startup-profile", false);
153747
- const profile = import_node_path60.default.relative(
153748
- projectRoot ?? process.cwd(),
153749
- import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
153750
- );
153751
- await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
153752
- throw new UserError(esm_default2`
153753
- Your Worker failed validation because it exceeded startup limits.
153754
- To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
153755
-
153756
- A CPU Profile of your Worker's startup phase has been written to ${profile} - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.
153757
-
153758
- Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`);
153759
- }
153760
- __name(handleStartupError, "handleStartupError");
153761
- async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
153762
- if (errIsScriptSize(err)) {
153763
- printOffendingDependencies(dependencies);
153764
- } else if (errIsStartupErr(err)) {
153765
- await handleStartupError(workerBundle, projectRoot);
153766
- }
153767
- }
153768
- __name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
153769
154074
 
153770
154075
  // src/deploy/deploy.ts
153771
154076
  var validateRoutes3 = /* @__PURE__ */ __name((routes, assets) => {
@@ -153958,12 +154263,15 @@ Edits that have been made via the script API will be overridden by your local co
153958
154263
  }
153959
154264
  if (!(props.compatibilityDate || config.compatibility_date)) {
153960
154265
  const compatibilityDateStr = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1 + "").padStart(2, "0")}-${((/* @__PURE__ */ new Date()).getDate() + "").padStart(2, "0")}`;
153961
- throw new UserError(`A compatibility_date is required when publishing. Add the following to your ${configFileName(config.configPath)} file:
154266
+ throw new UserError(
154267
+ `A compatibility_date is required when publishing. Add the following to your ${configFileName(config.configPath)} file:
153962
154268
  \`\`\`
153963
154269
  ${formatConfigSnippet({ compatibility_date: compatibilityDateStr }, config.configPath, false)}
153964
154270
  \`\`\`
153965
154271
  Or you could pass it in your terminal as \`--compatibility-date ${compatibilityDateStr}\`
153966
- See https://developers.cloudflare.com/workers/platform/compatibility-dates for more information.`);
154272
+ See https://developers.cloudflare.com/workers/platform/compatibility-dates for more information.`,
154273
+ { telemetryMessage: "missing compatibiltiy date when deploying" }
154274
+ );
153967
154275
  }
153968
154276
  const routes = props.routes ?? config.routes ?? (config.route ? [config.route] : []) ?? [];
153969
154277
  validateRoutes3(routes, props.assetsOptions);
@@ -154016,22 +154324,26 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
154016
154324
  }
154017
154325
  if (!props.isWorkersSite && Boolean(props.legacyAssetPaths) && format11 === "service-worker") {
154018
154326
  throw new UserError(
154019
- "You cannot use the service-worker format with an `assets` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/"
154327
+ "You cannot use the service-worker format with an `assets` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/",
154328
+ { telemetryMessage: true }
154020
154329
  );
154021
154330
  }
154022
154331
  if (config.wasm_modules && format11 === "modules") {
154023
154332
  throw new UserError(
154024
- "You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code"
154333
+ "You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code",
154334
+ { telemetryMessage: true }
154025
154335
  );
154026
154336
  }
154027
154337
  if (config.text_blobs && format11 === "modules") {
154028
154338
  throw new UserError(
154029
- `You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your ${configFileName(config.configPath)} file`
154339
+ `You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your ${configFileName(config.configPath)} file`,
154340
+ { telemetryMessage: "[text_blobs] with an ES module worker" }
154030
154341
  );
154031
154342
  }
154032
154343
  if (config.data_blobs && format11 === "modules") {
154033
154344
  throw new UserError(
154034
- `You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your ${configFileName(config.configPath)} file`
154345
+ `You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your ${configFileName(config.configPath)} file`,
154346
+ { telemetryMessage: "[data_blobs] with an ES module worker" }
154035
154347
  );
154036
154348
  }
154037
154349
  let sourceMapSize;
@@ -154313,17 +154625,21 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
154313
154625
  if (!bindingsPrinted) {
154314
154626
  printBindings({ ...withoutStaticAssets, vars: maskedVars });
154315
154627
  }
154316
- await helpIfErrorIsSizeOrScriptStartup(
154628
+ const message = await helpIfErrorIsSizeOrScriptStartup(
154317
154629
  err,
154318
154630
  dependencies,
154319
154631
  workerBundle,
154320
154632
  props.projectRoot
154321
154633
  );
154634
+ if (message !== null) {
154635
+ logger.error(message);
154636
+ }
154322
154637
  if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
154323
154638
  err.preventReport();
154324
154639
  if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
154325
154640
  throw new UserError(
154326
- "You must use a real database in the database_id configuration. You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development"
154641
+ "You must use a real database in the database_id configuration. You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development",
154642
+ { telemetryMessage: true }
154327
154643
  );
154328
154644
  }
154329
154645
  const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
@@ -154426,7 +154742,8 @@ async function publishRoutesFallback(routes, {
154426
154742
  }) {
154427
154743
  if (notProd) {
154428
154744
  throw new UserError(
154429
- "Service environments combined with an API token that doesn't have 'All Zones' permissions is not supported.\nEither turn off service environments by setting `legacy_env = true`, creating an API token with 'All Zones' permissions, or logging in via OAuth"
154745
+ "Service environments combined with an API token that doesn't have 'All Zones' permissions is not supported.\nEither turn off service environments by setting `legacy_env = true`, creating an API token with 'All Zones' permissions, or logging in via OAuth",
154746
+ { telemetryMessage: true }
154430
154747
  );
154431
154748
  }
154432
154749
  logger.warn(
@@ -154485,7 +154802,8 @@ async function publishRoutesFallback(routes, {
154485
154802
  continue;
154486
154803
  } else {
154487
154804
  throw new UserError(
154488
- `The route with pattern "${routePattern}" is already associated with another worker called "${knownScript}".`
154805
+ `The route with pattern "${routePattern}" is already associated with another worker called "${knownScript}".`,
154806
+ { telemetryMessage: "route already associated with another worker" }
154489
154807
  );
154490
154808
  }
154491
154809
  }
@@ -154572,7 +154890,8 @@ async function updateQueueConsumers(scriptName, config) {
154572
154890
  } else {
154573
154891
  if (scriptName === void 0) {
154574
154892
  throw new UserError(
154575
- "Script name is required to update queue consumers"
154893
+ "Script name is required to update queue consumers",
154894
+ { telemetryMessage: true }
154576
154895
  );
154577
154896
  }
154578
154897
  const body = {
@@ -154936,7 +155255,8 @@ function validateAssetsArgsAndConfig(args, config) {
154936
155255
  }
154937
155256
  if ("legacy" in args ? args.assets && args.legacy.site : (args.assets || config?.assets) && (args.site || config?.site)) {
154938
155257
  throw new UserError(
154939
- "Cannot use assets and Workers Sites in the same Worker.\nPlease remove either the `site` or `assets` field from your configuration file."
155258
+ "Cannot use assets and Workers Sites in the same Worker.\nPlease remove either the `site` or `assets` field from your configuration file.",
155259
+ { telemetryMessage: true }
154940
155260
  );
154941
155261
  }
154942
155262
  const noOpEntrypoint = path65.resolve(
@@ -156110,7 +156430,10 @@ function getBindings2(configParam, env6, local, args) {
156110
156430
  ({ binding, preview_bucket_name, bucket_name, jurisdiction }) => {
156111
156431
  if (!preview_bucket_name && !local) {
156112
156432
  throw new UserError(
156113
- `In development, you should use a separate r2 bucket than the one you'd use in production. Please create a new r2 bucket with "wrangler r2 bucket create <name>" and add its name as preview_bucket_name to the r2_buckets "${binding}" in your ${configFileName(configParam.configPath)} file`
156433
+ `In development, you should use a separate r2 bucket than the one you'd use in production. Please create a new r2 bucket with "wrangler r2 bucket create <name>" and add its name as preview_bucket_name to the r2_buckets "${binding}" in your ${configFileName(configParam.configPath)} file`,
156434
+ {
156435
+ telemetryMessage: "no preview r2 bucket configured in remote dev"
156436
+ }
156114
156437
  );
156115
156438
  }
156116
156439
  return {
@@ -156133,7 +156456,8 @@ function getBindings2(configParam, env6, local, args) {
156133
156456
  const connectionStringFromEnv = process.env[`WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive2.binding}`];
156134
156457
  if (local && connectionStringFromEnv === void 0 && hyperdrive2.localConnectionString === void 0) {
156135
156458
  throw new UserError(
156136
- `When developing locally, you should use a local Postgres connection string to emulate Hyperdrive functionality. Please setup Postgres locally and set the value of the 'WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive2.binding}' variable or "${hyperdrive2.binding}"'s "localConnectionString" to the Postgres connection string.`
156459
+ `When developing locally, you should use a local Postgres connection string to emulate Hyperdrive functionality. Please setup Postgres locally and set the value of the 'WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive2.binding}' variable or "${hyperdrive2.binding}"'s "localConnectionString" to the Postgres connection string.`,
156460
+ { telemetryMessage: "no local hyperdrive connection string" }
156137
156461
  );
156138
156462
  }
156139
156463
  if (connectionStringFromEnv) {
@@ -156882,7 +157206,7 @@ init_import_meta_url();
156882
157206
  // ../../node_modules/.pnpm/get-port@7.0.0/node_modules/get-port/index.js
156883
157207
  init_import_meta_url();
156884
157208
  var import_node_net = __toESM(require("node:net"), 1);
156885
- var import_node_os9 = __toESM(require("node:os"), 1);
157209
+ var import_node_os10 = __toESM(require("node:os"), 1);
156886
157210
  var Locked = class extends Error {
156887
157211
  constructor(port) {
156888
157212
  super(`${port} is locked`);
@@ -156896,7 +157220,7 @@ var lockedPorts = {
156896
157220
  var releaseOldLockedPortsIntervalMs = 1e3 * 15;
156897
157221
  var timeout;
156898
157222
  var getLocalHosts = /* @__PURE__ */ __name(() => {
156899
- const interfaces = import_node_os9.default.networkInterfaces();
157223
+ const interfaces = import_node_os10.default.networkInterfaces();
156900
157224
  const results = /* @__PURE__ */ new Set([void 0, "0.0.0.0"]);
156901
157225
  for (const _interface of Object.values(interfaces)) {
156902
157226
  for (const config of _interface) {