wrangler 2.2.0 → 2.2.2

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.
@@ -4788,8 +4788,8 @@ var require_util2 = __commonJS({
4788
4788
  function createDeferredPromise() {
4789
4789
  let res;
4790
4790
  let rej;
4791
- const promise = new Promise((resolve14, reject) => {
4792
- res = resolve14;
4791
+ const promise = new Promise((resolve15, reject) => {
4792
+ res = resolve15;
4793
4793
  rej = reject;
4794
4794
  });
4795
4795
  return { promise, resolve: res, reject: rej };
@@ -5921,8 +5921,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
5921
5921
  });
5922
5922
  }
5923
5923
  });
5924
- const busboyResolve = new Promise((resolve14, reject) => {
5925
- busboy.on("finish", resolve14);
5924
+ const busboyResolve = new Promise((resolve15, reject) => {
5925
+ busboy.on("finish", resolve15);
5926
5926
  busboy.on("error", (err2) => reject(err2));
5927
5927
  });
5928
5928
  if (this.body !== null)
@@ -6308,9 +6308,9 @@ var require_dispatcher_base = __commonJS({
6308
6308
  }
6309
6309
  close(callback) {
6310
6310
  if (callback === void 0) {
6311
- return new Promise((resolve14, reject) => {
6311
+ return new Promise((resolve15, reject) => {
6312
6312
  this.close((err2, data) => {
6313
- return err2 ? reject(err2) : resolve14(data);
6313
+ return err2 ? reject(err2) : resolve15(data);
6314
6314
  });
6315
6315
  });
6316
6316
  }
@@ -6348,9 +6348,9 @@ var require_dispatcher_base = __commonJS({
6348
6348
  err2 = null;
6349
6349
  }
6350
6350
  if (callback === void 0) {
6351
- return new Promise((resolve14, reject) => {
6351
+ return new Promise((resolve15, reject) => {
6352
6352
  this.destroy(err2, (err3, data) => {
6353
- return err3 ? reject(err3) : resolve14(data);
6353
+ return err3 ? reject(err3) : resolve15(data);
6354
6354
  });
6355
6355
  });
6356
6356
  }
@@ -7279,16 +7279,16 @@ var require_client = __commonJS({
7279
7279
  return this[kNeedDrain] < 2;
7280
7280
  }
7281
7281
  async [kClose]() {
7282
- return new Promise((resolve14) => {
7282
+ return new Promise((resolve15) => {
7283
7283
  if (!this[kSize]) {
7284
- this.destroy(resolve14);
7284
+ this.destroy(resolve15);
7285
7285
  } else {
7286
- this[kClosedResolve] = resolve14;
7286
+ this[kClosedResolve] = resolve15;
7287
7287
  }
7288
7288
  });
7289
7289
  }
7290
7290
  async [kDestroy](err2) {
7291
- return new Promise((resolve14) => {
7291
+ return new Promise((resolve15) => {
7292
7292
  const requests = this[kQueue].splice(this[kPendingIdx]);
7293
7293
  for (let i2 = 0; i2 < requests.length; i2++) {
7294
7294
  const request = requests[i2];
@@ -7299,7 +7299,7 @@ var require_client = __commonJS({
7299
7299
  this[kClosedResolve]();
7300
7300
  this[kClosedResolve] = null;
7301
7301
  }
7302
- resolve14();
7302
+ resolve15();
7303
7303
  };
7304
7304
  if (!this[kSocket]) {
7305
7305
  queueMicrotask(callback);
@@ -7835,7 +7835,7 @@ var require_client = __commonJS({
7835
7835
  });
7836
7836
  }
7837
7837
  try {
7838
- const socket = await new Promise((resolve14, reject) => {
7838
+ const socket = await new Promise((resolve15, reject) => {
7839
7839
  client[kConnector]({
7840
7840
  host,
7841
7841
  hostname,
@@ -7846,7 +7846,7 @@ var require_client = __commonJS({
7846
7846
  if (err2) {
7847
7847
  reject(err2);
7848
7848
  } else {
7849
- resolve14(socket2);
7849
+ resolve15(socket2);
7850
7850
  }
7851
7851
  });
7852
7852
  });
@@ -8216,12 +8216,12 @@ upgrade: ${upgrade}\r
8216
8216
  cb2();
8217
8217
  }
8218
8218
  }
8219
- const waitForDrain = () => new Promise((resolve14, reject) => {
8219
+ const waitForDrain = () => new Promise((resolve15, reject) => {
8220
8220
  assert14(callback === null);
8221
8221
  if (socket[kError]) {
8222
8222
  reject(socket[kError]);
8223
8223
  } else {
8224
- callback = resolve14;
8224
+ callback = resolve15;
8225
8225
  }
8226
8226
  });
8227
8227
  socket.on("close", onDrain).on("drain", onDrain);
@@ -8545,8 +8545,8 @@ var require_pool_base = __commonJS({
8545
8545
  if (this[kQueue].isEmpty()) {
8546
8546
  return Promise.all(this[kClients].map((c) => c.close()));
8547
8547
  } else {
8548
- return new Promise((resolve14) => {
8549
- this[kClosedResolve] = resolve14;
8548
+ return new Promise((resolve15) => {
8549
+ this[kClosedResolve] = resolve15;
8550
8550
  });
8551
8551
  }
8552
8552
  }
@@ -9099,11 +9099,11 @@ var require_readable = __commonJS({
9099
9099
  throw new TypeError("unusable");
9100
9100
  }
9101
9101
  assert14(!stream2[kConsume]);
9102
- return new Promise((resolve14, reject) => {
9102
+ return new Promise((resolve15, reject) => {
9103
9103
  stream2[kConsume] = {
9104
9104
  type: type2,
9105
9105
  stream: stream2,
9106
- resolve: resolve14,
9106
+ resolve: resolve15,
9107
9107
  reject,
9108
9108
  length: 0,
9109
9109
  body: []
@@ -9138,12 +9138,12 @@ var require_readable = __commonJS({
9138
9138
  }
9139
9139
  }
9140
9140
  function consumeEnd(consume2) {
9141
- const { type: type2, body, resolve: resolve14, stream: stream2, length } = consume2;
9141
+ const { type: type2, body, resolve: resolve15, stream: stream2, length } = consume2;
9142
9142
  try {
9143
9143
  if (type2 === "text") {
9144
- resolve14(toUSVString(Buffer.concat(body)));
9144
+ resolve15(toUSVString(Buffer.concat(body)));
9145
9145
  } else if (type2 === "json") {
9146
- resolve14(JSON.parse(Buffer.concat(body)));
9146
+ resolve15(JSON.parse(Buffer.concat(body)));
9147
9147
  } else if (type2 === "arrayBuffer") {
9148
9148
  const dst = new Uint8Array(length);
9149
9149
  let pos = 0;
@@ -9151,12 +9151,12 @@ var require_readable = __commonJS({
9151
9151
  dst.set(buf, pos);
9152
9152
  pos += buf.byteLength;
9153
9153
  }
9154
- resolve14(dst);
9154
+ resolve15(dst);
9155
9155
  } else if (type2 === "blob") {
9156
9156
  if (!Blob3) {
9157
9157
  Blob3 = require("buffer").Blob;
9158
9158
  }
9159
- resolve14(new Blob3(body, { type: stream2[kContentType] }));
9159
+ resolve15(new Blob3(body, { type: stream2[kContentType] }));
9160
9160
  }
9161
9161
  consumeFinish(consume2);
9162
9162
  } catch (err2) {
@@ -9392,9 +9392,9 @@ var require_api_request = __commonJS({
9392
9392
  }
9393
9393
  function request(opts, callback) {
9394
9394
  if (callback === void 0) {
9395
- return new Promise((resolve14, reject) => {
9395
+ return new Promise((resolve15, reject) => {
9396
9396
  request.call(this, opts, (err2, data) => {
9397
- return err2 ? reject(err2) : resolve14(data);
9397
+ return err2 ? reject(err2) : resolve15(data);
9398
9398
  });
9399
9399
  });
9400
9400
  }
@@ -9547,9 +9547,9 @@ var require_api_stream = __commonJS({
9547
9547
  };
9548
9548
  function stream2(opts, factory, callback) {
9549
9549
  if (callback === void 0) {
9550
- return new Promise((resolve14, reject) => {
9550
+ return new Promise((resolve15, reject) => {
9551
9551
  stream2.call(this, opts, factory, (err2, data) => {
9552
- return err2 ? reject(err2) : resolve14(data);
9552
+ return err2 ? reject(err2) : resolve15(data);
9553
9553
  });
9554
9554
  });
9555
9555
  }
@@ -9832,9 +9832,9 @@ var require_api_upgrade = __commonJS({
9832
9832
  };
9833
9833
  function upgrade(opts, callback) {
9834
9834
  if (callback === void 0) {
9835
- return new Promise((resolve14, reject) => {
9835
+ return new Promise((resolve15, reject) => {
9836
9836
  upgrade.call(this, opts, (err2, data) => {
9837
- return err2 ? reject(err2) : resolve14(data);
9837
+ return err2 ? reject(err2) : resolve15(data);
9838
9838
  });
9839
9839
  });
9840
9840
  }
@@ -9921,9 +9921,9 @@ var require_api_connect = __commonJS({
9921
9921
  };
9922
9922
  function connect2(opts, callback) {
9923
9923
  if (callback === void 0) {
9924
- return new Promise((resolve14, reject) => {
9924
+ return new Promise((resolve15, reject) => {
9925
9925
  connect2.call(this, opts, (err2, data) => {
9926
- return err2 ? reject(err2) : resolve14(data);
9926
+ return err2 ? reject(err2) : resolve15(data);
9927
9927
  });
9928
9928
  });
9929
9929
  }
@@ -13386,7 +13386,7 @@ var require_fetch = __commonJS({
13386
13386
  return response;
13387
13387
  async function dispatch({ body }) {
13388
13388
  const url3 = requestCurrentURL(request);
13389
- return new Promise((resolve14, reject) => fetchParams.controller.dispatcher.dispatch(
13389
+ return new Promise((resolve15, reject) => fetchParams.controller.dispatcher.dispatch(
13390
13390
  {
13391
13391
  path: url3.pathname + url3.search,
13392
13392
  origin: url3.origin,
@@ -13443,7 +13443,7 @@ var require_fetch = __commonJS({
13443
13443
  }
13444
13444
  }
13445
13445
  }
13446
- resolve14({
13446
+ resolve15({
13447
13447
  status,
13448
13448
  statusText,
13449
13449
  headersList: headers[kHeadersList],
@@ -65877,7 +65877,7 @@ var require_backend = __commonJS({
65877
65877
  }
65878
65878
  ;
65879
65879
  return function(data) {
65880
- return new Promise(function(resolve14, reject) {
65880
+ return new Promise(function(resolve15, reject) {
65881
65881
  _intercept = true;
65882
65882
  if (typeof data === "string") {
65883
65883
  _data = {
@@ -65896,7 +65896,7 @@ var require_backend = __commonJS({
65896
65896
  try {
65897
65897
  if (document.execCommand("copy")) {
65898
65898
  cleanup();
65899
- resolve14();
65899
+ resolve15();
65900
65900
  } else {
65901
65901
  if (!tryBogusSelect) {
65902
65902
  bogusSelect();
@@ -65923,15 +65923,15 @@ var require_backend = __commonJS({
65923
65923
  if (_intercept) {
65924
65924
  _intercept = false;
65925
65925
  e2.preventDefault();
65926
- var resolve14 = _resolve2;
65926
+ var resolve15 = _resolve2;
65927
65927
  _resolve2 = null;
65928
- resolve14(e2.clipboardData.getData(_dataType));
65928
+ resolve15(e2.clipboardData.getData(_dataType));
65929
65929
  }
65930
65930
  });
65931
65931
  return function(dataType) {
65932
- return new Promise(function(resolve14, reject) {
65932
+ return new Promise(function(resolve15, reject) {
65933
65933
  _intercept = true;
65934
- _resolve2 = resolve14;
65934
+ _resolve2 = resolve15;
65935
65935
  _dataType = dataType || "text/plain";
65936
65936
  try {
65937
65937
  if (!document.execCommand("paste")) {
@@ -66066,24 +66066,24 @@ var require_backend = __commonJS({
66066
66066
  }, module3.exports ? module3.exports = c : a.Promise || (a.Promise = c);
66067
66067
  })(this);
66068
66068
  clipboard6.copy = function(data) {
66069
- return new Promise(function(resolve14, reject) {
66069
+ return new Promise(function(resolve15, reject) {
66070
66070
  if (typeof data !== "string" && !("text/plain" in data)) {
66071
66071
  throw new Error("You must provide a text/plain type.");
66072
66072
  }
66073
66073
  var strData = typeof data === "string" ? data : data["text/plain"];
66074
66074
  var copySucceeded = window.clipboardData.setData("Text", strData);
66075
66075
  if (copySucceeded) {
66076
- resolve14();
66076
+ resolve15();
66077
66077
  } else {
66078
66078
  reject(new Error("Copying was rejected."));
66079
66079
  }
66080
66080
  });
66081
66081
  };
66082
66082
  clipboard6.paste = function() {
66083
- return new Promise(function(resolve14, reject) {
66083
+ return new Promise(function(resolve15, reject) {
66084
66084
  var strData = window.clipboardData.getData("Text");
66085
66085
  if (strData) {
66086
- resolve14(strData);
66086
+ resolve15(strData);
66087
66087
  } else {
66088
66088
  reject(new Error("Pasting was rejected."));
66089
66089
  }
@@ -75496,8 +75496,8 @@ var require_ink = __commonJS({
75496
75496
  }
75497
75497
  waitUntilExit() {
75498
75498
  if (!this.exitPromise) {
75499
- this.exitPromise = new Promise((resolve14, reject) => {
75500
- this.resolveExitPromise = resolve14;
75499
+ this.exitPromise = new Promise((resolve15, reject) => {
75500
+ this.resolveExitPromise = resolve15;
75501
75501
  this.rejectExitPromise = reject;
75502
75502
  });
75503
75503
  }
@@ -77740,20 +77740,20 @@ var require_parse_async = __commonJS({
77740
77740
  const index = 0;
77741
77741
  const blocksize = opts.blocksize || 40960;
77742
77742
  const parser2 = new TOMLParser();
77743
- return new Promise((resolve14, reject) => {
77744
- setImmediate(parseAsyncNext, index, blocksize, resolve14, reject);
77743
+ return new Promise((resolve15, reject) => {
77744
+ setImmediate(parseAsyncNext, index, blocksize, resolve15, reject);
77745
77745
  });
77746
- function parseAsyncNext(index2, blocksize2, resolve14, reject) {
77746
+ function parseAsyncNext(index2, blocksize2, resolve15, reject) {
77747
77747
  if (index2 >= str.length) {
77748
77748
  try {
77749
- return resolve14(parser2.finish());
77749
+ return resolve15(parser2.finish());
77750
77750
  } catch (err2) {
77751
77751
  return reject(prettyError(err2, str));
77752
77752
  }
77753
77753
  }
77754
77754
  try {
77755
77755
  parser2.parse(str.slice(index2, index2 + blocksize2));
77756
- setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve14, reject);
77756
+ setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve15, reject);
77757
77757
  } catch (err2) {
77758
77758
  reject(prettyError(err2, str));
77759
77759
  }
@@ -77780,7 +77780,7 @@ var require_parse_stream = __commonJS({
77780
77780
  function parseReadable(stm) {
77781
77781
  const parser2 = new TOMLParser();
77782
77782
  stm.setEncoding("utf8");
77783
- return new Promise((resolve14, reject) => {
77783
+ return new Promise((resolve15, reject) => {
77784
77784
  let readable;
77785
77785
  let ended = false;
77786
77786
  let errored = false;
@@ -77789,7 +77789,7 @@ var require_parse_stream = __commonJS({
77789
77789
  if (readable)
77790
77790
  return;
77791
77791
  try {
77792
- resolve14(parser2.finish());
77792
+ resolve15(parser2.finish());
77793
77793
  } catch (err2) {
77794
77794
  reject(err2);
77795
77795
  }
@@ -78276,12 +78276,12 @@ var require_isexe = __commonJS({
78276
78276
  if (typeof Promise !== "function") {
78277
78277
  throw new TypeError("callback not provided");
78278
78278
  }
78279
- return new Promise(function(resolve14, reject) {
78279
+ return new Promise(function(resolve15, reject) {
78280
78280
  isexe(path37, options6 || {}, function(er, is2) {
78281
78281
  if (er) {
78282
78282
  reject(er);
78283
78283
  } else {
78284
- resolve14(is2);
78284
+ resolve15(is2);
78285
78285
  }
78286
78286
  });
78287
78287
  });
@@ -78346,27 +78346,27 @@ var require_which = __commonJS({
78346
78346
  opt = {};
78347
78347
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
78348
78348
  const found = [];
78349
- const step = (i2) => new Promise((resolve14, reject) => {
78349
+ const step = (i2) => new Promise((resolve15, reject) => {
78350
78350
  if (i2 === pathEnv.length)
78351
- return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
78351
+ return opt.all && found.length ? resolve15(found) : reject(getNotFoundError(cmd));
78352
78352
  const ppRaw = pathEnv[i2];
78353
78353
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
78354
78354
  const pCmd = path37.join(pathPart, cmd);
78355
78355
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
78356
- resolve14(subStep(p, i2, 0));
78356
+ resolve15(subStep(p, i2, 0));
78357
78357
  });
78358
- const subStep = (p, i2, ii) => new Promise((resolve14, reject) => {
78358
+ const subStep = (p, i2, ii) => new Promise((resolve15, reject) => {
78359
78359
  if (ii === pathExt.length)
78360
- return resolve14(step(i2 + 1));
78360
+ return resolve15(step(i2 + 1));
78361
78361
  const ext = pathExt[ii];
78362
78362
  isexe(p + ext, { pathExt: pathExtExe }, (er, is2) => {
78363
78363
  if (!er && is2) {
78364
78364
  if (opt.all)
78365
78365
  found.push(p + ext);
78366
78366
  else
78367
- return resolve14(p + ext);
78367
+ return resolve15(p + ext);
78368
78368
  }
78369
- return resolve14(subStep(p, i2, ii + 1));
78369
+ return resolve15(subStep(p, i2, ii + 1));
78370
78370
  });
78371
78371
  });
78372
78372
  return cb2 ? step(0).then((res) => cb2(null, res), cb2) : step(0);
@@ -79381,7 +79381,7 @@ var require_kill = __commonJS({
79381
79381
  return spawnedPromise;
79382
79382
  }
79383
79383
  let timeoutId;
79384
- const timeoutPromise = new Promise((resolve14, reject) => {
79384
+ const timeoutPromise = new Promise((resolve15, reject) => {
79385
79385
  timeoutId = setTimeout(() => {
79386
79386
  timeoutKill2(spawned, killSignal, reject);
79387
79387
  }, timeout);
@@ -79503,7 +79503,7 @@ var require_get_stream = __commonJS({
79503
79503
  };
79504
79504
  const { maxBuffer } = options6;
79505
79505
  const stream3 = bufferStream(options6);
79506
- await new Promise((resolve14, reject) => {
79506
+ await new Promise((resolve15, reject) => {
79507
79507
  const rejectPromise = (error) => {
79508
79508
  if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
79509
79509
  error.bufferedData = stream3.getBufferedValue();
@@ -79513,7 +79513,7 @@ var require_get_stream = __commonJS({
79513
79513
  (async () => {
79514
79514
  try {
79515
79515
  await streamPipelinePromisified(inputStream, stream3);
79516
- resolve14();
79516
+ resolve15();
79517
79517
  } catch (error) {
79518
79518
  rejectPromise(error);
79519
79519
  }
@@ -79673,9 +79673,9 @@ var require_promise = __commonJS({
79673
79673
  return spawned;
79674
79674
  };
79675
79675
  var getSpawnedPromise2 = (spawned) => {
79676
- return new Promise((resolve14, reject) => {
79676
+ return new Promise((resolve15, reject) => {
79677
79677
  spawned.on("exit", (exitCode, signal) => {
79678
- resolve14({ exitCode, signal });
79678
+ resolve15({ exitCode, signal });
79679
79679
  });
79680
79680
  spawned.on("error", (error) => {
79681
79681
  reject(error);
@@ -80128,10 +80128,10 @@ var require_command_exists = __commonJS({
80128
80128
  module2.exports = function commandExists2(commandName, callback) {
80129
80129
  var cleanedCommandName = cleanInput(commandName);
80130
80130
  if (!callback && typeof Promise !== "undefined") {
80131
- return new Promise(function(resolve14, reject) {
80131
+ return new Promise(function(resolve15, reject) {
80132
80132
  commandExists2(commandName, function(error, output) {
80133
80133
  if (output) {
80134
- resolve14(commandName);
80134
+ resolve15(commandName);
80135
80135
  } else {
80136
80136
  reject(error);
80137
80137
  }
@@ -88214,11 +88214,11 @@ var require_raw_body = __commonJS({
88214
88214
  if (done) {
88215
88215
  return readStream(stream2, encoding, length, limit, wrap2(done));
88216
88216
  }
88217
- return new Promise(function executor(resolve14, reject) {
88217
+ return new Promise(function executor(resolve15, reject) {
88218
88218
  readStream(stream2, encoding, length, limit, function onRead(err2, buf) {
88219
88219
  if (err2)
88220
88220
  return reject(err2);
88221
- resolve14(buf);
88221
+ resolve15(buf);
88222
88222
  });
88223
88223
  });
88224
88224
  }
@@ -101849,7 +101849,7 @@ var require_view = __commonJS({
101849
101849
  var basename5 = path37.basename;
101850
101850
  var extname5 = path37.extname;
101851
101851
  var join13 = path37.join;
101852
- var resolve14 = path37.resolve;
101852
+ var resolve15 = path37.resolve;
101853
101853
  module2.exports = View;
101854
101854
  function View(name, options6) {
101855
101855
  var opts = options6 || {};
@@ -101883,7 +101883,7 @@ var require_view = __commonJS({
101883
101883
  debug('lookup "%s"', name);
101884
101884
  for (var i2 = 0; i2 < roots.length && !path38; i2++) {
101885
101885
  var root = roots[i2];
101886
- var loc = resolve14(root, name);
101886
+ var loc = resolve15(root, name);
101887
101887
  var dir = dirname12(loc);
101888
101888
  var file = basename5(loc);
101889
101889
  path38 = this.resolve(dir, file);
@@ -101894,7 +101894,7 @@ var require_view = __commonJS({
101894
101894
  debug('render "%s"', this.path);
101895
101895
  this.engine(this.path, options6, callback);
101896
101896
  };
101897
- View.prototype.resolve = function resolve15(dir, file) {
101897
+ View.prototype.resolve = function resolve16(dir, file) {
101898
101898
  var ext = this.ext;
101899
101899
  var path38 = join13(dir, file);
101900
101900
  var stat3 = tryStat(path38);
@@ -103038,7 +103038,7 @@ var require_send = __commonJS({
103038
103038
  var extname5 = path37.extname;
103039
103039
  var join13 = path37.join;
103040
103040
  var normalize2 = path37.normalize;
103041
- var resolve14 = path37.resolve;
103041
+ var resolve15 = path37.resolve;
103042
103042
  var sep2 = path37.sep;
103043
103043
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
103044
103044
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
@@ -103075,7 +103075,7 @@ var require_send = __commonJS({
103075
103075
  this._maxage = opts.maxAge || opts.maxage;
103076
103076
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
103077
103077
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
103078
- this._root = opts.root ? resolve14(opts.root) : null;
103078
+ this._root = opts.root ? resolve15(opts.root) : null;
103079
103079
  if (!this._root && opts.from) {
103080
103080
  this.from(opts.from);
103081
103081
  }
@@ -103099,7 +103099,7 @@ var require_send = __commonJS({
103099
103099
  return this;
103100
103100
  }, "send.index: pass index as option");
103101
103101
  SendStream.prototype.root = function root(path38) {
103102
- this._root = resolve14(String(path38));
103102
+ this._root = resolve15(String(path38));
103103
103103
  debug("root %s", this._root);
103104
103104
  return this;
103105
103105
  };
@@ -103263,7 +103263,7 @@ var require_send = __commonJS({
103263
103263
  return res;
103264
103264
  }
103265
103265
  parts = normalize2(path38).split(sep2);
103266
- path38 = resolve14(path38);
103266
+ path38 = resolve15(path38);
103267
103267
  }
103268
103268
  if (containsDotFile(parts)) {
103269
103269
  var access3 = this._dotfiles;
@@ -104563,7 +104563,7 @@ var require_application = __commonJS({
104563
104563
  var deprecate = require_depd()("express");
104564
104564
  var flatten = require_array_flatten();
104565
104565
  var merge = require_utils_merge();
104566
- var resolve14 = require("path").resolve;
104566
+ var resolve15 = require("path").resolve;
104567
104567
  var setPrototypeOf = require_setprototypeof();
104568
104568
  var hasOwnProperty2 = Object.prototype.hasOwnProperty;
104569
104569
  var slice = Array.prototype.slice;
@@ -104602,7 +104602,7 @@ var require_application = __commonJS({
104602
104602
  this.mountpath = "/";
104603
104603
  this.locals.settings = this.settings;
104604
104604
  this.set("view", View);
104605
- this.set("views", resolve14("views"));
104605
+ this.set("views", resolve15("views"));
104606
104606
  this.set("jsonp callback name", "callback");
104607
104607
  if (env5 === "production") {
104608
104608
  this.enable("view cache");
@@ -105853,7 +105853,7 @@ var require_response2 = __commonJS({
105853
105853
  var send = require_send();
105854
105854
  var extname5 = path37.extname;
105855
105855
  var mime = send.mime;
105856
- var resolve14 = path37.resolve;
105856
+ var resolve15 = path37.resolve;
105857
105857
  var vary = require_vary();
105858
105858
  var res = Object.create(http3.ServerResponse.prototype);
105859
105859
  module2.exports = res;
@@ -106117,7 +106117,7 @@ var require_response2 = __commonJS({
106117
106117
  }
106118
106118
  opts = Object.create(opts);
106119
106119
  opts.headers = headers;
106120
- var fullPath = !opts.root ? resolve14(path38) : path38;
106120
+ var fullPath = !opts.root ? resolve15(path38) : path38;
106121
106121
  return this.sendFile(fullPath, opts, done);
106122
106122
  };
106123
106123
  res.contentType = res.type = function contentType(type2) {
@@ -106382,7 +106382,7 @@ var require_serve_static = __commonJS({
106382
106382
  var encodeUrl = require_encodeurl();
106383
106383
  var escapeHtml = require_escape_html();
106384
106384
  var parseUrl = require_parseurl();
106385
- var resolve14 = require("path").resolve;
106385
+ var resolve15 = require("path").resolve;
106386
106386
  var send = require_send();
106387
106387
  var url3 = require("url");
106388
106388
  module2.exports = serveStatic2;
@@ -106402,7 +106402,7 @@ var require_serve_static = __commonJS({
106402
106402
  throw new TypeError("option setHeaders must be function");
106403
106403
  }
106404
106404
  opts.maxage = opts.maxage || opts.maxAge || 0;
106405
- opts.root = resolve14(root);
106405
+ opts.root = resolve15(root);
106406
106406
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
106407
106407
  return function serveStatic3(req, res, next) {
106408
106408
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -106568,11 +106568,11 @@ var require_p_finally = __commonJS({
106568
106568
  onFinally = onFinally || (() => {
106569
106569
  });
106570
106570
  return promise.then(
106571
- (val) => new Promise((resolve14) => {
106572
- resolve14(onFinally());
106571
+ (val) => new Promise((resolve15) => {
106572
+ resolve15(onFinally());
106573
106573
  }).then(() => val),
106574
- (err2) => new Promise((resolve14) => {
106575
- resolve14(onFinally());
106574
+ (err2) => new Promise((resolve15) => {
106575
+ resolve15(onFinally());
106576
106576
  }).then(() => {
106577
106577
  throw err2;
106578
106578
  })
@@ -106593,18 +106593,18 @@ var require_p_timeout = __commonJS({
106593
106593
  this.name = "TimeoutError";
106594
106594
  }
106595
106595
  };
106596
- var pTimeout2 = (promise, milliseconds, fallback) => new Promise((resolve14, reject) => {
106596
+ var pTimeout2 = (promise, milliseconds, fallback) => new Promise((resolve15, reject) => {
106597
106597
  if (typeof milliseconds !== "number" || milliseconds < 0) {
106598
106598
  throw new TypeError("Expected `milliseconds` to be a positive number");
106599
106599
  }
106600
106600
  if (milliseconds === Infinity) {
106601
- resolve14(promise);
106601
+ resolve15(promise);
106602
106602
  return;
106603
106603
  }
106604
106604
  const timer = setTimeout(() => {
106605
106605
  if (typeof fallback === "function") {
106606
106606
  try {
106607
- resolve14(fallback());
106607
+ resolve15(fallback());
106608
106608
  } catch (error) {
106609
106609
  reject(error);
106610
106610
  }
@@ -106618,7 +106618,7 @@ var require_p_timeout = __commonJS({
106618
106618
  reject(timeoutError2);
106619
106619
  }, milliseconds);
106620
106620
  pFinally(
106621
- promise.then(resolve14, reject),
106621
+ promise.then(resolve15, reject),
106622
106622
  () => {
106623
106623
  clearTimeout(timer);
106624
106624
  }
@@ -106644,7 +106644,7 @@ var require_p_wait_for = __commonJS({
106644
106644
  ...options6
106645
106645
  };
106646
106646
  let retryTimeout;
106647
- const promise = new Promise((resolve14, reject) => {
106647
+ const promise = new Promise((resolve15, reject) => {
106648
106648
  const check = async () => {
106649
106649
  try {
106650
106650
  const value = await condition();
@@ -106652,7 +106652,7 @@ var require_p_wait_for = __commonJS({
106652
106652
  throw new TypeError("Expected condition to return a boolean");
106653
106653
  }
106654
106654
  if (value === true) {
106655
- resolve14();
106655
+ resolve15();
106656
106656
  } else {
106657
106657
  retryTimeout = setTimeout(check, options6.interval);
106658
106658
  }
@@ -107491,7 +107491,7 @@ var require_uri_all = __commonJS({
107491
107491
  target.fragment = relative11.fragment;
107492
107492
  return target;
107493
107493
  }
107494
- function resolve14(baseURI, relativeURI, options6) {
107494
+ function resolve15(baseURI, relativeURI, options6) {
107495
107495
  var schemelessOptions = assign({ scheme: "null" }, options6);
107496
107496
  return serialize(resolveComponents(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
107497
107497
  }
@@ -107759,7 +107759,7 @@ var require_uri_all = __commonJS({
107759
107759
  exports3.removeDotSegments = removeDotSegments;
107760
107760
  exports3.serialize = serialize;
107761
107761
  exports3.resolveComponents = resolveComponents;
107762
- exports3.resolve = resolve14;
107762
+ exports3.resolve = resolve15;
107763
107763
  exports3.normalize = normalize2;
107764
107764
  exports3.equal = equal;
107765
107765
  exports3.escapeComponent = escapeComponent;
@@ -108151,20 +108151,20 @@ var require_resolve = __commonJS({
108151
108151
  var util3 = require_util4();
108152
108152
  var SchemaObject = require_schema_obj();
108153
108153
  var traverse = require_json_schema_traverse();
108154
- module2.exports = resolve14;
108155
- resolve14.normalizeId = normalizeId;
108156
- resolve14.fullPath = getFullPath;
108157
- resolve14.url = resolveUrl;
108158
- resolve14.ids = resolveIds;
108159
- resolve14.inlineRef = inlineRef;
108160
- resolve14.schema = resolveSchema;
108161
- function resolve14(compile, root, ref) {
108154
+ module2.exports = resolve15;
108155
+ resolve15.normalizeId = normalizeId;
108156
+ resolve15.fullPath = getFullPath;
108157
+ resolve15.url = resolveUrl;
108158
+ resolve15.ids = resolveIds;
108159
+ resolve15.inlineRef = inlineRef;
108160
+ resolve15.schema = resolveSchema;
108161
+ function resolve15(compile, root, ref) {
108162
108162
  var refVal = this._refs[ref];
108163
108163
  if (typeof refVal == "string") {
108164
108164
  if (this._refs[refVal])
108165
108165
  refVal = this._refs[refVal];
108166
108166
  else
108167
- return resolve14.call(this, compile, root, refVal);
108167
+ return resolve15.call(this, compile, root, refVal);
108168
108168
  }
108169
108169
  refVal = refVal || this._schemas[ref];
108170
108170
  if (refVal instanceof SchemaObject) {
@@ -108391,7 +108391,7 @@ var require_error_classes = __commonJS({
108391
108391
  "../../node_modules/ajv/lib/compile/error_classes.js"(exports2, module2) {
108392
108392
  "use strict";
108393
108393
  init_import_meta_url();
108394
- var resolve14 = require_resolve();
108394
+ var resolve15 = require_resolve();
108395
108395
  module2.exports = {
108396
108396
  Validation: errorSubclass(ValidationError),
108397
108397
  MissingRef: errorSubclass(MissingRefError)
@@ -108406,8 +108406,8 @@ var require_error_classes = __commonJS({
108406
108406
  };
108407
108407
  function MissingRefError(baseId, ref, message) {
108408
108408
  this.message = message || MissingRefError.message(baseId, ref);
108409
- this.missingRef = resolve14.url(baseId, ref);
108410
- this.missingSchema = resolve14.normalizeId(resolve14.fullPath(this.missingRef));
108409
+ this.missingRef = resolve15.url(baseId, ref);
108410
+ this.missingSchema = resolve15.normalizeId(resolve15.fullPath(this.missingRef));
108411
108411
  }
108412
108412
  function errorSubclass(Subclass) {
108413
108413
  Subclass.prototype = Object.create(Error.prototype);
@@ -108961,7 +108961,7 @@ var require_compile = __commonJS({
108961
108961
  "../../node_modules/ajv/lib/compile/index.js"(exports2, module2) {
108962
108962
  "use strict";
108963
108963
  init_import_meta_url();
108964
- var resolve14 = require_resolve();
108964
+ var resolve15 = require_resolve();
108965
108965
  var util3 = require_util4();
108966
108966
  var errorClasses = require_error_classes();
108967
108967
  var stableStringify = require_fast_json_stable_stringify();
@@ -109021,7 +109021,7 @@ var require_compile = __commonJS({
109021
109021
  RULES,
109022
109022
  validate: validateGenerator,
109023
109023
  util: util3,
109024
- resolve: resolve14,
109024
+ resolve: resolve15,
109025
109025
  resolveRef,
109026
109026
  usePattern,
109027
109027
  useDefault,
@@ -109083,7 +109083,7 @@ var require_compile = __commonJS({
109083
109083
  return validate;
109084
109084
  }
109085
109085
  function resolveRef(baseId2, ref, isRoot) {
109086
- ref = resolve14.url(baseId2, ref);
109086
+ ref = resolve15.url(baseId2, ref);
109087
109087
  var refIndex = refs[ref];
109088
109088
  var _refVal, refCode;
109089
109089
  if (refIndex !== void 0) {
@@ -109100,11 +109100,11 @@ var require_compile = __commonJS({
109100
109100
  }
109101
109101
  }
109102
109102
  refCode = addLocalRef(ref);
109103
- var v2 = resolve14.call(self2, localCompile, root, ref);
109103
+ var v2 = resolve15.call(self2, localCompile, root, ref);
109104
109104
  if (v2 === void 0) {
109105
109105
  var localSchema = localRefs && localRefs[ref];
109106
109106
  if (localSchema) {
109107
- v2 = resolve14.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root, localRefs, baseId2);
109107
+ v2 = resolve15.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root, localRefs, baseId2);
109108
109108
  }
109109
109109
  }
109110
109110
  if (v2 === void 0) {
@@ -112760,7 +112760,7 @@ var require_ajv = __commonJS({
112760
112760
  "use strict";
112761
112761
  init_import_meta_url();
112762
112762
  var compileSchema = require_compile();
112763
- var resolve14 = require_resolve();
112763
+ var resolve15 = require_resolve();
112764
112764
  var Cache2 = require_cache();
112765
112765
  var SchemaObject = require_schema_obj();
112766
112766
  var stableStringify = require_fast_json_stable_stringify();
@@ -112852,7 +112852,7 @@ var require_ajv = __commonJS({
112852
112852
  var id = this._getId(schema);
112853
112853
  if (id !== void 0 && typeof id != "string")
112854
112854
  throw new Error("schema id must be string");
112855
- key2 = resolve14.normalizeId(key2 || id);
112855
+ key2 = resolve15.normalizeId(key2 || id);
112856
112856
  checkUnique(this, key2);
112857
112857
  this._schemas[key2] = this._addSchema(schema, _skipValidation, _meta, true);
112858
112858
  return this;
@@ -112898,7 +112898,7 @@ var require_ajv = __commonJS({
112898
112898
  }
112899
112899
  }
112900
112900
  function _getSchemaFragment(self2, ref) {
112901
- var res = resolve14.schema.call(self2, { schema: {} }, ref);
112901
+ var res = resolve15.schema.call(self2, { schema: {} }, ref);
112902
112902
  if (res) {
112903
112903
  var schema = res.schema, root = res.root, baseId = res.baseId;
112904
112904
  var v = compileSchema.call(self2, schema, root, void 0, baseId);
@@ -112914,7 +112914,7 @@ var require_ajv = __commonJS({
112914
112914
  }
112915
112915
  }
112916
112916
  function _getSchemaObj(self2, keyRef) {
112917
- keyRef = resolve14.normalizeId(keyRef);
112917
+ keyRef = resolve15.normalizeId(keyRef);
112918
112918
  return self2._schemas[keyRef] || self2._refs[keyRef] || self2._fragments[keyRef];
112919
112919
  }
112920
112920
  function removeSchema(schemaKeyRef) {
@@ -112942,7 +112942,7 @@ var require_ajv = __commonJS({
112942
112942
  this._cache.del(cacheKey);
112943
112943
  var id = this._getId(schemaKeyRef);
112944
112944
  if (id) {
112945
- id = resolve14.normalizeId(id);
112945
+ id = resolve15.normalizeId(id);
112946
112946
  delete this._schemas[id];
112947
112947
  delete this._refs[id];
112948
112948
  }
@@ -112967,14 +112967,14 @@ var require_ajv = __commonJS({
112967
112967
  if (cached)
112968
112968
  return cached;
112969
112969
  shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
112970
- var id = resolve14.normalizeId(this._getId(schema));
112970
+ var id = resolve15.normalizeId(this._getId(schema));
112971
112971
  if (id && shouldAddSchema)
112972
112972
  checkUnique(this, id);
112973
112973
  var willValidate = this._opts.validateSchema !== false && !skipValidation;
112974
112974
  var recursiveMeta;
112975
- if (willValidate && !(recursiveMeta = id && id == resolve14.normalizeId(schema.$schema)))
112975
+ if (willValidate && !(recursiveMeta = id && id == resolve15.normalizeId(schema.$schema)))
112976
112976
  this.validateSchema(schema, true);
112977
- var localRefs = resolve14.ids.call(this, schema);
112977
+ var localRefs = resolve15.ids.call(this, schema);
112978
112978
  var schemaObj = new SchemaObject({
112979
112979
  id,
112980
112980
  schema,
@@ -115405,7 +115405,7 @@ var require_fast_json_stringify = __commonJS({
115405
115405
  }
115406
115406
  var arrayItemsReferenceSerializersMap = /* @__PURE__ */ new Map();
115407
115407
  var objectReferenceSerializersMap = /* @__PURE__ */ new Map();
115408
- function build7(schema, options6) {
115408
+ function build5(schema, options6) {
115409
115409
  arrayItemsReferenceSerializersMap.clear();
115410
115410
  objectReferenceSerializersMap.clear();
115411
115411
  options6 = options6 || {};
@@ -116567,7 +116567,7 @@ function $asStringSmall (str) {
116567
116567
  }
116568
116568
  return true;
116569
116569
  }
116570
- module2.exports = build7;
116570
+ module2.exports = build5;
116571
116571
  module2.exports.restore = function(debugModeStr, options6 = {}) {
116572
116572
  const dependencies = [debugModeStr];
116573
116573
  const args = [];
@@ -117893,8 +117893,8 @@ var require_createInternalHttpTerminator = __commonJS({
117893
117893
  }
117894
117894
  let resolveTerminating;
117895
117895
  let rejectTerminating;
117896
- terminating = new Promise((resolve14, reject) => {
117897
- resolveTerminating = resolve14;
117896
+ terminating = new Promise((resolve15, reject) => {
117897
+ resolveTerminating = resolve15;
117898
117898
  rejectTerminating = reject;
117899
117899
  });
117900
117900
  server2.on("request", (incomingMessage, outgoingMessage) => {
@@ -118168,14 +118168,14 @@ var require_open = __commonJS({
118168
118168
  }
118169
118169
  const subprocess = childProcess2.spawn(command2, cliArguments, childProcessOptions);
118170
118170
  if (options6.wait) {
118171
- return new Promise((resolve14, reject) => {
118171
+ return new Promise((resolve15, reject) => {
118172
118172
  subprocess.once("error", reject);
118173
118173
  subprocess.once("close", (exitCode) => {
118174
118174
  if (options6.allowNonzeroExitCode && exitCode > 0) {
118175
118175
  reject(new Error(`Exited with code ${exitCode}`));
118176
118176
  return;
118177
118177
  }
118178
- resolve14(subprocess);
118178
+ resolve15(subprocess);
118179
118179
  });
118180
118180
  });
118181
118181
  }
@@ -123004,13 +123004,13 @@ var require_chalk = __commonJS({
123004
123004
  styles[key2] = {
123005
123005
  get() {
123006
123006
  const codes = ansiStyles[key2];
123007
- return build7.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key2);
123007
+ return build5.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key2);
123008
123008
  }
123009
123009
  };
123010
123010
  }
123011
123011
  styles.visible = {
123012
123012
  get() {
123013
- return build7.call(this, this._styles || [], true, "visible");
123013
+ return build5.call(this, this._styles || [], true, "visible");
123014
123014
  }
123015
123015
  };
123016
123016
  ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), "g");
@@ -123028,7 +123028,7 @@ var require_chalk = __commonJS({
123028
123028
  close: ansiStyles.color.close,
123029
123029
  closeRe: ansiStyles.color.closeRe
123030
123030
  };
123031
- return build7.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
123031
+ return build5.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
123032
123032
  };
123033
123033
  }
123034
123034
  };
@@ -123049,14 +123049,14 @@ var require_chalk = __commonJS({
123049
123049
  close: ansiStyles.bgColor.close,
123050
123050
  closeRe: ansiStyles.bgColor.closeRe
123051
123051
  };
123052
- return build7.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
123052
+ return build5.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
123053
123053
  };
123054
123054
  }
123055
123055
  };
123056
123056
  }
123057
123057
  var proto = Object.defineProperties(() => {
123058
123058
  }, styles);
123059
- function build7(_styles, _empty, key2) {
123059
+ function build5(_styles, _empty, key2) {
123060
123060
  const builder = function() {
123061
123061
  return applyStyle.apply(builder, arguments);
123062
123062
  };
@@ -134925,7 +134925,7 @@ var require_update_check = __commonJS({
134925
134925
  });
134926
134926
  await writeFile6(file, content, "utf8");
134927
134927
  };
134928
- var loadPackage = (url3, authInfo) => new Promise((resolve14, reject) => {
134928
+ var loadPackage = (url3, authInfo) => new Promise((resolve15, reject) => {
134929
134929
  const options6 = {
134930
134930
  host: url3.hostname,
134931
134931
  path: url3.pathname,
@@ -134956,7 +134956,7 @@ var require_update_check = __commonJS({
134956
134956
  response.on("end", () => {
134957
134957
  try {
134958
134958
  const parsedData = JSON.parse(rawData);
134959
- resolve14(parsedData);
134959
+ resolve15(parsedData);
134960
134960
  } catch (e2) {
134961
134961
  reject(e2);
134962
134962
  }
@@ -136722,14 +136722,14 @@ var getLocalHosts = () => {
136722
136722
  }
136723
136723
  return results;
136724
136724
  };
136725
- var checkAvailablePort = (options6) => new Promise((resolve14, reject) => {
136725
+ var checkAvailablePort = (options6) => new Promise((resolve15, reject) => {
136726
136726
  const server2 = import_node_net.default.createServer();
136727
136727
  server2.unref();
136728
136728
  server2.on("error", reject);
136729
136729
  server2.listen(options6, () => {
136730
136730
  const { port } = server2.address();
136731
136731
  server2.close(() => {
136732
- resolve14(port);
136732
+ resolve15(port);
136733
136733
  });
136734
136734
  });
136735
136735
  });
@@ -136903,18 +136903,18 @@ function pLimit(concurrency) {
136903
136903
  queue.dequeue()();
136904
136904
  }
136905
136905
  };
136906
- const run2 = async (fn, resolve14, args) => {
136906
+ const run2 = async (fn, resolve15, args) => {
136907
136907
  activeCount++;
136908
136908
  const result = (async () => fn(...args))();
136909
- resolve14(result);
136909
+ resolve15(result);
136910
136910
  try {
136911
136911
  await result;
136912
136912
  } catch {
136913
136913
  }
136914
136914
  next();
136915
136915
  };
136916
- const enqueue = (fn, resolve14, args) => {
136917
- queue.enqueue(run2.bind(void 0, fn, resolve14, args));
136916
+ const enqueue = (fn, resolve15, args) => {
136917
+ queue.enqueue(run2.bind(void 0, fn, resolve15, args));
136918
136918
  (async () => {
136919
136919
  await Promise.resolve();
136920
136920
  if (activeCount < concurrency && queue.size > 0) {
@@ -136922,8 +136922,8 @@ function pLimit(concurrency) {
136922
136922
  }
136923
136923
  })();
136924
136924
  };
136925
- const generator = (fn, ...args) => new Promise((resolve14) => {
136926
- enqueue(fn, resolve14, args);
136925
+ const generator = (fn, ...args) => new Promise((resolve15) => {
136926
+ enqueue(fn, resolve15, args);
136927
136927
  });
136928
136928
  Object.defineProperties(generator, {
136929
136929
  activeCount: {
@@ -138363,7 +138363,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
138363
138363
  isBoolean,
138364
138364
  void 0
138365
138365
  );
138366
- const { deprecatedUpload, ...build7 } = normalizeAndValidateBuild(
138366
+ const { deprecatedUpload, ...build5 } = normalizeAndValidateBuild(
138367
138367
  diagnostics,
138368
138368
  rawEnv,
138369
138369
  rawEnv.build ?? topLevelEnv?.build ?? {},
@@ -138456,7 +138456,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
138456
138456
  isOneOf("bundled", "unbound"),
138457
138457
  void 0
138458
138458
  ),
138459
- build: build7,
138459
+ build: build5,
138460
138460
  workers_dev,
138461
138461
  vars: notInheritable(
138462
138462
  diagnostics,
@@ -139786,17 +139786,17 @@ var DEV_REGISTRY_HOST = `http://localhost:${DEV_REGISTRY_PORT}`;
139786
139786
  var server;
139787
139787
  var terminator;
139788
139788
  async function isPortAvailable() {
139789
- return new Promise((resolve14, reject) => {
139789
+ return new Promise((resolve15, reject) => {
139790
139790
  const netServer = import_net.default.createServer().once("error", (err2) => {
139791
139791
  netServer.close();
139792
139792
  if (err2.code === "EADDRINUSE") {
139793
- resolve14(false);
139793
+ resolve15(false);
139794
139794
  } else {
139795
139795
  reject(err2);
139796
139796
  }
139797
139797
  }).once("listening", () => {
139798
139798
  netServer.close();
139799
- resolve14(true);
139799
+ resolve15(true);
139800
139800
  });
139801
139801
  netServer.listen(DEV_REGISTRY_PORT);
139802
139802
  });
@@ -140560,7 +140560,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
140560
140560
  return spawnedPromise;
140561
140561
  }
140562
140562
  let timeoutId;
140563
- const timeoutPromise = new Promise((resolve14, reject) => {
140563
+ const timeoutPromise = new Promise((resolve15, reject) => {
140564
140564
  timeoutId = setTimeout(() => {
140565
140565
  timeoutKill(spawned, killSignal, reject);
140566
140566
  }, timeout);
@@ -140678,9 +140678,9 @@ var mergePromise = (spawned, promise) => {
140678
140678
  }
140679
140679
  return spawned;
140680
140680
  };
140681
- var getSpawnedPromise = (spawned) => new Promise((resolve14, reject) => {
140681
+ var getSpawnedPromise = (spawned) => new Promise((resolve15, reject) => {
140682
140682
  spawned.on("exit", (exitCode, signal) => {
140683
- resolve14({ exitCode, signal });
140683
+ resolve15({ exitCode, signal });
140684
140684
  });
140685
140685
  spawned.on("error", (error) => {
140686
140686
  reject(error);
@@ -140989,19 +140989,19 @@ ${migrateUrl}`
140989
140989
  }
140990
140990
  return { file, directory, format: format6 };
140991
140991
  }
140992
- async function runCustomBuild(expectedEntryAbsolute, expectedEntryRelative, build7) {
140993
- if (build7?.command) {
140994
- logger.log("Running custom build:", build7.command);
140995
- await execaCommand(build7.command, {
140992
+ async function runCustomBuild(expectedEntryAbsolute, expectedEntryRelative, build5) {
140993
+ if (build5?.command) {
140994
+ logger.log("Running custom build:", build5.command);
140995
+ await execaCommand(build5.command, {
140996
140996
  shell: true,
140997
140997
  stdout: "inherit",
140998
140998
  stderr: "inherit",
140999
- ...build7.cwd && { cwd: build7.cwd }
140999
+ ...build5.cwd && { cwd: build5.cwd }
141000
141000
  });
141001
141001
  if (fileExists(expectedEntryAbsolute) === false) {
141002
141002
  throw new Error(
141003
141003
  getMissingEntryPointMessage(
141004
- `The expected output file at "${expectedEntryRelative}" was not found after running custom build: ${build7.command}.
141004
+ `The expected output file at "${expectedEntryRelative}" was not found after running custom build: ${build5.command}.
141005
141005
  The \`main\` property in wrangler.toml should point to the file generated by the custom build.`,
141006
141006
  expectedEntryAbsolute,
141007
141007
  expectedEntryRelative
@@ -141159,7 +141159,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
141159
141159
  var wrapper_default = import_websocket.default;
141160
141160
 
141161
141161
  // package.json
141162
- var version = "2.2.0";
141162
+ var version = "2.2.2";
141163
141163
  var package_default = {
141164
141164
  name: "wrangler",
141165
141165
  version,
@@ -141276,6 +141276,7 @@ var package_default = {
141276
141276
  "xxhash-wasm": "^1.0.1"
141277
141277
  },
141278
141278
  devDependencies: {
141279
+ "@cloudflare/types": "^6.18.4",
141279
141280
  "@databases/split-sql-query": "^1.0.3",
141280
141281
  "@databases/sql": "^3.2.0",
141281
141282
  "@iarna/toml": "^3.0.0",
@@ -141937,7 +141938,7 @@ function createStreamHandler(previewToken, remote, localPort, localProtocol, acc
141937
141938
  };
141938
141939
  }
141939
141940
  async function waitForPortToBeAvailable(port, options6) {
141940
- return new Promise((resolve14, reject) => {
141941
+ return new Promise((resolve15, reject) => {
141941
141942
  options6.abortSignal.addEventListener("abort", () => {
141942
141943
  const abortError = new Error("waitForPortToBeAvailable() aborted");
141943
141944
  abortError.code = "ABORT_ERR";
@@ -141951,7 +141952,7 @@ async function waitForPortToBeAvailable(port, options6) {
141951
141952
  function doResolve() {
141952
141953
  clearTimeout(timeout);
141953
141954
  clearInterval(interval2);
141954
- resolve14();
141955
+ resolve15();
141955
141956
  }
141956
141957
  function doReject(err2) {
141957
141958
  clearInterval(interval2);
@@ -142749,8 +142750,8 @@ function createModuleCollector(props) {
142749
142750
  modules,
142750
142751
  plugin: {
142751
142752
  name: "wrangler-module-collector",
142752
- setup(build7) {
142753
- build7.onStart(() => {
142753
+ setup(build5) {
142754
+ build5.onStart(() => {
142754
142755
  modules.splice(0);
142755
142756
  });
142756
142757
  const rulesMatchers = rules.flatMap((rule) => {
@@ -142763,7 +142764,7 @@ function createModuleCollector(props) {
142763
142764
  });
142764
142765
  });
142765
142766
  if (props.wrangler1xlegacyModuleReferences.fileNames.size > 0) {
142766
- build7.onResolve(
142767
+ build5.onResolve(
142767
142768
  {
142768
142769
  filter: new RegExp(
142769
142770
  "^(" + [...props.wrangler1xlegacyModuleReferences.fileNames].map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|") + ")$"
@@ -142807,7 +142808,7 @@ function createModuleCollector(props) {
142807
142808
  if (rule.type === "ESModule" || rule.type === "CommonJS")
142808
142809
  return;
142809
142810
  rule.globs.forEach((glob) => {
142810
- build7.onResolve(
142811
+ build5.onResolve(
142811
142812
  { filter: (0, import_glob_to_regexp.default)(glob) },
142812
142813
  async (args) => {
142813
142814
  const filePath = import_node_path13.default.join(args.resolveDir, args.path);
@@ -142828,7 +142829,7 @@ function createModuleCollector(props) {
142828
142829
  }
142829
142830
  );
142830
142831
  if (props.format === "service-worker") {
142831
- build7.onLoad(
142832
+ build5.onLoad(
142832
142833
  { filter: (0, import_glob_to_regexp.default)(glob) },
142833
142834
  async (args) => {
142834
142835
  return {
@@ -142844,7 +142845,7 @@ function createModuleCollector(props) {
142844
142845
  });
142845
142846
  rulesToRemove.forEach((rule) => {
142846
142847
  rule.globs.forEach((glob) => {
142847
- build7.onResolve(
142848
+ build5.onResolve(
142848
142849
  { filter: (0, import_glob_to_regexp.default)(glob) },
142849
142850
  async (args) => {
142850
142851
  throw new Error(
@@ -144020,17 +144021,17 @@ async function login(props) {
144020
144021
  const urlToOpen = await getAuthURL(props?.scopes);
144021
144022
  let server2;
144022
144023
  let loginTimeoutHandle;
144023
- const timerPromise = new Promise((resolve14) => {
144024
+ const timerPromise = new Promise((resolve15) => {
144024
144025
  loginTimeoutHandle = setTimeout(() => {
144025
144026
  logger.error(
144026
144027
  "Timed out waiting for authorization code, please try again."
144027
144028
  );
144028
144029
  server2.close();
144029
144030
  clearTimeout(loginTimeoutHandle);
144030
- resolve14(false);
144031
+ resolve15(false);
144031
144032
  }, 6e4);
144032
144033
  });
144033
- const loginPromise = new Promise((resolve14, reject) => {
144034
+ const loginPromise = new Promise((resolve15, reject) => {
144034
144035
  server2 = import_node_http4.default.createServer(async (req, res) => {
144035
144036
  function finish(status, error) {
144036
144037
  clearTimeout(loginTimeoutHandle);
@@ -144038,7 +144039,7 @@ async function login(props) {
144038
144039
  if (error || closeErr) {
144039
144040
  reject(error || closeErr);
144040
144041
  } else
144041
- resolve14(status);
144042
+ resolve15(status);
144042
144043
  });
144043
144044
  }
144044
144045
  (0, import_node_assert4.default)(req.url, "This request doesn't have a URL");
@@ -144177,13 +144178,13 @@ async function getAccountId() {
144177
144178
  }
144178
144179
  if (isInteractive() && !CI.isCI()) {
144179
144180
  const account = await new Promise(
144180
- (resolve14, reject) => {
144181
+ (resolve15, reject) => {
144181
144182
  const { unmount } = (0, import_ink2.render)(
144182
144183
  /* @__PURE__ */ import_react5.default.createElement(ChooseAccount, {
144183
144184
  accounts,
144184
144185
  onSelect: async (selected) => {
144185
144186
  saveAccountToCache(selected);
144186
- resolve14(selected);
144187
+ resolve15(selected);
144187
144188
  unmount();
144188
144189
  },
144189
144190
  onError: (err2) => {
@@ -145718,11 +145719,17 @@ async function bundleWorker(entry, destination, options6) {
145718
145719
  firstPartyWorkerDevFacade,
145719
145720
  targetConsumer,
145720
145721
  testScheduled,
145721
- experimentalLocalStubCache
145722
+ experimentalLocalStubCache,
145723
+ inject: injectOption,
145724
+ loader,
145725
+ sourcemap,
145726
+ plugins,
145727
+ disableModuleCollection,
145728
+ isOutfile
145722
145729
  } = options6;
145723
145730
  const tmpDir = await import_tmp_promise.default.dir({ unsafeCleanup: true });
145724
145731
  const entryDirectory = path18.dirname(entry.file);
145725
- const moduleCollector = createModuleCollector({
145732
+ let moduleCollector = createModuleCollector({
145726
145733
  wrangler1xlegacyModuleReferences: {
145727
145734
  rootDirectory: entryDirectory,
145728
145735
  fileNames: new Set(
@@ -145734,6 +145741,16 @@ async function bundleWorker(entry, destination, options6) {
145734
145741
  format: entry.format,
145735
145742
  rules
145736
145743
  });
145744
+ if (disableModuleCollection) {
145745
+ moduleCollector = {
145746
+ modules: [],
145747
+ plugin: {
145748
+ name: moduleCollector.plugin.name,
145749
+ setup: () => {
145750
+ }
145751
+ }
145752
+ };
145753
+ }
145737
145754
  const checkedFetchFileToInject = path18.join(tmpDir.path, "checked-fetch.js");
145738
145755
  if (checkFetch && !fs6.existsSync(checkedFetchFileToInject)) {
145739
145756
  fs6.mkdirSync(tmpDir.path, {
@@ -145788,7 +145805,7 @@ async function bundleWorker(entry, destination, options6) {
145788
145805
  for (const middlewareFn of middleware) {
145789
145806
  inputEntry = await middlewareFn(inputEntry);
145790
145807
  }
145791
- const inject = [];
145808
+ const inject = injectOption ?? [];
145792
145809
  if (checkFetch)
145793
145810
  inject.push(checkedFetchFileToInject);
145794
145811
  if (experimentalLocalStubCache) {
@@ -145801,11 +145818,15 @@ async function bundleWorker(entry, destination, options6) {
145801
145818
  bundle: true,
145802
145819
  absWorkingDir: entry.directory,
145803
145820
  outdir: destination,
145821
+ ...isOutfile ? {
145822
+ outdir: void 0,
145823
+ outfile: destination
145824
+ } : {},
145804
145825
  inject,
145805
145826
  external: ["__STATIC_CONTENT_MANIFEST"],
145806
145827
  format: entry.format === "modules" ? "esm" : "iife",
145807
145828
  target: "es2020",
145808
- sourcemap: true,
145829
+ sourcemap: sourcemap ?? true,
145809
145830
  sourceRoot: destination,
145810
145831
  minify,
145811
145832
  metafile: true,
@@ -145821,11 +145842,13 @@ async function bundleWorker(entry, destination, options6) {
145821
145842
  loader: {
145822
145843
  ".js": "jsx",
145823
145844
  ".mjs": "jsx",
145824
- ".cjs": "jsx"
145845
+ ".cjs": "jsx",
145846
+ ...loader || {}
145825
145847
  },
145826
145848
  plugins: [
145827
145849
  ...entry.format === "modules" || middlewareToLoad.length === 0 ? [moduleCollector.plugin] : [],
145828
- ...nodeCompat ? [(0, import_node_globals_polyfill.default)({ buffer: true }), (0, import_node_modules_polyfill.default)()] : []
145850
+ ...nodeCompat ? [(0, import_node_globals_polyfill.default)({ buffer: true }), (0, import_node_modules_polyfill.default)()] : [],
145851
+ ...plugins || []
145829
145852
  ],
145830
145853
  ...jsxFactory && { jsxFactory },
145831
145854
  ...jsxFragment && { jsxFragment },
@@ -145872,8 +145895,8 @@ async function bundleWorker(entry, destination, options6) {
145872
145895
  function esbuildAliasExternalPlugin(aliases2) {
145873
145896
  return {
145874
145897
  name: "alias",
145875
- setup(build7) {
145876
- build7.onResolve({ filter: /.*/g }, (args) => {
145898
+ setup(build5) {
145899
+ build5.onResolve({ filter: /.*/g }, (args) => {
145877
145900
  if (args.kind === "entry-point") {
145878
145901
  return {
145879
145902
  path: args.path
@@ -146196,7 +146219,7 @@ function useEsbuild({
146196
146219
  }
146197
146220
  }
146198
146221
  };
146199
- async function build7() {
146222
+ async function build5() {
146200
146223
  if (!destination)
146201
146224
  return;
146202
146225
  const {
@@ -146258,7 +146281,7 @@ function useEsbuild({
146258
146281
  sourceMapPath
146259
146282
  });
146260
146283
  }
146261
- build7().catch((err2) => {
146284
+ build5().catch((err2) => {
146262
146285
  exit2(err2);
146263
146286
  });
146264
146287
  return () => {
@@ -146545,19 +146568,19 @@ function useTmpDir() {
146545
146568
  }, [handleError]);
146546
146569
  return directory?.name;
146547
146570
  }
146548
- function useCustomBuild(expectedEntry, build7) {
146571
+ function useCustomBuild(expectedEntry, build5) {
146549
146572
  (0, import_react8.useEffect)(() => {
146550
- if (!build7.command)
146573
+ if (!build5.command)
146551
146574
  return;
146552
146575
  let watcher;
146553
- if (build7.watch_dir) {
146554
- watcher = (0, import_chokidar2.watch)(build7.watch_dir, {
146576
+ if (build5.watch_dir) {
146577
+ watcher = (0, import_chokidar2.watch)(build5.watch_dir, {
146555
146578
  persistent: true,
146556
146579
  ignoreInitial: true
146557
146580
  }).on("all", (_event, filePath) => {
146558
146581
  const relativeFile = path19.relative(expectedEntry.directory, expectedEntry.file) || ".";
146559
146582
  logger.log(`The file ${filePath} changed, restarting build...`);
146560
- runCustomBuild(expectedEntry.file, relativeFile, build7).catch((err2) => {
146583
+ runCustomBuild(expectedEntry.file, relativeFile, build5).catch((err2) => {
146561
146584
  logger.error("Custom build failed:", err2);
146562
146585
  });
146563
146586
  });
@@ -146565,10 +146588,10 @@ function useCustomBuild(expectedEntry, build7) {
146565
146588
  return () => {
146566
146589
  watcher?.close();
146567
146590
  };
146568
- }, [build7, expectedEntry]);
146591
+ }, [build5, expectedEntry]);
146569
146592
  }
146570
146593
  function sleep(period) {
146571
- return new Promise((resolve14) => setTimeout(resolve14, period));
146594
+ return new Promise((resolve15) => setTimeout(resolve15, period));
146572
146595
  }
146573
146596
  var SLEEP_DURATION = 2e3;
146574
146597
  var hostNameRegex = /userHostname="(.*)"/g;
@@ -147172,13 +147195,13 @@ function Confirm(props) {
147172
147195
  return /* @__PURE__ */ React5.createElement(import_ink5.Box, null, /* @__PURE__ */ React5.createElement(import_ink5.Text, null, props.text, " (", import_chalk2.default.bold("y"), "/n)"));
147173
147196
  }
147174
147197
  function confirm(text) {
147175
- return new Promise((resolve14) => {
147198
+ return new Promise((resolve15) => {
147176
147199
  const { unmount } = (0, import_ink5.render)(
147177
147200
  /* @__PURE__ */ React5.createElement(Confirm, {
147178
147201
  text,
147179
147202
  onConfirm: (answer) => {
147180
147203
  unmount();
147181
- resolve14(answer);
147204
+ resolve15(answer);
147182
147205
  }
147183
147206
  })
147184
147207
  );
@@ -147194,7 +147217,7 @@ function Prompt(props) {
147194
147217
  })));
147195
147218
  }
147196
147219
  async function prompt(text, type2 = "text", defaultValue) {
147197
- return new Promise((resolve14) => {
147220
+ return new Promise((resolve15) => {
147198
147221
  const { unmount } = (0, import_ink5.render)(
147199
147222
  /* @__PURE__ */ React5.createElement(Prompt, {
147200
147223
  text,
@@ -147202,7 +147225,7 @@ async function prompt(text, type2 = "text", defaultValue) {
147202
147225
  type: type2,
147203
147226
  onSubmit: (inputText) => {
147204
147227
  unmount();
147205
- resolve14(inputText);
147228
+ resolve15(inputText);
147206
147229
  }
147207
147230
  })
147208
147231
  );
@@ -147220,7 +147243,7 @@ function Select(props) {
147220
147243
  }));
147221
147244
  }
147222
147245
  function select(text, options6, initialIndex) {
147223
- return new Promise((resolve14) => {
147246
+ return new Promise((resolve15) => {
147224
147247
  const { unmount } = (0, import_ink5.render)(
147225
147248
  /* @__PURE__ */ React5.createElement(Select, {
147226
147249
  text,
@@ -147228,7 +147251,7 @@ function select(text, options6, initialIndex) {
147228
147251
  initialIndex,
147229
147252
  onSelect: (option) => {
147230
147253
  unmount();
147231
- resolve14(option);
147254
+ resolve15(option);
147232
147255
  }
147233
147256
  })
147234
147257
  );
@@ -149876,12 +149899,12 @@ var YargsInstance = class {
149876
149899
  async getCompletion(args, done) {
149877
149900
  argsert("<array> [function]", [args, done], arguments.length);
149878
149901
  if (!done) {
149879
- return new Promise((resolve14, reject) => {
149902
+ return new Promise((resolve15, reject) => {
149880
149903
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err2, completions) => {
149881
149904
  if (err2)
149882
149905
  reject(err2);
149883
149906
  else
149884
- resolve14(completions);
149907
+ resolve15(completions);
149885
149908
  });
149886
149909
  });
149887
149910
  } else {
@@ -154131,7 +154154,7 @@ Author: ${versions.metadata.author_email}
154131
154154
  Source: ${sourceStr(versions.metadata.source)}
154132
154155
  `
154133
154156
  );
154134
- versionMessages[0] += "\u{1F7E9}Active";
154157
+ versionMessages[0] += "\u{1F7E9} Active";
154135
154158
  logger.log(...versionMessages.reverse());
154136
154159
  }
154137
154160
  function sourceStr(source) {
@@ -156123,100 +156146,100 @@ and that at least one include rule is provided.
156123
156146
  init_import_meta_url();
156124
156147
  var import_promises10 = require("node:fs/promises");
156125
156148
  var import_node_path24 = require("node:path");
156126
- var import_node_globals_polyfill2 = __toESM(require("@esbuild-plugins/node-globals-polyfill"));
156127
- var import_node_modules_polyfill2 = __toESM(require("@esbuild-plugins/node-modules-polyfill"));
156128
- var import_esbuild3 = require("esbuild");
156129
156149
  function buildPlugin({
156130
156150
  routesModule,
156131
156151
  outfile = "bundle.js",
156132
156152
  minify = false,
156133
156153
  sourcemap = false,
156134
156154
  watch: watch5 = false,
156135
- nodeCompat,
156136
156155
  onEnd = () => {
156137
- }
156156
+ },
156157
+ nodeCompat,
156158
+ functionsDirectory,
156159
+ local,
156160
+ betaD1Shims
156138
156161
  }) {
156139
- return (0, import_esbuild3.build)({
156140
- entryPoints: [(0, import_node_path24.resolve)(getBasePath(), "templates/pages-template-plugin.ts")],
156141
- inject: [routesModule],
156142
- bundle: true,
156143
- format: "esm",
156144
- target: "esnext",
156145
- loader: {
156146
- ".html": "text",
156147
- ".txt": "text"
156162
+ return bundleWorker(
156163
+ {
156164
+ file: (0, import_node_path24.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
156165
+ directory: functionsDirectory,
156166
+ format: "modules"
156148
156167
  },
156149
- outfile,
156150
- minify,
156151
- sourcemap,
156152
- watch: watch5,
156153
- allowOverwrite: true,
156154
- define: { ...nodeCompat ? { global: "globalThis" } : {} },
156155
- plugins: [
156156
- {
156157
- name: "wrangler notifier and monitor",
156158
- setup(pluginBuild) {
156159
- pluginBuild.onEnd((result) => {
156160
- if (result.errors.length > 0) {
156161
- console.error(
156162
- `${result.errors.length} error(s) and ${result.warnings.length} warning(s) when compiling Worker.`
156163
- );
156164
- } else if (result.warnings.length > 0) {
156165
- console.warn(
156166
- `${result.warnings.length} warning(s) when compiling Worker.`
156167
- );
156168
- onEnd();
156169
- } else {
156170
- console.log("Compiled Worker successfully.");
156171
- onEnd();
156172
- }
156173
- });
156174
- }
156175
- },
156176
- {
156177
- name: "Assets",
156178
- setup(pluginBuild) {
156179
- if (pluginBuild.initialOptions.outfile) {
156180
- const outdir = (0, import_node_path24.dirname)(pluginBuild.initialOptions.outfile);
156181
- pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
156182
- const directory = (0, import_node_path24.resolve)(
156183
- args.resolveDir,
156184
- args.path.slice("assets:".length)
156185
- );
156186
- const exists = await (0, import_promises10.access)(directory).then(() => true).catch(() => false);
156187
- const isDirectory2 = exists && (await (0, import_promises10.lstat)(directory)).isDirectory();
156188
- if (!isDirectory2) {
156189
- return {
156190
- errors: [
156191
- {
156192
- text: `'${directory}' does not exist or is not a directory.`
156193
- }
156194
- ]
156195
- };
156168
+ (0, import_node_path24.resolve)(outfile),
156169
+ {
156170
+ inject: [routesModule],
156171
+ minify,
156172
+ sourcemap,
156173
+ watch: watch5,
156174
+ nodeCompat,
156175
+ define: {},
156176
+ betaD1Shims: (betaD1Shims || []).map(
156177
+ (binding) => `${D1_BETA_PREFIX}${binding}`
156178
+ ),
156179
+ plugins: [
156180
+ {
156181
+ name: "wrangler notifier and monitor",
156182
+ setup(pluginBuild) {
156183
+ pluginBuild.onEnd((result) => {
156184
+ if (result.errors.length > 0) {
156185
+ console.error(
156186
+ `${result.errors.length} error(s) and ${result.warnings.length} warning(s) when compiling Worker.`
156187
+ );
156188
+ } else if (result.warnings.length > 0) {
156189
+ console.warn(
156190
+ `${result.warnings.length} warning(s) when compiling Worker.`
156191
+ );
156192
+ onEnd();
156193
+ } else {
156194
+ console.log("Compiled Worker successfully.");
156195
+ onEnd();
156196
156196
  }
156197
- const path37 = `assets:./${(0, import_node_path24.relative)(outdir, directory)}`;
156198
- return { path: path37, external: true, namespace: "assets" };
156199
156197
  });
156200
156198
  }
156199
+ },
156200
+ {
156201
+ name: "Assets",
156202
+ setup(pluginBuild) {
156203
+ if (pluginBuild.initialOptions.outfile) {
156204
+ const outdir = (0, import_node_path24.dirname)(pluginBuild.initialOptions.outfile);
156205
+ pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
156206
+ const directory = (0, import_node_path24.resolve)(
156207
+ args.resolveDir,
156208
+ args.path.slice("assets:".length)
156209
+ );
156210
+ const exists = await (0, import_promises10.access)(directory).then(() => true).catch(() => false);
156211
+ const isDirectory2 = exists && (await (0, import_promises10.lstat)(directory)).isDirectory();
156212
+ if (!isDirectory2) {
156213
+ return {
156214
+ errors: [
156215
+ {
156216
+ text: `'${directory}' does not exist or is not a directory.`
156217
+ }
156218
+ ]
156219
+ };
156220
+ }
156221
+ const path37 = `assets:./${(0, import_node_path24.relative)(outdir, directory)}`;
156222
+ return { path: path37, external: true, namespace: "assets" };
156223
+ });
156224
+ }
156225
+ }
156201
156226
  }
156202
- },
156203
- ...nodeCompat ? [
156204
- (0, import_node_globals_polyfill2.default)({
156205
- buffer: true
156206
- }),
156207
- (0, import_node_modules_polyfill2.default)()
156208
- ] : []
156209
- ]
156210
- });
156227
+ ],
156228
+ isOutfile: true,
156229
+ serveAssetsFromWorker: false,
156230
+ disableModuleCollection: true,
156231
+ rules: [],
156232
+ checkFetch: local,
156233
+ targetConsumer: local ? "dev" : "publish",
156234
+ local
156235
+ }
156236
+ );
156211
156237
  }
156212
156238
 
156213
156239
  // src/pages/functions/buildWorker.ts
156214
156240
  init_import_meta_url();
156215
156241
  var import_promises11 = require("node:fs/promises");
156216
156242
  var import_node_path25 = require("node:path");
156217
- var import_node_globals_polyfill3 = __toESM(require("@esbuild-plugins/node-globals-polyfill"));
156218
- var import_node_modules_polyfill3 = __toESM(require("@esbuild-plugins/node-modules-polyfill"));
156219
- var import_esbuild4 = require("esbuild");
156220
156243
 
156221
156244
  // ../../node_modules/nanoid/index.js
156222
156245
  init_import_meta_url();
@@ -156261,124 +156284,133 @@ function buildWorker({
156261
156284
  onEnd = () => {
156262
156285
  },
156263
156286
  buildOutputDirectory,
156264
- nodeCompat
156287
+ nodeCompat,
156288
+ functionsDirectory,
156289
+ local,
156290
+ betaD1Shims
156265
156291
  }) {
156266
- return (0, import_esbuild4.build)({
156267
- entryPoints: [(0, import_node_path25.resolve)(getBasePath(), "templates/pages-template-worker.ts")],
156268
- inject: [routesModule],
156269
- bundle: true,
156270
- format: "esm",
156271
- target: "esnext",
156272
- loader: {
156273
- ".html": "text",
156274
- ".txt": "text"
156275
- },
156276
- outfile,
156277
- minify,
156278
- sourcemap,
156279
- watch: watch5,
156280
- allowOverwrite: true,
156281
- define: {
156282
- __FALLBACK_SERVICE__: JSON.stringify(fallbackService),
156283
- ...nodeCompat ? { global: "globalThis" } : {}
156292
+ return bundleWorker(
156293
+ {
156294
+ file: (0, import_node_path25.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
156295
+ directory: functionsDirectory,
156296
+ format: "modules"
156284
156297
  },
156285
- plugins: [
156286
- {
156287
- name: "wrangler notifier and monitor",
156288
- setup(pluginBuild) {
156289
- pluginBuild.onEnd((result) => {
156290
- if (result.errors.length > 0) {
156291
- console.error(
156292
- `${result.errors.length} error(s) and ${result.warnings.length} warning(s) when compiling Worker.`
156293
- );
156294
- } else if (result.warnings.length > 0) {
156295
- console.warn(
156296
- `${result.warnings.length} warning(s) when compiling Worker.`
156297
- );
156298
- onEnd();
156299
- } else {
156300
- console.log("Compiled Worker successfully.");
156301
- onEnd();
156302
- }
156303
- });
156304
- }
156298
+ (0, import_node_path25.resolve)(outfile),
156299
+ {
156300
+ inject: [routesModule],
156301
+ minify,
156302
+ sourcemap,
156303
+ watch: watch5,
156304
+ nodeCompat,
156305
+ loader: {
156306
+ ".txt": "text",
156307
+ ".html": "text"
156305
156308
  },
156306
- {
156307
- name: "Assets",
156308
- setup(pluginBuild) {
156309
- const identifiers = /* @__PURE__ */ new Map();
156310
- pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
156311
- const directory = (0, import_node_path25.resolve)(
156312
- args.resolveDir,
156313
- args.path.slice("assets:".length)
156314
- );
156315
- const exists = await (0, import_promises11.access)(directory).then(() => true).catch(() => false);
156316
- const isDirectory2 = exists && (await (0, import_promises11.lstat)(directory)).isDirectory();
156317
- if (!isDirectory2) {
156318
- return {
156319
- errors: [
156320
- {
156321
- text: `'${directory}' does not exist or is not a directory.`
156322
- }
156323
- ]
156324
- };
156325
- }
156326
- identifiers.set(directory, nanoid());
156327
- if (!buildOutputDirectory) {
156328
- console.warn(
156329
- "You're attempting to import static assets as part of your Pages Functions, but have not specified a directory in which to put them. You must use 'wrangler pages dev <directory>' rather than 'wrangler pages dev -- <command>' to import static assets in Functions."
156330
- );
156331
- }
156332
- return { path: directory, namespace: "assets" };
156333
- });
156334
- pluginBuild.onLoad(
156335
- { filter: /.*/, namespace: "assets" },
156336
- async (args) => {
156337
- const identifier = identifiers.get(args.path);
156338
- if (buildOutputDirectory) {
156339
- const staticAssetsOutputDirectory = (0, import_node_path25.join)(
156340
- buildOutputDirectory,
156341
- "cdn-cgi",
156342
- "pages-plugins",
156343
- identifier
156309
+ define: {
156310
+ __FALLBACK_SERVICE__: JSON.stringify(fallbackService)
156311
+ },
156312
+ betaD1Shims: (betaD1Shims || []).map(
156313
+ (binding) => `${D1_BETA_PREFIX}${binding}`
156314
+ ),
156315
+ plugins: [
156316
+ {
156317
+ name: "wrangler notifier and monitor",
156318
+ setup(pluginBuild) {
156319
+ pluginBuild.onEnd((result) => {
156320
+ if (result.errors.length > 0) {
156321
+ console.error(
156322
+ `${result.errors.length} error(s) and ${result.warnings.length} warning(s) when compiling Worker.`
156344
156323
  );
156345
- await (0, import_promises11.rm)(staticAssetsOutputDirectory, {
156346
- force: true,
156347
- recursive: true
156348
- });
156349
- await (0, import_promises11.cp)(args.path, staticAssetsOutputDirectory, {
156350
- force: true,
156351
- recursive: true
156352
- });
156324
+ } else if (result.warnings.length > 0) {
156325
+ console.warn(
156326
+ `${result.warnings.length} warning(s) when compiling Worker.`
156327
+ );
156328
+ onEnd();
156329
+ } else {
156330
+ console.log("Compiled Worker successfully.");
156331
+ onEnd();
156332
+ }
156333
+ });
156334
+ }
156335
+ },
156336
+ {
156337
+ name: "Assets",
156338
+ setup(pluginBuild) {
156339
+ const identifiers = /* @__PURE__ */ new Map();
156340
+ pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
156341
+ const directory = (0, import_node_path25.resolve)(
156342
+ args.resolveDir,
156343
+ args.path.slice("assets:".length)
156344
+ );
156345
+ const exists = await (0, import_promises11.access)(directory).then(() => true).catch(() => false);
156346
+ const isDirectory2 = exists && (await (0, import_promises11.lstat)(directory)).isDirectory();
156347
+ if (!isDirectory2) {
156353
156348
  return {
156354
- contents: `export const onRequest = ({ request, env, functionPath }) => {
156349
+ errors: [
156350
+ {
156351
+ text: `'${directory}' does not exist or is not a directory.`
156352
+ }
156353
+ ]
156354
+ };
156355
+ }
156356
+ identifiers.set(directory, nanoid());
156357
+ if (!buildOutputDirectory) {
156358
+ console.warn(
156359
+ "You're attempting to import static assets as part of your Pages Functions, but have not specified a directory in which to put them. You must use 'wrangler pages dev <directory>' rather than 'wrangler pages dev -- <command>' to import static assets in Functions."
156360
+ );
156361
+ }
156362
+ return { path: directory, namespace: "assets" };
156363
+ });
156364
+ pluginBuild.onLoad(
156365
+ { filter: /.*/, namespace: "assets" },
156366
+ async (args) => {
156367
+ const identifier = identifiers.get(args.path);
156368
+ if (buildOutputDirectory) {
156369
+ const staticAssetsOutputDirectory = (0, import_node_path25.join)(
156370
+ buildOutputDirectory,
156371
+ "cdn-cgi",
156372
+ "pages-plugins",
156373
+ identifier
156374
+ );
156375
+ await (0, import_promises11.rm)(staticAssetsOutputDirectory, {
156376
+ force: true,
156377
+ recursive: true
156378
+ });
156379
+ await (0, import_promises11.cp)(args.path, staticAssetsOutputDirectory, {
156380
+ force: true,
156381
+ recursive: true
156382
+ });
156383
+ return {
156384
+ contents: `export const onRequest = ({ request, env, functionPath }) => {
156355
156385
  const url = new URL(request.url)
156356
156386
  const relativePathname = \`/\${url.pathname.split(functionPath)[1] || ''}\`.replace(/^\\/\\//, '/');
156357
156387
  url.pathname = '/cdn-cgi/pages-plugins/${identifier}' + relativePathname
156358
156388
  request = new Request(url.toString(), request)
156359
156389
  return env.ASSETS.fetch(request)
156360
156390
  }`
156361
- };
156391
+ };
156392
+ }
156362
156393
  }
156363
- }
156364
- );
156394
+ );
156395
+ }
156365
156396
  }
156366
- },
156367
- ...nodeCompat ? [
156368
- (0, import_node_globals_polyfill3.default)({
156369
- buffer: true
156370
- }),
156371
- (0, import_node_modules_polyfill3.default)()
156372
- ] : []
156373
- ]
156374
- });
156397
+ ],
156398
+ isOutfile: true,
156399
+ serveAssetsFromWorker: false,
156400
+ disableModuleCollection: true,
156401
+ rules: [],
156402
+ checkFetch: local,
156403
+ targetConsumer: local ? "dev" : "publish",
156404
+ local
156405
+ }
156406
+ );
156375
156407
  }
156376
156408
 
156377
156409
  // src/pages/functions/filepath-routing.ts
156378
156410
  init_import_meta_url();
156379
156411
  var import_promises12 = __toESM(require("node:fs/promises"));
156380
156412
  var import_node_path26 = __toESM(require("node:path"));
156381
- var import_esbuild5 = require("esbuild");
156413
+ var import_esbuild3 = require("esbuild");
156382
156414
  async function generateConfigFromFileTree({
156383
156415
  baseDir,
156384
156416
  baseURL
@@ -156393,7 +156425,7 @@ async function generateConfigFromFileTree({
156393
156425
  await forEachFile(baseDir, async (filepath) => {
156394
156426
  const ext = import_node_path26.default.extname(filepath);
156395
156427
  if (/^\.(mjs|js|ts|tsx|jsx)$/.test(ext)) {
156396
- const { metafile } = await (0, import_esbuild5.build)({
156428
+ const { metafile } = await (0, import_esbuild3.build)({
156397
156429
  metafile: true,
156398
156430
  write: false,
156399
156431
  bundle: false,
@@ -156825,6 +156857,12 @@ function Options5(yargs) {
156825
156857
  default: false,
156826
156858
  type: "boolean",
156827
156859
  hidden: true
156860
+ },
156861
+ bindings: {
156862
+ type: "string",
156863
+ describe: "Bindings used in Functions (used to register beta product shims)",
156864
+ deprecated: true,
156865
+ hidden: true
156828
156866
  }
156829
156867
  }).epilogue(pagesBetaWarning);
156830
156868
  }
@@ -156839,7 +156877,8 @@ var Handler5 = async ({
156839
156877
  watch: watch5,
156840
156878
  plugin,
156841
156879
  buildOutputDirectory,
156842
- nodeCompat
156880
+ nodeCompat,
156881
+ bindings
156843
156882
  }) => {
156844
156883
  if (!isInPagesCI) {
156845
156884
  logger.log(pagesBetaWarning);
@@ -156849,6 +156888,15 @@ var Handler5 = async ({
156849
156888
  "Enabling node.js compatibility mode for builtins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details."
156850
156889
  );
156851
156890
  }
156891
+ let d1Databases = void 0;
156892
+ if (bindings) {
156893
+ try {
156894
+ const decodedBindings = JSON.parse(bindings);
156895
+ d1Databases = Object.keys(decodedBindings?.d1_databases || {});
156896
+ } catch {
156897
+ throw new FatalError("Could not parse a valid set of 'bindings'.", 1);
156898
+ }
156899
+ }
156852
156900
  buildOutputDirectory ??= (0, import_node_path29.dirname)(outfile);
156853
156901
  try {
156854
156902
  await buildFunctions({
@@ -156862,7 +156910,9 @@ var Handler5 = async ({
156862
156910
  plugin,
156863
156911
  buildOutputDirectory,
156864
156912
  nodeCompat,
156865
- routesOutputPath
156913
+ routesOutputPath,
156914
+ local: false,
156915
+ d1Databases
156866
156916
  });
156867
156917
  } catch (e2) {
156868
156918
  if (e2 instanceof FunctionsNoRoutesError) {
@@ -156888,7 +156938,9 @@ async function buildFunctions({
156888
156938
  plugin = false,
156889
156939
  buildOutputDirectory,
156890
156940
  routesOutputPath,
156891
- nodeCompat
156941
+ nodeCompat,
156942
+ local,
156943
+ d1Databases
156892
156944
  }) {
156893
156945
  RUNNING_BUILDERS.forEach(
156894
156946
  (runningBuilder) => runningBuilder.stop && runningBuilder.stop()
@@ -156919,6 +156971,7 @@ async function buildFunctions({
156919
156971
  srcDir: functionsDirectory,
156920
156972
  outfile: routesModule
156921
156973
  });
156974
+ const absoluteFunctionsDirectory = (0, import_node_path29.resolve)(functionsDirectory);
156922
156975
  if (plugin) {
156923
156976
  RUNNING_BUILDERS.push(
156924
156977
  await buildPlugin({
@@ -156928,6 +156981,9 @@ async function buildFunctions({
156928
156981
  sourcemap,
156929
156982
  watch: watch5,
156930
156983
  nodeCompat,
156984
+ functionsDirectory: absoluteFunctionsDirectory,
156985
+ local,
156986
+ betaD1Shims: d1Databases,
156931
156987
  onEnd
156932
156988
  })
156933
156989
  );
@@ -156940,6 +156996,9 @@ async function buildFunctions({
156940
156996
  sourcemap,
156941
156997
  fallbackService,
156942
156998
  watch: watch5,
156999
+ functionsDirectory: absoluteFunctionsDirectory,
157000
+ local,
157001
+ betaD1Shims: d1Databases,
156943
157002
  onEnd,
156944
157003
  buildOutputDirectory,
156945
157004
  nodeCompat
@@ -157100,7 +157159,7 @@ async function ListHandler3({ projectName }) {
157100
157159
  const isInteractive2 = process.stdin.isTTY;
157101
157160
  if (!projectName && isInteractive2) {
157102
157161
  const projects = await listProjects({ accountId });
157103
- projectName = await new Promise((resolve14) => {
157162
+ projectName = await new Promise((resolve15) => {
157104
157163
  const { unmount: unmount2 } = (0, import_ink11.render)(
157105
157164
  /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_ink11.Text, null, "Select a project:"), /* @__PURE__ */ import_react15.default.createElement(import_ink_select_input3.default, {
157106
157165
  items: projects.map((project) => ({
@@ -157109,7 +157168,7 @@ async function ListHandler3({ projectName }) {
157109
157168
  value: project
157110
157169
  })),
157111
157170
  onSelect: async (selected) => {
157112
- resolve14(selected.value.name);
157171
+ resolve15(selected.value.name);
157113
157172
  unmount2();
157114
157173
  }
157115
157174
  }))
@@ -157363,6 +157422,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157363
157422
  await esbuild3.build({
157364
157423
  entryPoints: [scriptPath],
157365
157424
  write: false,
157425
+ bundle: true,
157366
157426
  plugins: [blockWorkerJsImports]
157367
157427
  });
157368
157428
  } catch {
@@ -157376,7 +157436,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157376
157436
  await runBuild();
157377
157437
  });
157378
157438
  } else if (usingFunctions) {
157379
- const outfile = (0, import_node_path30.join)((0, import_node_os12.tmpdir)(), `./functionsWorker-${Math.random()}.js`);
157439
+ const outfile = (0, import_node_path30.join)((0, import_node_os12.tmpdir)(), `./functionsWorker-${Math.random()}.mjs`);
157380
157440
  scriptPath = outfile;
157381
157441
  if (nodeCompat) {
157382
157442
  console.warn(
@@ -157393,7 +157453,9 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157393
157453
  watch: true,
157394
157454
  onEnd,
157395
157455
  buildOutputDirectory: directory,
157396
- nodeCompat
157456
+ nodeCompat,
157457
+ local: true,
157458
+ d1Databases: d1s.map((binding) => binding.toString())
157397
157459
  });
157398
157460
  await sendMetricsEvent("build pages functions");
157399
157461
  (0, import_chokidar3.watch)([functionsDirectory], {
@@ -157408,7 +157470,9 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157408
157470
  watch: true,
157409
157471
  onEnd,
157410
157472
  buildOutputDirectory: directory,
157411
- nodeCompat
157473
+ nodeCompat,
157474
+ local: true,
157475
+ d1Databases: d1s.map((binding) => binding.toString())
157412
157476
  });
157413
157477
  await sendMetricsEvent("build pages functions");
157414
157478
  } catch (e2) {
@@ -157535,8 +157599,8 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157535
157599
  vars: Object.fromEntries(
157536
157600
  bindings.map((binding) => binding.toString().split("=")).map(([key2, ...values]) => [key2, values.join("=")])
157537
157601
  ),
157538
- kv: kvs.map((val) => ({
157539
- binding: val.toString(),
157602
+ kv: kvs.map((binding) => ({
157603
+ binding: binding.toString(),
157540
157604
  id: ""
157541
157605
  })),
157542
157606
  durableObjects: durableObjects.map((durableObject) => {
@@ -157570,7 +157634,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
157570
157634
  persist,
157571
157635
  persistTo,
157572
157636
  showInteractiveDevSession: void 0,
157573
- inspect: true,
157637
+ inspect: void 0,
157574
157638
  logPrefix: "pages",
157575
157639
  logLevel: logLevel ?? "warn"
157576
157640
  },
@@ -157693,13 +157757,18 @@ async function spawnProxyProcess({
157693
157757
  }
157694
157758
  var blockWorkerJsImports = {
157695
157759
  name: "block-worker-js-imports",
157696
- setup(build7) {
157697
- build7.onResolve({ filter: /.*/g }, (_args) => {
157760
+ setup(build5) {
157761
+ build5.onResolve({ filter: /.*/g }, (args) => {
157762
+ if (args.kind === "entry-point") {
157763
+ return {
157764
+ path: args.path
157765
+ };
157766
+ }
157698
157767
  logger.error(
157699
157768
  `_worker.js is importing from another file. This will throw an error if deployed.
157700
157769
  You should bundle your Worker or remove the import if it is unused.`
157701
157770
  );
157702
- return null;
157771
+ process.exit(1);
157703
157772
  });
157704
157773
  }
157705
157774
  };
@@ -157798,12 +157867,12 @@ var TimeoutError = class extends Error {
157798
157867
  };
157799
157868
  function pTimeout(promise, milliseconds, fallback, options6) {
157800
157869
  let timer;
157801
- const cancelablePromise = new Promise((resolve14, reject) => {
157870
+ const cancelablePromise = new Promise((resolve15, reject) => {
157802
157871
  if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
157803
157872
  throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
157804
157873
  }
157805
157874
  if (milliseconds === Number.POSITIVE_INFINITY) {
157806
- resolve14(promise);
157875
+ resolve15(promise);
157807
157876
  return;
157808
157877
  }
157809
157878
  options6 = {
@@ -157813,7 +157882,7 @@ function pTimeout(promise, milliseconds, fallback, options6) {
157813
157882
  timer = options6.customTimers.setTimeout.call(void 0, () => {
157814
157883
  if (typeof fallback === "function") {
157815
157884
  try {
157816
- resolve14(fallback());
157885
+ resolve15(fallback());
157817
157886
  } catch (error) {
157818
157887
  reject(error);
157819
157888
  }
@@ -157828,7 +157897,7 @@ function pTimeout(promise, milliseconds, fallback, options6) {
157828
157897
  }, milliseconds);
157829
157898
  (async () => {
157830
157899
  try {
157831
- resolve14(await promise);
157900
+ resolve15(await promise);
157832
157901
  } catch (error) {
157833
157902
  reject(error);
157834
157903
  } finally {
@@ -158015,7 +158084,7 @@ var PQueue = class extends import_eventemitter3.default {
158015
158084
  __classPrivateFieldGet3(this, _PQueue_instances, "m", _PQueue_processQueue).call(this);
158016
158085
  }
158017
158086
  async add(fn, options6 = {}) {
158018
- return new Promise((resolve14, reject) => {
158087
+ return new Promise((resolve15, reject) => {
158019
158088
  const run2 = async () => {
158020
158089
  var _a2;
158021
158090
  var _b, _c;
@@ -158033,7 +158102,7 @@ var PQueue = class extends import_eventemitter3.default {
158033
158102
  return void 0;
158034
158103
  });
158035
158104
  const result = await operation;
158036
- resolve14(result);
158105
+ resolve15(result);
158037
158106
  this.emit("completed", result);
158038
158107
  } catch (error) {
158039
158108
  reject(error);
@@ -158067,11 +158136,11 @@ var PQueue = class extends import_eventemitter3.default {
158067
158136
  if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size === 0) {
158068
158137
  return;
158069
158138
  }
158070
- return new Promise((resolve14) => {
158139
+ return new Promise((resolve15) => {
158071
158140
  const existingResolve = __classPrivateFieldGet3(this, _PQueue_resolveEmpty, "f");
158072
158141
  __classPrivateFieldSet2(this, _PQueue_resolveEmpty, () => {
158073
158142
  existingResolve();
158074
- resolve14();
158143
+ resolve15();
158075
158144
  }, "f");
158076
158145
  });
158077
158146
  }
@@ -158079,11 +158148,11 @@ var PQueue = class extends import_eventemitter3.default {
158079
158148
  if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size < limit) {
158080
158149
  return;
158081
158150
  }
158082
- return new Promise((resolve14) => {
158151
+ return new Promise((resolve15) => {
158083
158152
  const listener = () => {
158084
158153
  if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size < limit) {
158085
158154
  this.removeListener("next", listener);
158086
- resolve14();
158155
+ resolve15();
158087
158156
  }
158088
158157
  };
158089
158158
  this.on("next", listener);
@@ -158093,11 +158162,11 @@ var PQueue = class extends import_eventemitter3.default {
158093
158162
  if (__classPrivateFieldGet3(this, _PQueue_pendingCount, "f") === 0 && __classPrivateFieldGet3(this, _PQueue_queue, "f").size === 0) {
158094
158163
  return;
158095
158164
  }
158096
- return new Promise((resolve14) => {
158165
+ return new Promise((resolve15) => {
158097
158166
  const existingResolve = __classPrivateFieldGet3(this, _PQueue_resolveIdle, "f");
158098
158167
  __classPrivateFieldSet2(this, _PQueue_resolveIdle, () => {
158099
158168
  existingResolve();
158100
- resolve14();
158169
+ resolve15();
158101
158170
  }, "f");
158102
158171
  });
158103
158172
  }
@@ -158571,11 +158640,11 @@ var Handler8 = async ({
158571
158640
  const isInteractive2 = process.stdin.isTTY;
158572
158641
  if (!projectName && isInteractive2) {
158573
158642
  const projects = (await listProjects({ accountId })).filter(
158574
- (project) => !project.source
158643
+ (project2) => !project2.source
158575
158644
  );
158576
158645
  let existingOrNew = "new";
158577
158646
  if (projects.length > 0) {
158578
- existingOrNew = await new Promise((resolve14) => {
158647
+ existingOrNew = await new Promise((resolve15) => {
158579
158648
  const { unmount } = (0, import_ink13.render)(
158580
158649
  /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(import_ink13.Text, null, "No project selected. Would you like to create one or use an existing project?"), /* @__PURE__ */ import_react17.default.createElement(import_ink_select_input4.default, {
158581
158650
  items: [
@@ -158591,7 +158660,7 @@ var Handler8 = async ({
158591
158660
  }
158592
158661
  ],
158593
158662
  onSelect: async (selected) => {
158594
- resolve14(selected.value);
158663
+ resolve15(selected.value);
158595
158664
  unmount();
158596
158665
  }
158597
158666
  }))
@@ -158600,16 +158669,16 @@ var Handler8 = async ({
158600
158669
  }
158601
158670
  switch (existingOrNew) {
158602
158671
  case "existing": {
158603
- projectName = await new Promise((resolve14) => {
158672
+ projectName = await new Promise((resolve15) => {
158604
158673
  const { unmount } = (0, import_ink13.render)(
158605
158674
  /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(import_ink13.Text, null, "Select a project:"), /* @__PURE__ */ import_react17.default.createElement(import_ink_select_input4.default, {
158606
- items: projects.map((project) => ({
158607
- key: project.name,
158608
- label: project.name,
158609
- value: project
158675
+ items: projects.map((project2) => ({
158676
+ key: project2.name,
158677
+ label: project2.name,
158678
+ value: project2
158610
158679
  })),
158611
158680
  onSelect: async (selected) => {
158612
- resolve14(selected.value.name);
158681
+ resolve15(selected.value.name);
158613
158682
  unmount();
158614
158683
  }
158615
158684
  }))
@@ -158710,6 +158779,13 @@ To silence this warning, pass in --commit-dirty=true`
158710
158779
  _workerJS = (0, import_node_fs18.readFileSync)((0, import_node_path34.join)(directory, "_worker.js"), "utf-8");
158711
158780
  } catch {
158712
158781
  }
158782
+ const project = await fetchResult(
158783
+ `/accounts/${accountId}/pages/projects/${projectName}`
158784
+ );
158785
+ let isProduction = true;
158786
+ if (branch) {
158787
+ isProduction = project.production_branch === branch;
158788
+ }
158713
158789
  let builtFunctions = void 0;
158714
158790
  const functionsDirectory = (0, import_node_path34.join)((0, import_node_process7.cwd)(), "functions");
158715
158791
  const routesOutputPath = !(0, import_node_fs18.existsSync)((0, import_node_path34.join)(directory, "_routes.json")) ? (0, import_node_path34.join)((0, import_node_os13.tmpdir)(), `_routes-${Math.random()}.json`) : void 0;
@@ -158722,7 +158798,11 @@ To silence this warning, pass in --commit-dirty=true`
158722
158798
  onEnd: () => {
158723
158799
  },
158724
158800
  buildOutputDirectory: (0, import_node_path34.dirname)(outfile),
158725
- routesOutputPath
158801
+ routesOutputPath,
158802
+ local: false,
158803
+ d1Databases: Object.keys(
158804
+ project.deployment_configs[isProduction ? "production" : "preview"].d1_databases ?? {}
158805
+ )
158726
158806
  });
158727
158807
  builtFunctions = (0, import_node_fs18.readFileSync)(outfile, "utf-8");
158728
158808
  } catch (e2) {
@@ -159151,7 +159231,7 @@ ${onboardingLink}`);
159151
159231
 
159152
159232
  // src/publish/publish.ts
159153
159233
  function sleep3(ms) {
159154
- return new Promise((resolve14) => setTimeout(resolve14, ms));
159234
+ return new Promise((resolve15) => setTimeout(resolve15, ms));
159155
159235
  }
159156
159236
  var scriptStartupErrorRegex = /startup/i;
159157
159237
  function errIsScriptSizeOrStartupErr(err2) {
@@ -159674,8 +159754,9 @@ ${dashLink}`);
159674
159754
  logger.log("Current Deployment ID:", deploymentsList.latest.id);
159675
159755
  } catch (e2) {
159676
159756
  if (e2.code === 10023) {
159757
+ } else {
159758
+ throw e2;
159677
159759
  }
159678
- throw e2;
159679
159760
  }
159680
159761
  }
159681
159762
  function formatTime2(duration) {
@@ -159798,7 +159879,7 @@ async function ensureQueuesExist(config) {
159798
159879
  await getQueue(config, queue);
159799
159880
  } catch (err2) {
159800
159881
  const queueErr = err2;
159801
- if (queueErr.code === 100123) {
159882
+ if (queueErr.code === 11e3) {
159802
159883
  throw new Error(
159803
159884
  `Queue "${queue}" does not exist. To create it, run: wrangler queues create ${queue}`
159804
159885
  );
@@ -160800,6 +160881,10 @@ init_import_meta_url();
160800
160881
  var fs13 = __toESM(require("node:fs"));
160801
160882
  var stream = __toESM(require("node:stream"));
160802
160883
 
160884
+ // src/r2/constants.ts
160885
+ init_import_meta_url();
160886
+ var MAX_UPLOAD_SIZE = 300 * 1024 * 1024;
160887
+
160803
160888
  // src/r2/helpers.ts
160804
160889
  init_import_meta_url();
160805
160890
  var import_node_stream = require("node:stream");
@@ -160908,9 +160993,9 @@ var r2 = (r2Yargs) => {
160908
160993
  }
160909
160994
  const input = await getR2Object(accountId, bucket, key2);
160910
160995
  const output = file ? fs13.createWriteStream(file) : process.stdout;
160911
- await new Promise((resolve14, reject) => {
160996
+ await new Promise((resolve15, reject) => {
160912
160997
  stream.pipeline(input, output, (err2) => {
160913
- err2 ? reject(err2) : resolve14();
160998
+ err2 ? reject(err2) : resolve15();
160914
160999
  });
160915
161000
  });
160916
161001
  if (!pipe)
@@ -160987,11 +161072,11 @@ var r2 = (r2Yargs) => {
160987
161072
  const stats = fs13.statSync(file);
160988
161073
  objectSize = stats.size;
160989
161074
  } else {
160990
- object = await new Promise((resolve14, reject) => {
161075
+ object = await new Promise((resolve15, reject) => {
160991
161076
  const stdin = process.stdin;
160992
161077
  const chunks = Array();
160993
161078
  stdin.on("data", (chunk) => chunks.push(chunk));
160994
- stdin.on("end", () => resolve14(Buffer.concat(chunks)));
161079
+ stdin.on("end", () => resolve15(Buffer.concat(chunks)));
160995
161080
  stdin.on(
160996
161081
  "error",
160997
161082
  (err2) => reject(
@@ -161003,6 +161088,15 @@ var r2 = (r2Yargs) => {
161003
161088
  });
161004
161089
  objectSize = object.byteLength;
161005
161090
  }
161091
+ if (objectSize > MAX_UPLOAD_SIZE) {
161092
+ throw new FatalError(
161093
+ `Error: Wrangler only supports uploading files up to ${prettyBytes(
161094
+ MAX_UPLOAD_SIZE
161095
+ )} in size
161096
+ ${key2} is ${prettyBytes(objectSize)} in size`,
161097
+ 1
161098
+ );
161099
+ }
161006
161100
  logger.log(`Creating object "${key2}" in bucket "${bucket}".`);
161007
161101
  await putR2Object(accountId, bucket, key2, object, {
161008
161102
  ...options6,
@@ -161272,7 +161366,7 @@ function trimTrailingWhitespace(str) {
161272
161366
  return str.trimEnd();
161273
161367
  }
161274
161368
  function readFromStdin() {
161275
- return new Promise((resolve14, reject) => {
161369
+ return new Promise((resolve15, reject) => {
161276
161370
  const stdin = process.stdin;
161277
161371
  const chunks = [];
161278
161372
  stdin.on("readable", () => {
@@ -161282,7 +161376,7 @@ function readFromStdin() {
161282
161376
  }
161283
161377
  });
161284
161378
  stdin.on("end", () => {
161285
- resolve14(chunks.join(""));
161379
+ resolve15(chunks.join(""));
161286
161380
  });
161287
161381
  stdin.on("error", (err2) => {
161288
161382
  reject(err2);
@@ -161705,7 +161799,7 @@ async function generateTypes(configToDTS, config) {
161705
161799
  for (const varName in configToDTS.vars) {
161706
161800
  const varValue = configToDTS.vars[varName];
161707
161801
  if (typeof varValue === "string" || typeof varValue === "number" || typeof varValue === "boolean") {
161708
- envTypeStructure.push(` ${varName}: ${varValue};`);
161802
+ envTypeStructure.push(` ${varName}: "${varValue}";`);
161709
161803
  }
161710
161804
  if (typeof varValue === "object" && varValue !== null) {
161711
161805
  envTypeStructure.push(` ${varName}: ${JSON.stringify(varValue)};`);
@@ -162951,7 +163045,7 @@ unstable_dev()'s behaviour will likely change in future releases`
162951
163045
  let readyPort;
162952
163046
  let readyAddress;
162953
163047
  if (testMode) {
162954
- return new Promise((resolve14) => {
163048
+ return new Promise((resolve15) => {
162955
163049
  return new Promise((ready) => {
162956
163050
  const devServer = startApiDev({
162957
163051
  script,
@@ -162970,7 +163064,7 @@ unstable_dev()'s behaviour will likely change in future releases`
162970
163064
  }
162971
163065
  });
162972
163066
  }).then((devServer) => {
162973
- resolve14({
163067
+ resolve15({
162974
163068
  port: readyPort,
162975
163069
  address: readyAddress,
162976
163070
  stop: devServer.stop,
@@ -162992,7 +163086,7 @@ unstable_dev()'s behaviour will likely change in future releases`
162992
163086
  });
162993
163087
  });
162994
163088
  } else {
162995
- return new Promise((resolve14) => {
163089
+ return new Promise((resolve15) => {
162996
163090
  return new Promise((ready) => {
162997
163091
  const devServer = startDev({
162998
163092
  script,
@@ -163009,7 +163103,7 @@ unstable_dev()'s behaviour will likely change in future releases`
163009
163103
  }
163010
163104
  });
163011
163105
  }).then((devServer) => {
163012
- resolve14({
163106
+ resolve15({
163013
163107
  port: readyPort,
163014
163108
  address: readyAddress,
163015
163109
  stop: devServer.stop,