wrangler 4.13.2 → 4.14.1

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");
@@ -81171,7 +81399,7 @@ var import_miniflare8 = require("miniflare");
81171
81399
  init_import_meta_url();
81172
81400
  var import_node_assert5 = __toESM(require("node:assert"));
81173
81401
  var import_node_crypto4 = require("node:crypto");
81174
- var import_node_path15 = __toESM(require("node:path"));
81402
+ var import_node_path16 = __toESM(require("node:path"));
81175
81403
  var import_miniflare6 = require("miniflare");
81176
81404
 
81177
81405
  // src/ai/fetcher.ts
@@ -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.2";
81416
+ var version = "4.14.1";
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
  }
@@ -90292,7 +90548,10 @@ function validateScopeKeys(scopes) {
90292
90548
  return scopes.every((scope) => scope in DefaultScopes);
90293
90549
  }
90294
90550
  __name(validateScopeKeys, "validateScopeKeys");
90295
- var CALLBACK_URL = "http://localhost:8976/oauth/callback";
90551
+ function getCallbackUrl(host = "localhost", port = 8976) {
90552
+ return `http://${host}:${port}/oauth/callback`;
90553
+ }
90554
+ __name(getCallbackUrl, "getCallbackUrl");
90296
90555
  var LocalState = {
90297
90556
  ...getAuthTokens()
90298
90557
  };
@@ -90534,7 +90793,7 @@ function isReturningFromAuthServer(query) {
90534
90793
  return true;
90535
90794
  }
90536
90795
  __name(isReturningFromAuthServer, "isReturningFromAuthServer");
