wrangler 3.114.7 → 3.114.8

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.
@@ -6990,7 +6990,7 @@ var require_client = __commonJS({
6990
6990
  resume(client);
6991
6991
  }
6992
6992
  __name(onHTTP2GoAway, "onHTTP2GoAway");
6993
- var constants3 = require_constants3();
6993
+ var constants4 = require_constants3();
6994
6994
  var createRedirectInterceptor = require_redirectInterceptor();
6995
6995
  var EMPTY_BUF = Buffer.alloc(0);
6996
6996
  async function lazyllhttp() {
@@ -7058,7 +7058,7 @@ var require_client = __commonJS({
7058
7058
  constructor(client, socket, { exports: exports3 }) {
7059
7059
  assert38(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
7060
7060
  this.llhttp = exports3;
7061
- this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
7061
+ this.ptr = this.llhttp.llhttp_alloc(constants4.TYPE.RESPONSE);
7062
7062
  this.client = client;
7063
7063
  this.socket = socket;
7064
7064
  this.timeout = null;
@@ -7150,19 +7150,19 @@ var require_client = __commonJS({
7150
7150
  currentBufferRef = null;
7151
7151
  }
7152
7152
  const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
7153
- if (ret === constants3.ERROR.PAUSED_UPGRADE) {
7153
+ if (ret === constants4.ERROR.PAUSED_UPGRADE) {
7154
7154
  this.onUpgrade(data.slice(offset));
7155
- } else if (ret === constants3.ERROR.PAUSED) {
7155
+ } else if (ret === constants4.ERROR.PAUSED) {
7156
7156
  this.paused = true;
7157
7157
  socket.unshift(data.slice(offset));
7158
- } else if (ret !== constants3.ERROR.OK) {
7158
+ } else if (ret !== constants4.ERROR.OK) {
7159
7159
  const ptr = llhttp.llhttp_get_error_reason(this.ptr);
7160
7160
  let message = "";
7161
7161
  if (ptr) {
7162
7162
  const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
7163
7163
  message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
7164
7164
  }
7165
- throw new HTTPParserError(message, constants3.ERROR[ret], data.slice(offset));
7165
+ throw new HTTPParserError(message, constants4.ERROR[ret], data.slice(offset));
7166
7166
  }
7167
7167
  } catch (err) {
7168
7168
  util5.destroy(socket, err);
@@ -7332,7 +7332,7 @@ var require_client = __commonJS({
7332
7332
  socket[kBlocking] = false;
7333
7333
  resume(client);
7334
7334
  }
7335
- return pause ? constants3.ERROR.PAUSED : 0;
7335
+ return pause ? constants4.ERROR.PAUSED : 0;
7336
7336
  }
7337
7337
  onBody(buf) {
7338
7338
  const { client, socket, statusCode, maxResponseSize } = this;
@@ -7354,7 +7354,7 @@ var require_client = __commonJS({
7354
7354
  }
7355
7355
  this.bytesRead += buf.length;
7356
7356
  if (request4.onData(buf) === false) {
7357
- return constants3.ERROR.PAUSED;
7357
+ return constants4.ERROR.PAUSED;
7358
7358
  }
7359
7359
  }
7360
7360
  onMessageComplete() {
@@ -7389,13 +7389,13 @@ var require_client = __commonJS({
7389
7389
  if (socket[kWriting]) {
7390
7390
  assert38.strictEqual(client[kRunning], 0);
7391
7391
  util5.destroy(socket, new InformationalError("reset"));
7392
- return constants3.ERROR.PAUSED;
7392
+ return constants4.ERROR.PAUSED;
7393
7393
  } else if (!shouldKeepAlive) {
7394
7394
  util5.destroy(socket, new InformationalError("reset"));
7395
- return constants3.ERROR.PAUSED;
7395
+ return constants4.ERROR.PAUSED;
7396
7396
  } else if (socket[kReset2] && client[kRunning] === 0) {
7397
7397
  util5.destroy(socket, new InformationalError("reset"));
7398
- return constants3.ERROR.PAUSED;
7398
+ return constants4.ERROR.PAUSED;
7399
7399
  } else if (client[kPipelining] === 1) {
7400
7400
  setImmediate(resume, client);
7401
7401
  } else {
@@ -29722,9 +29722,9 @@ var require_async = __commonJS({
29722
29722
  ];
29723
29723
  }, "defaultPaths");
29724
29724
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb2) {
29725
- fs27.stat(file, function(err, stat8) {
29725
+ fs27.stat(file, function(err, stat9) {
29726
29726
  if (!err) {
29727
- return cb2(null, stat8.isFile() || stat8.isFIFO());
29727
+ return cb2(null, stat9.isFile() || stat9.isFIFO());
29728
29728
  }
29729
29729
  if (err.code === "ENOENT" || err.code === "ENOTDIR")
29730
29730
  return cb2(null, false);
@@ -29732,9 +29732,9 @@ var require_async = __commonJS({
29732
29732
  });
29733
29733
  }, "isFile");
29734
29734
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb2) {
29735
- fs27.stat(dir, function(err, stat8) {
29735
+ fs27.stat(dir, function(err, stat9) {
29736
29736
  if (!err) {
29737
- return cb2(null, stat8.isDirectory());
29737
+ return cb2(null, stat9.isDirectory());
29738
29738
  }
29739
29739
  if (err.code === "ENOENT" || err.code === "ENOTDIR")
29740
29740
  return cb2(null, false);
@@ -30268,23 +30268,23 @@ var require_sync = __commonJS({
30268
30268
  }, "defaultPaths");
30269
30269
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
30270
30270
  try {
30271
- var stat8 = fs27.statSync(file, { throwIfNoEntry: false });
30271
+ var stat9 = fs27.statSync(file, { throwIfNoEntry: false });
30272
30272
  } catch (e7) {
30273
30273
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
30274
30274
  return false;
30275
30275
  throw e7;
30276
30276
  }
30277
- return !!stat8 && (stat8.isFile() || stat8.isFIFO());
30277
+ return !!stat9 && (stat9.isFile() || stat9.isFIFO());
30278
30278
  }, "isFile");
30279
30279
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
30280
30280
  try {
30281
- var stat8 = fs27.statSync(dir, { throwIfNoEntry: false });
30281
+ var stat9 = fs27.statSync(dir, { throwIfNoEntry: false });
30282
30282
  } catch (e7) {
30283
30283
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
30284
30284
  return false;
30285
30285
  throw e7;
30286
30286
  }
30287
- return !!stat8 && stat8.isDirectory();
30287
+ return !!stat9 && stat9.isDirectory();
30288
30288
  }, "isDirectory");
30289
30289
  var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync4(x6) {
30290
30290
  try {
@@ -53952,16 +53952,16 @@ var require_windows = __commonJS({
53952
53952
  return false;
53953
53953
  }
53954
53954
  __name(checkPathExt, "checkPathExt");
53955
- function checkStat(stat8, path72, options32) {
53956
- if (!stat8.isSymbolicLink() && !stat8.isFile()) {
53955
+ function checkStat(stat9, path72, options32) {
53956
+ if (!stat9.isSymbolicLink() && !stat9.isFile()) {
53957
53957
  return false;
53958
53958
  }
53959
53959
  return checkPathExt(path72, options32);
53960
53960
  }
53961
53961
  __name(checkStat, "checkStat");
53962
53962
  function isexe(path72, options32, cb2) {
53963
- fs27.stat(path72, function(er, stat8) {
53964
- cb2(er, er ? false : checkStat(stat8, path72, options32));
53963
+ fs27.stat(path72, function(er, stat9) {
53964
+ cb2(er, er ? false : checkStat(stat9, path72, options32));
53965
53965
  });
53966
53966
  }
53967
53967
  __name(isexe, "isexe");
@@ -53980,8 +53980,8 @@ var require_mode = __commonJS({
53980
53980
  isexe.sync = sync;
53981
53981
  var fs27 = require("fs");
53982
53982
  function isexe(path72, options32, cb2) {
53983
- fs27.stat(path72, function(er, stat8) {
53984
- cb2(er, er ? false : checkStat(stat8, options32));
53983
+ fs27.stat(path72, function(er, stat9) {
53984
+ cb2(er, er ? false : checkStat(stat9, options32));
53985
53985
  });
53986
53986
  }
53987
53987
  __name(isexe, "isexe");
@@ -53989,14 +53989,14 @@ var require_mode = __commonJS({
53989
53989
  return checkStat(fs27.statSync(path72), options32);
53990
53990
  }
53991
53991
  __name(sync, "sync");
53992
- function checkStat(stat8, options32) {
53993
- return stat8.isFile() && checkMode(stat8, options32);
53992
+ function checkStat(stat9, options32) {
53993
+ return stat9.isFile() && checkMode(stat9, options32);
53994
53994
  }
53995
53995
  __name(checkStat, "checkStat");
53996
- function checkMode(stat8, options32) {
53997
- var mod = stat8.mode;
53998
- var uid = stat8.uid;
53999
- var gid = stat8.gid;
53996
+ function checkMode(stat9, options32) {
53997
+ var mod = stat9.mode;
53998
+ var uid = stat9.uid;
53999
+ var gid = stat9.gid;
54000
54000
  var myUid = options32.uid !== void 0 ? options32.uid : process.getuid && process.getuid();
54001
54001
  var myGid = options32.gid !== void 0 ? options32.gid : process.getgid && process.getgid();
54002
54002
  var u5 = parseInt("100", 8);
@@ -54618,14 +54618,14 @@ var require_command_exists = __commonJS({
54618
54618
  var execSync4 = require("child_process").execSync;
54619
54619
  var fs27 = require("fs");
54620
54620
  var path72 = require("path");
54621
- var access3 = fs27.access;
54621
+ var access4 = fs27.access;
54622
54622
  var accessSync = fs27.accessSync;
54623
- var constants3 = fs27.constants || fs27;
54623
+ var constants4 = fs27.constants || fs27;
54624
54624
  var isUsingWindows = process.platform == "win32";
54625
54625
  var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
54626
- access3(
54626
+ access4(
54627
54627
  commandName,
54628
- constants3.F_OK,
54628
+ constants4.F_OK,
54629
54629
  function(err) {
54630
54630
  callback(!err);
54631
54631
  }
@@ -54633,16 +54633,16 @@ var require_command_exists = __commonJS({
54633
54633
  }, "fileNotExists");
54634
54634
  var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
54635
54635
  try {
54636
- accessSync(commandName, constants3.F_OK);
54636
+ accessSync(commandName, constants4.F_OK);
54637
54637
  return false;
54638
54638
  } catch (e7) {
54639
54639
  return true;
54640
54640
  }
54641
54641
  }, "fileNotExistsSync");
54642
54642
  var localExecutable = /* @__PURE__ */ __name(function(commandName, callback) {
54643
- access3(
54643
+ access4(
54644
54644
  commandName,
54645
- constants3.F_OK | constants3.X_OK,
54645
+ constants4.F_OK | constants4.X_OK,
54646
54646
  function(err) {
54647
54647
  callback(null, !err);
54648
54648
  }
@@ -54650,7 +54650,7 @@ var require_command_exists = __commonJS({
54650
54650
  }, "localExecutable");
54651
54651
  var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
54652
54652
  try {
54653
- accessSync(commandName, constants3.F_OK | constants3.X_OK);
54653
+ accessSync(commandName, constants4.F_OK | constants4.X_OK);
54654
54654
  return true;
54655
54655
  } catch (e7) {
54656
54656
  return false;
@@ -58621,8 +58621,8 @@ var init_esm2 = __esm({
58621
58621
  }
58622
58622
  return this._userIgnored(path72, stats);
58623
58623
  }
58624
- _isntIgnored(path72, stat8) {
58625
- return !this._isIgnored(path72, stat8);
58624
+ _isntIgnored(path72, stat9) {
58625
+ return !this._isIgnored(path72, stat9);
58626
58626
  }
58627
58627
  /**
58628
58628
  * Provides a set of common helpers and properties relating to symlink handling.
@@ -67691,11 +67691,11 @@ var init_createConfigValueProvider = __esm({
67691
67691
  // ../../node_modules/.pnpm/@smithy+node-config-provider@3.1.12/node_modules/@smithy/node-config-provider/dist-es/getSelectorName.js
67692
67692
  function getSelectorName(functionString) {
67693
67693
  try {
67694
- const constants3 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
67695
- constants3.delete("CONFIG");
67696
- constants3.delete("CONFIG_PREFIX_SEPARATOR");
67697
- constants3.delete("ENV");
67698
- return [...constants3].join(", ");
67694
+ const constants4 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
67695
+ constants4.delete("CONFIG");
67696
+ constants4.delete("CONFIG_PREFIX_SEPARATOR");
67697
+ constants4.delete("ENV");
67698
+ return [...constants4].join(", ");
67699
67699
  } catch (e7) {
67700
67700
  return functionString;
67701
67701
  }
@@ -81436,7 +81436,7 @@ var import_miniflare8 = require("miniflare");
81436
81436
  init_import_meta_url();
81437
81437
  var import_node_assert5 = __toESM(require("node:assert"));
81438
81438
  var import_node_crypto4 = require("node:crypto");
81439
- var import_node_path15 = __toESM(require("node:path"));
81439
+ var import_node_path16 = __toESM(require("node:path"));
81440
81440
  var import_miniflare6 = require("miniflare");
81441
81441
 
81442
81442
  // src/ai/fetcher.ts
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
81450
81450
 
81451
81451
  // package.json
81452
81452
  var name = "wrangler";
81453
- var version = "3.114.7";
81453
+ var version = "3.114.8";
81454
81454
 
81455
81455
  // src/environment-variables/misc-variables.ts
81456
81456
  init_import_meta_url();
@@ -83998,7 +83998,7 @@ function checkType(type) {
83998
83998
  throw new Error(`Invalid type specified: ${type}`);
83999
83999
  }
84000
84000
  __name(checkType, "checkType");
84001
- var matchType = /* @__PURE__ */ __name((type, stat8) => type === void 0 || stat8[typeMappings[type]](), "matchType");
84001
+ var matchType = /* @__PURE__ */ __name((type, stat9) => type === void 0 || stat9[typeMappings[type]](), "matchType");
84002
84002
  var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
84003
84003
  async function locatePath(paths, {
84004
84004
  cwd: cwd2 = import_node_process2.default.cwd(),
@@ -84012,8 +84012,8 @@ async function locatePath(paths, {
84012
84012
  const statFunction = allowSymlinks ? import_node_fs3.promises.stat : import_node_fs3.promises.lstat;
84013
84013
  return pLocate(paths, async (path_) => {
84014
84014
  try {
84015
- const stat8 = await statFunction(import_node_path6.default.resolve(cwd2, path_));
84016
- return matchType(type, stat8);
84015
+ const stat9 = await statFunction(import_node_path6.default.resolve(cwd2, path_));
84016
+ return matchType(type, stat9);
84017
84017
  } catch {
84018
84018
  return false;
84019
84019
  }
@@ -84030,8 +84030,8 @@ function locatePathSync(paths, {
84030
84030
  const statFunction = allowSymlinks ? import_node_fs3.default.statSync : import_node_fs3.default.lstatSync;
84031
84031
  for (const path_ of paths) {
84032
84032
  try {
84033
- const stat8 = statFunction(import_node_path6.default.resolve(cwd2, path_));
84034
- if (matchType(type, stat8)) {
84033
+ const stat9 = statFunction(import_node_path6.default.resolve(cwd2, path_));
84034
+ if (matchType(type, stat9)) {
84035
84035
  return path_;
84036
84036
  }
84037
84037
  } catch {
@@ -91830,18 +91830,78 @@ __name(AIFetcher, "AIFetcher");
91830
91830
  // src/deployment-bundle/module-collection.ts
91831
91831
  init_import_meta_url();
91832
91832
  var import_node_crypto3 = __toESM(require("node:crypto"));
91833
- var import_node_fs7 = require("node:fs");
91833
+ var import_node_fs8 = require("node:fs");
91834
91834
  var import_promises4 = require("node:fs/promises");
91835
- var import_node_path14 = __toESM(require("node:path"));
91835
+ var import_node_path15 = __toESM(require("node:path"));
91836
91836
  var import_glob_to_regexp2 = __toESM(require_glob_to_regexp());
91837
91837
  var import_resolve = __toESM(require_resolve());
91838
91838
 
91839
91839
  // src/deployment-bundle/find-additional-modules.ts
91840
91840
  init_import_meta_url();
91841
91841
  var import_promises3 = require("node:fs/promises");
91842
- var import_node_path13 = __toESM(require("node:path"));
91842
+ var import_node_path14 = __toESM(require("node:path"));
91843
91843
  var import_glob_to_regexp = __toESM(require_glob_to_regexp());
91844
91844
 
91845
+ // src/paths.ts
91846
+ init_import_meta_url();
91847
+ var import_node_console = require("node:console");
91848
+ var import_node_fs6 = __toESM(require("node:fs"));
91849
+ var import_node_path12 = __toESM(require("node:path"));
91850
+ var import_signal_exit3 = __toESM(require_signal_exit());
91851
+ function toUrlPath(filePath) {
91852
+ (0, import_node_console.assert)(
91853
+ !/^[a-z]:/i.test(filePath),
91854
+ "Tried to convert a Windows file path with a drive to a URL path."
91855
+ );
91856
+ return filePath.replace(/\\/g, "/");
91857
+ }
91858
+ __name(toUrlPath, "toUrlPath");
91859
+ function readableRelative(to) {
91860
+ const relativePath = import_node_path12.default.relative(process.cwd(), to);
91861
+ if (
91862
+ // No directory nesting, return as-is
91863
+ import_node_path12.default.basename(relativePath) === relativePath || // Outside current directory
91864
+ relativePath.startsWith(".")
91865
+ ) {
91866
+ return relativePath;
91867
+ } else {
91868
+ return "./" + relativePath;
91869
+ }
91870
+ }
91871
+ __name(readableRelative, "readableRelative");
91872
+ function getBasePath() {
91873
+ return import_node_path12.default.resolve(__dirname, "..");
91874
+ }
91875
+ __name(getBasePath, "getBasePath");
91876
+ function getWranglerHiddenDirPath(projectRoot) {
91877
+ projectRoot ??= process.cwd();
91878
+ return import_node_path12.default.join(projectRoot, ".wrangler");
91879
+ }
91880
+ __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
91881
+ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
91882
+ const tmpRoot = import_node_path12.default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
91883
+ import_node_fs6.default.mkdirSync(tmpRoot, { recursive: true });
91884
+ const tmpPrefix = import_node_path12.default.join(tmpRoot, `${prefix}-`);
91885
+ const tmpDir = import_node_fs6.default.realpathSync(import_node_fs6.default.mkdtempSync(tmpPrefix));
91886
+ const removeDir = /* @__PURE__ */ __name(() => {
91887
+ if (cleanup) {
91888
+ try {
91889
+ return import_node_fs6.default.rmSync(tmpDir, { recursive: true, force: true });
91890
+ } catch (e7) {
91891
+ }
91892
+ }
91893
+ }, "removeDir");
91894
+ const removeExitListener = (0, import_signal_exit3.default)(removeDir);
91895
+ return {
91896
+ path: tmpDir,
91897
+ remove() {
91898
+ removeExitListener();
91899
+ removeDir();
91900
+ }
91901
+ };
91902
+ }
91903
+ __name(getWranglerTmpDir, "getWranglerTmpDir");
91904
+
91845
91905
  // src/deployment-bundle/bundle-type.ts
91846
91906
  init_import_meta_url();
91847
91907
  function getBundleType(format11, file) {
@@ -91914,8 +91974,8 @@ __name(parseRules, "parseRules");
91914
91974
 
91915
91975
  // src/deployment-bundle/source-maps.ts
91916
91976
  init_import_meta_url();
91917
- var import_node_fs6 = __toESM(require("node:fs"));
91918
- var import_node_path12 = __toESM(require("node:path"));
91977
+ var import_node_fs7 = __toESM(require("node:fs"));
91978
+ var import_node_path13 = __toESM(require("node:path"));
91919
91979
  function loadSourceMaps(main2, modules, bundle) {
91920
91980
  const { sourceMapPath, sourceMapMetadata } = bundle;
91921
91981
  if (sourceMapPath && sourceMapMetadata) {
@@ -91930,18 +91990,18 @@ function loadSourceMap({ name: name2, filePath }, sourceMapPath, { entryDirector
91930
91990
  return [];
91931
91991
  }
91932
91992
  const map2 = JSON.parse(
91933
- import_node_fs6.default.readFileSync(import_node_path12.default.join(entryDirectory, sourceMapPath), "utf8")
91993
+ import_node_fs7.default.readFileSync(import_node_path13.default.join(entryDirectory, sourceMapPath), "utf8")
91934
91994
  );
91935
91995
  map2.file = name2;
91936
91996
  if (map2.sourceRoot) {
91937
- const sourceRootPath = import_node_path12.default.dirname(
91938
- import_node_path12.default.join(entryDirectory, sourceMapPath)
91997
+ const sourceRootPath = import_node_path13.default.dirname(
91998
+ import_node_path13.default.join(entryDirectory, sourceMapPath)
91939
91999
  );
91940
- map2.sourceRoot = import_node_path12.default.relative(sourceRootPath, map2.sourceRoot);
92000
+ map2.sourceRoot = import_node_path13.default.relative(sourceRootPath, map2.sourceRoot);
91941
92001
  }
91942
92002
  map2.sources = map2.sources.map((source) => {
91943
- const originalPath = import_node_path12.default.join(import_node_path12.default.dirname(filePath), source);
91944
- return import_node_path12.default.relative(entryDirectory, originalPath);
92003
+ const originalPath = import_node_path13.default.join(import_node_path13.default.dirname(filePath), source);
92004
+ return import_node_path13.default.relative(entryDirectory, originalPath);
91945
92005
  });
91946
92006
  return [
91947
92007
  {
@@ -92001,14 +92061,14 @@ function sourceMapForModule(module3) {
92001
92061
  if (sourceMapUrl === void 0) {
92002
92062
  return;
92003
92063
  }
92004
- const sourcemapPath = import_node_path12.default.join(import_node_path12.default.dirname(module3.filePath), sourceMapUrl);
92005
- if (!import_node_fs6.default.existsSync(sourcemapPath)) {
92064
+ const sourcemapPath = import_node_path13.default.join(import_node_path13.default.dirname(module3.filePath), sourceMapUrl);
92065
+ if (!import_node_fs7.default.existsSync(sourcemapPath)) {
92006
92066
  throw new Error(
92007
92067
  `Invalid source map path in ${module3.filePath}: ${sourcemapPath} does not exist.`
92008
92068
  );
92009
92069
  }
92010
92070
  const map2 = JSON.parse(
92011
- import_node_fs6.default.readFileSync(sourcemapPath, "utf8")
92071
+ import_node_fs7.default.readFileSync(sourcemapPath, "utf8")
92012
92072
  );
92013
92073
  map2.file = module3.name;
92014
92074
  if (map2.sourceRoot) {
@@ -92038,12 +92098,18 @@ function stripPrefix(prefix, input) {
92038
92098
  __name(stripPrefix, "stripPrefix");
92039
92099
 
92040
92100
  // src/deployment-bundle/find-additional-modules.ts
92041
- async function* getFiles(root, relativeTo) {
92042
- for (const file of await (0, import_promises3.readdir)(root, { withFileTypes: true })) {
92101
+ async function* getFiles(configPath, moduleRoot, relativeTo, projectRoot) {
92102
+ const wranglerHiddenDirPath = getWranglerHiddenDirPath(projectRoot);
92103
+ for (const file of await (0, import_promises3.readdir)(moduleRoot, { withFileTypes: true })) {
92104
+ const absPath = import_node_path14.default.join(moduleRoot, file.name);
92043
92105
  if (file.isDirectory()) {
92044
- yield* getFiles(import_node_path13.default.join(root, file.name), relativeTo);
92106
+ if (absPath !== wranglerHiddenDirPath) {
92107
+ yield* getFiles(configPath, absPath, relativeTo, projectRoot);
92108
+ }
92045
92109
  } else {
92046
- yield import_node_path13.default.relative(relativeTo, import_node_path13.default.join(root, file.name)).replaceAll("\\", "/");
92110
+ if (absPath !== configPath) {
92111
+ yield import_node_path14.default.relative(relativeTo, absPath).replaceAll("\\", "/");
92112
+ }
92047
92113
  }
92048
92114
  }
92049
92115
  }
@@ -92054,8 +92120,13 @@ function isValidPythonPackageName(name2) {
92054
92120
  }
92055
92121
  __name(isValidPythonPackageName, "isValidPythonPackageName");
92056
92122
  async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
92057
- const files = getFiles(entry.moduleRoot, entry.moduleRoot);
92058
- const relativeEntryPoint = import_node_path13.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
92123
+ const files = getFiles(
92124
+ entry.configPath,
92125
+ entry.moduleRoot,
92126
+ entry.moduleRoot,
92127
+ entry.projectRoot
92128
+ );
92129
+ const relativeEntryPoint = import_node_path14.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
92059
92130
  if (Array.isArray(rules)) {
92060
92131
  rules = parseRules(rules);
92061
92132
  }
@@ -92068,7 +92139,7 @@ async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
92068
92139
  let pythonRequirements = "";
92069
92140
  try {
92070
92141
  pythonRequirements = await (0, import_promises3.readFile)(
92071
- import_node_path13.default.resolve(entry.projectRoot, "requirements.txt"),
92142
+ import_node_path14.default.resolve(entry.projectRoot, "requirements.txt"),
92072
92143
  "utf-8"
92073
92144
  );
92074
92145
  } catch (e7) {
@@ -92132,7 +92203,7 @@ async function matchFiles(files, relativeTo, { rules, removedRules }) {
92132
92203
  if (!regexp.test(filePath)) {
92133
92204
  continue;
92134
92205
  }
92135
- const absoluteFilePath = import_node_path13.default.join(relativeTo, filePath);
92206
+ const absoluteFilePath = import_node_path14.default.join(relativeTo, filePath);
92136
92207
  const fileContent = await (0, import_promises3.readFile)(
92137
92208
  absoluteFilePath
92138
92209
  );
@@ -92177,19 +92248,19 @@ async function* findAdditionalModuleWatchDirs(root) {
92177
92248
  if (entry.name === "node_modules" || entry.name === ".git") {
92178
92249
  continue;
92179
92250
  }
92180
- yield* findAdditionalModuleWatchDirs(import_node_path13.default.join(root, entry.name));
92251
+ yield* findAdditionalModuleWatchDirs(import_node_path14.default.join(root, entry.name));
92181
92252
  }
92182
92253
  }
92183
92254
  }
92184
92255
  __name(findAdditionalModuleWatchDirs, "findAdditionalModuleWatchDirs");
92185
92256
  async function writeAdditionalModules(modules, destination) {
92186
92257
  for (const module3 of modules) {
92187
- const modulePath = import_node_path13.default.resolve(destination, module3.name);
92258
+ const modulePath = import_node_path14.default.resolve(destination, module3.name);
92188
92259
  logger.debug("Writing additional module to output", modulePath);
92189
- await (0, import_promises3.mkdir)(import_node_path13.default.dirname(modulePath), { recursive: true });
92260
+ await (0, import_promises3.mkdir)(import_node_path14.default.dirname(modulePath), { recursive: true });
92190
92261
  await (0, import_promises3.writeFile)(modulePath, module3.content);
92191
92262
  if (module3.sourceMap) {
92192
- const sourcemapPath = import_node_path13.default.resolve(destination, module3.sourceMap.name);
92263
+ const sourcemapPath = import_node_path14.default.resolve(destination, module3.sourceMap.name);
92193
92264
  await (0, import_promises3.writeFile)(sourcemapPath, module3.sourceMap.content);
92194
92265
  }
92195
92266
  }
@@ -92248,7 +92319,7 @@ function createModuleCollector(props) {
92248
92319
  }
92249
92320
  const found = await findAdditionalModules(props.entry, parsedRules);
92250
92321
  foundModulePaths = found.map(
92251
- ({ name: name2 }) => import_node_path14.default.resolve(props.entry.moduleRoot, name2)
92322
+ ({ name: name2 }) => import_node_path15.default.resolve(props.entry.moduleRoot, name2)
92252
92323
  );
92253
92324
  modules.push(...found);
92254
92325
  }
@@ -92263,7 +92334,7 @@ function createModuleCollector(props) {
92263
92334
  const watchDirs = [];
92264
92335
  if (props.findAdditionalModules) {
92265
92336
  watchFiles = foundModulePaths;
92266
- const root = import_node_path14.default.resolve(props.entry.moduleRoot);
92337
+ const root = import_node_path15.default.resolve(props.entry.moduleRoot);
92267
92338
  for await (const dir of findAdditionalModuleWatchDirs(root)) {
92268
92339
  watchDirs.push(dir);
92269
92340
  }
@@ -92292,12 +92363,12 @@ function createModuleCollector(props) {
92292
92363
  return;
92293
92364
  }
92294
92365
  logger.warn(
92295
- `Deprecation: detected a legacy module import in "./${import_node_path14.default.relative(
92366
+ `Deprecation: detected a legacy module import in "./${import_node_path15.default.relative(
92296
92367
  process.cwd(),
92297
92368
  args.importer
92298
92369
  )}". This will stop working in the future. Replace references to "${args.path}" with "./${args.path}";`
92299
92370
  );
92300
- const filePath = import_node_path14.default.join(
92371
+ const filePath = import_node_path15.default.join(
92301
92372
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92302
92373
  props.wrangler1xLegacyModuleReferences.rootDirectory,
92303
92374
  args.path
@@ -92306,7 +92377,7 @@ function createModuleCollector(props) {
92306
92377
  filePath
92307
92378
  );
92308
92379
  const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
92309
- const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path14.default.basename(args.path)}`;
92380
+ const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
92310
92381
  const { rule } = rulesMatchers.find(({ regex: regex2 }) => regex2.test(fileName)) || {};
92311
92382
  if (rule) {
92312
92383
  modules.push({
@@ -92340,7 +92411,7 @@ function createModuleCollector(props) {
92340
92411
  if (args.pluginData?.skip) {
92341
92412
  return;
92342
92413
  }
92343
- let filePath = import_node_path14.default.join(args.resolveDir, args.path);
92414
+ let filePath = import_node_path15.default.join(args.resolveDir, args.path);
92344
92415
  if (foundModulePaths.includes(filePath)) {
92345
92416
  return { path: args.path, external: true };
92346
92417
  }
@@ -92371,7 +92442,7 @@ function createModuleCollector(props) {
92371
92442
  filePath
92372
92443
  );
92373
92444
  const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
92374
- const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path14.default.basename(args.path)}`;
92445
+ const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
92375
92446
  modules.push({
92376
92447
  name: fileName,
92377
92448
  filePath,
@@ -92433,8 +92504,8 @@ function getWrangler1xLegacyModuleReferences(rootDirectory, entryPath) {
92433
92504
  return {
92434
92505
  rootDirectory,
92435
92506
  fileNames: new Set(
92436
- (0, import_node_fs7.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
92437
- (dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path14.default.basename(entryPath)
92507
+ (0, import_node_fs8.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
92508
+ (dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path15.default.basename(entryPath)
92438
92509
  ).map((dirEnt) => dirEnt.name)
92439
92510
  )
92440
92511
  };
@@ -93198,7 +93269,7 @@ async function buildSourceOptions(config) {
93198
93269
  config.bundle.modules
93199
93270
  );
93200
93271
  const entrypointNames = isPython ? [] : config.bundle.entry.exports;
93201
- const modulesRoot = import_node_path15.default.dirname(scriptPath3);
93272
+ const modulesRoot = import_node_path16.default.dirname(scriptPath3);
93202
93273
  const sourceOptions = {
93203
93274
  modulesRoot,
93204
93275
  modules: [
@@ -93211,7 +93282,7 @@ async function buildSourceOptions(config) {
93211
93282
  // Misc (WebAssembly, etc, ...)
93212
93283
  ...modules.map((module3) => ({
93213
93284
  type: ModuleTypeToRuleType[module3.type ?? "esm"],
93214
- path: import_node_path15.default.resolve(modulesRoot, module3.name),
93285
+ path: import_node_path16.default.resolve(modulesRoot, module3.name),
93215
93286
  contents: module3.content
93216
93287
  }))
93217
93288
  ]
@@ -93292,14 +93363,14 @@ function buildMiniflareBindingOptions(config) {
93292
93363
  const wasmBindings = { ...bindings.wasm_modules };
93293
93364
  if (config.format === "service-worker" && config.bundle) {
93294
93365
  const scriptPath3 = config.bundle.path;
93295
- const modulesRoot = import_node_path15.default.dirname(scriptPath3);
93366
+ const modulesRoot = import_node_path16.default.dirname(scriptPath3);
93296
93367
  for (const { type, name: name2 } of config.bundle.modules) {
93297
93368
  if (type === "text") {
93298
- textBlobBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93369
+ textBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
93299
93370
  } else if (type === "buffer") {
93300
- dataBlobBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93371
+ dataBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
93301
93372
  } else if (type === "compiled-wasm") {
93302
- wasmBindings[getIdentifier(name2)] = import_node_path15.default.resolve(modulesRoot, name2);
93373
+ wasmBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
93303
93374
  }
93304
93375
  }
93305
93376
  }
@@ -93565,14 +93636,14 @@ function buildMiniflareBindingOptions(config) {
93565
93636
  __name(buildMiniflareBindingOptions, "buildMiniflareBindingOptions");
93566
93637
  function buildPersistOptions(localPersistencePath) {
93567
93638
  if (localPersistencePath !== null) {
93568
- const v3Path = import_node_path15.default.join(localPersistencePath, "v3");
93639
+ const v3Path = import_node_path16.default.join(localPersistencePath, "v3");
93569
93640
  return {
93570
- cachePersist: import_node_path15.default.join(v3Path, "cache"),
93571
- durableObjectsPersist: import_node_path15.default.join(v3Path, "do"),
93572
- kvPersist: import_node_path15.default.join(v3Path, "kv"),
93573
- r2Persist: import_node_path15.default.join(v3Path, "r2"),
93574
- d1Persist: import_node_path15.default.join(v3Path, "d1"),
93575
- workflowsPersist: import_node_path15.default.join(v3Path, "workflows")
93641
+ cachePersist: import_node_path16.default.join(v3Path, "cache"),
93642
+ durableObjectsPersist: import_node_path16.default.join(v3Path, "do"),
93643
+ kvPersist: import_node_path16.default.join(v3Path, "kv"),
93644
+ r2Persist: import_node_path16.default.join(v3Path, "r2"),
93645
+ d1Persist: import_node_path16.default.join(v3Path, "d1"),
93646
+ workflowsPersist: import_node_path16.default.join(v3Path, "workflows")
93576
93647
  };
93577
93648
  }
93578
93649
  }
@@ -93596,7 +93667,7 @@ function buildSitesOptions({
93596
93667
  if (legacyAssetPaths !== void 0) {
93597
93668
  const { baseDirectory, assetDirectory, includePatterns, excludePatterns } = legacyAssetPaths;
93598
93669
  return {
93599
- sitePath: import_node_path15.default.join(baseDirectory, assetDirectory),
93670
+ sitePath: import_node_path16.default.join(baseDirectory, assetDirectory),
93600
93671
  siteInclude: includePatterns.length > 0 ? includePatterns : void 0,
93601
93672
  siteExclude: excludePatterns.length > 0 ? excludePatterns : void 0
93602
93673
  };
@@ -94545,19 +94616,19 @@ init_import_meta_url();
94545
94616
  var import_node_assert9 = __toESM(require("node:assert"));
94546
94617
  var import_node_crypto7 = require("node:crypto");
94547
94618
  var import_node_events2 = __toESM(require("node:events"));
94548
- var import_node_path19 = __toESM(require("node:path"));
94619
+ var import_node_path20 = __toESM(require("node:path"));
94549
94620
  var import_miniflare10 = require("miniflare");
94550
94621
 
94551
94622
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
94552
94623
  init_import_meta_url();
94553
- var import_node_path16 = __toESM(require("node:path"));
94554
- var scriptPath = import_node_path16.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
94624
+ var import_node_path17 = __toESM(require("node:path"));
94625
+ var scriptPath = import_node_path17.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
94555
94626
  var InspectorProxyWorker_default = scriptPath;
94556
94627
 
94557
94628
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
94558
94629
  init_import_meta_url();
94559
- var import_node_path17 = __toESM(require("node:path"));
94560
- var scriptPath2 = import_node_path17.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
94630
+ var import_node_path18 = __toESM(require("node:path"));
94631
+ var scriptPath2 = import_node_path18.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
94561
94632
  var ProxyWorker_default = scriptPath2;
94562
94633
 
94563
94634
  // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/wrapper.mjs
@@ -94580,8 +94651,8 @@ var import_open2 = __toESM(require_open());
94580
94651
  // src/api/startDevWorker/bundle-allowed-paths.ts
94581
94652
  init_import_meta_url();
94582
94653
  var import_node_assert8 = __toESM(require("node:assert"));
94583
- var import_node_fs8 = __toESM(require("node:fs"));
94584
- var import_node_path18 = __toESM(require("node:path"));
94654
+ var import_node_fs9 = __toESM(require("node:fs"));
94655
+ var import_node_path19 = __toESM(require("node:path"));
94585
94656
  var import_node_url6 = require("node:url");
94586
94657
  function isAllowedSourcePath(bundle, filePath) {
94587
94658
  const allowed = getBundleReferencedPaths(bundle);
@@ -94608,12 +94679,12 @@ function getBundleReferencedPaths(bundle) {
94608
94679
  }
94609
94680
  const sourceMappingPath = (0, import_node_url6.fileURLToPath)(sourceMappingURL);
94610
94681
  allowed.sourceMapPaths.add(sourceMappingPath);
94611
- const sourceMapData = import_node_fs8.default.readFileSync(sourceMappingPath, "utf8");
94682
+ const sourceMapData = import_node_fs9.default.readFileSync(sourceMappingPath, "utf8");
94612
94683
  const sourceMap = JSON.parse(sourceMapData);
94613
94684
  const sourceRoot = sourceMap.sourceRoot ?? "";
94614
94685
  for (const source of sourceMap.sources) {
94615
94686
  const sourceURL = new URL(
94616
- import_node_path18.default.posix.join(sourceRoot, source),
94687
+ import_node_path19.default.posix.join(sourceRoot, source),
94617
94688
  sourceMappingURL
94618
94689
  );
94619
94690
  allowed.sourcePaths.add((0, import_node_url6.fileURLToPath)(sourceURL));
@@ -94636,7 +94707,7 @@ function* getBundleSourcePaths(bundle) {
94636
94707
  }
94637
94708
  __name(getBundleSourcePaths, "getBundleSourcePaths");
94638
94709
  function maybeGetSourceMappingURL(sourcePath) {
94639
- const source = import_node_fs8.default.readFileSync(sourcePath, "utf8");
94710
+ const source = import_node_fs9.default.readFileSync(sourcePath, "utf8");
94640
94711
  const sourceMappingURLIndex = source.lastIndexOf("//# sourceMappingURL=");
94641
94712
  if (sourceMappingURLIndex === -1) {
94642
94713
  return;
@@ -94855,8 +94926,8 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
94855
94926
 
94856
94927
  // src/https-options.ts
94857
94928
  init_import_meta_url();
94858
- var fs7 = __toESM(require("node:fs"));
94859
- var path20 = __toESM(require("node:path"));
94929
+ var fs8 = __toESM(require("node:fs"));
94930
+ var path21 = __toESM(require("node:path"));
94860
94931
  var import_miniflare9 = require("miniflare");
94861
94932
  var CERT_EXPIRY_DAYS = 30;
94862
94933
  var ONE_DAY_IN_MS = 864e5;
@@ -94873,37 +94944,37 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
94873
94944
  "Must specify both certificate path and key path to use a Custom Certificate."
94874
94945
  );
94875
94946
  }
94876
- if (!fs7.existsSync(customHttpsKeyPath)) {
94947
+ if (!fs8.existsSync(customHttpsKeyPath)) {
94877
94948
  throw new UserError(
94878
94949
  "Missing Custom Certificate Key at " + customHttpsKeyPath
94879
94950
  );
94880
94951
  }
94881
- if (!fs7.existsSync(customHttpsCertPath)) {
94952
+ if (!fs8.existsSync(customHttpsCertPath)) {
94882
94953
  throw new UserError(
94883
94954
  "Missing Custom Certificate File at " + customHttpsCertPath
94884
94955
  );
94885
94956
  }
94886
94957
  logger.log("Using custom certificate at ", customHttpsKeyPath);
94887
94958
  return {
94888
- key: fs7.readFileSync(customHttpsKeyPath, "utf8"),
94889
- cert: fs7.readFileSync(customHttpsCertPath, "utf8")
94959
+ key: fs8.readFileSync(customHttpsKeyPath, "utf8"),
94960
+ cert: fs8.readFileSync(customHttpsCertPath, "utf8")
94890
94961
  };
94891
94962
  }
94892
- const certDirectory = path20.join(getGlobalWranglerConfigPath(), "local-cert");
94893
- const keyPath = path20.join(certDirectory, "key.pem");
94894
- const certPath = path20.join(certDirectory, "cert.pem");
94895
- const regenerate = !fs7.existsSync(keyPath) || !fs7.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94963
+ const certDirectory = path21.join(getGlobalWranglerConfigPath(), "local-cert");
94964
+ const keyPath = path21.join(certDirectory, "key.pem");
94965
+ const certPath = path21.join(certDirectory, "cert.pem");
94966
+ const regenerate = !fs8.existsSync(keyPath) || !fs8.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94896
94967
  if (regenerate) {
94897
94968
  logger.log("Generating new self-signed certificate...");
94898
94969
  const { key, cert } = generateCertificate();
94899
94970
  try {
94900
- fs7.mkdirSync(certDirectory, { recursive: true });
94901
- fs7.writeFileSync(keyPath, key, "utf8");
94902
- fs7.writeFileSync(certPath, cert, "utf8");
94971
+ fs8.mkdirSync(certDirectory, { recursive: true });
94972
+ fs8.writeFileSync(keyPath, key, "utf8");
94973
+ fs8.writeFileSync(certPath, cert, "utf8");
94903
94974
  } catch (e7) {
94904
94975
  const message = e7 instanceof Error ? e7.message : `${e7}`;
94905
94976
  logger.warn(
94906
- `Unable to cache generated self-signed certificate in ${path20.relative(
94977
+ `Unable to cache generated self-signed certificate in ${path21.relative(
94907
94978
  process.cwd(),
94908
94979
  certDirectory
94909
94980
  )}.
@@ -94913,15 +94984,15 @@ ${message}`
94913
94984
  return { key, cert };
94914
94985
  } else {
94915
94986
  return {
94916
- key: fs7.readFileSync(keyPath, "utf8"),
94917
- cert: fs7.readFileSync(certPath, "utf8")
94987
+ key: fs8.readFileSync(keyPath, "utf8"),
94988
+ cert: fs8.readFileSync(certPath, "utf8")
94918
94989
  };
94919
94990
  }
94920
94991
  }
94921
94992
  __name(getHttpsOptions, "getHttpsOptions");
94922
94993
  function hasCertificateExpired(keyPath, certPath) {
94923
- const keyStat = fs7.statSync(keyPath);
94924
- const certStat = fs7.statSync(certPath);
94994
+ const keyStat = fs8.statSync(keyPath);
94995
+ const certStat = fs8.statSync(certPath);
94925
94996
  const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
94926
94997
  return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
94927
94998
  }
@@ -94996,7 +95067,7 @@ var ProxyController = class extends Controller {
94996
95067
  name: "ProxyWorker",
94997
95068
  compatibilityDate: "2023-12-18",
94998
95069
  compatibilityFlags: ["nodejs_compat"],
94999
- modulesRoot: import_node_path19.default.dirname(ProxyWorker_default),
95070
+ modulesRoot: import_node_path20.default.dirname(ProxyWorker_default),
95000
95071
  modules: [{ type: "ESModule", path: ProxyWorker_default }],
95001
95072
  durableObjects: {
95002
95073
  DURABLE_OBJECT: {
@@ -95025,7 +95096,7 @@ var ProxyController = class extends Controller {
95025
95096
  "nodejs_compat",
95026
95097
  "increase_websocket_message_size"
95027
95098
  ],
95028
- modulesRoot: import_node_path19.default.dirname(InspectorProxyWorker_default),
95099
+ modulesRoot: import_node_path20.default.dirname(InspectorProxyWorker_default),
95029
95100
  modules: [{ type: "ESModule", path: InspectorProxyWorker_default }],
95030
95101
  durableObjects: {
95031
95102
  DURABLE_OBJECT: {
@@ -95403,7 +95474,7 @@ __name(NoOpProxyController, "NoOpProxyController");
95403
95474
  init_import_meta_url();
95404
95475
  var import_node_assert25 = __toESM(require("node:assert"));
95405
95476
  var import_node_fs33 = require("node:fs");
95406
- var import_promises37 = require("node:fs/promises");
95477
+ var import_promises38 = require("node:fs/promises");
95407
95478
  var path65 = __toESM(require("node:path"));
95408
95479
 
95409
95480
  // ../workers-shared/index.ts
@@ -100037,16 +100108,16 @@ var import_undici4 = __toESM(require_undici());
100037
100108
 
100038
100109
  // src/dev/get-local-persistence-path.ts
100039
100110
  init_import_meta_url();
100040
- var import_node_path20 = __toESM(require("node:path"));
100111
+ var import_node_path21 = __toESM(require("node:path"));
100041
100112
  function getLocalPersistencePath(persistTo, { userConfigPath }) {
100042
100113
  return persistTo ? (
100043
100114
  // If path specified, always treat it as relative to cwd()
100044
- import_node_path20.default.resolve(process.cwd(), persistTo)
100115
+ import_node_path21.default.resolve(process.cwd(), persistTo)
100045
100116
  ) : (
100046
100117
  // Otherwise, treat it as relative to the Wrangler configuration file,
100047
100118
  // if one can be found, otherwise cwd()
100048
- import_node_path20.default.resolve(
100049
- userConfigPath ? import_node_path20.default.dirname(userConfigPath) : process.cwd(),
100119
+ import_node_path21.default.resolve(
100120
+ userConfigPath ? import_node_path21.default.dirname(userConfigPath) : process.cwd(),
100050
100121
  ".wrangler/state"
100051
100122
  )
100052
100123
  );
@@ -100326,14 +100397,14 @@ var import_undici5 = __toESM(require_undici());
100326
100397
 
100327
100398
  // src/package-manager.ts
100328
100399
  init_import_meta_url();
100329
- var import_node_fs9 = require("node:fs");
100330
- var import_node_path23 = require("node:path");
100400
+ var import_node_fs10 = require("node:fs");
100401
+ var import_node_path24 = require("node:path");
100331
100402
  var import_node_process10 = require("node:process");
100332
100403
 
100333
100404
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
100334
100405
  init_import_meta_url();
100335
100406
  var import_node_buffer2 = require("node:buffer");
100336
- var import_node_path22 = __toESM(require("node:path"), 1);
100407
+ var import_node_path23 = __toESM(require("node:path"), 1);
100337
100408
  var import_node_child_process = __toESM(require("node:child_process"), 1);
100338
100409
  var import_node_process9 = __toESM(require("node:process"), 1);
100339
100410
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
@@ -100356,7 +100427,7 @@ __name(stripFinalNewline, "stripFinalNewline");
100356
100427
  // ../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
100357
100428
  init_import_meta_url();
100358
100429
  var import_node_process8 = __toESM(require("node:process"), 1);
100359
- var import_node_path21 = __toESM(require("node:path"), 1);
100430
+ var import_node_path22 = __toESM(require("node:path"), 1);
100360
100431
  var import_node_url9 = __toESM(require("node:url"), 1);
100361
100432
 
100362
100433
  // ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
@@ -100382,15 +100453,15 @@ function npmRunPath(options32 = {}) {
100382
100453
  } = options32;
100383
100454
  let previous;
100384
100455
  const cwdString = cwd2 instanceof URL ? import_node_url9.default.fileURLToPath(cwd2) : cwd2;
100385
- let cwdPath = import_node_path21.default.resolve(cwdString);
100456
+ let cwdPath = import_node_path22.default.resolve(cwdString);
100386
100457
  const result = [];
100387
100458
  while (previous !== cwdPath) {
100388
- result.push(import_node_path21.default.join(cwdPath, "node_modules/.bin"));
100459
+ result.push(import_node_path22.default.join(cwdPath, "node_modules/.bin"));
100389
100460
  previous = cwdPath;
100390
- cwdPath = import_node_path21.default.resolve(cwdPath, "..");
100461
+ cwdPath = import_node_path22.default.resolve(cwdPath, "..");
100391
100462
  }
100392
- result.push(import_node_path21.default.resolve(cwdString, execPath, ".."));
100393
- return [...result, path_].join(import_node_path21.default.delimiter);
100463
+ result.push(import_node_path22.default.resolve(cwdString, execPath, ".."));
100464
+ return [...result, path_].join(import_node_path22.default.delimiter);
100394
100465
  }
100395
100466
  __name(npmRunPath, "npmRunPath");
100396
100467
  function npmRunPathEnv({ env: env6 = import_node_process8.default.env, ...options32 } = {}) {
@@ -100951,7 +101022,7 @@ var normalizeStdio = /* @__PURE__ */ __name((options32) => {
100951
101022
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
100952
101023
  init_import_meta_url();
100953
101024
  var import_node_os5 = __toESM(require("node:os"), 1);
100954
- var import_signal_exit3 = __toESM(require_signal_exit(), 1);
101025
+ var import_signal_exit4 = __toESM(require_signal_exit(), 1);
100955
101026
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
100956
101027
  var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options32 = {}) => {
100957
101028
  const killResult = kill(signal);
@@ -101015,7 +101086,7 @@ var setExitHandler = /* @__PURE__ */ __name(async (spawned, { cleanup, detached
101015
101086
  if (!cleanup || detached) {
101016
101087
  return timedPromise;
101017
101088
  }
101018
- const removeExitHandler = (0, import_signal_exit3.default)(() => {
101089
+ const removeExitHandler = (0, import_signal_exit4.default)(() => {
101019
101090
  spawned.kill();
101020
101091
  });
101021
101092
  return timedPromise.finally(() => {
@@ -101192,7 +101263,7 @@ var handleArguments = /* @__PURE__ */ __name((file, args, options32 = {}) => {
101192
101263
  };
101193
101264
  options32.env = getEnv(options32);
101194
101265
  options32.stdio = normalizeStdio(options32);
101195
- if (import_node_process9.default.platform === "win32" && import_node_path22.default.basename(file, ".exe") === "cmd") {
101266
+ if (import_node_process9.default.platform === "win32" && import_node_path23.default.basename(file, ".exe") === "cmd") {
101196
101267
  args.unshift("/q");
101197
101268
  }
101198
101269
  return { file, args, options: options32, parsed };
@@ -101354,9 +101425,9 @@ async function getPackageManager(cwd2) {
101354
101425
  supportsNpm(),
101355
101426
  supportsPnpm()
101356
101427
  ]);
101357
- const hasYarnLock = (0, import_node_fs9.existsSync)((0, import_node_path23.join)(cwd2, "yarn.lock"));
101358
- const hasNpmLock = (0, import_node_fs9.existsSync)((0, import_node_path23.join)(cwd2, "package-lock.json"));
101359
- const hasPnpmLock = (0, import_node_fs9.existsSync)((0, import_node_path23.join)(cwd2, "pnpm-lock.yaml"));
101428
+ const hasYarnLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "yarn.lock"));
101429
+ const hasNpmLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "package-lock.json"));
101430
+ const hasPnpmLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "pnpm-lock.yaml"));
101360
101431
  const userAgent = sniffUserAgent();
101361
101432
  if (hasNpmLock) {
101362
101433
  if (hasNpm) {
@@ -101552,8 +101623,8 @@ __name(getNodeVersion, "getNodeVersion");
101552
101623
  // src/metrics/metrics-config.ts
101553
101624
  init_import_meta_url();
101554
101625
  var import_node_crypto8 = require("node:crypto");
101555
- var import_node_fs10 = require("node:fs");
101556
- var import_node_path24 = __toESM(require("node:path"));
101626
+ var import_node_fs11 = require("node:fs");
101627
+ var import_node_path25 = __toESM(require("node:path"));
101557
101628
  var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
101558
101629
  function getMetricsConfig({
101559
101630
  sendMetrics
@@ -101592,8 +101663,8 @@ function getMetricsConfig({
101592
101663
  }
101593
101664
  __name(getMetricsConfig, "getMetricsConfig");
101594
101665
  function writeMetricsConfig(config) {
101595
- (0, import_node_fs10.mkdirSync)(import_node_path24.default.dirname(getMetricsConfigPath()), { recursive: true });
101596
- (0, import_node_fs10.writeFileSync)(
101666
+ (0, import_node_fs11.mkdirSync)(import_node_path25.default.dirname(getMetricsConfigPath()), { recursive: true });
101667
+ (0, import_node_fs11.writeFileSync)(
101597
101668
  getMetricsConfigPath(),
101598
101669
  JSON.stringify(
101599
101670
  config,
@@ -101605,7 +101676,7 @@ function writeMetricsConfig(config) {
101605
101676
  __name(writeMetricsConfig, "writeMetricsConfig");
101606
101677
  function readMetricsConfig() {
101607
101678
  try {
101608
- const config = (0, import_node_fs10.readFileSync)(getMetricsConfigPath(), "utf8");
101679
+ const config = (0, import_node_fs11.readFileSync)(getMetricsConfigPath(), "utf8");
101609
101680
  return JSON.parse(
101610
101681
  config,
101611
101682
  (key, value) => key === "date" ? new Date(value) : value
@@ -101625,7 +101696,7 @@ function updateMetricsPermission(enabled) {
101625
101696
  }
101626
101697
  __name(updateMetricsPermission, "updateMetricsPermission");
101627
101698
  function getMetricsConfigPath() {
101628
- return import_node_path24.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
101699
+ return import_node_path25.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
101629
101700
  }
101630
101701
  __name(getMetricsConfigPath, "getMetricsConfigPath");
101631
101702
  function getDeviceId(config) {
@@ -101893,7 +101964,7 @@ __name(getMetricsUsageHeaders, "getMetricsUsageHeaders");
101893
101964
 
101894
101965
  // src/r2/helpers.ts
101895
101966
  init_import_meta_url();
101896
- var fs8 = __toESM(require("node:fs"));
101967
+ var fs9 = __toESM(require("node:fs"));
101897
101968
  var import_web = require("node:stream/web");
101898
101969
  var import_miniflare14 = require("miniflare");
101899
101970
 
@@ -102903,7 +102974,7 @@ function isValidR2BucketName(name2) {
102903
102974
  __name(isValidR2BucketName, "isValidR2BucketName");
102904
102975
  var CHUNK_SIZE = 1024;
102905
102976
  async function createFileReadableStream(filePath) {
102906
- const handle = await fs8.promises.open(filePath, "r");
102977
+ const handle = await fs9.promises.open(filePath, "r");
102907
102978
  let position = 0;
102908
102979
  return new import_web.ReadableStream({
102909
102980
  async pull(controller) {
@@ -103333,62 +103404,6 @@ var fs11 = __toESM(require("node:fs"));
103333
103404
  var path28 = __toESM(require("node:path"));
103334
103405
  var esbuild = __toESM(require("esbuild"));
103335
103406
 
103336
- // src/paths.ts
103337
- init_import_meta_url();
103338
- var import_node_console = require("node:console");
103339
- var import_node_fs11 = __toESM(require("node:fs"));
103340
- var import_node_path25 = __toESM(require("node:path"));
103341
- var import_signal_exit4 = __toESM(require_signal_exit());
103342
- function toUrlPath(filePath) {
103343
- (0, import_node_console.assert)(
103344
- !/^[a-z]:/i.test(filePath),
103345
- "Tried to convert a Windows file path with a drive to a URL path."
103346
- );
103347
- return filePath.replace(/\\/g, "/");
103348
- }
103349
- __name(toUrlPath, "toUrlPath");
103350
- function readableRelative(to) {
103351
- const relativePath = import_node_path25.default.relative(process.cwd(), to);
103352
- if (
103353
- // No directory nesting, return as-is
103354
- import_node_path25.default.basename(relativePath) === relativePath || // Outside current directory
103355
- relativePath.startsWith(".")
103356
- ) {
103357
- return relativePath;
103358
- } else {
103359
- return "./" + relativePath;
103360
- }
103361
- }
103362
- __name(readableRelative, "readableRelative");
103363
- function getBasePath() {
103364
- return import_node_path25.default.resolve(__dirname, "..");
103365
- }
103366
- __name(getBasePath, "getBasePath");
103367
- function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
103368
- projectRoot ??= process.cwd();
103369
- const tmpRoot = import_node_path25.default.join(projectRoot, ".wrangler", "tmp");
103370
- import_node_fs11.default.mkdirSync(tmpRoot, { recursive: true });
103371
- const tmpPrefix = import_node_path25.default.join(tmpRoot, `${prefix}-`);
103372
- const tmpDir = import_node_fs11.default.realpathSync(import_node_fs11.default.mkdtempSync(tmpPrefix));
103373
- const removeDir = /* @__PURE__ */ __name(() => {
103374
- if (cleanup) {
103375
- try {
103376
- return import_node_fs11.default.rmSync(tmpDir, { recursive: true, force: true });
103377
- } catch (e7) {
103378
- }
103379
- }
103380
- }, "removeDir");
103381
- const removeExitListener = (0, import_signal_exit4.default)(removeDir);
103382
- return {
103383
- path: tmpDir,
103384
- remove() {
103385
- removeExitListener();
103386
- removeDir();
103387
- }
103388
- };
103389
- }
103390
- __name(getWranglerTmpDir, "getWranglerTmpDir");
103391
-
103392
103407
  // src/deployment-bundle/apply-middleware.ts
103393
103408
  init_import_meta_url();
103394
103409
  var fs10 = __toESM(require("node:fs"));
@@ -105925,22 +105940,22 @@ __name(triggersDeploy, "triggersDeploy");
105925
105940
 
105926
105941
  // src/utils/friendly-validator-errors.ts
105927
105942
  init_import_meta_url();
105928
- var import_promises36 = require("node:fs/promises");
105943
+ var import_promises37 = require("node:fs/promises");
105929
105944
  var import_node_path60 = __toESM(require("node:path"));
105930
105945
 
105931
105946
  // src/check/commands.ts
105932
105947
  init_import_meta_url();
105933
105948
  var import_crypto6 = require("crypto");
105934
- var import_promises34 = require("fs/promises");
105949
+ var import_promises35 = require("fs/promises");
105935
105950
  var import_node_events4 = __toESM(require("node:events"));
105936
- var import_promises35 = require("node:fs/promises");
105951
+ var import_promises36 = require("node:fs/promises");
105937
105952
  var import_path23 = __toESM(require("path"));
105938
105953
  var import_miniflare22 = require("miniflare");
105939
105954
 
105940
105955
  // src/index.ts
105941
105956
  init_import_meta_url();
105942
105957
  var import_node_os8 = __toESM(require("node:os"));
105943
- var import_promises33 = require("node:timers/promises");
105958
+ var import_promises34 = require("node:timers/promises");
105944
105959
  var import_undici20 = __toESM(require_undici());
105945
105960
 
105946
105961
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
@@ -120126,6 +120141,7 @@ ${migrateUrl}`
120126
120141
  return {
120127
120142
  file: paths.absolutePath,
120128
120143
  projectRoot,
120144
+ configPath: config.configPath,
120129
120145
  format: format11,
120130
120146
  moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path33.default.dirname(paths.absolutePath),
120131
120147
  name: config.name ?? "worker",
@@ -123881,6 +123897,7 @@ function buildWorkerFromFunctions({
123881
123897
  const entry = {
123882
123898
  file: (0, import_node_path41.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
123883
123899
  projectRoot: functionsDirectory,
123900
+ configPath: void 0,
123884
123901
  format: "modules",
123885
123902
  moduleRoot: functionsDirectory,
123886
123903
  exports: []
@@ -123950,6 +123967,7 @@ function buildRawWorker({
123950
123967
  const entry = {
123951
123968
  file: workerScriptPath,
123952
123969
  projectRoot: (0, import_node_path41.resolve)(directory),
123970
+ configPath: void 0,
123953
123971
  format: "modules",
123954
123972
  moduleRoot: (0, import_node_path41.resolve)(directory),
123955
123973
  exports: []
@@ -124024,6 +124042,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
124024
124042
  {
124025
124043
  file: entrypoint,
124026
124044
  projectRoot: (0, import_node_path41.resolve)(workerJSDirectory),
124045
+ configPath: void 0,
124027
124046
  format: "modules",
124028
124047
  moduleRoot: (0, import_node_path41.resolve)(workerJSDirectory),
124029
124048
  exports: []
@@ -124219,6 +124238,7 @@ function buildPluginFromFunctions({
124219
124238
  const entry = {
124220
124239
  file: (0, import_node_path42.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
124221
124240
  projectRoot: functionsDirectory,
124241
+ configPath: void 0,
124222
124242
  format: "modules",
124223
124243
  moduleRoot: functionsDirectory,
124224
124244
  exports: []
@@ -147153,7 +147173,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
147153
147173
  if (configToDTS.version_metadata) {
147154
147174
  envTypeStructure.push([
147155
147175
  configToDTS.version_metadata.binding,
147156
- "{ id: string; tag: string }"
147176
+ "WorkerVersionMetadata"
147157
147177
  ]);
147158
147178
  }
147159
147179
  if (configToDTS.assets?.binding) {
@@ -147384,8 +147404,8 @@ function printTokenPermissions(user) {
147384
147404
  `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
147385
147405
  );
147386
147406
  logger.log(`Scope (Access)`);
147387
- for (const [scope, access3] of permissions) {
147388
- logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
147407
+ for (const [scope, access4] of permissions) {
147408
+ logger.log(`- ${scope} ${access4 ? `(${access4})` : ``}`);
147389
147409
  }
147390
147410
  }
147391
147411
  __name(printTokenPermissions, "printTokenPermissions");
@@ -147579,6 +147599,7 @@ init_import_meta_url();
147579
147599
 
147580
147600
  // src/vectorize/common.ts
147581
147601
  init_import_meta_url();
147602
+ var import_promises33 = require("node:fs/promises");
147582
147603
  var vectorizeGABanner = `--------------------
147583
147604
  \u{1F4E3} Vectorize is now Generally Available.
147584
147605
  \u{1F4E3} Please use the '--deprecated-v1' flag to create, get, list, delete and insert vectors into legacy Vectorize indexes
@@ -147593,6 +147614,16 @@ var VECTORIZE_V1_MAX_BATCH_SIZE = 1e3;
147593
147614
  var VECTORIZE_MAX_BATCH_SIZE = 5e3;
147594
147615
  var VECTORIZE_UPSERT_BATCH_SIZE = VECTORIZE_V1_MAX_BATCH_SIZE;
147595
147616
  var VECTORIZE_MAX_UPSERT_VECTOR_RECORDS = 1e5;
147617
+ async function isValidFile(path72) {
147618
+ try {
147619
+ await (0, import_promises33.access)(path72, import_promises33.constants.R_OK);
147620
+ const fileStat = await (0, import_promises33.stat)(path72);
147621
+ return fileStat.isFile() && fileStat.size > 0;
147622
+ } catch (err) {
147623
+ return false;
147624
+ }
147625
+ }
147626
+ __name(isValidFile, "isValidFile");
147596
147627
  async function* getBatchFromFile(rl, batchSize = VECTORIZE_MAX_BATCH_SIZE) {
147597
147628
  const batch = [];
147598
147629
  try {
@@ -147871,10 +147902,9 @@ async function handler18(args) {
147871
147902
  dimensions: args.dimensions
147872
147903
  };
147873
147904
  } else {
147874
- logger.error(
147875
- "You must provide both dimensions and a metric, or a known model preset when creating an index."
147905
+ throw new UserError(
147906
+ "\u{1F6A8} You must provide both dimensions and a metric, or a known model preset when creating an index."
147876
147907
  );
147877
- return;
147878
147908
  }
147879
147909
  if (args.deprecatedV1) {
147880
147910
  logger.warn(
@@ -148010,8 +148040,9 @@ __name(options22, "options");
148010
148040
  async function handler21(args) {
148011
148041
  const config = readConfig(args);
148012
148042
  if (args.ids.length === 0) {
148013
- logger.error("\u{1F6A8} Please provide valid vector identifiers for deletion.");
148014
- return;
148043
+ throw new UserError(
148044
+ "\u{1F6A8} Please provide valid vector identifiers for deletion."
148045
+ );
148015
148046
  }
148016
148047
  logger.log(`\u{1F4CB} Deleting vectors...`);
148017
148048
  const ids = {
@@ -148109,8 +148140,7 @@ __name(options25, "options");
148109
148140
  async function handler24(args) {
148110
148141
  const config = readConfig(args);
148111
148142
  if (args.ids.length === 0) {
148112
- logger.error("\u{1F6A8} Please provide valid vector identifiers.");
148113
- return;
148143
+ throw new UserError("\u{1F6A8} Please provide valid vector identifiers.");
148114
148144
  }
148115
148145
  logger.log(`\u{1F4CB} Fetching vectors...`);
148116
148146
  const ids = {
@@ -148195,18 +148225,19 @@ function options27(yargs) {
148195
148225
  }
148196
148226
  __name(options27, "options");
148197
148227
  async function handler26(args) {
148228
+ if (!await isValidFile(args.file)) {
148229
+ throw new UserError(`\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`);
148230
+ }
148198
148231
  const config = readConfig(args);
148199
148232
  const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs29.createReadStream)(args.file) });
148200
148233
  if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
148201
- logger.error(
148234
+ throw new UserError(
148202
148235
  `\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_V1_MAX_BATCH_SIZE} records at a time.`
148203
148236
  );
148204
- return;
148205
148237
  } else if (!args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
148206
- logger.error(
148207
- `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits`
148238
+ throw new UserError(
148239
+ `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
148208
148240
  );
148209
- return;
148210
148241
  }
148211
148242
  let vectorInsertCount = 0;
148212
148243
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -148426,10 +148457,9 @@ async function handler29(args) {
148426
148457
  }
148427
148458
  }
148428
148459
  if (args.vector === void 0 && args.vectorId === void 0 || args.vector !== void 0 && args.vectorId !== void 0) {
148429
- logger.error(
148460
+ throw new UserError(
148430
148461
  "\u{1F6A8} Either vector or vector-id parameter must be provided, but not both."
148431
148462
  );
148432
- return;
148433
148463
  }
148434
148464
  logger.log(`\u{1F4CB} Searching for relevant vectors...`);
148435
148465
  let res;
@@ -148546,13 +148576,15 @@ function options31(yargs) {
148546
148576
  }
148547
148577
  __name(options31, "options");
148548
148578
  async function handler30(args) {
148579
+ if (!await isValidFile(args.file)) {
148580
+ throw new UserError(`\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`);
148581
+ }
148549
148582
  const config = readConfig(args);
148550
148583
  const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs30.createReadStream)(args.file) });
148551
148584
  if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
148552
- logger.error(
148553
- `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits`
148585
+ throw new UserError(
148586
+ `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
148554
148587
  );
148555
- return;
148556
148588
  }
148557
148589
  let vectorUpsertCount = 0;
148558
148590
  for await (const batch of getBatchFromFile(rl, args.batchSize)) {
@@ -153349,7 +153381,7 @@ ${tryRunningItIn}${oneOfThese}`
153349
153381
  const controller = new AbortController();
153350
153382
  await Promise.race([
153351
153383
  Promise.allSettled(dispatcher?.requests ?? []),
153352
- (0, import_promises33.setTimeout)(1e3, void 0, controller)
153384
+ (0, import_promises34.setTimeout)(1e3, void 0, controller)
153353
153385
  // Ensure we don't hang indefinitely
153354
153386
  ]).then(() => controller.abort());
153355
153387
  } catch (e7) {
@@ -153413,7 +153445,7 @@ async function checkStartupHandler({
153413
153445
  startMessage: "Analysing",
153414
153446
  endMessage: source_default.green("Startup phase analysed")
153415
153447
  });
153416
- await (0, import_promises35.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
153448
+ await (0, import_promises36.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
153417
153449
  log(
153418
153450
  `CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
153419
153451
  );
@@ -153492,7 +153524,7 @@ async function convertWorkerBundleToModules(workerBundle) {
153492
153524
  }
153493
153525
  __name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
153494
153526
  async function parseFormDataFromFile(file) {
153495
- const bundle = await (0, import_promises34.readFile)(file);
153527
+ const bundle = await (0, import_promises35.readFile)(file);
153496
153528
  const firstLine = bundle.findIndex((v7) => v7 === 10);
153497
153529
  const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
153498
153530
  return await new Response(bundle, {
@@ -153590,7 +153622,7 @@ async function handleStartupError(workerBundle, projectRoot) {
153590
153622
  projectRoot ?? process.cwd(),
153591
153623
  import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
153592
153624
  );
153593
- await (0, import_promises36.writeFile)(profile, JSON.stringify(cpuProfile));
153625
+ await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
153594
153626
  throw new UserError(esm_default2`
153595
153627
  Your Worker failed validation because it exceeded startup limits.
153596
153628
  To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
@@ -154536,7 +154568,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
154536
154568
  payload.append(
154537
154569
  manifestEntry[1].hash,
154538
154570
  new import_undici22.File(
154539
- [(await (0, import_promises37.readFile)(absFilePath)).toString("base64")],
154571
+ [(await (0, import_promises38.readFile)(absFilePath)).toString("base64")],
154540
154572
  manifestEntry[1].hash,
154541
154573
  {
154542
154574
  // Most formdata body encoders (incl. undici's) will override with "application/octet-stream" if you use a falsy value here
@@ -154628,7 +154660,7 @@ Assets already uploaded have been saved, so the next attempt will automatically
154628
154660
  return completionJwt;
154629
154661
  }, "syncAssets");
154630
154662
  var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
154631
- const files = await (0, import_promises37.readdir)(dir, { recursive: true });
154663
+ const files = await (0, import_promises38.readdir)(dir, { recursive: true });
154632
154664
  const manifest = {};
154633
154665
  let counter = 0;
154634
154666
  const { assetsIgnoreFunction, assetsIgnoreFilePresent } = await createAssetsIgnoreFunction(dir);
@@ -154639,7 +154671,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
154639
154671
  return;
154640
154672
  }
154641
154673
  const filepath = path65.join(dir, relativeFilepath);
154642
- const filestat = await (0, import_promises37.stat)(filepath);
154674
+ const filestat = await (0, import_promises38.stat)(filepath);
154643
154675
  if (filestat.isSymbolicLink() || filestat.isDirectory()) {
154644
154676
  return;
154645
154677
  } else {
@@ -154834,7 +154866,7 @@ init_import_meta_url();
154834
154866
  // src/dev-registry/file-registry.ts
154835
154867
  init_import_meta_url();
154836
154868
  var import_node_fs34 = require("node:fs");
154837
- var import_promises38 = require("node:fs/promises");
154869
+ var import_promises39 = require("node:fs/promises");
154838
154870
  var import_node_path62 = __toESM(require("node:path"));
154839
154871
  var util3 = __toESM(require("node:util"));
154840
154872
  init_esm2();
@@ -154906,8 +154938,8 @@ async function registerWorker(name2, definition) {
154906
154938
  if (existingHeartbeat) {
154907
154939
  clearInterval(existingHeartbeat);
154908
154940
  }
154909
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
154910
- await (0, import_promises38.writeFile)(
154941
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
154942
+ await (0, import_promises39.writeFile)(
154911
154943
  import_node_path62.default.join(DEV_REGISTRY_PATH, name2),
154912
154944
  // We don't currently do anything with the stored Wrangler version,
154913
154945
  // but if we need to make breaking changes to this format in the future
@@ -154930,7 +154962,7 @@ async function getRegisteredWorkers() {
154930
154962
  __name(getRegisteredWorkers, "getRegisteredWorkers");
154931
154963
  async function unregisterWorker(name2) {
154932
154964
  try {
154933
- await (0, import_promises38.unlink)(import_node_path62.default.join(DEV_REGISTRY_PATH, name2));
154965
+ await (0, import_promises39.unlink)(import_node_path62.default.join(DEV_REGISTRY_PATH, name2));
154934
154966
  const existingHeartbeat = heartbeats.get(name2);
154935
154967
  if (existingHeartbeat) {
154936
154968
  clearInterval(existingHeartbeat);
@@ -154942,17 +154974,17 @@ async function unregisterWorker(name2) {
154942
154974
  }
154943
154975
  __name(unregisterWorker, "unregisterWorker");
154944
154976
  async function loadWorkerDefinitions() {
154945
- await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
154977
+ await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
154946
154978
  globalWorkers ??= {};
154947
154979
  const newWorkers = /* @__PURE__ */ new Set();
154948
- const workerDefinitions = await (0, import_promises38.readdir)(DEV_REGISTRY_PATH);
154980
+ const workerDefinitions = await (0, import_promises39.readdir)(DEV_REGISTRY_PATH);
154949
154981
  for (const workerName of workerDefinitions) {
154950
154982
  try {
154951
- const file = await (0, import_promises38.readFile)(
154983
+ const file = await (0, import_promises39.readFile)(
154952
154984
  import_node_path62.default.join(DEV_REGISTRY_PATH, workerName),
154953
154985
  "utf8"
154954
154986
  );
154955
- const stats = await (0, import_promises38.stat)(import_node_path62.default.join(DEV_REGISTRY_PATH, workerName));
154987
+ const stats = await (0, import_promises39.stat)(import_node_path62.default.join(DEV_REGISTRY_PATH, workerName));
154956
154988
  if (stats.mtime.getTime() < Date.now() - 6e5) {
154957
154989
  await unregisterWorker(workerName);
154958
154990
  } else {
@@ -156443,6 +156475,7 @@ var BundlerController = class extends Controller {
156443
156475
  const entry = {
156444
156476
  file: config.entrypoint,
156445
156477
  projectRoot: config.projectRoot,
156478
+ configPath: config.config,
156446
156479
  format: config.build.format,
156447
156480
  moduleRoot: config.build.moduleRoot,
156448
156481
  exports: config.build.exports
@@ -156572,6 +156605,7 @@ var BundlerController = class extends Controller {
156572
156605
  const entry = {
156573
156606
  file: config.entrypoint,
156574
156607
  projectRoot: config.projectRoot,
156608
+ configPath: config.config,
156575
156609
  format: config.build.format,
156576
156610
  moduleRoot: config.build.moduleRoot,
156577
156611
  exports: config.build.exports,