wrangler 4.13.1 → 4.14.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.
@@ -7032,7 +7032,7 @@ var require_client = __commonJS({
7032
7032
  resume(client);
7033
7033
  }
7034
7034
  __name(onHTTP2GoAway, "onHTTP2GoAway");
7035
- var constants3 = require_constants3();
7035
+ var constants4 = require_constants3();
7036
7036
  var createRedirectInterceptor = require_redirectInterceptor();
7037
7037
  var EMPTY_BUF = Buffer.alloc(0);
7038
7038
  async function lazyllhttp() {
@@ -7103,7 +7103,7 @@ var require_client = __commonJS({
7103
7103
  constructor(client, socket, { exports: exports3 }) {
7104
7104
  assert37(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
7105
7105
  this.llhttp = exports3;
7106
- this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
7106
+ this.ptr = this.llhttp.llhttp_alloc(constants4.TYPE.RESPONSE);
7107
7107
  this.client = client;
7108
7108
  this.socket = socket;
7109
7109
  this.timeout = null;
@@ -7195,19 +7195,19 @@ var require_client = __commonJS({
7195
7195
  currentBufferRef = null;
7196
7196
  }
7197
7197
  const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
7198
- if (ret === constants3.ERROR.PAUSED_UPGRADE) {
7198
+ if (ret === constants4.ERROR.PAUSED_UPGRADE) {
7199
7199
  this.onUpgrade(data.slice(offset));
7200
- } else if (ret === constants3.ERROR.PAUSED) {
7200
+ } else if (ret === constants4.ERROR.PAUSED) {
7201
7201
  this.paused = true;
7202
7202
  socket.unshift(data.slice(offset));
7203
- } else if (ret !== constants3.ERROR.OK) {
7203
+ } else if (ret !== constants4.ERROR.OK) {
7204
7204
  const ptr = llhttp.llhttp_get_error_reason(this.ptr);
7205
7205
  let message = "";
7206
7206
  if (ptr) {
7207
7207
  const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
7208
7208
  message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
7209
7209
  }
7210
- throw new HTTPParserError(message, constants3.ERROR[ret], data.slice(offset));
7210
+ throw new HTTPParserError(message, constants4.ERROR[ret], data.slice(offset));
7211
7211
  }
7212
7212
  } catch (err) {
7213
7213
  util5.destroy(socket, err);
@@ -7377,7 +7377,7 @@ var require_client = __commonJS({
7377
7377
  socket[kBlocking] = false;
7378
7378
  resume(client);
7379
7379
  }
7380
- return pause ? constants3.ERROR.PAUSED : 0;
7380
+ return pause ? constants4.ERROR.PAUSED : 0;
7381
7381
  }
7382
7382
  onBody(buf) {
7383
7383
  const { client, socket, statusCode, maxResponseSize } = this;
@@ -7399,7 +7399,7 @@ var require_client = __commonJS({
7399
7399
  }
7400
7400
  this.bytesRead += buf.length;
7401
7401
  if (request4.onData(buf) === false) {
7402
- return constants3.ERROR.PAUSED;
7402
+ return constants4.ERROR.PAUSED;
7403
7403
  }
7404
7404
  }
7405
7405
  onMessageComplete() {
@@ -7434,13 +7434,13 @@ var require_client = __commonJS({
7434
7434
  if (socket[kWriting]) {
7435
7435
  assert37.strictEqual(client[kRunning], 0);
7436
7436
  util5.destroy(socket, new InformationalError("reset"));
7437
- return constants3.ERROR.PAUSED;
7437
+ return constants4.ERROR.PAUSED;
7438
7438
  } else if (!shouldKeepAlive) {
7439
7439
  util5.destroy(socket, new InformationalError("reset"));
7440
- return constants3.ERROR.PAUSED;
7440
+ return constants4.ERROR.PAUSED;
7441
7441
  } else if (socket[kReset2] && client[kRunning] === 0) {
7442
7442
  util5.destroy(socket, new InformationalError("reset"));
7443
- return constants3.ERROR.PAUSED;
7443
+ return constants4.ERROR.PAUSED;
7444
7444
  } else if (client[kPipelining] === 1) {
7445
7445
  setImmediate(resume, client);
7446
7446
  } else {
@@ -29673,18 +29673,18 @@ var require_async = __commonJS({
29673
29673
  ];
29674
29674
  }, "defaultPaths");
29675
29675
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb2) {
29676
- fs23.stat(file, function(err, stat9) {
29676
+ fs23.stat(file, function(err, stat10) {
29677
29677
  if (!err) {
29678
- return cb2(null, stat9.isFile() || stat9.isFIFO());
29678
+ return cb2(null, stat10.isFile() || stat10.isFIFO());
29679
29679
  }
29680
29680
  if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb2(null, false);
29681
29681
  return cb2(err);
29682
29682
  });
29683
29683
  }, "isFile");
29684
29684
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb2) {
29685
- fs23.stat(dir, function(err, stat9) {
29685
+ fs23.stat(dir, function(err, stat10) {
29686
29686
  if (!err) {
29687
- return cb2(null, stat9.isDirectory());
29687
+ return cb2(null, stat10.isDirectory());
29688
29688
  }
29689
29689
  if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb2(null, false);
29690
29690
  return cb2(err);
@@ -30176,21 +30176,21 @@ var require_sync = __commonJS({
30176
30176
  }, "defaultPaths");
30177
30177
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
30178
30178
  try {
30179
- var stat9 = fs23.statSync(file, { throwIfNoEntry: false });
30179
+ var stat10 = fs23.statSync(file, { throwIfNoEntry: false });
30180
30180
  } catch (e7) {
30181
30181
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR")) return false;
30182
30182
  throw e7;
30183
30183
  }
30184
- return !!stat9 && (stat9.isFile() || stat9.isFIFO());
30184
+ return !!stat10 && (stat10.isFile() || stat10.isFIFO());
30185
30185
  }, "isFile");
30186
30186
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
30187
30187
  try {
30188
- var stat9 = fs23.statSync(dir, { throwIfNoEntry: false });
30188
+ var stat10 = fs23.statSync(dir, { throwIfNoEntry: false });
30189
30189
  } catch (e7) {
30190
30190
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR")) return false;
30191
30191
  throw e7;
30192
30192
  }
30193
- return !!stat9 && stat9.isDirectory();
30193
+ return !!stat10 && stat10.isDirectory();
30194
30194
  }, "isDirectory");
30195
30195
  var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync4(x6) {
30196
30196
  try {
@@ -53445,16 +53445,16 @@ var require_windows = __commonJS({
53445
53445
  return false;
53446
53446
  }
53447
53447
  __name(checkPathExt, "checkPathExt");
53448
- function checkStat(stat9, path69, options) {
53449
- if (!stat9.isSymbolicLink() && !stat9.isFile()) {
53448
+ function checkStat(stat10, path69, options) {
53449
+ if (!stat10.isSymbolicLink() && !stat10.isFile()) {
53450
53450
  return false;
53451
53451
  }
53452
53452
  return checkPathExt(path69, options);
53453
53453
  }
53454
53454
  __name(checkStat, "checkStat");
53455
53455
  function isexe(path69, options, cb2) {
53456
- fs23.stat(path69, function(er, stat9) {
53457
- cb2(er, er ? false : checkStat(stat9, path69, options));
53456
+ fs23.stat(path69, function(er, stat10) {
53457
+ cb2(er, er ? false : checkStat(stat10, path69, options));
53458
53458
  });
53459
53459
  }
53460
53460
  __name(isexe, "isexe");
@@ -53473,8 +53473,8 @@ var require_mode = __commonJS({
53473
53473
  isexe.sync = sync;
53474
53474
  var fs23 = require("fs");
53475
53475
  function isexe(path69, options, cb2) {
53476
- fs23.stat(path69, function(er, stat9) {
53477
- cb2(er, er ? false : checkStat(stat9, options));
53476
+ fs23.stat(path69, function(er, stat10) {
53477
+ cb2(er, er ? false : checkStat(stat10, options));
53478
53478
  });
53479
53479
  }
53480
53480
  __name(isexe, "isexe");
@@ -53482,14 +53482,14 @@ var require_mode = __commonJS({
53482
53482
  return checkStat(fs23.statSync(path69), options);
53483
53483
  }
53484
53484
  __name(sync, "sync");
53485
- function checkStat(stat9, options) {
53486
- return stat9.isFile() && checkMode(stat9, options);
53485
+ function checkStat(stat10, options) {
53486
+ return stat10.isFile() && checkMode(stat10, options);
53487
53487
  }
53488
53488
  __name(checkStat, "checkStat");
53489
- function checkMode(stat9, options) {
53490
- var mod = stat9.mode;
53491
- var uid = stat9.uid;
53492
- var gid = stat9.gid;
53489
+ function checkMode(stat10, options) {
53490
+ var mod = stat10.mode;
53491
+ var uid = stat10.uid;
53492
+ var gid = stat10.gid;
53493
53493
  var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
53494
53494
  var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
53495
53495
  var u5 = parseInt("100", 8);
@@ -54113,14 +54113,14 @@ var require_command_exists = __commonJS({
54113
54113
  var execSync4 = require("child_process").execSync;
54114
54114
  var fs23 = require("fs");
54115
54115
  var path69 = require("path");
54116
- var access3 = fs23.access;
54116
+ var access4 = fs23.access;
54117
54117
  var accessSync = fs23.accessSync;
54118
- var constants3 = fs23.constants || fs23;
54118
+ var constants4 = fs23.constants || fs23;
54119
54119
  var isUsingWindows = process.platform == "win32";
54120
54120
  var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
54121
- access3(
54121
+ access4(
54122
54122
  commandName,
54123
- constants3.F_OK,
54123
+ constants4.F_OK,
54124
54124
  function(err) {
54125
54125
  callback(!err);
54126
54126
  }
@@ -54128,16 +54128,16 @@ var require_command_exists = __commonJS({
54128
54128
  }, "fileNotExists");
54129
54129
  var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
54130
54130
  try {
54131
- accessSync(commandName, constants3.F_OK);
54131
+ accessSync(commandName, constants4.F_OK);
54132
54132
  return false;
54133
54133
  } catch (e7) {
54134
54134
  return true;
54135
54135
  }
54136
54136
  }, "fileNotExistsSync");
54137
54137
  var localExecutable = /* @__PURE__ */ __name(function(commandName, callback) {
54138
- access3(
54138
+ access4(
54139
54139
  commandName,
54140
- constants3.F_OK | constants3.X_OK,
54140
+ constants4.F_OK | constants4.X_OK,
54141
54141
  function(err) {
54142
54142
  callback(null, !err);
54143
54143
  }
@@ -54145,7 +54145,7 @@ var require_command_exists = __commonJS({
54145
54145
  }, "localExecutable");
54146
54146
  var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
54147
54147
  try {
54148
- accessSync(commandName, constants3.F_OK | constants3.X_OK);
54148
+ accessSync(commandName, constants4.F_OK | constants4.X_OK);
54149
54149
  return true;
54150
54150
  } catch (e7) {
54151
54151
  return false;
@@ -58234,8 +58234,8 @@ var init_esm2 = __esm({
58234
58234
  }
58235
58235
  return this._userIgnored(path69, stats);
58236
58236
  }
58237
- _isntIgnored(path69, stat9) {
58238
- return !this._isIgnored(path69, stat9);
58237
+ _isntIgnored(path69, stat10) {
58238
+ return !this._isIgnored(path69, stat10);
58239
58239
  }
58240
58240
  /**
58241
58241
  * Provides a set of common helpers and properties relating to symlink handling.
@@ -67252,11 +67252,11 @@ var init_createConfigValueProvider = __esm({
67252
67252
  // ../../node_modules/.pnpm/@smithy+node-config-provider@3.1.12/node_modules/@smithy/node-config-provider/dist-es/getSelectorName.js
67253
67253
  function getSelectorName(functionString) {
67254
67254
  try {
67255
- const constants3 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
67256
- constants3.delete("CONFIG");
67257
- constants3.delete("CONFIG_PREFIX_SEPARATOR");
67258
- constants3.delete("ENV");
67259
- return [...constants3].join(", ");
67255
+ const constants4 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
67256
+ constants4.delete("CONFIG");
67257
+ constants4.delete("CONFIG_PREFIX_SEPARATOR");
67258
+ constants4.delete("ENV");
67259
+ return [...constants4].join(", ");
67260
67260
  } catch (e7) {
67261
67261
  return functionString;
67262
67262
  }
@@ -77871,12 +77871,240 @@ var init_miniflare = __esm({
77871
77871
  }
77872
77872
  });
77873
77873
 
77874
+ // ../workers-shared/utils/responses.ts
77875
+ var OkResponse, NotFoundResponse, MethodNotAllowedResponse, InternalServerErrorResponse, NotModifiedResponse, MovedPermanentlyResponse, FoundResponse, SeeOtherResponse, TemporaryRedirectResponse, PermanentRedirectResponse;
77876
+ var init_responses = __esm({
77877
+ "../workers-shared/utils/responses.ts"() {
77878
+ "use strict";
77879
+ init_import_meta_url();
77880
+ OkResponse = class _OkResponse extends Response {
77881
+ static {
77882
+ __name(this, "OkResponse");
77883
+ }
77884
+ static {
77885
+ this.status = 200;
77886
+ }
77887
+ constructor(body, init3) {
77888
+ super(body, {
77889
+ ...init3,
77890
+ status: _OkResponse.status
77891
+ });
77892
+ }
77893
+ };
77894
+ NotFoundResponse = class _NotFoundResponse extends Response {
77895
+ static {
77896
+ __name(this, "NotFoundResponse");
77897
+ }
77898
+ static {
77899
+ this.status = 404;
77900
+ }
77901
+ constructor(...[body, init3]) {
77902
+ super(body, {
77903
+ ...init3,
77904
+ status: _NotFoundResponse.status,
77905
+ statusText: "Not Found"
77906
+ });
77907
+ }
77908
+ };
77909
+ MethodNotAllowedResponse = class _MethodNotAllowedResponse extends Response {
77910
+ static {
77911
+ __name(this, "MethodNotAllowedResponse");
77912
+ }
77913
+ static {
77914
+ this.status = 405;
77915
+ }
77916
+ constructor(...[body, init3]) {
77917
+ super(body, {
77918
+ ...init3,
77919
+ status: _MethodNotAllowedResponse.status,
77920
+ statusText: "Method Not Allowed"
77921
+ });
77922
+ }
77923
+ };
77924
+ InternalServerErrorResponse = class _InternalServerErrorResponse extends Response {
77925
+ static {
77926
+ __name(this, "InternalServerErrorResponse");
77927
+ }
77928
+ static {
77929
+ this.status = 500;
77930
+ }
77931
+ constructor(err, init3) {
77932
+ super(null, {
77933
+ ...init3,
77934
+ status: _InternalServerErrorResponse.status
77935
+ });
77936
+ }
77937
+ };
77938
+ NotModifiedResponse = class _NotModifiedResponse extends Response {
77939
+ static {
77940
+ __name(this, "NotModifiedResponse");
77941
+ }
77942
+ static {
77943
+ this.status = 304;
77944
+ }
77945
+ constructor(...[_body, init3]) {
77946
+ super(null, {
77947
+ ...init3,
77948
+ status: _NotModifiedResponse.status,
77949
+ statusText: "Not Modified"
77950
+ });
77951
+ }
77952
+ };
77953
+ MovedPermanentlyResponse = class _MovedPermanentlyResponse extends Response {
77954
+ static {
77955
+ __name(this, "MovedPermanentlyResponse");
77956
+ }
77957
+ static {
77958
+ this.status = 301;
77959
+ }
77960
+ constructor(location, init3) {
77961
+ super(null, {
77962
+ ...init3,
77963
+ status: _MovedPermanentlyResponse.status,
77964
+ statusText: "Moved Permanently",
77965
+ headers: {
77966
+ ...init3?.headers,
77967
+ Location: location
77968
+ }
77969
+ });
77970
+ }
77971
+ };
77972
+ FoundResponse = class _FoundResponse extends Response {
77973
+ static {
77974
+ __name(this, "FoundResponse");
77975
+ }
77976
+ static {
77977
+ this.status = 302;
77978
+ }
77979
+ constructor(location, init3) {
77980
+ super(null, {
77981
+ ...init3,
77982
+ status: _FoundResponse.status,
77983
+ statusText: "Found",
77984
+ headers: {
77985
+ ...init3?.headers,
77986
+ Location: location
77987
+ }
77988
+ });
77989
+ }
77990
+ };
77991
+ SeeOtherResponse = class _SeeOtherResponse extends Response {
77992
+ static {
77993
+ __name(this, "SeeOtherResponse");
77994
+ }
77995
+ static {
77996
+ this.status = 303;
77997
+ }
77998
+ constructor(location, init3) {
77999
+ super(null, {
78000
+ ...init3,
78001
+ status: _SeeOtherResponse.status,
78002
+ statusText: "See Other",
78003
+ headers: {
78004
+ ...init3?.headers,
78005
+ Location: location
78006
+ }
78007
+ });
78008
+ }
78009
+ };
78010
+ TemporaryRedirectResponse = class _TemporaryRedirectResponse extends Response {
78011
+ static {
78012
+ __name(this, "TemporaryRedirectResponse");
78013
+ }
78014
+ static {
78015
+ this.status = 307;
78016
+ }
78017
+ constructor(location, init3) {
78018
+ super(null, {
78019
+ ...init3,
78020
+ status: _TemporaryRedirectResponse.status,
78021
+ statusText: "Temporary Redirect",
78022
+ headers: {
78023
+ ...init3?.headers,
78024
+ Location: location
78025
+ }
78026
+ });
78027
+ }
78028
+ };
78029
+ PermanentRedirectResponse = class _PermanentRedirectResponse extends Response {
78030
+ static {
78031
+ __name(this, "PermanentRedirectResponse");
78032
+ }
78033
+ static {
78034
+ this.status = 308;
78035
+ }
78036
+ constructor(location, init3) {
78037
+ super(null, {
78038
+ ...init3,
78039
+ status: _PermanentRedirectResponse.status,
78040
+ statusText: "Permanent Redirect",
78041
+ headers: {
78042
+ ...init3?.headers,
78043
+ Location: location
78044
+ }
78045
+ });
78046
+ }
78047
+ };
78048
+ }
78049
+ });
78050
+
78051
+ // ../workers-shared/utils/tracing.ts
78052
+ var init_tracing = __esm({
78053
+ "../workers-shared/utils/tracing.ts"() {
78054
+ "use strict";
78055
+ init_import_meta_url();
78056
+ }
78057
+ });
78058
+
78059
+ // ../workers-shared/asset-worker/src/compatibility-flags.ts
78060
+ var init_compatibility_flags = __esm({
78061
+ "../workers-shared/asset-worker/src/compatibility-flags.ts"() {
78062
+ "use strict";
78063
+ init_import_meta_url();
78064
+ }
78065
+ });
78066
+
78067
+ // ../workers-shared/asset-worker/src/constants.ts
78068
+ var init_constants11 = __esm({
78069
+ "../workers-shared/asset-worker/src/constants.ts"() {
78070
+ "use strict";
78071
+ init_import_meta_url();
78072
+ }
78073
+ });
78074
+
78075
+ // ../workers-shared/asset-worker/src/utils/headers.ts
78076
+ var init_headers = __esm({
78077
+ "../workers-shared/asset-worker/src/utils/headers.ts"() {
78078
+ "use strict";
78079
+ init_import_meta_url();
78080
+ init_tracing();
78081
+ init_compatibility_flags();
78082
+ init_constants11();
78083
+ init_handler2();
78084
+ init_rules_engine();
78085
+ }
78086
+ });
78087
+
78088
+ // ../workers-shared/asset-worker/src/handler.ts
78089
+ var init_handler2 = __esm({
78090
+ "../workers-shared/asset-worker/src/handler.ts"() {
78091
+ "use strict";
78092
+ init_import_meta_url();
78093
+ init_responses();
78094
+ init_tracing();
78095
+ init_compatibility_flags();
78096
+ init_headers();
78097
+ init_rules_engine();
78098
+ }
78099
+ });
78100
+
77874
78101
  // ../workers-shared/asset-worker/src/utils/rules-engine.ts
77875
78102
  var ESCAPE_REGEX_CHARACTERS2, escapeRegex2, HOST_PLACEHOLDER_REGEX, PLACEHOLDER_REGEX2, replacer, generateRulesMatcher;
77876
78103
  var init_rules_engine = __esm({
77877
78104
  "../workers-shared/asset-worker/src/utils/rules-engine.ts"() {
77878
78105
  "use strict";
77879
78106
  init_import_meta_url();
78107
+ init_handler2();
77880
78108
  ESCAPE_REGEX_CHARACTERS2 = /[-/\\^$*+?.()|[\]{}]/g;
77881
78109
  escapeRegex2 = /* @__PURE__ */ __name((str) => {
77882
78110
  return str.replace(ESCAPE_REGEX_CHARACTERS2, "\\$&");
@@ -77937,13 +78165,13 @@ function mergeHeaders(base, extra) {
77937
78165
  function stripLeadingDoubleSlashes(location) {
77938
78166
  return location.replace(/^(\/|%2F|%2f|%5C|%5c|%09|\s|\\)+(.*)/, "/$2");
77939
78167
  }
77940
- var OkResponse, MovedPermanentlyResponse, FoundResponse, NotModifiedResponse, PermanentRedirectResponse, NotFoundResponse, MethodNotAllowedResponse, NotAcceptableResponse, InternalServerErrorResponse, SeeOtherResponse, TemporaryRedirectResponse;
77941
- var init_responses = __esm({
78168
+ var OkResponse2, MovedPermanentlyResponse2, FoundResponse2, NotModifiedResponse2, PermanentRedirectResponse2, NotFoundResponse2, MethodNotAllowedResponse2, NotAcceptableResponse, InternalServerErrorResponse2, SeeOtherResponse2, TemporaryRedirectResponse2;
78169
+ var init_responses2 = __esm({
77942
78170
  "../pages-shared/asset-server/responses.ts"() {
77943
78171
  init_import_meta_url();
77944
78172
  __name(mergeHeaders, "mergeHeaders");
77945
78173
  __name(stripLeadingDoubleSlashes, "stripLeadingDoubleSlashes");
77946
- OkResponse = class extends Response {
78174
+ OkResponse2 = class extends Response {
77947
78175
  static {
77948
78176
  __name(this, "OkResponse");
77949
78177
  }
@@ -77955,7 +78183,7 @@ var init_responses = __esm({
77955
78183
  });
77956
78184
  }
77957
78185
  };
77958
- MovedPermanentlyResponse = class extends Response {
78186
+ MovedPermanentlyResponse2 = class extends Response {
77959
78187
  static {
77960
78188
  __name(this, "MovedPermanentlyResponse");
77961
78189
  }
@@ -77975,7 +78203,7 @@ var init_responses = __esm({
77975
78203
  });
77976
78204
  }
77977
78205
  };
77978
- FoundResponse = class extends Response {
78206
+ FoundResponse2 = class extends Response {
77979
78207
  static {
77980
78208
  __name(this, "FoundResponse");
77981
78209
  }
@@ -77995,7 +78223,7 @@ var init_responses = __esm({
77995
78223
  });
77996
78224
  }
77997
78225
  };
77998
- NotModifiedResponse = class extends Response {
78226
+ NotModifiedResponse2 = class extends Response {
77999
78227
  static {
78000
78228
  __name(this, "NotModifiedResponse");
78001
78229
  }
@@ -78006,7 +78234,7 @@ var init_responses = __esm({
78006
78234
  });
78007
78235
  }
78008
78236
  };
78009
- PermanentRedirectResponse = class extends Response {
78237
+ PermanentRedirectResponse2 = class extends Response {
78010
78238
  static {
78011
78239
  __name(this, "PermanentRedirectResponse");
78012
78240
  }
@@ -78026,7 +78254,7 @@ var init_responses = __esm({
78026
78254
  });
78027
78255
  }
78028
78256
  };
78029
- NotFoundResponse = class extends Response {
78257
+ NotFoundResponse2 = class extends Response {
78030
78258
  static {
78031
78259
  __name(this, "NotFoundResponse");
78032
78260
  }
@@ -78038,7 +78266,7 @@ var init_responses = __esm({
78038
78266
  });
78039
78267
  }
78040
78268
  };
78041
- MethodNotAllowedResponse = class extends Response {
78269
+ MethodNotAllowedResponse2 = class extends Response {
78042
78270
  static {
78043
78271
  __name(this, "MethodNotAllowedResponse");
78044
78272
  }
@@ -78062,7 +78290,7 @@ var init_responses = __esm({
78062
78290
  });
78063
78291
  }
78064
78292
  };
78065
- InternalServerErrorResponse = class extends Response {
78293
+ InternalServerErrorResponse2 = class extends Response {
78066
78294
  static {
78067
78295
  __name(this, "InternalServerErrorResponse");
78068
78296
  }
@@ -78080,7 +78308,7 @@ ${err.stack}`;
78080
78308
  });
78081
78309
  }
78082
78310
  };
78083
- SeeOtherResponse = class extends Response {
78311
+ SeeOtherResponse2 = class extends Response {
78084
78312
  static {
78085
78313
  __name(this, "SeeOtherResponse");
78086
78314
  }
@@ -78098,7 +78326,7 @@ ${err.stack}`;
78098
78326
  });
78099
78327
  }
78100
78328
  };
78101
- TemporaryRedirectResponse = class extends Response {
78329
+ TemporaryRedirectResponse2 = class extends Response {
78102
78330
  static {
78103
78331
  __name(this, "TemporaryRedirectResponse");
78104
78332
  }
@@ -78124,18 +78352,18 @@ var handler_exports = {};
78124
78352
  __export(handler_exports, {
78125
78353
  ANALYTICS_VERSION: () => ANALYTICS_VERSION2,
78126
78354
  ASSET_PRESERVATION_CACHE: () => ASSET_PRESERVATION_CACHE,
78127
- CACHE_CONTROL_BROWSER: () => CACHE_CONTROL_BROWSER,
78355
+ CACHE_CONTROL_BROWSER: () => CACHE_CONTROL_BROWSER2,
78128
78356
  CACHE_PRESERVATION_WRITE_FREQUENCY: () => CACHE_PRESERVATION_WRITE_FREQUENCY,
78129
- HEADERS_VERSION: () => HEADERS_VERSION2,
78357
+ HEADERS_VERSION: () => HEADERS_VERSION3,
78130
78358
  HEADERS_VERSION_V1: () => HEADERS_VERSION_V1,
78131
- REDIRECTS_VERSION: () => REDIRECTS_VERSION2,
78359
+ REDIRECTS_VERSION: () => REDIRECTS_VERSION3,
78132
78360
  generateHandler: () => generateHandler,
78133
78361
  isPreservationCacheResponseExpiring: () => isPreservationCacheResponseExpiring,
78134
78362
  normaliseHeaders: () => normaliseHeaders,
78135
78363
  parseQualityWeightedList: () => parseQualityWeightedList
78136
78364
  });
78137
78365
  function normaliseHeaders(headers) {
78138
- if (headers.version === HEADERS_VERSION2) {
78366
+ if (headers.version === HEADERS_VERSION3) {
78139
78367
  return headers.rules;
78140
78368
  } else if (headers.version === HEADERS_VERSION_V1) {
78141
78369
  return Object.keys(headers.rules).reduce(
@@ -78176,7 +78404,7 @@ async function generateHandler({
78176
78404
  if (assetEntry = await notFoundFindAssetEntryForPath("/index.html")) {
78177
78405
  return notFoundServeAsset(assetEntry, { preserve: false });
78178
78406
  }
78179
- return new NotFoundResponse();
78407
+ return new NotFoundResponse2();
78180
78408
  }, "generateNotFoundResponse"),
78181
78409
  attachAdditionalHeaders = /* @__PURE__ */ __name(() => {
78182
78410
  }, "attachAdditionalHeaders"),
@@ -78188,8 +78416,8 @@ async function generateHandler({
78188
78416
  let { pathname } = url4;
78189
78417
  const earlyHintsCache = metadata.deploymentId ? await caches?.open(`eh:${metadata.deploymentId}`) : void 0;
78190
78418
  const headerRules = metadata.headers ? normaliseHeaders(metadata.headers) : {};
78191
- const staticRules = metadata.redirects?.version === REDIRECTS_VERSION2 ? metadata.redirects.staticRules || {} : {};
78192
- const staticRedirectsMatcher = /* @__PURE__ */ __name(() => {
78419
+ const staticRules = metadata.redirects?.version === REDIRECTS_VERSION3 ? metadata.redirects.staticRules || {} : {};
78420
+ const staticRedirectsMatcher2 = /* @__PURE__ */ __name(() => {
78193
78421
  const withHostMatch = staticRules[`https://${host}${pathname}`];
78194
78422
  const withoutHostMatch = staticRules[pathname];
78195
78423
  if (withHostMatch && withoutHostMatch) {
@@ -78201,8 +78429,8 @@ async function generateHandler({
78201
78429
  }
78202
78430
  return withHostMatch || withoutHostMatch;
78203
78431
  }, "staticRedirectsMatcher");
78204
- const generateRedirectsMatcher = /* @__PURE__ */ __name(() => generateRulesMatcher(
78205
- metadata.redirects?.version === REDIRECTS_VERSION2 ? metadata.redirects.rules : {},
78432
+ const generateRedirectsMatcher2 = /* @__PURE__ */ __name(() => generateRulesMatcher(
78433
+ metadata.redirects?.version === REDIRECTS_VERSION3 ? metadata.redirects.rules : {},
78206
78434
  ({ status: status2, to }, replacements) => ({
78207
78435
  status: status2,
78208
78436
  to: replacer(to, replacements)
@@ -78210,7 +78438,7 @@ async function generateHandler({
78210
78438
  ), "generateRedirectsMatcher");
78211
78439
  let assetEntry;
78212
78440
  async function generateResponse() {
78213
- const match2 = staticRedirectsMatcher() || generateRedirectsMatcher()({ request: request4 })[0];
78441
+ const match2 = staticRedirectsMatcher2() || generateRedirectsMatcher2()({ request: request4 })[0];
78214
78442
  if (match2) {
78215
78443
  if (match2.status === 200) {
78216
78444
  pathname = new URL(match2.to, request4.url).pathname;
@@ -78220,31 +78448,31 @@ async function generateHandler({
78220
78448
  const location = destination.origin === new URL(request4.url).origin ? `${destination.pathname}${destination.search || search}${destination.hash}` : `${destination.href.slice(0, destination.href.length - (destination.search.length + destination.hash.length))}${destination.search ? destination.search : search}${destination.hash}`;
78221
78449
  switch (status2) {
78222
78450
  case 301:
78223
- return new MovedPermanentlyResponse(location, void 0, {
78451
+ return new MovedPermanentlyResponse2(location, void 0, {
78224
78452
  preventLeadingDoubleSlash: false
78225
78453
  });
78226
78454
  case 303:
78227
- return new SeeOtherResponse(location, void 0, {
78455
+ return new SeeOtherResponse2(location, void 0, {
78228
78456
  preventLeadingDoubleSlash: false
78229
78457
  });
78230
78458
  case 307:
78231
- return new TemporaryRedirectResponse(location, void 0, {
78459
+ return new TemporaryRedirectResponse2(location, void 0, {
78232
78460
  preventLeadingDoubleSlash: false
78233
78461
  });
78234
78462
  case 308:
78235
- return new PermanentRedirectResponse(location, void 0, {
78463
+ return new PermanentRedirectResponse2(location, void 0, {
78236
78464
  preventLeadingDoubleSlash: false
78237
78465
  });
78238
78466
  case 302:
78239
78467
  default:
78240
- return new FoundResponse(location, void 0, {
78468
+ return new FoundResponse2(location, void 0, {
78241
78469
  preventLeadingDoubleSlash: false
78242
78470
  });
78243
78471
  }
78244
78472
  }
78245
78473
  }
78246
78474
  if (!request4.method.match(/^(get|head)$/i)) {
78247
- return new MethodNotAllowedResponse();
78475
+ return new MethodNotAllowedResponse2();
78248
78476
  }
78249
78477
  try {
78250
78478
  pathname = globalThis.decodeURIComponent(pathname);
@@ -78254,13 +78482,13 @@ async function generateHandler({
78254
78482
  if (assetEntry = await findAssetEntryForPath(`${pathname}index.html`)) {
78255
78483
  return serveAsset(assetEntry);
78256
78484
  } else if (pathname.endsWith("/index/")) {
78257
- return new PermanentRedirectResponse(
78485
+ return new PermanentRedirectResponse2(
78258
78486
  `/${pathname.slice(1, -"index/".length)}${search}`
78259
78487
  );
78260
78488
  } else if (assetEntry = await findAssetEntryForPath(
78261
78489
  `${pathname.replace(/\/$/, ".html")}`
78262
78490
  )) {
78263
- return new PermanentRedirectResponse(
78491
+ return new PermanentRedirectResponse2(
78264
78492
  `/${pathname.slice(1, -1)}${search}`
78265
78493
  );
78266
78494
  } else {
@@ -78271,26 +78499,26 @@ async function generateHandler({
78271
78499
  if (pathname.endsWith(".html")) {
78272
78500
  const extensionlessPath = pathname.slice(0, -".html".length);
78273
78501
  if (extensionlessPath.endsWith("/index")) {
78274
- return new PermanentRedirectResponse(
78502
+ return new PermanentRedirectResponse2(
78275
78503
  `${extensionlessPath.replace(/\/index$/, "/")}${search}`
78276
78504
  );
78277
78505
  } else if (await findAssetEntryForPath(extensionlessPath) || extensionlessPath === "/") {
78278
78506
  return serveAsset(assetEntry);
78279
78507
  } else {
78280
- return new PermanentRedirectResponse(`${extensionlessPath}${search}`);
78508
+ return new PermanentRedirectResponse2(`${extensionlessPath}${search}`);
78281
78509
  }
78282
78510
  } else {
78283
78511
  return serveAsset(assetEntry);
78284
78512
  }
78285
78513
  } else if (pathname.endsWith("/index")) {
78286
- return new PermanentRedirectResponse(
78514
+ return new PermanentRedirectResponse2(
78287
78515
  `/${pathname.slice(1, -"index".length)}${search}`
78288
78516
  );
78289
78517
  } else if (assetEntry = await findAssetEntryForPath(`${pathname}.html`)) {
78290
78518
  return serveAsset(assetEntry);
78291
78519
  }
78292
78520
  if (assetEntry = await findAssetEntryForPath(`${pathname}/index.html`)) {
78293
- return new PermanentRedirectResponse(`${pathname}/${search}`);
78521
+ return new PermanentRedirectResponse2(`${pathname}/${search}`);
78294
78522
  } else {
78295
78523
  return notFound();
78296
78524
  }
@@ -78460,7 +78688,7 @@ async function generateHandler({
78460
78688
  const { strongETag, weakETag } = generateETagHeader(assetKey);
78461
78689
  const isIfNoneMatch = checkIfNoneMatch(request4, strongETag, weakETag);
78462
78690
  if (isIfNoneMatch) {
78463
- return new NotModifiedResponse();
78691
+ return new NotModifiedResponse2();
78464
78692
  }
78465
78693
  try {
78466
78694
  const asset = await fetchAsset(assetKey);
@@ -78480,7 +78708,7 @@ async function generateHandler({
78480
78708
  headers["cache-control"] = "no-transform";
78481
78709
  headers["content-encoding"] = content.encoding;
78482
78710
  }
78483
- const response = new OkResponse(
78711
+ const response = new OkResponse2(
78484
78712
  request4.method === "HEAD" ? null : asset.body,
78485
78713
  {
78486
78714
  headers,
@@ -78488,7 +78716,7 @@ async function generateHandler({
78488
78716
  }
78489
78717
  );
78490
78718
  if (isCacheable(request4)) {
78491
- response.headers.append("cache-control", CACHE_CONTROL_BROWSER);
78719
+ response.headers.append("cache-control", CACHE_CONTROL_BROWSER2);
78492
78720
  }
78493
78721
  attachAdditionalHeaders(response, content, servingAssetEntry, asset);
78494
78722
  if (isPreview(new URL(request4.url))) {
@@ -78533,7 +78761,7 @@ async function generateHandler({
78533
78761
  return response;
78534
78762
  } catch (err) {
78535
78763
  logError(err);
78536
- return new InternalServerErrorResponse(err);
78764
+ return new InternalServerErrorResponse2(err);
78537
78765
  }
78538
78766
  }
78539
78767
  __name(serveAsset, "serveAsset");
@@ -78565,7 +78793,7 @@ async function generateHandler({
78565
78793
  if (setMetrics) {
78566
78794
  setMetrics({ preservationCacheResult: "not-modified" });
78567
78795
  }
78568
- return new NotModifiedResponse();
78796
+ return new NotModifiedResponse2();
78569
78797
  }
78570
78798
  const asset = await fetchAsset(assetKey);
78571
78799
  if (asset) {
@@ -78606,12 +78834,12 @@ async function generateHandler({
78606
78834
  const assetKey = getAssetKey(assetEntry, content);
78607
78835
  try {
78608
78836
  const { body, contentType } = await fetchAsset(assetKey);
78609
- const response = new NotFoundResponse(body);
78837
+ const response = new NotFoundResponse2(body);
78610
78838
  response.headers.set("content-type", contentType);
78611
78839
  return response;
78612
78840
  } catch (err) {
78613
78841
  logError(err);
78614
- return new InternalServerErrorResponse(err);
78842
+ return new InternalServerErrorResponse2(err);
78615
78843
  }
78616
78844
  }
78617
78845
  }
@@ -78659,18 +78887,18 @@ function isPreservationCacheResponseExpiring(response) {
78659
78887
  function isHTMLContentType(contentType) {
78660
78888
  return contentType?.toLowerCase().startsWith("text/html") || false;
78661
78889
  }
78662
- var ASSET_PRESERVATION_CACHE, CACHE_CONTROL_PRESERVATION, CACHE_PRESERVATION_WRITE_FREQUENCY, CACHE_CONTROL_BROWSER, REDIRECTS_VERSION2, HEADERS_VERSION2, HEADERS_VERSION_V1, ANALYTICS_VERSION2, ALLOWED_EARLY_HINT_LINK_ATTRIBUTES;
78663
- var init_handler2 = __esm({
78890
+ var ASSET_PRESERVATION_CACHE, CACHE_CONTROL_PRESERVATION, CACHE_PRESERVATION_WRITE_FREQUENCY, CACHE_CONTROL_BROWSER2, REDIRECTS_VERSION3, HEADERS_VERSION3, HEADERS_VERSION_V1, ANALYTICS_VERSION2, ALLOWED_EARLY_HINT_LINK_ATTRIBUTES;
78891
+ var init_handler3 = __esm({
78664
78892
  "../pages-shared/asset-server/handler.ts"() {
78665
78893
  init_import_meta_url();
78666
78894
  init_rules_engine();
78667
- init_responses();
78895
+ init_responses2();
78668
78896
  ASSET_PRESERVATION_CACHE = "assetPreservationCacheV2";
78669
78897
  CACHE_CONTROL_PRESERVATION = "public, s-maxage=604800";
78670
78898
  CACHE_PRESERVATION_WRITE_FREQUENCY = 86400;
78671
- CACHE_CONTROL_BROWSER = "public, max-age=0, must-revalidate";
78672
- REDIRECTS_VERSION2 = 1;
78673
- HEADERS_VERSION2 = 2;
78899
+ CACHE_CONTROL_BROWSER2 = "public, max-age=0, must-revalidate";
78900
+ REDIRECTS_VERSION3 = 1;
78901
+ HEADERS_VERSION3 = 2;
78674
78902
  HEADERS_VERSION_V1 = 1;
78675
78903
  ANALYTICS_VERSION2 = 1;
78676
78904
  ALLOWED_EARLY_HINT_LINK_ATTRIBUTES = ["rel", "as", "href"];
@@ -78729,7 +78957,7 @@ async function generateAssetsFetch(directory, log2) {
78729
78957
  directory = (0, import_node_path62.resolve)(directory);
78730
78958
  const polyfill2 = (await Promise.resolve().then(() => (init_miniflare(), miniflare_exports2))).default;
78731
78959
  await polyfill2();
78732
- const { generateHandler: generateHandler2, parseQualityWeightedList: parseQualityWeightedList2 } = await Promise.resolve().then(() => (init_handler2(), handler_exports));
78960
+ const { generateHandler: generateHandler2, parseQualityWeightedList: parseQualityWeightedList2 } = await Promise.resolve().then(() => (init_handler3(), handler_exports));
78733
78961
  const headersFile = (0, import_node_path62.join)(directory, "_headers");
78734
78962
  const redirectsFile = (0, import_node_path62.join)(directory, "_redirects");
78735
78963
  const workerFile = (0, import_node_path62.join)(directory, "_worker.js");
@@ -81185,7 +81413,7 @@ var import_undici3 = __toESM(require_undici());
81185
81413
 
81186
81414
  // package.json
81187
81415
  var name = "wrangler";
81188
- var version = "4.13.1";
81416
+ var version = "4.14.0";
81189
81417
 
81190
81418
  // src/environment-variables/misc-variables.ts
81191
81419
  init_import_meta_url();
@@ -83606,7 +83834,7 @@ function checkType(type) {
83606
83834
  throw new Error(`Invalid type specified: ${type}`);
83607
83835
  }
83608
83836
  __name(checkType, "checkType");
83609
- var matchType = /* @__PURE__ */ __name((type, stat9) => type === void 0 || stat9[typeMappings[type]](), "matchType");
83837
+ var matchType = /* @__PURE__ */ __name((type, stat10) => type === void 0 || stat10[typeMappings[type]](), "matchType");
83610
83838
  var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
83611
83839
  function locatePathSync(paths, {
83612
83840
  cwd: cwd2 = import_node_process2.default.cwd(),
@@ -83618,8 +83846,8 @@ function locatePathSync(paths, {
83618
83846
  const statFunction = allowSymlinks ? import_node_fs3.default.statSync : import_node_fs3.default.lstatSync;
83619
83847
  for (const path_ of paths) {
83620
83848
  try {
83621
- const stat9 = statFunction(import_node_path6.default.resolve(cwd2, path_));
83622
- if (matchType(type, stat9)) {
83849
+ const stat10 = statFunction(import_node_path6.default.resolve(cwd2, path_));
83850
+ if (matchType(type, stat10)) {
83623
83851
  return path_;
83624
83852
  }
83625
83853
  } catch {
@@ -83846,7 +84074,7 @@ var friendlyBindingNames = {
83846
84074
  secrets_store_secrets: "Secrets Store Secrets",
83847
84075
  assets: "Assets"
83848
84076
  };
83849
- function printBindings(bindings, context2 = {}) {
84077
+ function printBindings(bindings, tailConsumers = [], context2 = {}) {
83850
84078
  let hasConnectionStatus = false;
83851
84079
  const addSuffix = createAddSuffix({
83852
84080
  isProvisioning: context2.provisioning,
@@ -84245,39 +84473,67 @@ function printBindings(bindings, context2 = {}) {
84245
84473
  });
84246
84474
  }
84247
84475
  if (output.length === 0) {
84248
- logger.log("No bindings found.");
84249
- return;
84250
- }
84251
- if (context2.local) {
84252
- logger.once.log(
84253
- `Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
84476
+ if (context2.name && getFlag("MULTIWORKER")) {
84477
+ logger.log(`No bindings found for ${source_default.blue(context2.name)}`);
84478
+ } else {
84479
+ logger.log("No bindings found.");
84480
+ }
84481
+ } else {
84482
+ if (context2.local) {
84483
+ logger.once.log(
84484
+ `Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
84254
84485
  `
84255
- );
84486
+ );
84487
+ }
84488
+ let title2;
84489
+ if (context2.provisioning) {
84490
+ title2 = "The following bindings need to be provisioned:";
84491
+ } else if (context2.name && getFlag("MULTIWORKER")) {
84492
+ title2 = `${source_default.blue(context2.name)} has access to the following bindings:`;
84493
+ } else {
84494
+ title2 = "Your Worker has access to the following bindings:";
84495
+ }
84496
+ const message = [
84497
+ title2,
84498
+ ...output.map((bindingGroup) => {
84499
+ return [
84500
+ `- ${bindingGroup.name}:`,
84501
+ bindingGroup.entries.map(
84502
+ ({ key, value }) => ` - ${key}${value ? ":" : ""} ${value}`
84503
+ )
84504
+ ];
84505
+ }).flat(2)
84506
+ ].join("\n");
84507
+ logger.log(message);
84256
84508
  }
84257
84509
  let title;
84258
- if (context2.provisioning) {
84259
- title = "The following bindings need to be provisioned:";
84260
- } else if (context2.name && getFlag("MULTIWORKER")) {
84261
- title = `${source_default.blue(context2.name)} has access to the following bindings:`;
84510
+ if (context2.name && getFlag("MULTIWORKER")) {
84511
+ title = `${source_default.blue(context2.name)} is sending Tail events to the following Workers:`;
84262
84512
  } else {
84263
- title = "Your worker has access to the following bindings:";
84513
+ title = "Your Worker is sending Tail events to the following Workers:";
84514
+ }
84515
+ if (tailConsumers !== void 0 && tailConsumers.length > 0) {
84516
+ logger.log(
84517
+ `${title}
84518
+ ${tailConsumers.map(({ service }) => {
84519
+ if (context2.local && context2.registry !== null) {
84520
+ const registryDefinition = context2.registry?.[service];
84521
+ hasConnectionStatus = true;
84522
+ if (registryDefinition) {
84523
+ return `- ${service} ${source_default.green("[connected]")}`;
84524
+ } else {
84525
+ return `- ${service} ${source_default.red("[not connected]")}`;
84526
+ }
84527
+ } else {
84528
+ return `- ${service}`;
84529
+ }
84530
+ }).join("\n")}`
84531
+ );
84264
84532
  }
84265
- const message = [
84266
- title,
84267
- ...output.map((bindingGroup) => {
84268
- return [
84269
- `- ${bindingGroup.name}:`,
84270
- bindingGroup.entries.map(
84271
- ({ key, value }) => ` - ${key}${value ? ":" : ""} ${value}`
84272
- )
84273
- ];
84274
- }).flat(2)
84275
- ].join("\n");
84276
- logger.log(message);
84277
84533
  if (hasConnectionStatus) {
84278
84534
  logger.once.info(
84279
84535
  `
84280
- Service bindings & durable object bindings connect to other \`wrangler dev\` processes running locally, with their connection status indicated by ${source_default.green("[connected]")} or ${source_default.red("[not connected]")}. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
84536
+ Service bindings, Durable Object bindings, and Tail consumers connect to other \`wrangler dev\` processes running locally, with their connection status indicated by ${source_default.green("[connected]")} or ${source_default.red("[not connected]")}. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
84281
84537
  `
84282
84538
  );
84283
84539
  }
@@ -92805,6 +93061,37 @@ function buildMiniflareBindingOptions(config) {
92805
93061
  };
92806
93062
  }
92807
93063
  }
93064
+ const tails = [];
93065
+ const notFoundTails = /* @__PURE__ */ new Set();
93066
+ for (const tail of config.tails ?? []) {
93067
+ if (tail.service === config.name || config.workerDefinitions === null) {
93068
+ tails.push({ name: tail.service });
93069
+ continue;
93070
+ }
93071
+ const target = config.workerDefinitions?.[tail.service];
93072
+ const defaultEntrypoint = target?.entrypointAddresses?.["default"];
93073
+ if (target?.host === void 0 || target.port === void 0 || defaultEntrypoint === void 0) {
93074
+ notFoundTails.add(tail.service);
93075
+ } else {
93076
+ const style = import_miniflare6.HttpOptions_Style.PROXY;
93077
+ const address = `${defaultEntrypoint.host}:${defaultEntrypoint.port}`;
93078
+ tails.push({
93079
+ external: {
93080
+ address,
93081
+ http: {
93082
+ style,
93083
+ cfBlobHeader: import_miniflare6.CoreHeaders.CF_BLOB
93084
+ }
93085
+ }
93086
+ });
93087
+ }
93088
+ }
93089
+ if (notFoundTails.size > 0) {
93090
+ logger.debug(
93091
+ "Couldn't connect to the following configured `tail_consumers`: ",
93092
+ [...notFoundTails.values()].join(", ")
93093
+ );
93094
+ }
92808
93095
  const classNameToUseSQLite = getClassNamesWhichUseSQLite(config.migrations);
92809
93096
  const internalObjects = [];
92810
93097
  const externalObjects = [];
@@ -93011,7 +93298,8 @@ function buildMiniflareBindingOptions(config) {
93011
93298
  bindings.unsafe?.bindings?.filter((b6) => b6.type == "ratelimit").map(ratelimitEntry) ?? []
93012
93299
  ),
93013
93300
  serviceBindings,
93014
- wrappedBindings
93301
+ wrappedBindings,
93302
+ tails
93015
93303
  };
93016
93304
  return {
93017
93305
  bindingOptions,
@@ -93137,8 +93425,8 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
93137
93425
  if (config.crons.length > 0 && !config.testScheduled) {
93138
93426
  if (!didWarnMiniflareCronSupport) {
93139
93427
  didWarnMiniflareCronSupport = true;
93140
- log2.warn(
93141
- "Miniflare 3 does not currently trigger scheduled Workers automatically.\nUse `--test-scheduled` to forward fetch triggers."
93428
+ logger.warn(
93429
+ "Miniflare does not currently trigger scheduled Workers automatically.\nRefer to https://developers.cloudflare.com/workers/configuration/cron-triggers/#test-cron-triggers for more details "
93142
93430
  );
93143
93431
  }
93144
93432
  }
@@ -93722,7 +94010,8 @@ async function convertToConfigBundle(event) {
93722
94010
  serviceBindings: fetchers,
93723
94011
  bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false,
93724
94012
  imagesLocalMode: event.config.dev?.imagesLocalMode ?? false,
93725
- testScheduled: !!event.config.dev.testScheduled
94013
+ testScheduled: !!event.config.dev.testScheduled,
94014
+ tails: event.config.tailConsumers
93726
94015
  };
93727
94016
  }
93728
94017
  __name(convertToConfigBundle, "convertToConfigBundle");
@@ -94893,7 +95182,7 @@ var NoOpProxyController = class extends ProxyController {
94893
95182
  init_import_meta_url();
94894
95183
  var import_node_assert24 = __toESM(require("node:assert"));
94895
95184
  var import_node_fs31 = require("node:fs");
94896
- var import_promises37 = require("node:fs/promises");
95185
+ var import_promises38 = require("node:fs/promises");
94897
95186
  var path62 = __toESM(require("node:path"));
94898
95187
 
94899
95188
  // ../workers-shared/index.ts
@@ -102755,7 +103044,7 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
102755
103044
  printable[resource.resourceType] ??= [];
102756
103045
  printable[resource.resourceType].push({ binding: resource.binding });
102757
103046
  }
102758
- printBindings(printable, { provisioning: true });
103047
+ printBindings(printable, config.tail_consumers, { provisioning: true });
102759
103048
  logger.log();
102760
103049
  const existingResources = {};
102761
103050
  for (const resource of pendingResources) {
@@ -105362,22 +105651,22 @@ __name(triggersDeploy, "triggersDeploy");
105362
105651
 
105363
105652
  // src/utils/friendly-validator-errors.ts
105364
105653
  init_import_meta_url();
105365
- var import_promises36 = require("node:fs/promises");
105654
+ var import_promises37 = require("node:fs/promises");
105366
105655
  var import_node_path58 = __toESM(require("node:path"));
105367
105656
 
105368
105657
  // src/check/commands.ts
105369
105658
  init_import_meta_url();
105370
105659
  var import_crypto6 = require("crypto");
105371
- var import_promises34 = require("fs/promises");
105660
+ var import_promises35 = require("fs/promises");
105372
105661
  var import_node_events4 = __toESM(require("node:events"));
105373
- var import_promises35 = require("node:fs/promises");
105662
+ var import_promises36 = require("node:fs/promises");
105374
105663
  var import_path23 = __toESM(require("path"));
105375
105664
  var import_miniflare24 = require("miniflare");
105376
105665
 
105377
105666
  // src/index.ts
105378
105667
  init_import_meta_url();
105379
105668
  var import_node_os7 = __toESM(require("node:os"));
105380
- var import_promises33 = require("node:timers/promises");
105669
+ var import_promises34 = require("node:timers/promises");
105381
105670
  var import_undici20 = __toESM(require_undici());
105382
105671
 
105383
105672
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
@@ -145060,8 +145349,8 @@ function printTokenPermissions(user) {
145060
145349
  `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
145061
145350
  );
145062
145351
  logger.log(`Scope (Access)`);
145063
- for (const [scope, access3] of permissions) {
145064
- logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
145352
+ for (const [scope, access4] of permissions) {
145353
+ logger.log(`- ${scope} ${access4 ? `(${access4})` : ``}`);
145065
145354
  }
145066
145355
  }
145067
145356
  __name(printTokenPermissions, "printTokenPermissions");
@@ -145471,11 +145760,22 @@ __name(deleteMetadataIndex, "deleteMetadataIndex");
145471
145760
 
145472
145761
  // src/vectorize/common.ts
145473
145762
  init_import_meta_url();
145763
+ var import_promises33 = require("node:fs/promises");
145474
145764
  var deprecatedV1DefaultFlag = false;
145475
145765
  var VECTORIZE_V1_MAX_BATCH_SIZE = 1e3;
145476
145766
  var VECTORIZE_MAX_BATCH_SIZE = 5e3;
145477
145767
  var VECTORIZE_UPSERT_BATCH_SIZE = VECTORIZE_V1_MAX_BATCH_SIZE;
145478
145768
  var VECTORIZE_MAX_UPSERT_VECTOR_RECORDS = 1e5;
145769
+ async function isValidFile(path69) {
145770
+ try {
145771
+ await (0, import_promises33.access)(path69, import_promises33.constants.R_OK);
145772
+ const fileStat = await (0, import_promises33.stat)(path69);
145773
+ return fileStat.isFile() && fileStat.size > 0;
145774
+ } catch (err) {
145775
+ return false;
145776
+ }
145777
+ }
145778
+ __name(isValidFile, "isValidFile");
145479
145779
  async function* getBatchFromFile(rl, batchSize = VECTORIZE_MAX_BATCH_SIZE) {
145480
145780
  const batch = [];
145481
145781
  try {
@@ -145563,10 +145863,9 @@ var vectorizeCreateCommand = createCommand({
145563
145863
  dimensions: args.dimensions
145564
145864
  };
145565
145865
  } else {
145566
- logger.error(
145567
- "You must provide both dimensions and a metric, or a known model preset when creating an index."
145866
+ throw new UserError(
145867
+ "\u{1F6A8} You must provide both dimensions and a metric, or a known model preset when creating an index."
145568
145868
  );
145569
- return;
145570
145869
  }
145571
145870
  if (args.deprecatedV1) {
145572
145871
  logger.warn(
@@ -145724,8 +146023,9 @@ var vectorizeDeleteVectorsCommand = createCommand({
145724
146023
  positionalArgs: ["name"],
145725
146024
  async handler(args, { config }) {
145726
146025
  if (args.ids.length === 0) {
145727
- logger.error("\u{1F6A8} Please provide valid vector identifiers for deletion.");
145728
- return;
146026
+ throw new UserError(
146027
+ "\u{1F6A8} Please provide valid vector identifiers for deletion."
146028
+ );
145729
146029
  }
145730
146030
  logger.log(`\u{1F4CB} Deleting vectors...`);
145731
146031
  const ids = {
@@ -145843,8 +146143,7 @@ var vectorizeGetVectorsCommand = createCommand({
145843
146143
  positionalArgs: ["name"],
145844
146144
  async handler(args, { config }) {
145845
146145
  if (args.ids.length === 0) {
145846
- logger.error("\u{1F6A8} Please provide valid vector identifiers.");
145847
- return;
146146
+ throw new UserError("\u{1F6A8} Please provide valid vector identifiers.");
145848
146147
  }
145849
146148
  logger.log(`\u{1F4CB} Fetching vectors...`);
145850
146149
  const ids = {
@@ -145956,17 +146255,20 @@ var vectorizeInsertCommand = createCommand({
145956
146255
  },
145957
146256
  positionalArgs: ["name"],
145958
146257
  async handler(args, { config }) {
146258
+ if (!await isValidFile(args.file)) {
146259
+ throw new UserError(
146260
+ `\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`
146261
+ );
146262
+ }
145959
146263
  const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs27.createReadStream)(args.file) });
145960
146264
  if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
145961
- logger.error(
146265
+ throw new UserError(
145962
146266
  `\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_V1_MAX_BATCH_SIZE} records at a time.`
145963
146267
  );
145964
- return;
145965
146268
  } else if (!args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
145966
- logger.error(
145967
- `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits`
146269
+ throw new UserError(
146270
+ `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
145968
146271
  );
145969
- return;
145970
146272
  }
145971
146273
  let vectorInsertCount = 0;
145972
146274
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -146210,10 +146512,9 @@ var vectorizeQueryCommand = createCommand({
146210
146512
  }
146211
146513
  }
146212
146514
  if (args.vector === void 0 && args.vectorId === void 0 || args.vector !== void 0 && args.vectorId !== void 0) {
146213
- logger.error(
146515
+ throw new UserError(
146214
146516
  "\u{1F6A8} Either vector or vector-id parameter must be provided, but not both."
146215
146517
  );
146216
- return;
146217
146518
  }
146218
146519
  logger.log(`\u{1F4CB} Searching for relevant vectors...`);
146219
146520
  let res;
@@ -146338,12 +146639,16 @@ var vectorizeUpsertCommand = createCommand({
146338
146639
  },
146339
146640
  positionalArgs: ["name"],
146340
146641
  async handler(args, { config }) {
146642
+ if (!await isValidFile(args.file)) {
146643
+ throw new UserError(
146644
+ `\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`
146645
+ );
146646
+ }
146341
146647
  const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs28.createReadStream)(args.file) });
146342
146648
  if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
146343
- logger.error(
146344
- `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits`
146649
+ throw new UserError(
146650
+ `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
146345
146651
  );
146346
- return;
146347
146652
  }
146348
146653
  let vectorUpsertCount = 0;
146349
146654
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -148474,7 +148779,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
148474
148779
  let workerBundle;
148475
148780
  if (props.dryRun) {
148476
148781
  workerBundle = createWorkerUploadForm(worker);
148477
- printBindings({ ...bindings, vars: maskedVars });
148782
+ printBindings({ ...bindings, vars: maskedVars }, config.tail_consumers);
148478
148783
  } else {
148479
148784
  (0, import_node_assert22.default)(accountId, "Missing accountId");
148480
148785
  if (getFlag("RESOURCES_PROVISION")) {
@@ -148499,12 +148804,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
148499
148804
  );
148500
148805
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
148501
148806
  bindingsPrinted = true;
148502
- printBindings({ ...bindings, vars: maskedVars });
148807
+ printBindings({ ...bindings, vars: maskedVars }, config.tail_consumers);
148503
148808
  versionId = result.id;
148504
148809
  hasPreview = result.metadata.has_preview;
148505
148810
  } catch (err) {
148506
148811
  if (!bindingsPrinted) {
148507
- printBindings({ ...bindings, vars: maskedVars });
148812
+ printBindings(
148813
+ { ...bindings, vars: maskedVars },
148814
+ config.tail_consumers
148815
+ );
148508
148816
  }
148509
148817
  await helpIfErrorIsSizeOrScriptStartup(
148510
148818
  err,
@@ -149629,6 +149937,10 @@ var emojifyInstanceStatus = /* @__PURE__ */ __name((status2) => {
149629
149937
  return "\u25B6 Running";
149630
149938
  case "terminated":
149631
149939
  return "\u{1F6AB} Terminated";
149940
+ case "waiting":
149941
+ return "\u23F0 Waiting";
149942
+ default:
149943
+ return "\u2753 Unknown";
149632
149944
  }
149633
149945
  }, "emojifyInstanceStatus");
149634
149946
  var emojifyInstanceTriggerName = /* @__PURE__ */ __name((status2) => {
@@ -149653,6 +149965,8 @@ var emojifyStepType = /* @__PURE__ */ __name((type) => {
149653
149965
  return "\u{1F4A4} Sleeping";
149654
149966
  case "termination":
149655
149967
  return "\u{1F6AB} Termination";
149968
+ case "waitForEvent":
149969
+ return "\u{1F440} Waiting for event";
149656
149970
  default:
149657
149971
  return "\u2753 Unknown";
149658
149972
  }
@@ -149771,7 +150085,7 @@ var workflowsInstancesDescribeCommand = createCommand({
149771
150085
  function logStep(args, step) {
149772
150086
  logRaw("");
149773
150087
  const formattedStep = {};
149774
- if (step.type == "sleep" || step.type == "step") {
150088
+ if (step.type == "sleep" || step.type == "step" || step.type == "waitForEvent") {
149775
150089
  formattedStep.Name = step.name;
149776
150090
  formattedStep.Type = emojifyStepType(step.type);
149777
150091
  if (step.start != void 0) {
@@ -149813,6 +150127,8 @@ function logStep(args, step) {
149813
150127
  formattedStep["Retries At"] = `${retryDate.toLocaleString()} (in ${formatDistanceToNowStrict(retryDate)} from now)`;
149814
150128
  }
149815
150129
  }
150130
+ }
150131
+ if (step.type == "step" || step.type == "waitForEvent") {
149816
150132
  if (step.output !== void 0 && args.stepOutput) {
149817
150133
  let output;
149818
150134
  try {
@@ -149823,7 +150139,7 @@ function logStep(args, step) {
149823
150139
  formattedStep.Output = output.length > args.truncateOutputLimit ? output.substring(0, args.truncateOutputLimit) + "[...output truncated]" : output;
149824
150140
  }
149825
150141
  }
149826
- logRaw(formatLabelledValues(formattedStep, { indentationCount: 2 }));
150142
+ logger.log(formatLabelledValues(formattedStep, { indentationCount: 2 }));
149827
150143
  if (step.type == "step") {
149828
150144
  const prettyAttempts = step.attempts.map((val2) => {
149829
150145
  const attempt = {};
@@ -151393,7 +151709,7 @@ ${tryRunningItIn}${oneOfThese}`
151393
151709
  const controller = new AbortController();
151394
151710
  await Promise.race([
151395
151711
  Promise.allSettled(dispatcher?.requests ?? []),
151396
- (0, import_promises33.setTimeout)(1e3, void 0, controller)
151712
+ (0, import_promises34.setTimeout)(1e3, void 0, controller)
151397
151713
  // Ensure we don't hang indefinitely
151398
151714
  ]).then(() => controller.abort());
151399
151715
  } catch (e7) {
@@ -151457,7 +151773,7 @@ async function checkStartupHandler({
151457
151773
  startMessage: "Analysing",
151458
151774
  endMessage: source_default.green("Startup phase analysed")
151459
151775
  });
151460
- await (0, import_promises35.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
151776
+ await (0, import_promises36.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
151461
151777
  log(
151462
151778
  `CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
151463
151779
  );
@@ -151536,7 +151852,7 @@ async function convertWorkerBundleToModules(workerBundle) {
151536
151852
  }
151537
151853
  __name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
151538
151854
  async function parseFormDataFromFile(file) {
151539
- const bundle = await (0, import_promises34.readFile)(file);
151855
+ const bundle = await (0, import_promises35.readFile)(file);
151540
151856
  const firstLine = bundle.findIndex((v7) => v7 === 10);
151541
151857
  const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
151542
151858
  return await new Response(bundle, {
@@ -151634,7 +151950,7 @@ async function handleStartupError(workerBundle, projectRoot) {
151634
151950
  projectRoot ?? process.cwd(),
151635
151951
  import_node_path58.default.join(tmpDir.path, `worker.cpuprofile`)
151636
151952
  );
151637
- await (0, import_promises36.writeFile)(profile, JSON.stringify(cpuProfile));
151953
+ await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
151638
151954
  throw new UserError(esm_default2`
151639
151955
  Your Worker failed validation because it exceeded startup limits.
151640
151956
  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.
@@ -152099,7 +152415,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152099
152415
  let workerBundle;
152100
152416
  if (props.dryRun) {
152101
152417
  workerBundle = createWorkerUploadForm(worker);
152102
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152418
+ printBindings(
152419
+ { ...withoutStaticAssets, vars: maskedVars },
152420
+ config.tail_consumers
152421
+ );
152103
152422
  } else {
152104
152423
  (0, import_node_assert23.default)(accountId, "Missing accountId");
152105
152424
  if (getFlag("RESOURCES_PROVISION")) {
@@ -152171,7 +152490,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152171
152490
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
152172
152491
  }
152173
152492
  bindingsPrinted = true;
152174
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152493
+ printBindings(
152494
+ { ...withoutStaticAssets, vars: maskedVars },
152495
+ config.tail_consumers
152496
+ );
152175
152497
  versionId = parseNonHyphenedUuid(result.deployment_id);
152176
152498
  if (config.first_party_worker) {
152177
152499
  if (result.id) {
@@ -152192,7 +152514,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152192
152514
  }
152193
152515
  } catch (err) {
152194
152516
  if (!bindingsPrinted) {
152195
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152517
+ printBindings(
152518
+ { ...withoutStaticAssets, vars: maskedVars },
152519
+ config.tail_consumers
152520
+ );
152196
152521
  }
152197
152522
  await helpIfErrorIsSizeOrScriptStartup(
152198
152523
  err,
@@ -152580,7 +152905,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
152580
152905
  payload.append(
152581
152906
  manifestEntry[1].hash,
152582
152907
  new import_undici22.File(
152583
- [(await (0, import_promises37.readFile)(absFilePath)).toString("base64")],
152908
+ [(await (0, import_promises38.readFile)(absFilePath)).toString("base64")],
152584
152909
  manifestEntry[1].hash,
152585
152910
  {
152586
152911
  // Most formdata body encoders (incl. undici's) will override with "application/octet-stream" if you use a falsy value here
@@ -152674,7 +152999,7 @@ Assets already uploaded have been saved, so the next attempt will automatically
152674
152999
  return completionJwt;
152675
153000
  }, "syncAssets");
152676
153001
  var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
152677
- const files = await (0, import_promises37.readdir)(dir, { recursive: true });
153002
+ const files = await (0, import_promises38.readdir)(dir, { recursive: true });
152678
153003
  logReadFilesFromDirectory(dir, files);
152679
153004
  const manifest = {};
152680
153005
  let counter = 0;
@@ -152686,7 +153011,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
152686
153011
  return;
152687
153012
  }
152688
153013
  const filepath = path62.join(dir, relativeFilepath);
152689
- const filestat = await (0, import_promises37.stat)(filepath);
153014
+ const filestat = await (0, import_promises38.stat)(filepath);
152690
153015
  if (filestat.isSymbolicLink() || filestat.isDirectory()) {
152691
153016
  return;
152692
153017
  } else {
@@ -152873,7 +153198,7 @@ init_import_meta_url();
152873
153198
  // src/dev-registry/file-registry.ts
152874
153199
  init_import_meta_url();
152875
153200
  var import_node_fs32 = require("node:fs");
152876
- var import_promises38 = require("node:fs/promises");
153201
+ var import_promises39 = require("node:fs/promises");
152877
153202
  var import_node_path60 = __toESM(require("node:path"));
152878
153203
  var util3 = __toESM(require("node:util"));
152879
153204
  init_esm2();
@@ -152945,8 +153270,8 @@ async function registerWorker(name2, definition) {
152945
153270
  if (existingHeartbeat) {
152946
153271
  clearInterval(existingHeartbeat);
152947
153272
  }
152948
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
152949
- await (0, import_promises38.writeFile)(
153273
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
153274
+ await (0, import_promises39.writeFile)(
152950
153275
  import_node_path60.default.join(DEV_REGISTRY_PATH, name2),
152951
153276
  // We don't currently do anything with the stored Wrangler version,
152952
153277
  // but if we need to make breaking changes to this format in the future
@@ -152969,7 +153294,7 @@ async function getRegisteredWorkers() {
152969
153294
  __name(getRegisteredWorkers, "getRegisteredWorkers");
152970
153295
  async function unregisterWorker(name2) {
152971
153296
  try {
152972
- await (0, import_promises38.unlink)(import_node_path60.default.join(DEV_REGISTRY_PATH, name2));
153297
+ await (0, import_promises39.unlink)(import_node_path60.default.join(DEV_REGISTRY_PATH, name2));
152973
153298
  const existingHeartbeat = heartbeats.get(name2);
152974
153299
  if (existingHeartbeat) {
152975
153300
  clearInterval(existingHeartbeat);
@@ -152981,17 +153306,17 @@ async function unregisterWorker(name2) {
152981
153306
  }
152982
153307
  __name(unregisterWorker, "unregisterWorker");
152983
153308
  async function loadWorkerDefinitions() {
152984
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
153309
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
152985
153310
  globalWorkers ??= {};
152986
153311
  const newWorkers = /* @__PURE__ */ new Set();
152987
- const workerDefinitions = await (0, import_promises38.readdir)(DEV_REGISTRY_PATH);
153312
+ const workerDefinitions = await (0, import_promises39.readdir)(DEV_REGISTRY_PATH);
152988
153313
  for (const workerName of workerDefinitions) {
152989
153314
  try {
152990
- const file = await (0, import_promises38.readFile)(
153315
+ const file = await (0, import_promises39.readFile)(
152991
153316
  import_node_path60.default.join(DEV_REGISTRY_PATH, workerName),
152992
153317
  "utf8"
152993
153318
  );
152994
- const stats = await (0, import_promises38.stat)(import_node_path60.default.join(DEV_REGISTRY_PATH, workerName));
153319
+ const stats = await (0, import_promises39.stat)(import_node_path60.default.join(DEV_REGISTRY_PATH, workerName));
152995
153320
  if (stats.mtime.getTime() < Date.now() - 6e5) {
152996
153321
  await unregisterWorker(workerName);
152997
153322
  } else {
@@ -153026,9 +153351,10 @@ __name(getRegisteredWorkers2, "getRegisteredWorkers");
153026
153351
  async function getBoundRegisteredWorkers({
153027
153352
  name: name2,
153028
153353
  services,
153029
- durableObjects
153354
+ durableObjects,
153355
+ tailConsumers
153030
153356
  }, existingWorkerDefinitions) {
153031
- const serviceNames = (services || []).map(
153357
+ const serviceNames = [...services || [], ...tailConsumers ?? []].map(
153032
153358
  (serviceBinding) => serviceBinding.service
153033
153359
  );
153034
153360
  const durableObjectServices = (durableObjects || { bindings: [] }).bindings.map((durableObjectBinding) => durableObjectBinding.script_name);
@@ -153536,7 +153862,8 @@ async function updateDevEnvRegistry(devEnv, registry) {
153536
153862
  "durable_object_namespace",
153537
153863
  devEnv.config.latestConfig?.bindings
153538
153864
  )
153539
- }
153865
+ },
153866
+ tailConsumers: devEnv.config.latestConfig?.tailConsumers
153540
153867
  },
153541
153868
  registry
153542
153869
  );
@@ -154938,6 +155265,7 @@ async function resolveBindings(config, input) {
154938
155265
  ...bindings,
154939
155266
  vars: maskedVars
154940
155267
  },
155268
+ input.tailConsumers ?? config.tail_consumers,
154941
155269
  {
154942
155270
  registry: input.dev?.registry,
154943
155271
  local: !input.dev?.remote,
@@ -155057,7 +155385,8 @@ If you are trying to develop Pages and Workers together, please use \`wrangler p
155057
155385
  capnp: input.unsafe?.capnp ?? unsafe?.capnp,
155058
155386
  metadata: input.unsafe?.metadata ?? unsafe?.metadata
155059
155387
  },
155060
- assets: assetsOptions
155388
+ assets: assetsOptions,
155389
+ tailConsumers: config.tail_consumers ?? []
155061
155390
  };
155062
155391
  if (extractBindingsOfType("browser", resolved.bindings).length && !resolved.dev.remote) {
155063
155392
  throw new UserError(
@@ -156135,7 +156464,8 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
156135
156464
  const workerDefinitions = await getBoundRegisteredWorkers({
156136
156465
  name: rawConfig.name,
156137
156466
  services: bindings.services,
156138
- durableObjects: rawConfig["durable_objects"]
156467
+ durableObjects: rawConfig["durable_objects"],
156468
+ tailConsumers: []
156139
156469
  });
156140
156470
  const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions({
156141
156471
  name: rawConfig.name,
@@ -156145,7 +156475,8 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
156145
156475
  services: rawConfig.services,
156146
156476
  serviceBindings: {},
156147
156477
  migrations: rawConfig.migrations,
156148
- imagesLocalMode: false
156478
+ imagesLocalMode: false,
156479
+ tails: []
156149
156480
  });
156150
156481
  const persistOptions = getMiniflarePersistOptions(options.persist);
156151
156482
  const serviceBindings = await getServiceBindings(bindings.services);
@@ -156214,7 +156545,8 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
156214
156545
  services: [],
156215
156546
  serviceBindings: {},
156216
156547
  migrations: config.migrations,
156217
- imagesLocalMode: !!options?.imagesLocalMode
156548
+ imagesLocalMode: !!options?.imagesLocalMode,
156549
+ tails: config.tail_consumers
156218
156550
  });
156219
156551
  if (bindings.services !== void 0) {
156220
156552
  bindingOptions.serviceBindings = Object.fromEntries(