90537
- async function getAuthURL(scopes, clientId) {
90796
+ async function getAuthURL(scopes, clientId, callbackHost, callbackPort) {
90538
90797
  const { codeChallenge, codeVerifier } = await generatePKCECodes();
90539
90798
  const stateQueryParam = generateRandomState(RECOMMENDED_STATE_LENGTH);
90540
90799
  Object.assign(LocalState, {
@@ -90545,7 +90804,7 @@ async function getAuthURL(scopes, clientId) {
90545
90804
  return generateAuthUrl({
90546
90805
  authUrl: getAuthUrlFromEnv(),
90547
90806
  clientId,
90548
- callbackUrl: CALLBACK_URL,
90807
+ callbackUrl: getCallbackUrl(callbackHost, callbackPort),
90549
90808
  scopes,
90550
90809
  stateQueryParam,
90551
90810
  codeChallenge
@@ -90624,7 +90883,7 @@ async function exchangeAuthCodeForAccessToken() {
90624
90883
  const params = new URLSearchParams({
90625
90884
  grant_type: `authorization_code`,
90626
90885
  code: authorizationCode ?? "",
90627
- redirect_uri: CALLBACK_URL,
90886
+ redirect_uri: getCallbackUrl(),
90628
90887
  client_id: getClientIdFromEnv(),
90629
90888
  code_verifier: codeVerifier
90630
90889
  });
@@ -90732,7 +90991,12 @@ async function loginOrRefreshIfRequired(props) {
90732
90991
  }
90733
90992
  __name(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
90734
90993
  async function getOauthToken(options) {
90735
- const urlToOpen = await getAuthURL(options.scopes, options.clientId);
90994
+ const urlToOpen = await getAuthURL(
90995
+ options.scopes,
90996
+ options.clientId,
90997
+ options.callbackHost,
90998
+ options.callbackPort
90999
+ );
90736
91000
  let server;
90737
91001
  let loginTimeoutHandle;
90738
91002
  const timerPromise = new Promise((_4, reject) => {
@@ -91268,18 +91532,78 @@ __name(AIFetcher, "AIFetcher");
91268
91532
  // src/deployment-bundle/module-collection.ts
91269
91533
  init_import_meta_url();
91270
91534
  var import_node_crypto3 = __toESM(require("node:crypto"));
91271
- var import_node_fs7 = require("node:fs");
91535
+ var import_node_fs8 = require("node:fs");
91272
91536
  var import_promises4 = require("node:fs/promises");
91273
- var import_node_path14 = __toESM(require("node:path"));
91537
+ var import_node_path15 = __toESM(require("node:path"));
91274
91538
  var import_glob_to_regexp2 = __toESM(require_glob_to_regexp());
91275
91539
  var import_resolve = __toESM(require_resolve());
91276
91540
 
91277
91541
  // src/deployment-bundle/find-additional-modules.ts
91278
91542
  init_import_meta_url();
91279
91543
  var import_promises3 = require("node:fs/promises");
91280
- var import_node_path13 = __toESM(require("node:path"));
91544
+ var import_node_path14 = __toESM(require("node:path"));
91281
91545
  var import_glob_to_regexp = __toESM(require_glob_to_regexp());
91282
91546
 
91547
+ // src/paths.ts
91548
+ init_import_meta_url();
91549
+ var import_node_console = require("node:console");
91550
+ var import_node_fs6 = __toESM(require("node:fs"));
91551
+ var import_node_path12 = __toESM(require("node:path"));
91552
+ var import_signal_exit3 = __toESM(require_signal_exit());
91553
+ function toUrlPath(filePath) {
91554
+ (0, import_node_console.assert)(
91555
+ !/^[a-z]:/i.test(filePath),
91556
+ "Tried to convert a Windows file path with a drive to a URL path."
91557
+ );
91558
+ return filePath.replace(/\\/g, "/");
91559
+ }
91560
+ __name(toUrlPath, "toUrlPath");
91561
+ function readableRelative(to) {
91562
+ const relativePath = import_node_path12.default.relative(process.cwd(), to);
91563
+ if (
91564
+ // No directory nesting, return as-is
91565
+ import_node_path12.default.basename(relativePath) === relativePath || // Outside current directory
91566
+ relativePath.startsWith(".")
91567
+ ) {
91568
+ return relativePath;
91569
+ } else {
91570
+ return "./" + relativePath;
91571
+ }
91572
+ }
91573
+ __name(readableRelative, "readableRelative");
91574
+ function getBasePath() {
91575
+ return import_node_path12.default.resolve(__dirname, "..");
91576
+ }
91577
+ __name(getBasePath, "getBasePath");
91578
+ function getWranglerHiddenDirPath(projectRoot) {
91579
+ projectRoot ??= process.cwd();
91580
+ return import_node_path12.default.join(projectRoot, ".wrangler");
91581
+ }
91582
+ __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
91583
+ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
91584
+ const tmpRoot = import_node_path12.default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
91585
+ import_node_fs6.default.mkdirSync(tmpRoot, { recursive: true });
91586
+ const tmpPrefix = import_node_path12.default.join(tmpRoot, `${prefix}-`);
91587
+ const tmpDir = import_node_fs6.default.realpathSync(import_node_fs6.default.mkdtempSync(tmpPrefix));
91588
+ const removeDir = /* @__PURE__ */ __name(() => {
91589
+ if (cleanup) {
91590
+ try {
91591
+ return import_node_fs6.default.rmSync(tmpDir, { recursive: true, force: true });
91592
+ } catch (e7) {
91593
+ }
91594
+ }
91595
+ }, "removeDir");
91596
+ const removeExitListener = (0, import_signal_exit3.default)(removeDir);
91597
+ return {
91598
+ path: tmpDir,
91599
+ remove() {
91600
+ removeExitListener();
91601
+ removeDir();
91602
+ }
91603
+ };
91604
+ }
91605
+ __name(getWranglerTmpDir, "getWranglerTmpDir");
91606
+
91283
91607
  // src/deployment-bundle/bundle-type.ts
91284
91608
  init_import_meta_url();
91285
91609
  function getBundleType(format9, file) {
@@ -91352,8 +91676,8 @@ __name(parseRules, "parseRules");
91352
91676
 
91353
91677
  // src/deployment-bundle/source-maps.ts
91354
91678
  init_import_meta_url();
91355
- var import_node_fs6 = __toESM(require("node:fs"));
91356
- var import_node_path12 = __toESM(require("node:path"));
91679
+ var import_node_fs7 = __toESM(require("node:fs"));
91680
+ var import_node_path13 = __toESM(require("node:path"));
91357
91681
  function loadSourceMaps(main2, modules, bundle) {
91358
91682
  const { sourceMapPath, sourceMapMetadata } = bundle;
91359
91683
  if (sourceMapPath && sourceMapMetadata) {
@@ -91368,18 +91692,18 @@ function loadSourceMap({ name: name2, filePath }, sourceMapPath, { entryDirector
91368
91692
  return [];
91369
91693
  }
91370
91694
  const map2 = JSON.parse(
91371
- import_node_fs6.default.readFileSync(import_node_path12.default.join(entryDirectory, sourceMapPath), "utf8")
91695
+ import_node_fs7.default.readFileSync(import_node_path13.default.join(entryDirectory, sourceMapPath), "utf8")
91372
91696
  );
91373
91697
  map2.file = name2;
91374
91698
  if (map2.sourceRoot) {
91375
- const sourceRootPath = import_node_path12.default.dirname(
91376
- import_node_path12.default.join(entryDirectory, sourceMapPath)
91699
+ const sourceRootPath = import_node_path13.default.dirname(
91700
+ import_node_path13.default.join(entryDirectory, sourceMapPath)
91377
91701
  );
91378
- map2.sourceRoot = import_node_path12.default.relative(sourceRootPath, map2.sourceRoot);
91702
+ map2.sourceRoot = import_node_path13.default.relative(sourceRootPath, map2.sourceRoot);
91379
91703
  }
91380
91704
  map2.sources = map2.sources.map((source) => {
91381
- const originalPath = import_node_path12.default.join(import_node_path12.default.dirname(filePath), source);
91382
- return import_node_path12.default.relative(entryDirectory, originalPath);
91705
+ const originalPath = import_node_path13.default.join(import_node_path13.default.dirname(filePath), source);
91706
+ return import_node_path13.default.relative(entryDirectory, originalPath);
91383
91707
  });
91384
91708
  return [
91385
91709
  {
@@ -91439,14 +91763,14 @@ function sourceMapForModule(module3) {
91439
91763
  if (sourceMapUrl === void 0) {
91440
91764
  return;
91441
91765
  }
91442
- const sourcemapPath = import_node_path12.default.join(import_node_path12.default.dirname(module3.filePath), sourceMapUrl);
91443
- if (!import_node_fs6.default.existsSync(sourcemapPath)) {
91766
+ const sourcemapPath = import_node_path13.default.join(import_node_path13.default.dirname(module3.filePath), sourceMapUrl);
91767
+ if (!import_node_fs7.default.existsSync(sourcemapPath)) {
91444
91768
  throw new Error(
91445
91769
  `Invalid source map path in ${module3.filePath}: ${sourcemapPath} does not exist.`
91446
91770
  );
91447
91771
  }
91448
91772
  const map2 = JSON.parse(
91449
- import_node_fs6.default.readFileSync(sourcemapPath, "utf8")
91773
+ import_node_fs7.default.readFileSync(sourcemapPath, "utf8")
91450
91774
  );
91451
91775
  map2.file = module3.name;
91452
91776
  if (map2.sourceRoot) {
@@ -91476,12 +91800,18 @@ function stripPrefix(prefix, input) {
91476
91800
  __name(stripPrefix, "stripPrefix");
91477
91801
 
91478
91802
  // src/deployment-bundle/find-additional-modules.ts
91479
- async function* getFiles(root, relativeTo) {
91480
- for (const file of await (0, import_promises3.readdir)(root, { withFileTypes: true })) {
91803
+ async function* getFiles(configPath, moduleRoot, relativeTo, projectRoot) {
91804
+ const wranglerHiddenDirPath = getWranglerHiddenDirPath(projectRoot);
91805
+ for (const file of await (0, import_promises3.readdir)(moduleRoot, { withFileTypes: true })) {
91806
+ const absPath = import_node_path14.default.join(moduleRoot, file.name);
91481
91807
  if (file.isDirectory()) {
91482
- yield* getFiles(import_node_path13.default.join(root, file.name), relativeTo);
91808
+ if (absPath !== wranglerHiddenDirPath) {
91809
+ yield* getFiles(configPath, absPath, relativeTo, projectRoot);
91810
+ }
91483
91811
  } else {
91484
- yield import_node_path13.default.relative(relativeTo, import_node_path13.default.join(root, file.name)).replaceAll("\\", "/");
91812
+ if (absPath !== configPath) {
91813
+ yield import_node_path14.default.relative(relativeTo, absPath).replaceAll("\\", "/");
91814
+ }
91485
91815
  }
91486
91816
  }
91487
91817
  }
@@ -91492,8 +91822,13 @@ function isValidPythonPackageName(name2) {
91492
91822
  }
91493
91823
  __name(isValidPythonPackageName, "isValidPythonPackageName");
91494
91824
  async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
91495
- const files = getFiles(entry.moduleRoot, entry.moduleRoot);
91496
- const relativeEntryPoint = import_node_path13.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
91825
+ const files = getFiles(
91826
+ entry.configPath,
91827
+ entry.moduleRoot,
91828
+ entry.moduleRoot,
91829
+ entry.projectRoot
91830
+ );
91831
+ const relativeEntryPoint = import_node_path14.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
91497
91832
  if (Array.isArray(rules)) {
91498
91833
  rules = parseRules(rules);
91499
91834
  }
@@ -91506,7 +91841,7 @@ async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
91506
91841
  let pythonRequirements = "";
91507
91842
  try {
91508
91843
  pythonRequirements = await (0, import_promises3.readFile)(
91509
- import_node_path13.default.resolve(entry.projectRoot, "requirements.txt"),
91844
+ import_node_path14.default.resolve(entry.projectRoot, "requirements.txt"),
91510
91845
  "utf-8"
91511
91846
  );
91512
91847
  } catch (e7) {
@@ -91570,7 +91905,7 @@ async function matchFiles(files, relativeTo, { rules, removedRules }) {
91570
91905
  if (!regexp.test(filePath)) {
91571
91906
  continue;
91572
91907
  }
91573
- const absoluteFilePath = import_node_path13.default.join(relativeTo, filePath);
91908
+ const absoluteFilePath = import_node_path14.default.join(relativeTo, filePath);
91574
91909
  const fileContent = await (0, import_promises3.readFile)(
91575
91910
  absoluteFilePath
91576
91911
  );
@@ -91615,19 +91950,19 @@ async function* findAdditionalModuleWatchDirs(root) {
91615
91950
  if (entry.name === "node_modules" || entry.name === ".git") {
91616
91951
  continue;
91617
91952
  }
91618
- yield* findAdditionalModuleWatchDirs(import_node_path13.default.join(root, entry.name));
91953
+ yield* findAdditionalModuleWatchDirs(import_node_path14.default.join(root, entry.name));
91619
91954
  }
91620
91955
  }
91621
91956
  }
91622
91957
  __name(findAdditionalModuleWatchDirs, "findAdditionalModuleWatchDirs");
91623
91958
  async function writeAdditionalModules(modules, destination) {
91624
91959
  for (const module3 of modules) {
91625
- const modulePath = import_node_path13.default.resolve(destination, module3.name);
91960
+ const modulePath = import_node_path14.default.resolve(destination, module3.name);
91626
91961
  logger.debug("Writing additional module to output", modulePath);
91627
- await (0, import_promises3.mkdir)(import_node_path13.default.dirname(modulePath), { recursive: true });
91962
+ await (0, import_promises3.mkdir)(import_node_path14.default.dirname(modulePath), { recursive: true });
91628
91963
  await (0, import_promises3.writeFile)(modulePath, module3.content);
91629
91964
  if (module3.sourceMap) {
91630
- const sourcemapPath = import_node_path13.default.resolve(destination, module3.sourceMap.name);
91965
+ const sourcemapPath = import_node_path14.default.resolve(destination, module3.sourceMap.name);
91631
91966
  await (0, import_promises3.writeFile)(sourcemapPath, module3.sourceMap.content);
91632
91967
  }
91633
91968
  }
@@ -91686,7 +92021,7 @@ function createModuleCollector(props) {
91686
92021
  }
91687
92022
  const found = await findAdditionalModules(props.entry, parsedRules);
91688
92023
  foundModulePaths = found.map(
91689
- ({ name: name2 }) => import_node_path14.default.resolve(props.entry.moduleRoot, name2)
92024
+ ({ name: name2 }) => import_node_path15.default.resolve(props.entry.moduleRoot, name2)
91690
92025
  );
91691
92026
  modules.push(...found);
91692
92027
  }
@@ -91701,7 +92036,7 @@ function createModuleCollector(props) {
91701
92036
  const watchDirs = [];
91702
92037
  if (props.findAdditionalModules) {
91703
92038
  watchFiles = foundModulePaths;
91704
- const root = import_node_path14.default.resolve(props.entry.moduleRoot);
92039
+ const root = import_node_path15.default.resolve(props.entry.moduleRoot);
91705
92040
  for await (const dir of findAdditionalModuleWatchDirs(root)) {
91706
92041
  watchDirs.push(dir);
91707
92042
  }
@@ -91730,12 +92065,12 @@ function createModuleCollector(props) {
91730
92065
  return;
91731
92066
  }
91732
92067
  logger.warn(
91733
- `Deprecation: detected a legacy module import in "./${import_node_path14.default.relative(
92068
+ `Deprecation: detected a legacy module import in "./${import_node_path15.default.relative(
91734
92069
  process.cwd(),
91735
92070
  args.importer
91736
92071
  )}". This will stop working in the future. Replace references to "${args.path}" with "./${args.path}";`
91737
92072
  );
91738
- const filePath = import_node_path14.default.join(
92073
+ const filePath = import_node_path15.default.join(
91739
92074
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
91740
92075
  props.wrangler1xLegacyModuleReferences.rootDirectory,
91741
92076
  args.path
@@ -91744,7 +92079,7 @@ function createModuleCollector(props) {
91744
92079
  filePath
91745
92080
  );
91746
92081
  const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
91747
- const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path14.default.basename(args.path)}`;
92082
+ const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
91748
92083
  const { rule } = rulesMatchers.find(({ regex: regex2 }) => regex2.test(fileName)) || {};
91749
92084
  if (rule) {
91750
92085
  modules.push({
@@ -91778,7 +92113,7 @@ function createModuleCollector(props) {
91778
92113
  if (args.pluginData?.skip) {
91779
92114
  return;
91780
92115
  }
91781
- let filePath = import_node_path14.default.join(args.resolveDir, args.path);
92116
+ let filePath = import_node_path15.default.join(args.resolveDir, args.path);
91782
92117
  if (foundModulePaths.includes(filePath)) {
91783
92118
  return { path: args.path, external: true };
91784
92119
  }
@@ -91809,7 +92144,7 @@ function createModuleCollector(props) {
91809
92144
  filePath
91810
92145
  );
91811
92146
  const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
91812
- const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path14.default.basename(args.path)}`;
92147
+ const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
91813
92148
  modules.push({
91814
92149
  name: fileName,
91815
92150
  filePath,
@@ -91871,8 +92206,8 @@ function getWrangler1xLegacyModuleReferences(rootDirectory, entryPath) {
91871
92206
  return {
91872
92207
  rootDirectory,
91873
92208
  fileNames: new Set(
91874
- (0, import_node_fs7.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
91875
- (dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path14.default.basename(entryPath)
92209
+ (0, import_node_fs8.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
92210
+ (dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path15.default.basename(entryPath)
91876
92211
  ).map((dirEnt) => dirEnt.name)
91877
92212
  )
91878
92213
  };
@@ -92639,7 +92974,7 @@ async function buildSourceOptions(config) {
92639
92974
  config.bundle.modules
92640
92975
  );
92641
92976
  const entrypointNames = isPython ? [] : config.bundle.entry.exports;
92642
- const modulesRoot = import_node_path15.default.dirname(scriptPath3);
92977
+ const modulesRoot = import_node_path16.default.dirname(scriptPath3);
92643
92978
  const sourceOptions = {
92644
92979
  modulesRoot,
92645
92980
  modules: [
@@ -92652,7 +92987,7 @@ async function buildSourceOptions(config) {
92652
92987
  // Misc (WebAssembly, etc, ...)
92653
92988
  ...modules.map((module3) => ({
92654
92989
  type: ModuleTypeToRuleType[module3.type ?? "esm"],
92655
- path: import_node_path15.default.resolve(modulesRoot, module3.name),
92990
+ path: import_node_path16.default.resolve(modulesRoot, module3.name),
92656
92991
  contents: module3.content
92657
92992
  }))
92658
92993
  ]
@@ -92733,14 +93068,14 @@ function buildMiniflareBindingOptions(config) {
92733
93068
  const wasmBindings = { ...bindings.wasm_modules };
92734
93069
  if (config.format === "service-worker" && config.bundle) {
92735
93070
  const scriptPath3 = config.bundle.path;
92736
- const modulesRoot = import_node_path15.default.dirname(scriptPath3);
93071
+ const modulesRoot = import_node_path16.default.dirname(scriptPath3);
92737
93072
  for (const { type, name: name2 } of config.bundle.modules) {
92738
93073
  if (type === "text") {
92739
- textBlobBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93074
+ textBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
92740
93075
  } else if (type === "buffer") {
92741
- dataBlobBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93076
+ dataBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
92742
93077
  } else if (type === "compiled-wasm") {
92743
- wasmBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93078
+ wasmBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
92744
93079
  }
92745
93080
  }
92746
93081
  }
@@ -92805,6 +93140,37 @@ function buildMiniflareBindingOptions(config) {
92805
93140
  };
92806
93141
  }
92807
93142
  }
93143
+ const tails = [];
93144
+ const notFoundTails = /* @__PURE__ */ new Set();
93145
+ for (const tail of config.tails ?? []) {
93146
+ if (tail.service === config.name || config.workerDefinitions === null) {
93147
+ tails.push({ name: tail.service });
93148
+ continue;
93149
+ }
93150
+ const target = config.workerDefinitions?.[tail.service];
93151
+ const defaultEntrypoint = target?.entrypointAddresses?.["default"];
93152
+ if (target?.host === void 0 || target.port === void 0 || defaultEntrypoint === void 0) {
93153
+ notFoundTails.add(tail.service);
93154
+ } else {
93155
+ const style = import_miniflare6.HttpOptions_Style.PROXY;
93156
+ const address = `${defaultEntrypoint.host}:${defaultEntrypoint.port}`;
93157
+ tails.push({
93158
+ external: {
93159
+ address,
93160
+ http: {
93161
+ style,
93162
+ cfBlobHeader: import_miniflare6.CoreHeaders.CF_BLOB
93163
+ }
93164
+ }
93165
+ });
93166
+ }
93167
+ }
93168
+ if (notFoundTails.size > 0) {
93169
+ logger.debug(
93170
+ "Couldn't connect to the following configured `tail_consumers`: ",
93171
+ [...notFoundTails.values()].join(", ")
93172
+ );
93173
+ }
92808
93174
  const classNameToUseSQLite = getClassNamesWhichUseSQLite(config.migrations);
92809
93175
  const internalObjects = [];
92810
93176
  const externalObjects = [];
@@ -93011,7 +93377,8 @@ function buildMiniflareBindingOptions(config) {
93011
93377
  bindings.unsafe?.bindings?.filter((b6) => b6.type == "ratelimit").map(ratelimitEntry) ?? []
93012
93378
  ),
93013
93379
  serviceBindings,
93014
- wrappedBindings
93380
+ wrappedBindings,
93381
+ tails
93015
93382
  };
93016
93383
  return {
93017
93384
  bindingOptions,
@@ -93022,16 +93389,16 @@ function buildMiniflareBindingOptions(config) {
93022
93389
  __name(buildMiniflareBindingOptions, "buildMiniflareBindingOptions");
93023
93390
  function buildPersistOptions(localPersistencePath) {
93024
93391
  if (localPersistencePath !== null) {
93025
- const v3Path = import_node_path15.default.join(localPersistencePath, "v3");
93392
+ const v3Path = import_node_path16.default.join(localPersistencePath, "v3");
93026
93393
  return {
93027
- cachePersist: import_node_path15.default.join(v3Path, "cache"),
93028
- durableObjectsPersist: import_node_path15.default.join(v3Path, "do"),
93029
- kvPersist: import_node_path15.default.join(v3Path, "kv"),
93030
- r2Persist: import_node_path15.default.join(v3Path, "r2"),
93031
- d1Persist: import_node_path15.default.join(v3Path, "d1"),
93032
- workflowsPersist: import_node_path15.default.join(v3Path, "workflows"),
93033
- secretsStorePersist: import_node_path15.default.join(v3Path, "secrets-store"),
93034
- analyticsEngineDatasetsPersist: import_node_path15.default.join(v3Path, "analytics-engine")
93394
+ cachePersist: import_node_path16.default.join(v3Path, "cache"),
93395
+ durableObjectsPersist: import_node_path16.default.join(v3Path, "do"),
93396
+ kvPersist: import_node_path16.default.join(v3Path, "kv"),
93397
+ r2Persist: import_node_path16.default.join(v3Path, "r2"),
93398
+ d1Persist: import_node_path16.default.join(v3Path, "d1"),
93399
+ workflowsPersist: import_node_path16.default.join(v3Path, "workflows"),
93400
+ secretsStorePersist: import_node_path16.default.join(v3Path, "secrets-store"),
93401
+ analyticsEngineDatasetsPersist: import_node_path16.default.join(v3Path, "analytics-engine")
93035
93402
  };
93036
93403
  }
93037
93404
  }
@@ -93055,7 +93422,7 @@ function buildSitesOptions({
93055
93422
  if (legacyAssetPaths !== void 0) {
93056
93423
  const { baseDirectory, assetDirectory, includePatterns, excludePatterns } = legacyAssetPaths;
93057
93424
  return {
93058
- sitePath: import_node_path15.default.join(baseDirectory, assetDirectory),
93425
+ sitePath: import_node_path16.default.join(baseDirectory, assetDirectory),
93059
93426
  siteInclude: includePatterns.length > 0 ? includePatterns : void 0,
93060
93427
  siteExclude: excludePatterns.length > 0 ? excludePatterns : void 0
93061
93428
  };
@@ -93137,8 +93504,8 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
93137
93504
  if (config.crons.length > 0 && !config.testScheduled) {
93138
93505
  if (!didWarnMiniflareCronSupport) {
93139
93506
  didWarnMiniflareCronSupport = true;
93140
- log2.warn(
93141
- "Miniflare 3 does not currently trigger scheduled Workers automatically.\nUse `--test-scheduled` to forward fetch triggers."
93507
+ logger.warn(
93508
+ "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
93509
  );
93143
93510
  }
93144
93511
  }
@@ -93722,7 +94089,8 @@ async function convertToConfigBundle(event) {
93722
94089
  serviceBindings: fetchers,
93723
94090
  bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false,
93724
94091
  imagesLocalMode: event.config.dev?.imagesLocalMode ?? false,
93725
- testScheduled: !!event.config.dev.testScheduled
94092
+ testScheduled: !!event.config.dev.testScheduled,
94093
+ tails: event.config.tailConsumers
93726
94094
  };
93727
94095
  }
93728
94096
  __name(convertToConfigBundle, "convertToConfigBundle");
@@ -94029,19 +94397,19 @@ init_import_meta_url();
94029
94397
  var import_node_assert9 = __toESM(require("node:assert"));
94030
94398
  var import_node_crypto7 = require("node:crypto");
94031
94399
  var import_node_events2 = __toESM(require("node:events"));
94032
- var import_node_path19 = __toESM(require("node:path"));
94400
+ var import_node_path20 = __toESM(require("node:path"));
94033
94401
  var import_miniflare10 = require("miniflare");
94034
94402
 
94035
94403
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
94036
94404
  init_import_meta_url();
94037
- var import_node_path16 = __toESM(require("node:path"));
94038
- var scriptPath = import_node_path16.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
94405
+ var import_node_path17 = __toESM(require("node:path"));
94406
+ var scriptPath = import_node_path17.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
94039
94407
  var InspectorProxyWorker_default = scriptPath;
94040
94408
 
94041
94409
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
94042
94410
  init_import_meta_url();
94043
- var import_node_path17 = __toESM(require("node:path"));
94044
- var scriptPath2 = import_node_path17.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
94411
+ var import_node_path18 = __toESM(require("node:path"));
94412
+ var scriptPath2 = import_node_path18.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
94045
94413
  var ProxyWorker_default = scriptPath2;
94046
94414
 
94047
94415
  // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/wrapper.mjs
@@ -94064,8 +94432,8 @@ var import_open2 = __toESM(require_open());
94064
94432
  // src/api/startDevWorker/bundle-allowed-paths.ts
94065
94433
  init_import_meta_url();
94066
94434
  var import_node_assert8 = __toESM(require("node:assert"));
94067
- var import_node_fs8 = __toESM(require("node:fs"));
94068
- var import_node_path18 = __toESM(require("node:path"));
94435
+ var import_node_fs9 = __toESM(require("node:fs"));
94436
+ var import_node_path19 = __toESM(require("node:path"));
94069
94437
  var import_node_url6 = require("node:url");
94070
94438
  function isAllowedSourcePath(bundle, filePath) {
94071
94439
  const allowed = getBundleReferencedPaths(bundle);
@@ -94092,12 +94460,12 @@ function getBundleReferencedPaths(bundle) {
94092
94460
  }
94093
94461
  const sourceMappingPath = (0, import_node_url6.fileURLToPath)(sourceMappingURL);
94094
94462
  allowed.sourceMapPaths.add(sourceMappingPath);
94095
- const sourceMapData = import_node_fs8.default.readFileSync(sourceMappingPath, "utf8");
94463
+ const sourceMapData = import_node_fs9.default.readFileSync(sourceMappingPath, "utf8");
94096
94464
  const sourceMap = JSON.parse(sourceMapData);
94097
94465
  const sourceRoot = sourceMap.sourceRoot ?? "";
94098
94466
  for (const source of sourceMap.sources) {
94099
94467
  const sourceURL = new URL(
94100
- import_node_path18.default.posix.join(sourceRoot, source),
94468
+ import_node_path19.default.posix.join(sourceRoot, source),
94101
94469
  sourceMappingURL
94102
94470
  );
94103
94471
  allowed.sourcePaths.add((0, import_node_url6.fileURLToPath)(sourceURL));
@@ -94120,7 +94488,7 @@ function* getBundleSourcePaths(bundle) {
94120
94488
  }
94121
94489
  __name(getBundleSourcePaths, "getBundleSourcePaths");
94122
94490
  function maybeGetSourceMappingURL(sourcePath) {
94123
- const source = import_node_fs8.default.readFileSync(sourcePath, "utf8");
94491
+ const source = import_node_fs9.default.readFileSync(sourcePath, "utf8");
94124
94492
  const sourceMappingURLIndex = source.lastIndexOf("//# sourceMappingURL=");
94125
94493
  if (sourceMappingURLIndex === -1) {
94126
94494
  return;
@@ -94339,8 +94707,8 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
94339
94707
 
94340
94708
  // src/https-options.ts
94341
94709
  init_import_meta_url();
94342
- var fs7 = __toESM(require("node:fs"));
94343
- var path20 = __toESM(require("node:path"));
94710
+ var fs8 = __toESM(require("node:fs"));
94711
+ var path21 = __toESM(require("node:path"));
94344
94712
  var import_miniflare9 = require("miniflare");
94345
94713
  var CERT_EXPIRY_DAYS = 30;
94346
94714
  var ONE_DAY_IN_MS = 864e5;
@@ -94357,37 +94725,37 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
94357
94725
  "Must specify both certificate path and key path to use a Custom Certificate."
94358
94726
  );
94359
94727
  }
94360
- if (!fs7.existsSync(customHttpsKeyPath)) {
94728
+ if (!fs8.existsSync(customHttpsKeyPath)) {
94361
94729
  throw new UserError(
94362
94730
  "Missing Custom Certificate Key at " + customHttpsKeyPath
94363
94731
  );
94364
94732
  }
94365
- if (!fs7.existsSync(customHttpsCertPath)) {
94733
+ if (!fs8.existsSync(customHttpsCertPath)) {
94366
94734
  throw new UserError(
94367
94735
  "Missing Custom Certificate File at " + customHttpsCertPath
94368
94736
  );
94369
94737
  }
94370
94738
  logger.log("Using custom certificate at ", customHttpsKeyPath);
94371
94739
  return {
94372
- key: fs7.readFileSync(customHttpsKeyPath, "utf8"),
94373
- cert: fs7.readFileSync(customHttpsCertPath, "utf8")
94740
+ key: fs8.readFileSync(customHttpsKeyPath, "utf8"),
94741
+ cert: fs8.readFileSync(customHttpsCertPath, "utf8")
94374
94742
  };
94375
94743
  }
94376
- const certDirectory = path20.join(getGlobalWranglerConfigPath(), "local-cert");
94377
- const keyPath = path20.join(certDirectory, "key.pem");
94378
- const certPath = path20.join(certDirectory, "cert.pem");
94379
- const regenerate = !fs7.existsSync(keyPath) || !fs7.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94744
+ const certDirectory = path21.join(getGlobalWranglerConfigPath(), "local-cert");
94745
+ const keyPath = path21.join(certDirectory, "key.pem");
94746
+ const certPath = path21.join(certDirectory, "cert.pem");
94747
+ const regenerate = !fs8.existsSync(keyPath) || !fs8.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94380
94748
  if (regenerate) {
94381
94749
  logger.log("Generating new self-signed certificate...");
94382
94750
  const { key, cert } = generateCertificate();
94383
94751
  try {
94384
- fs7.mkdirSync(certDirectory, { recursive: true });
94385
- fs7.writeFileSync(keyPath, key, "utf8");
94386
- fs7.writeFileSync(certPath, cert, "utf8");
94752
+ fs8.mkdirSync(certDirectory, { recursive: true });
94753
+ fs8.writeFileSync(keyPath, key, "utf8");
94754
+ fs8.writeFileSync(certPath, cert, "utf8");
94387
94755
  } catch (e7) {
94388
94756
  const message = e7 instanceof Error ? e7.message : `${e7}`;
94389
94757
  logger.warn(
94390
- `Unable to cache generated self-signed certificate in ${path20.relative(
94758
+ `Unable to cache generated self-signed certificate in ${path21.relative(
94391
94759
  process.cwd(),
94392
94760
  certDirectory
94393
94761
  )}.
@@ -94397,15 +94765,15 @@ ${message}`
94397
94765
  return { key, cert };
94398
94766
  } else {
94399
94767
  return {
94400
- key: fs7.readFileSync(keyPath, "utf8"),
94401
- cert: fs7.readFileSync(certPath, "utf8")
94768
+ key: fs8.readFileSync(keyPath, "utf8"),
94769
+ cert: fs8.readFileSync(certPath, "utf8")
94402
94770
  };
94403
94771
  }
94404
94772
  }
94405
94773
  __name(getHttpsOptions, "getHttpsOptions");
94406
94774
  function hasCertificateExpired(keyPath, certPath) {
94407
- const keyStat = fs7.statSync(keyPath);
94408
- const certStat = fs7.statSync(certPath);
94775
+ const keyStat = fs8.statSync(keyPath);
94776
+ const certStat = fs8.statSync(certPath);
94409
94777
  const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
94410
94778
  return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
94411
94779
  }
@@ -94483,7 +94851,7 @@ var ProxyController = class extends Controller {
94483
94851
  name: "ProxyWorker",
94484
94852
  compatibilityDate: "2023-12-18",
94485
94853
  compatibilityFlags: ["nodejs_compat"],
94486
- modulesRoot: import_node_path19.default.dirname(ProxyWorker_default),
94854
+ modulesRoot: import_node_path20.default.dirname(ProxyWorker_default),
94487
94855
  modules: [{ type: "ESModule", path: ProxyWorker_default }],
94488
94856
  durableObjects: {
94489
94857
  DURABLE_OBJECT: {
@@ -94512,7 +94880,7 @@ var ProxyController = class extends Controller {
94512
94880
  "nodejs_compat",
94513
94881
  "increase_websocket_message_size"
94514
94882
  ],
94515
- modulesRoot: import_node_path19.default.dirname(InspectorProxyWorker_default),
94883
+ modulesRoot: import_node_path20.default.dirname(InspectorProxyWorker_default),
94516
94884
  modules: [{ type: "ESModule", path: InspectorProxyWorker_default }],
94517
94885
  durableObjects: {
94518
94886
  DURABLE_OBJECT: {
@@ -94893,7 +95261,7 @@ var NoOpProxyController = class extends ProxyController {
94893
95261
  init_import_meta_url();
94894
95262
  var import_node_assert24 = __toESM(require("node:assert"));
94895
95263
  var import_node_fs31 = require("node:fs");
94896
- var import_promises37 = require("node:fs/promises");
95264
+ var import_promises38 = require("node:fs/promises");
94897
95265
  var path62 = __toESM(require("node:path"));
94898
95266
 
94899
95267
  // ../workers-shared/index.ts
@@ -99605,16 +99973,16 @@ var import_undici4 = __toESM(require_undici());
99605
99973
 
99606
99974
  // src/dev/get-local-persistence-path.ts
99607
99975
  init_import_meta_url();
99608
- var import_node_path20 = __toESM(require("node:path"));
99976
+ var import_node_path21 = __toESM(require("node:path"));
99609
99977
  function getLocalPersistencePath(persistTo, { userConfigPath }) {
99610
99978
  return persistTo ? (
99611
99979
  // If path specified, always treat it as relative to cwd()
99612
- import_node_path20.default.resolve(process.cwd(), persistTo)
99980
+ import_node_path21.default.resolve(process.cwd(), persistTo)
99613
99981
  ) : (
99614
99982
  // Otherwise, treat it as relative to the Wrangler configuration file,
99615
99983
  // if one can be found, otherwise cwd()
99616
- import_node_path20.default.resolve(
99617
- userConfigPath ? import_node_path20.default.dirname(userConfigPath) : process.cwd(),
99984
+ import_node_path21.default.resolve(
99985
+ userConfigPath ? import_node_path21.default.dirname(userConfigPath) : process.cwd(),
99618
99986
  ".wrangler/state"
99619
99987
  )
99620
99988
  );
@@ -99912,7 +100280,7 @@ var import_node_process9 = require("node:process");
99912
100280
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
99913
100281
  init_import_meta_url();
99914
100282
  var import_node_buffer2 = require("node:buffer");
99915
- var import_node_path22 = __toESM(require("node:path"), 1);
100283
+ var import_node_path23 = __toESM(require("node:path"), 1);
99916
100284
  var import_node_child_process = __toESM(require("node:child_process"), 1);
99917
100285
  var import_node_process8 = __toESM(require("node:process"), 1);
99918
100286
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
@@ -99935,7 +100303,7 @@ __name(stripFinalNewline, "stripFinalNewline");
99935
100303
  // ../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
99936
100304
  init_import_meta_url();
99937
100305
  var import_node_process7 = __toESM(require("node:process"), 1);
99938
- var import_node_path21 = __toESM(require("node:path"), 1);
100306
+ var import_node_path22 = __toESM(require("node:path"), 1);
99939
100307
  var import_node_url9 = __toESM(require("node:url"), 1);
99940
100308
 
99941
100309
  // ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
@@ -99961,15 +100329,15 @@ function npmRunPath(options = {}) {
99961
100329
  } = options;
99962
100330
  let previous;
99963
100331
  const cwdString = cwd2 instanceof URL ? import_node_url9.default.fileURLToPath(cwd2) : cwd2;
99964
- let cwdPath = import_node_path21.default.resolve(cwdString);
100332
+ let cwdPath = import_node_path22.default.resolve(cwdString);
99965
100333
  const result = [];
99966
100334
  while (previous !== cwdPath) {
99967
- result.push(import_node_path21.default.join(cwdPath, "node_modules/.bin"));
100335
+ result.push(import_node_path22.default.join(cwdPath, "node_modules/.bin"));
99968
100336
  previous = cwdPath;
99969
- cwdPath = import_node_path21.default.resolve(cwdPath, "..");
100337
+ cwdPath = import_node_path22.default.resolve(cwdPath, "..");
99970
100338
  }
99971
- result.push(import_node_path21.default.resolve(cwdString, execPath, ".."));
99972
- return [...result, path_].join(import_node_path21.default.delimiter);
100339
+ result.push(import_node_path22.default.resolve(cwdString, execPath, ".."));
100340
+ return [...result, path_].join(import_node_path22.default.delimiter);
99973
100341
  }
99974
100342
  __name(npmRunPath, "npmRunPath");
99975
100343
  function npmRunPathEnv({ env: env6 = import_node_process7.default.env, ...options } = {}) {
@@ -100530,7 +100898,7 @@ var normalizeStdio = /* @__PURE__ */ __name((options) => {
100530
100898
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
100531
100899
  init_import_meta_url();
100532
100900
  var import_node_os4 = __toESM(require("node:os"), 1);
100533
- var import_signal_exit3 = __toESM(require_signal_exit(), 1);
100901
+ var import_signal_exit4 = __toESM(require_signal_exit(), 1);
100534
100902
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
100535
100903
  var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options = {}) => {
100536
100904
  const killResult = kill(signal);
@@ -100594,7 +100962,7 @@ var setExitHandler = /* @__PURE__ */ __name(async (spawned, { cleanup, detached
100594
100962
  if (!cleanup || detached) {
100595
100963
  return timedPromise;
100596
100964
  }
100597
- const removeExitHandler = (0, import_signal_exit3.default)(() => {
100965
+ const removeExitHandler = (0, import_signal_exit4.default)(() => {
100598
100966
  spawned.kill();
100599
100967
  });
100600
100968
  return timedPromise.finally(() => {
@@ -100771,7 +101139,7 @@ var handleArguments = /* @__PURE__ */ __name((file, args, options = {}) => {
100771
101139
  };
100772
101140
  options.env = getEnv(options);
100773
101141
  options.stdio = normalizeStdio(options);
100774
- if (import_node_process8.default.platform === "win32" && import_node_path22.default.basename(file, ".exe") === "cmd") {
101142
+ if (import_node_process8.default.platform === "win32" && import_node_path23.default.basename(file, ".exe") === "cmd") {
100775
101143
  args.unshift("/q");
100776
101144
  }
100777
101145
  return { file, args, options, parsed };
@@ -101045,8 +101413,8 @@ __name(getNodeVersion, "getNodeVersion");
101045
101413
  // src/metrics/metrics-config.ts
101046
101414
  init_import_meta_url();
101047
101415
  var import_node_crypto8 = require("node:crypto");
101048
- var import_node_fs9 = require("node:fs");
101049
- var import_node_path23 = __toESM(require("node:path"));
101416
+ var import_node_fs10 = require("node:fs");
101417
+ var import_node_path24 = __toESM(require("node:path"));
101050
101418
  var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
101051
101419
  function getMetricsConfig({
101052
101420
  sendMetrics
@@ -101085,8 +101453,8 @@ function getMetricsConfig({
101085
101453
  }
101086
101454
  __name(getMetricsConfig, "getMetricsConfig");
101087
101455
  function writeMetricsConfig(config) {
101088
- (0, import_node_fs9.mkdirSync)(import_node_path23.default.dirname(getMetricsConfigPath()), { recursive: true });
101089
- (0, import_node_fs9.writeFileSync)(
101456
+ (0, import_node_fs10.mkdirSync)(import_node_path24.default.dirname(getMetricsConfigPath()), { recursive: true });
101457
+ (0, import_node_fs10.writeFileSync)(
101090
101458
  getMetricsConfigPath(),
101091
101459
  JSON.stringify(
101092
101460
  config,
@@ -101098,7 +101466,7 @@ function writeMetricsConfig(config) {
101098
101466
  __name(writeMetricsConfig, "writeMetricsConfig");
101099
101467
  function readMetricsConfig() {
101100
101468
  try {
101101
- const config = (0, import_node_fs9.readFileSync)(getMetricsConfigPath(), "utf8");
101469
+ const config = (0, import_node_fs10.readFileSync)(getMetricsConfigPath(), "utf8");
101102
101470
  return JSON.parse(
101103
101471
  config,
101104
101472
  (key, value) => key === "date" ? new Date(value) : value
@@ -101118,7 +101486,7 @@ function updateMetricsPermission(enabled) {
101118
101486
  }
101119
101487
  __name(updateMetricsPermission, "updateMetricsPermission");
101120
101488
  function getMetricsConfigPath() {
101121
- return import_node_path23.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
101489
+ return import_node_path24.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
101122
101490
  }
101123
101491
  __name(getMetricsConfigPath, "getMetricsConfigPath");
101124
101492
  function getDeviceId(config) {
@@ -101386,7 +101754,7 @@ __name(getMetricsUsageHeaders, "getMetricsUsageHeaders");
101386
101754
 
101387
101755
  // src/r2/helpers.ts
101388
101756
  init_import_meta_url();
101389
- var fs8 = __toESM(require("node:fs"));
101757
+ var fs9 = __toESM(require("node:fs"));
101390
101758
  var import_web = require("node:stream/web");
101391
101759
  var import_miniflare14 = require("miniflare");
101392
101760
 
@@ -102431,7 +102799,7 @@ function isValidR2BucketName(name2) {
102431
102799
  __name(isValidR2BucketName, "isValidR2BucketName");
102432
102800
  var CHUNK_SIZE = 1024;
102433
102801
  async function createFileReadableStream(filePath) {
102434
- const handle = await fs8.promises.open(filePath, "r");
102802
+ const handle = await fs9.promises.open(filePath, "r");
102435
102803
  let position = 0;
102436
102804
  return new import_web.ReadableStream({
102437
102805
  async pull(controller) {
@@ -102755,7 +103123,7 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
102755
103123
  printable[resource.resourceType] ??= [];
102756
103124
  printable[resource.resourceType].push({ binding: resource.binding });
102757
103125
  }
102758
- printBindings(printable, { provisioning: true });
103126
+ printBindings(printable, config.tail_consumers, { provisioning: true });
102759
103127
  logger.log();
102760
103128
  const existingResources = {};
102761
103129
  for (const resource of pendingResources) {
@@ -102870,62 +103238,6 @@ var fs11 = __toESM(require("node:fs"));
102870
103238
  var path28 = __toESM(require("node:path"));
102871
103239
  var esbuild = __toESM(require("esbuild"));
102872
103240
 
102873
- // src/paths.ts
102874
- init_import_meta_url();
102875
- var import_node_console = require("node:console");
102876
- var import_node_fs10 = __toESM(require("node:fs"));
102877
- var import_node_path24 = __toESM(require("node:path"));
102878
- var import_signal_exit4 = __toESM(require_signal_exit());
102879
- function toUrlPath(filePath) {
102880
- (0, import_node_console.assert)(
102881
- !/^[a-z]:/i.test(filePath),
102882
- "Tried to convert a Windows file path with a drive to a URL path."
102883
- );
102884
- return filePath.replace(/\\/g, "/");
102885
- }
102886
- __name(toUrlPath, "toUrlPath");
102887
- function readableRelative(to) {
102888
- const relativePath = import_node_path24.default.relative(process.cwd(), to);
102889
- if (
102890
- // No directory nesting, return as-is
102891
- import_node_path24.default.basename(relativePath) === relativePath || // Outside current directory
102892
- relativePath.startsWith(".")
102893
- ) {
102894
- return relativePath;
102895
- } else {
102896
- return "./" + relativePath;
102897
- }
102898
- }
102899
- __name(readableRelative, "readableRelative");
102900
- function getBasePath() {
102901
- return import_node_path24.default.resolve(__dirname, "..");
102902
- }
102903
- __name(getBasePath, "getBasePath");
102904
- function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
102905
- projectRoot ??= process.cwd();
102906
- const tmpRoot = import_node_path24.default.join(projectRoot, ".wrangler", "tmp");
102907
- import_node_fs10.default.mkdirSync(tmpRoot, { recursive: true });
102908
- const tmpPrefix = import_node_path24.default.join(tmpRoot, `${prefix}-`);
102909
- const tmpDir = import_node_fs10.default.realpathSync(import_node_fs10.default.mkdtempSync(tmpPrefix));
102910
- const removeDir = /* @__PURE__ */ __name(() => {
102911
- if (cleanup) {
102912
- try {
102913
- return import_node_fs10.default.rmSync(tmpDir, { recursive: true, force: true });
102914
- } catch (e7) {
102915
- }
102916
- }
102917
- }, "removeDir");
102918
- const removeExitListener = (0, import_signal_exit4.default)(removeDir);
102919
- return {
102920
- path: tmpDir,
102921
- remove() {
102922
- removeExitListener();
102923
- removeDir();
102924
- }
102925
- };
102926
- }
102927
- __name(getWranglerTmpDir, "getWranglerTmpDir");
102928
-
102929
103241
  // src/deployment-bundle/apply-middleware.ts
102930
103242
  init_import_meta_url();
102931
103243
  var fs10 = __toESM(require("node:fs"));
@@ -105362,22 +105674,22 @@ __name(triggersDeploy, "triggersDeploy");
105362
105674
 
105363
105675
  // src/utils/friendly-validator-errors.ts
105364
105676
  init_import_meta_url();
105365
- var import_promises36 = require("node:fs/promises");
105677
+ var import_promises37 = require("node:fs/promises");
105366
105678
  var import_node_path58 = __toESM(require("node:path"));
105367
105679
 
105368
105680
  // src/check/commands.ts
105369
105681
  init_import_meta_url();
105370
105682
  var import_crypto6 = require("crypto");
105371
- var import_promises34 = require("fs/promises");
105683
+ var import_promises35 = require("fs/promises");
105372
105684
  var import_node_events4 = __toESM(require("node:events"));
105373
- var import_promises35 = require("node:fs/promises");
105685
+ var import_promises36 = require("node:fs/promises");
105374
105686
  var import_path23 = __toESM(require("path"));
105375
105687
  var import_miniflare24 = require("miniflare");
105376
105688
 
105377
105689
  // src/index.ts
105378
105690
  init_import_meta_url();
105379
105691
  var import_node_os7 = __toESM(require("node:os"));
105380
- var import_promises33 = require("node:timers/promises");
105692
+ var import_promises34 = require("node:timers/promises");
105381
105693
  var import_undici20 = __toESM(require_undici());
105382
105694
 
105383
105695
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
@@ -114850,7 +115162,8 @@ function createHandler(def) {
114850
115162
  }
114851
115163
  const experimentalFlags = def.behaviour?.overrideExperimentalFlags ? def.behaviour?.overrideExperimentalFlags(args) : {
114852
115164
  MULTIWORKER: false,
114853
- RESOURCES_PROVISION: args.experimentalProvision ?? false
115165
+ RESOURCES_PROVISION: args.experimentalProvision ?? false,
115166
+ MIXED_MODE: args.experimentalMixedMode ?? false
114854
115167
  };
114855
115168
  await run(
114856
115169
  experimentalFlags,
@@ -117207,6 +117520,7 @@ ${migrateUrl}`
117207
117520
  return {
117208
117521
  file: paths.absolutePath,
117209
117522
  projectRoot,
117523
+ configPath: config.configPath,
117210
117524
  format: format9,
117211
117525
  moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path32.default.dirname(paths.absolutePath),
117212
117526
  name: config.name ?? "worker",
@@ -117559,7 +117873,8 @@ var deployCommand = createCommand({
117559
117873
  useConfigRedirectIfAvailable: true,
117560
117874
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
117561
117875
  MULTIWORKER: false,
117562
- RESOURCES_PROVISION: args.experimentalProvision ?? false
117876
+ RESOURCES_PROVISION: args.experimentalProvision ?? false,
117877
+ MIXED_MODE: false
117563
117878
  }), "overrideExperimentalFlags")
117564
117879
  },
117565
117880
  validateArgs(args) {
@@ -120250,6 +120565,7 @@ function buildWorkerFromFunctions({
120250
120565
  const entry = {
120251
120566
  file: (0, import_node_path38.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
120252
120567
  projectRoot: functionsDirectory,
120568
+ configPath: void 0,
120253
120569
  format: "modules",
120254
120570
  moduleRoot: functionsDirectory,
120255
120571
  exports: []
@@ -120316,6 +120632,7 @@ function buildRawWorker({
120316
120632
  const entry = {
120317
120633
  file: workerScriptPath,
120318
120634
  projectRoot: (0, import_node_path38.resolve)(directory),
120635
+ configPath: void 0,
120319
120636
  format: "modules",
120320
120637
  moduleRoot: (0, import_node_path38.resolve)(directory),
120321
120638
  exports: []
@@ -120386,6 +120703,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
120386
120703
  {
120387
120704
  file: entrypoint,
120388
120705
  projectRoot: (0, import_node_path38.resolve)(workerJSDirectory),
120706
+ configPath: void 0,
120389
120707
  format: "modules",
120390
120708
  moduleRoot: (0, import_node_path38.resolve)(workerJSDirectory),
120391
120709
  exports: []
@@ -120582,6 +120900,7 @@ function buildPluginFromFunctions({
120582
120900
  const entry = {
120583
120901
  file: (0, import_node_path39.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
120584
120902
  projectRoot: functionsDirectory,
120903
+ configPath: void 0,
120585
120904
  format: "modules",
120586
120905
  moduleRoot: functionsDirectory,
120587
120906
  exports: []
@@ -124299,7 +124618,8 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
124299
124618
  const devServer = await run(
124300
124619
  {
124301
124620
  MULTIWORKER: Array.isArray(args.config),
124302
- RESOURCES_PROVISION: false
124621
+ RESOURCES_PROVISION: false,
124622
+ MIXED_MODE: false
124303
124623
  },
124304
124624
  () => startDev({
124305
124625
  script: scriptEntrypoint,
@@ -124362,6 +124682,7 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
124362
124682
  persistTo: args.persistTo,
124363
124683
  logLevel: args.logLevel ?? "log",
124364
124684
  experimentalProvision: void 0,
124685
+ experimentalMixedMode: false,
124365
124686
  experimentalVectorizeBindToProd: false,
124366
124687
  experimentalImagesLocalMode: false,
124367
124688
  enableIpc: true,
@@ -145060,8 +145381,8 @@ function printTokenPermissions(user) {
145060
145381
  `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
145061
145382
  );
145062
145383
  logger.log(`Scope (Access)`);
145063
- for (const [scope, access3] of permissions) {
145064
- logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
145384
+ for (const [scope, access4] of permissions) {
145385
+ logger.log(`- ${scope} ${access4 ? `(${access4})` : ``}`);
145065
145386
  }
145066
145387
  }
145067
145388
  __name(printTokenPermissions, "printTokenPermissions");
@@ -145471,11 +145792,22 @@ __name(deleteMetadataIndex, "deleteMetadataIndex");
145471
145792
 
145472
145793
  // src/vectorize/common.ts
145473
145794
  init_import_meta_url();
145795
+ var import_promises33 = require("node:fs/promises");
145474
145796
  var deprecatedV1DefaultFlag = false;
145475
145797
  var VECTORIZE_V1_MAX_BATCH_SIZE = 1e3;
145476
145798
  var VECTORIZE_MAX_BATCH_SIZE = 5e3;
145477
145799
  var VECTORIZE_UPSERT_BATCH_SIZE = VECTORIZE_V1_MAX_BATCH_SIZE;
145478
145800
  var VECTORIZE_MAX_UPSERT_VECTOR_RECORDS = 1e5;
145801
+ async function isValidFile(path69) {
145802
+ try {
145803
+ await (0, import_promises33.access)(path69, import_promises33.constants.R_OK);
145804
+ const fileStat = await (0, import_promises33.stat)(path69);
145805
+ return fileStat.isFile() && fileStat.size > 0;
145806
+ } catch (err) {
145807
+ return false;
145808
+ }
145809
+ }
145810
+ __name(isValidFile, "isValidFile");
145479
145811
  async function* getBatchFromFile(rl, batchSize = VECTORIZE_MAX_BATCH_SIZE) {
145480
145812
  const batch = [];
145481
145813
  try {
@@ -145563,10 +145895,9 @@ var vectorizeCreateCommand = createCommand({
145563
145895
  dimensions: args.dimensions
145564
145896
  };
145565
145897
  } else {
145566
- logger.error(
145567
- "You must provide both dimensions and a metric, or a known model preset when creating an index."
145898
+ throw new UserError(
145899
+ "\u{1F6A8} You must provide both dimensions and a metric, or a known model preset when creating an index."
145568
145900
  );
145569
- return;
145570
145901
  }
145571
145902
  if (args.deprecatedV1) {
145572
145903
  logger.warn(
@@ -145724,8 +146055,9 @@ var vectorizeDeleteVectorsCommand = createCommand({
145724
146055
  positionalArgs: ["name"],
145725
146056
  async handler(args, { config }) {
145726
146057
  if (args.ids.length === 0) {
145727
- logger.error("\u{1F6A8} Please provide valid vector identifiers for deletion.");
145728
- return;
146058
+ throw new UserError(
146059
+ "\u{1F6A8} Please provide valid vector identifiers for deletion."
146060
+ );
145729
146061
  }
145730
146062
  logger.log(`\u{1F4CB} Deleting vectors...`);
145731
146063
  const ids = {
@@ -145843,8 +146175,7 @@ var vectorizeGetVectorsCommand = createCommand({
145843
146175
  positionalArgs: ["name"],
145844
146176
  async handler(args, { config }) {
145845
146177
  if (args.ids.length === 0) {
145846
- logger.error("\u{1F6A8} Please provide valid vector identifiers.");
145847
- return;
146178
+ throw new UserError("\u{1F6A8} Please provide valid vector identifiers.");
145848
146179
  }
145849
146180
  logger.log(`\u{1F4CB} Fetching vectors...`);
145850
146181
  const ids = {
@@ -145956,17 +146287,20 @@ var vectorizeInsertCommand = createCommand({
145956
146287
  },
145957
146288
  positionalArgs: ["name"],
145958
146289
  async handler(args, { config }) {
146290
+ if (!await isValidFile(args.file)) {
146291
+ throw new UserError(
146292
+ `\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`
146293
+ );
146294
+ }
145959
146295
  const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs27.createReadStream)(args.file) });
145960
146296
  if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
145961
- logger.error(
146297
+ throw new UserError(
145962
146298
  `\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_V1_MAX_BATCH_SIZE} records at a time.`
145963
146299
  );
145964
- return;
145965
146300
  } 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`
146301
+ throw new UserError(
146302
+ `\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
146303
  );
145969
- return;
145970
146304
  }
145971
146305
  let vectorInsertCount = 0;
145972
146306
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -146210,10 +146544,9 @@ var vectorizeQueryCommand = createCommand({
146210
146544
  }
146211
146545
  }
146212
146546
  if (args.vector === void 0 && args.vectorId === void 0 || args.vector !== void 0 && args.vectorId !== void 0) {
146213
- logger.error(
146547
+ throw new UserError(
146214
146548
  "\u{1F6A8} Either vector or vector-id parameter must be provided, but not both."
146215
146549
  );
146216
- return;
146217
146550
  }
146218
146551
  logger.log(`\u{1F4CB} Searching for relevant vectors...`);
146219
146552
  let res;
@@ -146338,12 +146671,16 @@ var vectorizeUpsertCommand = createCommand({
146338
146671
  },
146339
146672
  positionalArgs: ["name"],
146340
146673
  async handler(args, { config }) {
146674
+ if (!await isValidFile(args.file)) {
146675
+ throw new UserError(
146676
+ `\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`
146677
+ );
146678
+ }
146341
146679
  const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs28.createReadStream)(args.file) });
146342
146680
  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`
146681
+ throw new UserError(
146682
+ `\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
146683
  );
146346
- return;
146347
146684
  }
146348
146685
  let vectorUpsertCount = 0;
146349
146686
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -148127,7 +148464,8 @@ var versionsUploadCommand = createCommand({
148127
148464
  useConfigRedirectIfAvailable: true,
148128
148465
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
148129
148466
  MULTIWORKER: false,
148130
- RESOURCES_PROVISION: args.experimentalProvision ?? false
148467
+ RESOURCES_PROVISION: args.experimentalProvision ?? false,
148468
+ MIXED_MODE: false
148131
148469
  }), "overrideExperimentalFlags")
148132
148470
  },
148133
148471
  handler: /* @__PURE__ */ __name(async function versionsUploadHandler(args, { config }) {
@@ -148474,7 +148812,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
148474
148812
  let workerBundle;
148475
148813
  if (props.dryRun) {
148476
148814
  workerBundle = createWorkerUploadForm(worker);
148477
- printBindings({ ...bindings, vars: maskedVars });
148815
+ printBindings({ ...bindings, vars: maskedVars }, config.tail_consumers);
148478
148816
  } else {
148479
148817
  (0, import_node_assert22.default)(accountId, "Missing accountId");
148480
148818
  if (getFlag("RESOURCES_PROVISION")) {
@@ -148499,12 +148837,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
148499
148837
  );
148500
148838
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
148501
148839
  bindingsPrinted = true;
148502
- printBindings({ ...bindings, vars: maskedVars });
148840
+ printBindings({ ...bindings, vars: maskedVars }, config.tail_consumers);
148503
148841
  versionId = result.id;
148504
148842
  hasPreview = result.metadata.has_preview;
148505
148843
  } catch (err) {
148506
148844
  if (!bindingsPrinted) {
148507
- printBindings({ ...bindings, vars: maskedVars });
148845
+ printBindings(
148846
+ { ...bindings, vars: maskedVars },
148847
+ config.tail_consumers
148848
+ );
148508
148849
  }
148509
148850
  await helpIfErrorIsSizeOrScriptStartup(
148510
148851
  err,
@@ -149629,6 +149970,10 @@ var emojifyInstanceStatus = /* @__PURE__ */ __name((status2) => {
149629
149970
  return "\u25B6 Running";
149630
149971
  case "terminated":
149631
149972
  return "\u{1F6AB} Terminated";
149973
+ case "waiting":
149974
+ return "\u23F0 Waiting";
149975
+ default:
149976
+ return "\u2753 Unknown";
149632
149977
  }
149633
149978
  }, "emojifyInstanceStatus");
149634
149979
  var emojifyInstanceTriggerName = /* @__PURE__ */ __name((status2) => {
@@ -149653,6 +149998,8 @@ var emojifyStepType = /* @__PURE__ */ __name((type) => {
149653
149998
  return "\u{1F4A4} Sleeping";
149654
149999
  case "termination":
149655
150000
  return "\u{1F6AB} Termination";
150001
+ case "waitForEvent":
150002
+ return "\u{1F440} Waiting for event";
149656
150003
  default:
149657
150004
  return "\u2753 Unknown";
149658
150005
  }
@@ -149771,7 +150118,7 @@ var workflowsInstancesDescribeCommand = createCommand({
149771
150118
  function logStep(args, step) {
149772
150119
  logRaw("");
149773
150120
  const formattedStep = {};
149774
- if (step.type == "sleep" || step.type == "step") {
150121
+ if (step.type == "sleep" || step.type == "step" || step.type == "waitForEvent") {
149775
150122
  formattedStep.Name = step.name;
149776
150123
  formattedStep.Type = emojifyStepType(step.type);
149777
150124
  if (step.start != void 0) {
@@ -149813,6 +150160,8 @@ function logStep(args, step) {
149813
150160
  formattedStep["Retries At"] = `${retryDate.toLocaleString()} (in ${formatDistanceToNowStrict(retryDate)} from now)`;
149814
150161
  }
149815
150162
  }
150163
+ }
150164
+ if (step.type == "step" || step.type == "waitForEvent") {
149816
150165
  if (step.output !== void 0 && args.stepOutput) {
149817
150166
  let output;
149818
150167
  try {
@@ -149823,7 +150172,7 @@ function logStep(args, step) {
149823
150172
  formattedStep.Output = output.length > args.truncateOutputLimit ? output.substring(0, args.truncateOutputLimit) + "[...output truncated]" : output;
149824
150173
  }
149825
150174
  }
149826
- logRaw(formatLabelledValues(formattedStep, { indentationCount: 2 }));
150175
+ logger.log(formatLabelledValues(formattedStep, { indentationCount: 2 }));
149827
150176
  if (step.type == "step") {
149828
150177
  const prettyAttempts = step.attempts.map((val2) => {
149829
150178
  const attempt = {};
@@ -150351,6 +150700,11 @@ function createCLIParser(argv) {
150351
150700
  type: "boolean",
150352
150701
  hidden: true,
150353
150702
  alias: ["x-provision"]
150703
+ }).option("experimental-mixed-mode", {
150704
+ describe: `Experimental: Enable Mixed Mode`,
150705
+ type: "boolean",
150706
+ hidden: true,
150707
+ alias: ["x-mixed-mode"]
150354
150708
  }).epilogue(
150355
150709
  `Please report any issues to ${source_default.hex("#3B818D")(
150356
150710
  "https://github.com/cloudflare/workers-sdk/issues/new/choose"
@@ -151393,7 +151747,7 @@ ${tryRunningItIn}${oneOfThese}`
151393
151747
  const controller = new AbortController();
151394
151748
  await Promise.race([
151395
151749
  Promise.allSettled(dispatcher?.requests ?? []),
151396
- (0, import_promises33.setTimeout)(1e3, void 0, controller)
151750
+ (0, import_promises34.setTimeout)(1e3, void 0, controller)
151397
151751
  // Ensure we don't hang indefinitely
151398
151752
  ]).then(() => controller.abort());
151399
151753
  } catch (e7) {
@@ -151457,7 +151811,7 @@ async function checkStartupHandler({
151457
151811
  startMessage: "Analysing",
151458
151812
  endMessage: source_default.green("Startup phase analysed")
151459
151813
  });
151460
- await (0, import_promises35.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
151814
+ await (0, import_promises36.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
151461
151815
  log(
151462
151816
  `CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
151463
151817
  );
@@ -151536,7 +151890,7 @@ async function convertWorkerBundleToModules(workerBundle) {
151536
151890
  }
151537
151891
  __name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
151538
151892
  async function parseFormDataFromFile(file) {
151539
- const bundle = await (0, import_promises34.readFile)(file);
151893
+ const bundle = await (0, import_promises35.readFile)(file);
151540
151894
  const firstLine = bundle.findIndex((v7) => v7 === 10);
151541
151895
  const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
151542
151896
  return await new Response(bundle, {
@@ -151634,7 +151988,7 @@ async function handleStartupError(workerBundle, projectRoot) {
151634
151988
  projectRoot ?? process.cwd(),
151635
151989
  import_node_path58.default.join(tmpDir.path, `worker.cpuprofile`)
151636
151990
  );
151637
- await (0, import_promises36.writeFile)(profile, JSON.stringify(cpuProfile));
151991
+ await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
151638
151992
  throw new UserError(esm_default2`
151639
151993
  Your Worker failed validation because it exceeded startup limits.
151640
151994
  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 +152453,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152099
152453
  let workerBundle;
152100
152454
  if (props.dryRun) {
152101
152455
  workerBundle = createWorkerUploadForm(worker);
152102
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152456
+ printBindings(
152457
+ { ...withoutStaticAssets, vars: maskedVars },
152458
+ config.tail_consumers
152459
+ );
152103
152460
  } else {
152104
152461
  (0, import_node_assert23.default)(accountId, "Missing accountId");
152105
152462
  if (getFlag("RESOURCES_PROVISION")) {
@@ -152171,7 +152528,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152171
152528
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
152172
152529
  }
152173
152530
  bindingsPrinted = true;
152174
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152531
+ printBindings(
152532
+ { ...withoutStaticAssets, vars: maskedVars },
152533
+ config.tail_consumers
152534
+ );
152175
152535
  versionId = parseNonHyphenedUuid(result.deployment_id);
152176
152536
  if (config.first_party_worker) {
152177
152537
  if (result.id) {
@@ -152192,7 +152552,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152192
152552
  }
152193
152553
  } catch (err) {
152194
152554
  if (!bindingsPrinted) {
152195
- printBindings({ ...withoutStaticAssets, vars: maskedVars });
152555
+ printBindings(
152556
+ { ...withoutStaticAssets, vars: maskedVars },
152557
+ config.tail_consumers
152558
+ );
152196
152559
  }
152197
152560
  await helpIfErrorIsSizeOrScriptStartup(
152198
152561
  err,
@@ -152580,7 +152943,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
152580
152943
  payload.append(
152581
152944
  manifestEntry[1].hash,
152582
152945
  new import_undici22.File(
152583
- [(await (0, import_promises37.readFile)(absFilePath)).toString("base64")],
152946
+ [(await (0, import_promises38.readFile)(absFilePath)).toString("base64")],
152584
152947
  manifestEntry[1].hash,
152585
152948
  {
152586
152949
  // Most formdata body encoders (incl. undici's) will override with "application/octet-stream" if you use a falsy value here
@@ -152674,7 +153037,7 @@ Assets already uploaded have been saved, so the next attempt will automatically
152674
153037
  return completionJwt;
152675
153038
  }, "syncAssets");
152676
153039
  var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
152677
- const files = await (0, import_promises37.readdir)(dir, { recursive: true });
153040
+ const files = await (0, import_promises38.readdir)(dir, { recursive: true });
152678
153041
  logReadFilesFromDirectory(dir, files);
152679
153042
  const manifest = {};
152680
153043
  let counter = 0;
@@ -152686,7 +153049,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
152686
153049
  return;
152687
153050
  }
152688
153051
  const filepath = path62.join(dir, relativeFilepath);
152689
- const filestat = await (0, import_promises37.stat)(filepath);
153052
+ const filestat = await (0, import_promises38.stat)(filepath);
152690
153053
  if (filestat.isSymbolicLink() || filestat.isDirectory()) {
152691
153054
  return;
152692
153055
  } else {
@@ -152873,7 +153236,7 @@ init_import_meta_url();
152873
153236
  // src/dev-registry/file-registry.ts
152874
153237
  init_import_meta_url();
152875
153238
  var import_node_fs32 = require("node:fs");
152876
- var import_promises38 = require("node:fs/promises");
153239
+ var import_promises39 = require("node:fs/promises");
152877
153240
  var import_node_path60 = __toESM(require("node:path"));
152878
153241
  var util3 = __toESM(require("node:util"));
152879
153242
  init_esm2();
@@ -152945,8 +153308,8 @@ async function registerWorker(name2, definition) {
152945
153308
  if (existingHeartbeat) {
152946
153309
  clearInterval(existingHeartbeat);
152947
153310
  }
152948
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
152949
- await (0, import_promises38.writeFile)(
153311
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
153312
+ await (0, import_promises39.writeFile)(
152950
153313
  import_node_path60.default.join(DEV_REGISTRY_PATH, name2),
152951
153314
  // We don't currently do anything with the stored Wrangler version,
152952
153315
  // but if we need to make breaking changes to this format in the future
@@ -152969,7 +153332,7 @@ async function getRegisteredWorkers() {
152969
153332
  __name(getRegisteredWorkers, "getRegisteredWorkers");
152970
153333
  async function unregisterWorker(name2) {
152971
153334
  try {
152972
- await (0, import_promises38.unlink)(import_node_path60.default.join(DEV_REGISTRY_PATH, name2));
153335
+ await (0, import_promises39.unlink)(import_node_path60.default.join(DEV_REGISTRY_PATH, name2));
152973
153336
  const existingHeartbeat = heartbeats.get(name2);
152974
153337
  if (existingHeartbeat) {
152975
153338
  clearInterval(existingHeartbeat);
@@ -152981,17 +153344,17 @@ async function unregisterWorker(name2) {
152981
153344
  }
152982
153345
  __name(unregisterWorker, "unregisterWorker");
152983
153346
  async function loadWorkerDefinitions() {
152984
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
153347
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
152985
153348
  globalWorkers ??= {};
152986
153349
  const newWorkers = /* @__PURE__ */ new Set();
152987
- const workerDefinitions = await (0, import_promises38.readdir)(DEV_REGISTRY_PATH);
153350
+ const workerDefinitions = await (0, import_promises39.readdir)(DEV_REGISTRY_PATH);
152988
153351
  for (const workerName of workerDefinitions) {
152989
153352
  try {
152990
- const file = await (0, import_promises38.readFile)(
153353
+ const file = await (0, import_promises39.readFile)(
152991
153354
  import_node_path60.default.join(DEV_REGISTRY_PATH, workerName),
152992
153355
  "utf8"
152993
153356
  );
152994
- const stats = await (0, import_promises38.stat)(import_node_path60.default.join(DEV_REGISTRY_PATH, workerName));
153357
+ const stats = await (0, import_promises39.stat)(import_node_path60.default.join(DEV_REGISTRY_PATH, workerName));
152995
153358
  if (stats.mtime.getTime() < Date.now() - 6e5) {
152996
153359
  await unregisterWorker(workerName);
152997
153360
  } else {
@@ -153026,9 +153389,10 @@ __name(getRegisteredWorkers2, "getRegisteredWorkers");
153026
153389
  async function getBoundRegisteredWorkers({
153027
153390
  name: name2,
153028
153391
  services,
153029
- durableObjects
153392
+ durableObjects,
153393
+ tailConsumers
153030
153394
  }, existingWorkerDefinitions) {
153031
- const serviceNames = (services || []).map(
153395
+ const serviceNames = [...services || [], ...tailConsumers ?? []].map(
153032
153396
  (serviceBinding) => serviceBinding.service
153033
153397
  );
153034
153398
  const durableObjectServices = (durableObjects || { bindings: [] }).bindings.map((durableObjectBinding) => durableObjectBinding.script_name);
@@ -153262,7 +153626,8 @@ var dev = createCommand({
153262
153626
  provideConfig: false,
153263
153627
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
153264
153628
  MULTIWORKER: Array.isArray(args.config),
153265
- RESOURCES_PROVISION: args.experimentalProvision ?? false
153629
+ RESOURCES_PROVISION: args.experimentalProvision ?? false,
153630
+ MIXED_MODE: args.experimentalMixedMode ?? false
153266
153631
  }), "overrideExperimentalFlags")
153267
153632
  },
153268
153633
  metadata: {
@@ -153536,7 +153901,8 @@ async function updateDevEnvRegistry(devEnv, registry) {
153536
153901
  "durable_object_namespace",
153537
153902
  devEnv.config.latestConfig?.bindings
153538
153903
  )
153539
- }
153904
+ },
153905
+ tailConsumers: devEnv.config.latestConfig?.tailConsumers
153540
153906
  },
153541
153907
  registry
153542
153908
  );
@@ -154132,6 +154498,7 @@ unstable_dev()'s behaviour will likely change in future releases`
154132
154498
  logLevel: options?.logLevel ?? defaultLogLevel,
154133
154499
  port: options?.port ?? 0,
154134
154500
  experimentalProvision: void 0,
154501
+ experimentalMixedMode: false,
154135
154502
  experimentalVectorizeBindToProd: vectorizeBindToProd ?? false,
154136
154503
  experimentalImagesLocalMode: imagesLocalMode ?? false,
154137
154504
  enableIpc: options?.experimental?.enableIpc,
@@ -154141,7 +154508,8 @@ unstable_dev()'s behaviour will likely change in future releases`
154141
154508
  {
154142
154509
  // TODO: can we make this work?
154143
154510
  MULTIWORKER: false,
154144
- RESOURCES_PROVISION: false
154511
+ RESOURCES_PROVISION: false,
154512
+ MIXED_MODE: false
154145
154513
  },
154146
154514
  () => startDev(devOptions)
154147
154515
  );
@@ -154387,6 +154755,7 @@ var BundlerController = class extends Controller {
154387
154755
  const entry = {
154388
154756
  file: config.entrypoint,
154389
154757
  projectRoot: config.projectRoot,
154758
+ configPath: config.config,
154390
154759
  format: config.build.format,
154391
154760
  moduleRoot: config.build.moduleRoot,
154392
154761
  exports: config.build.exports
@@ -154510,6 +154879,7 @@ var BundlerController = class extends Controller {
154510
154879
  const entry = {
154511
154880
  file: config.entrypoint,
154512
154881
  projectRoot: config.projectRoot,
154882
+ configPath: config.config,
154513
154883
  format: config.build.format,
154514
154884
  moduleRoot: config.build.moduleRoot,
154515
154885
  exports: config.build.exports,
@@ -154938,6 +155308,7 @@ async function resolveBindings(config, input) {
154938
155308
  ...bindings,
154939
155309
  vars: maskedVars
154940
155310
  },
155311
+ input.tailConsumers ?? config.tail_consumers,
154941
155312
  {
154942
155313
  registry: input.dev?.registry,
154943
155314
  local: !input.dev?.remote,
@@ -155057,7 +155428,8 @@ If you are trying to develop Pages and Workers together, please use \`wrangler p
155057
155428
  capnp: input.unsafe?.capnp ?? unsafe?.capnp,
155058
155429
  metadata: input.unsafe?.metadata ?? unsafe?.metadata
155059
155430
  },
155060
- assets: assetsOptions
155431
+ assets: assetsOptions,
155432
+ tailConsumers: config.tail_consumers ?? []
155061
155433
  };
155062
155434
  if (extractBindingsOfType("browser", resolved.bindings).length && !resolved.dev.remote) {
155063
155435
  throw new UserError(
@@ -156096,7 +156468,9 @@ async function getPlatformProxy(options = {}) {
156096
156468
  const miniflareOptions = await run(
156097
156469
  {
156098
156470
  MULTIWORKER: false,
156099
- RESOURCES_PROVISION: false
156471
+ RESOURCES_PROVISION: false,
156472
+ // TODO: when possible mixed mode should be made available for getPlatformProxy
156473
+ MIXED_MODE: false
156100
156474
  },
156101
156475
  () => getMiniflareOptionsFromConfig(rawConfig, env6, options)
156102
156476
  );
@@ -156135,7 +156509,8 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
156135
156509
  const workerDefinitions = await getBoundRegisteredWorkers({
156136
156510
  name: rawConfig.name,
156137
156511
  services: bindings.services,
156138
- durableObjects: rawConfig["durable_objects"]
156512
+ durableObjects: rawConfig["durable_objects"],
156513
+ tailConsumers: []
156139
156514
  });
156140
156515
  const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions({
156141
156516
  name: rawConfig.name,
@@ -156145,7 +156520,8 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
156145
156520
  services: rawConfig.services,
156146
156521
  serviceBindings: {},
156147
156522
  migrations: rawConfig.migrations,
156148
- imagesLocalMode: false
156523
+ imagesLocalMode: false,
156524
+ tails: []
156149
156525
  });
156150
156526
  const persistOptions = getMiniflarePersistOptions(options.persist);
156151
156527
  const serviceBindings = await getServiceBindings(bindings.services);
@@ -156214,7 +156590,8 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
156214
156590
  services: [],
156215
156591
  serviceBindings: {},
156216
156592
  migrations: config.migrations,
156217
- imagesLocalMode: !!options?.imagesLocalMode
156593
+ imagesLocalMode: !!options?.imagesLocalMode,
156594
+ tails: config.tail_consumers
156218
156595
  });
156219
156596
  if (bindings.services !== void 0) {
156220
156597
  bindingOptions.serviceBindings = Object.fromEntries(