@cloudflare/vite-plugin 1.32.3 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -21,7 +21,11 @@ import * as fsp from "node:fs/promises";
21
21
  import fs$1, { constants } from "node:fs/promises";
22
22
  import net from "node:net";
23
23
  import childProcess, { execFile, execFileSync, spawn } from "node:child_process";
24
- import path, { posix } from "path";
24
+ import * as nativeFs$1 from "fs";
25
+ import nativeFs from "fs";
26
+ import path, { basename, dirname as dirname$1, normalize, posix, relative as relative$1, resolve as resolve$1, sep } from "path";
27
+ import { fileURLToPath as fileURLToPath$1 } from "url";
28
+ import { createRequire as createRequire$1 } from "module";
25
29
  import { WebSocketServer } from "ws";
26
30
  import { Buffer as Buffer$1 } from "node:buffer";
27
31
 
@@ -49,7 +53,7 @@ var __toESM$1 = (mod, isNodeMode, target$1) => (target$1 = mod != null ? __creat
49
53
  value: mod,
50
54
  enumerable: true
51
55
  }) : target$1, mod));
52
- var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
56
+ var __require$2 = /* @__PURE__ */ createRequire(import.meta.url);
53
57
 
54
58
  //#endregion
55
59
  //#region ../workers-utils/dist/chunk-OZQVB3L3.mjs
@@ -70,8 +74,8 @@ var __name = (target$1, value) => __defProp(target$1, "name", {
70
74
  value,
71
75
  configurable: true
72
76
  });
73
- var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __require$1 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$1 !== "undefined" ? __require$1 : a)[b] }) : x)(function(x) {
74
- if (typeof __require$1 !== "undefined") return __require$1.apply(this, arguments);
77
+ var __require$1 = /* @__PURE__ */ ((x) => typeof __require$2 !== "undefined" ? __require$2 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$2 !== "undefined" ? __require$2 : a)[b] }) : x)(function(x) {
78
+ if (typeof __require$2 !== "undefined") return __require$2.apply(this, arguments);
75
79
  throw Error("Dynamic require of \"" + x + "\" is not supported");
76
80
  });
77
81
  var __commonJS = (cb, mod) => function __require2() {
@@ -99,7 +103,7 @@ var __toESM = (mod, isNodeMode, target$1) => (target$1 = mod != null ? __create(
99
103
  }) : target$1, mod));
100
104
 
101
105
  //#endregion
102
- //#region ../workers-utils/dist/chunk-S3JFRPJM.mjs
106
+ //#region ../workers-utils/dist/chunk-L6UDSO24.mjs
103
107
  function isCompatDate(str) {
104
108
  return /^\d{4}-\d{2}-\d{2}$/.test(str);
105
109
  }
@@ -181,6 +185,12 @@ function mapWorkerMetadataBindings(bindings) {
181
185
  secret_name: binding.secret_name
182
186
  }];
183
187
  break;
188
+ case "artifacts":
189
+ configObj.artifacts = [...configObj.artifacts ?? [], {
190
+ binding: binding.name,
191
+ namespace: binding.namespace
192
+ }];
193
+ break;
184
194
  case "unsafe_hello_world":
185
195
  configObj.unsafe_hello_world = [...configObj.unsafe_hello_world ?? [], {
186
196
  binding: binding.name,
@@ -1198,10 +1208,10 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
1198
1208
  });
1199
1209
  ensurePropertyComplete(offset + length);
1200
1210
  }, "onLiteralValue"),
1201
- onSeparator: /* @__PURE__ */ __name((sep, offset, length) => {
1211
+ onSeparator: /* @__PURE__ */ __name((sep$1, offset, length) => {
1202
1212
  if (currentParent.type === "property") {
1203
- if (sep === ":") currentParent.colonOffset = offset;
1204
- else if (sep === ",") ensurePropertyComplete(offset);
1213
+ if (sep$1 === ":") currentParent.colonOffset = offset;
1214
+ else if (sep$1 === ",") ensurePropertyComplete(offset);
1205
1215
  }
1206
1216
  }, "onSeparator"),
1207
1217
  onError: /* @__PURE__ */ __name((error, offset, length) => {
@@ -1788,7 +1798,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
1788
1798
  return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
1789
1799
  }
1790
1800
  __name(skipVoid, "skipVoid");
1791
- function skipUntil(str, ptr, sep, end, banNewLines = false) {
1801
+ function skipUntil(str, ptr, sep$1, end, banNewLines = false) {
1792
1802
  if (!end) {
1793
1803
  ptr = indexOfNewline(str, ptr);
1794
1804
  return ptr < 0 ? str.length : ptr;
@@ -1796,7 +1806,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
1796
1806
  for (let i$1 = ptr; i$1 < str.length; i$1++) {
1797
1807
  let c = str[i$1];
1798
1808
  if (c === "#") i$1 = indexOfNewline(str, i$1);
1799
- else if (c === sep) return i$1 + 1;
1809
+ else if (c === sep$1) return i$1 + 1;
1800
1810
  else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i$1 + 1] === "\n")) return i$1;
1801
1811
  }
1802
1812
  throw new TomlError("cannot find end of structure", {
@@ -3253,7 +3263,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
3253
3263
  exports$1.Adapt = Adapt;
3254
3264
  } });
3255
3265
  var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/platform-adapters/node.js"(exports$1) {
3256
- var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3266
+ var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3257
3267
  if (k2 === void 0) k2 = k;
3258
3268
  Object.defineProperty(o, k2, {
3259
3269
  enumerable: true,
@@ -3265,7 +3275,7 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
3265
3275
  if (k2 === void 0) k2 = k;
3266
3276
  o[k2] = m[k];
3267
3277
  });
3268
- var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3278
+ var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3269
3279
  Object.defineProperty(o, "default", {
3270
3280
  enumerable: true,
3271
3281
  value: v
@@ -3273,19 +3283,19 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
3273
3283
  } : function(o, v) {
3274
3284
  o["default"] = v;
3275
3285
  });
3276
- var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
3286
+ var __importStar = exports$1 && exports$1.__importStar || function(mod) {
3277
3287
  if (mod && mod.__esModule) return mod;
3278
3288
  var result = {};
3279
3289
  if (mod != null) {
3280
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
3290
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3281
3291
  }
3282
- __setModuleDefault$1(result, mod);
3292
+ __setModuleDefault(result, mod);
3283
3293
  return result;
3284
3294
  };
3285
3295
  exports$1.__esModule = true;
3286
3296
  exports$1.adapter = void 0;
3287
- var os2 = __importStar$1(__require("os"));
3288
- var path4 = __importStar$1(__require("path"));
3297
+ var os2 = __importStar(__require$1("os"));
3298
+ var path4 = __importStar(__require$1("path"));
3289
3299
  exports$1.adapter = {
3290
3300
  atImportPermissions: { env: true },
3291
3301
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -3302,7 +3312,7 @@ var require_mod_cjs = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
3302
3312
  module$1.exports = OSPaths_js_1.Adapt(node_js_1.adapter).OSPaths;
3303
3313
  } });
3304
3314
  var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/platform-adapters/node.js"(exports$1) {
3305
- var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3315
+ var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3306
3316
  if (k2 === void 0) k2 = k;
3307
3317
  Object.defineProperty(o, k2, {
3308
3318
  enumerable: true,
@@ -3314,7 +3324,7 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
3314
3324
  if (k2 === void 0) k2 = k;
3315
3325
  o[k2] = m[k];
3316
3326
  });
3317
- var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3327
+ var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3318
3328
  Object.defineProperty(o, "default", {
3319
3329
  enumerable: true,
3320
3330
  value: v
@@ -3322,22 +3332,22 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
3322
3332
  } : function(o, v) {
3323
3333
  o["default"] = v;
3324
3334
  });
3325
- var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
3335
+ var __importStar = exports$1 && exports$1.__importStar || function(mod) {
3326
3336
  if (mod && mod.__esModule) return mod;
3327
3337
  var result = {};
3328
3338
  if (mod != null) {
3329
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
3339
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3330
3340
  }
3331
- __setModuleDefault$1(result, mod);
3341
+ __setModuleDefault(result, mod);
3332
3342
  return result;
3333
3343
  };
3334
- var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
3344
+ var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
3335
3345
  return mod && mod.__esModule ? mod : { "default": mod };
3336
3346
  };
3337
3347
  exports$1.__esModule = true;
3338
3348
  exports$1.adapter = void 0;
3339
- var path4 = __importStar$1(__require("path"));
3340
- var os_paths_1 = __importDefault$2(require_mod_cjs());
3349
+ var path4 = __importStar(__require$1("path"));
3350
+ var os_paths_1 = __importDefault(require_mod_cjs());
3341
3351
  exports$1.adapter = {
3342
3352
  atImportPermissions: { env: true },
3343
3353
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -3354,7 +3364,7 @@ var require_mod_cjs2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.
3354
3364
  module$1.exports = XDG_js_1.Adapt(node_js_1.adapter).XDG;
3355
3365
  } });
3356
3366
  var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/platform-adapters/node.js"(exports$1) {
3357
- var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3367
+ var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
3358
3368
  if (k2 === void 0) k2 = k;
3359
3369
  Object.defineProperty(o, k2, {
3360
3370
  enumerable: true,
@@ -3366,7 +3376,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
3366
3376
  if (k2 === void 0) k2 = k;
3367
3377
  o[k2] = m[k];
3368
3378
  });
3369
- var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3379
+ var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
3370
3380
  Object.defineProperty(o, "default", {
3371
3381
  enumerable: true,
3372
3382
  value: v
@@ -3374,22 +3384,22 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
3374
3384
  } : function(o, v) {
3375
3385
  o["default"] = v;
3376
3386
  });
3377
- var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
3387
+ var __importStar = exports$1 && exports$1.__importStar || function(mod) {
3378
3388
  if (mod && mod.__esModule) return mod;
3379
3389
  var result = {};
3380
3390
  if (mod != null) {
3381
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
3391
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3382
3392
  }
3383
- __setModuleDefault$1(result, mod);
3393
+ __setModuleDefault(result, mod);
3384
3394
  return result;
3385
3395
  };
3386
- var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
3396
+ var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
3387
3397
  return mod && mod.__esModule ? mod : { "default": mod };
3388
3398
  };
3389
3399
  exports$1.__esModule = true;
3390
3400
  exports$1.adapter = void 0;
3391
- var path4 = __importStar$1(__require("path"));
3392
- var xdg_portable_1 = __importDefault$2(require_mod_cjs2());
3401
+ var path4 = __importStar(__require$1("path"));
3402
+ var xdg_portable_1 = __importDefault(require_mod_cjs2());
3393
3403
  exports$1.adapter = {
3394
3404
  atImportPermissions: {
3395
3405
  env: true,
@@ -3397,7 +3407,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
3397
3407
  },
3398
3408
  meta: {
3399
3409
  mainFilename: /* @__PURE__ */ __name(function() {
3400
- var requireMainFilename = (typeof __require !== "undefined" && __require !== null && __require.main ? __require.main : { filename: void 0 }).filename;
3410
+ var requireMainFilename = (typeof __require$1 !== "undefined" && __require$1 !== null && __require$1.main ? __require$1.main : { filename: void 0 }).filename;
3401
3411
  return (requireMainFilename !== process.execArgv[0] ? requireMainFilename : void 0) || (typeof process._eval === "undefined" ? process.argv[1] : void 0);
3402
3412
  }, "mainFilename"),
3403
3413
  pkgMainFilename: /* @__PURE__ */ __name(function() {
@@ -3454,6 +3464,7 @@ var defaultWranglerConfig = {
3454
3464
  hyperdrive: [],
3455
3465
  workflows: [],
3456
3466
  secrets_store_secrets: [],
3467
+ artifacts: [],
3457
3468
  services: [],
3458
3469
  analytics_engine_datasets: [],
3459
3470
  ai: void 0,
@@ -7501,7 +7512,7 @@ var friendlyBindingNames = {
7501
7512
  services: "Worker",
7502
7513
  analytics_engine_datasets: "Analytics Engine Dataset",
7503
7514
  text_blobs: "Text Blob",
7504
- browser: "Browser",
7515
+ browser: "Browser Run",
7505
7516
  ai: "AI",
7506
7517
  images: "Images",
7507
7518
  stream: "Stream",
@@ -7515,6 +7526,7 @@ var friendlyBindingNames = {
7515
7526
  workflows: "Workflow",
7516
7527
  pipelines: "Pipeline",
7517
7528
  secrets_store_secrets: "Secrets Store Secret",
7529
+ artifacts: "Artifacts",
7518
7530
  ratelimits: "Rate Limit",
7519
7531
  assets: "Assets",
7520
7532
  unsafe_hello_world: "Hello World",
@@ -7531,7 +7543,7 @@ var bindingTypeFriendlyNames = {
7531
7543
  send_email: "Send Email",
7532
7544
  wasm_module: "Wasm Module",
7533
7545
  text_blob: "Text Blob",
7534
- browser: "Browser",
7546
+ browser: "Browser Run",
7535
7547
  ai: "AI",
7536
7548
  images: "Images",
7537
7549
  stream: "Stream",
@@ -7553,6 +7565,7 @@ var bindingTypeFriendlyNames = {
7553
7565
  mtls_certificate: "mTLS Certificate",
7554
7566
  pipeline: "Pipeline",
7555
7567
  secrets_store_secret: "Secrets Store Secret",
7568
+ artifacts: "Artifacts",
7556
7569
  logfwdr: "logfwdr",
7557
7570
  unsafe_hello_world: "Hello World",
7558
7571
  flagship: "Flagship",
@@ -8027,6 +8040,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
8027
8040
  media: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "media", validateNamedSimpleBinding(envName), void 0),
8028
8041
  pipelines: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "pipelines", validateBindingArray(envName, validatePipelineBinding), []),
8029
8042
  secrets_store_secrets: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "secrets_store_secrets", validateBindingArray(envName, validateSecretsStoreSecretBinding), []),
8043
+ artifacts: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "artifacts", validateBindingArray(envName, validateArtifactsBinding), []),
8030
8044
  unsafe_hello_world: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "unsafe_hello_world", validateBindingArray(envName, validateHelloWorldBinding), []),
8031
8045
  flagship: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "flagship", validateBindingArray(envName, validateFlagshipBinding), []),
8032
8046
  worker_loaders: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "worker_loaders", validateBindingArray(envName, validateWorkerLoaderBinding), []),
@@ -8466,7 +8480,8 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
8466
8480
  "flagship",
8467
8481
  "vpc_network",
8468
8482
  "stream",
8469
- "media"
8483
+ "media",
8484
+ "artifacts"
8470
8485
  ].includes(value.type)) diagnostics.warnings.push(`The binding type "${value.type}" is directly supported by wrangler.
8471
8486
  Consider migrating this unsafe binding to a format for '${value.type}' bindings that is supported by wrangler for optimal support.
8472
8487
  For more details, see https://developers.cloudflare.com/workers/cli-wrangler/configuration`);
@@ -8586,6 +8601,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
8586
8601
  ]);
8587
8602
  if ("instances" in containerAppOptional) diagnostics.warnings.push(`"containers.instances" is deprecated. Use "containers.max_instances" instead.`);
8588
8603
  if ("durable_objects" in containerAppOptional) diagnostics.warnings.push(`"containers.durable_objects" is deprecated. Use the "class_name" field instead.`);
8604
+ if ("wrangler_ssh" in containerAppOptional) diagnostics.warnings.push(`"containers.wrangler_ssh" is deprecated. Use "containers.ssh" instead.`);
8589
8605
  if ("unsafe" in containerAppOptional) {
8590
8606
  if (containerAppOptional.unsafe && typeof containerAppOptional.unsafe !== "object" || Array.isArray(containerAppOptional.unsafe)) diagnostics.errors.push(`The field "containers.unsafe" should be an object but got ${JSON.stringify(typeof containerAppOptional.unsafe)}.`);
8591
8607
  }
@@ -8599,6 +8615,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
8599
8615
  "class_name",
8600
8616
  "scheduling_policy",
8601
8617
  "instance_type",
8618
+ "ssh",
8602
8619
  "wrangler_ssh",
8603
8620
  "authorized_keys",
8604
8621
  "trusted_user_ca_keys",
@@ -8619,9 +8636,22 @@ function validateContainerApp(envName, topLevelName, configPath) {
8619
8636
  "vcpu",
8620
8637
  "memory_mib"
8621
8638
  ]);
8622
- if ("wrangler_ssh" in containerAppOptional) {
8623
- if (!isRequiredProperty(containerAppOptional.wrangler_ssh, "enabled", "boolean")) diagnostics.errors.push(`${field}.wrangler_ssh.enabled must be a boolean`);
8624
- if (!isOptionalProperty(containerAppOptional.wrangler_ssh, "port", "number") || containerAppOptional.wrangler_ssh.port < 1 || containerAppOptional.wrangler_ssh.port > 65535) diagnostics.errors.push(`${field}.wrangler_ssh.port must be a number between 1 and 65535 inclusive`);
8639
+ let sshField;
8640
+ let sshConfig;
8641
+ if ("ssh" in containerAppOptional) {
8642
+ sshField = "ssh";
8643
+ sshConfig = containerAppOptional.ssh;
8644
+ containerAppOptional.wrangler_ssh = containerAppOptional.ssh;
8645
+ delete containerAppOptional.ssh;
8646
+ } else if ("wrangler_ssh" in containerAppOptional) {
8647
+ sshField = "wrangler_ssh";
8648
+ sshConfig = containerAppOptional.wrangler_ssh;
8649
+ }
8650
+ if (sshField !== void 0) {
8651
+ const sshConfigObject = typeof sshConfig === "object" && sshConfig !== null ? sshConfig : {};
8652
+ if (!isRequiredProperty(sshConfigObject, "enabled", "boolean")) diagnostics.errors.push(`${field}.${sshField}.enabled must be a boolean`);
8653
+ const sshPort = "port" in sshConfigObject ? sshConfigObject.port : void 0;
8654
+ if (!isOptionalProperty(sshConfigObject, "port", "number") || typeof sshPort === "number" && (sshPort < 1 || sshPort > 65535)) diagnostics.errors.push(`${field}.${sshField}.port must be a number between 1 and 65535 inclusive`);
8625
8655
  }
8626
8656
  if ("authorized_keys" in containerAppOptional) if (!Array.isArray(containerAppOptional.authorized_keys)) diagnostics.errors.push(`${field}.authorized_keys must be an array`);
8627
8657
  else for (const index in containerAppOptional.authorized_keys) {
@@ -8646,6 +8676,22 @@ function validateContainerApp(envName, topLevelName, configPath) {
8646
8676
  if ("tiers" in constraints) diagnostics.errors.push(`${field}.constraints.tier and ${field}.constraints.tiers cannot both be set`);
8647
8677
  }
8648
8678
  validateOptionalTypedArray(diagnostics, `${field}.constraints.tiers`, constraints.tiers, "number");
8679
+ validateOptionalProperty(diagnostics, `${field}.constraints`, "jurisdiction", constraints.jurisdiction, "string");
8680
+ if (constraints.jurisdiction && !["eu", "fedramp"].includes(constraints.jurisdiction)) diagnostics.errors.push(`${field}.constraints.jurisdiction must be one of: "eu", "fedramp"`);
8681
+ if (validateOptionalTypedArray(diagnostics, `${field}.constraints.regions`, constraints.regions, "string") && constraints.regions && Array.isArray(constraints.regions)) {
8682
+ const validRegions = [
8683
+ "ENAM",
8684
+ "WNAM",
8685
+ "EEUR",
8686
+ "WEUR",
8687
+ "APAC",
8688
+ "SAM",
8689
+ "ME",
8690
+ "OC",
8691
+ "AFR"
8692
+ ];
8693
+ for (const region of constraints.regions) if (typeof region === "string" && !validRegions.includes(region.toUpperCase())) diagnostics.errors.push(`${field}.constraints.regions contains invalid region "${region}". Valid regions are: ${validRegions.join(", ")}`);
8694
+ }
8649
8695
  }
8650
8696
  if (typeof containerAppOptional.instance_type === "string") {
8651
8697
  validateOptionalProperty(diagnostics, field, "instance_type", containerAppOptional.instance_type, "string", ALLOWED_INSTANCE_TYPES);
@@ -9275,6 +9321,28 @@ var validateSecretsStoreSecretBinding = /* @__PURE__ */ __name((diagnostics, fie
9275
9321
  ]);
9276
9322
  return isValid2;
9277
9323
  }, "validateSecretsStoreSecretBinding");
9324
+ var validateArtifactsBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
9325
+ if (typeof value !== "object" || value === null) {
9326
+ diagnostics.errors.push(`"artifacts" bindings should be objects, but got ${JSON.stringify(value)}`);
9327
+ return false;
9328
+ }
9329
+ let isValid2 = true;
9330
+ if (!isRequiredProperty(value, "binding", "string")) {
9331
+ diagnostics.errors.push(`"${field}" bindings must have a string "binding" field but got ${JSON.stringify(value)}.`);
9332
+ isValid2 = false;
9333
+ }
9334
+ if (!isRequiredProperty(value, "namespace", "string")) {
9335
+ diagnostics.errors.push(`"${field}" bindings must have a string "namespace" field but got ${JSON.stringify(value)}.`);
9336
+ isValid2 = false;
9337
+ }
9338
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
9339
+ "binding",
9340
+ "namespace",
9341
+ "remote"
9342
+ ]);
9343
+ if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
9344
+ return isValid2;
9345
+ }, "validateArtifactsBinding");
9278
9346
  var validateHelloWorldBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
9279
9347
  if (typeof value !== "object" || value === null) {
9280
9348
  diagnostics.errors.push(`"unsafe_hello_world" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -9407,6 +9475,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
9407
9475
  "media",
9408
9476
  "pipelines",
9409
9477
  "secrets_store_secrets",
9478
+ "artifacts",
9410
9479
  "unsafe_hello_world",
9411
9480
  "worker_loaders",
9412
9481
  "ratelimits",
@@ -9441,6 +9510,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
9441
9510
  if (previews.media !== void 0) isValid2 = validateNamedSimpleBinding(envName)(diagnostics, `${field}.media`, previews.media, void 0) && isValid2;
9442
9511
  isValid2 = validateBindingArray(envName, validatePipelineBinding)(diagnostics, `${field}.pipelines`, previews.pipelines, void 0) && isValid2;
9443
9512
  isValid2 = validateBindingArray(envName, validateSecretsStoreSecretBinding)(diagnostics, `${field}.secrets_store_secrets`, previews.secrets_store_secrets, void 0) && isValid2;
9513
+ isValid2 = validateBindingArray(envName, validateArtifactsBinding)(diagnostics, `${field}.artifacts`, previews.artifacts, void 0) && isValid2;
9444
9514
  isValid2 = validateBindingArray(envName, validateHelloWorldBinding)(diagnostics, `${field}.unsafe_hello_world`, previews.unsafe_hello_world, void 0) && isValid2;
9445
9515
  isValid2 = validateBindingArray(envName, validateWorkerLoaderBinding)(diagnostics, `${field}.worker_loaders`, previews.worker_loaders, void 0) && isValid2;
9446
9516
  isValid2 = validateBindingArray(envName, validateRateLimitBinding)(diagnostics, `${field}.ratelimits`, previews.ratelimits, void 0) && isValid2;
@@ -11209,8 +11279,8 @@ async function sendResponse(res, response) {
11209
11279
  else headers[key] = value;
11210
11280
  res.writeHead(response.status, headers);
11211
11281
  if (response.body != null && res.req.method !== "HEAD") {
11212
- for await (let chunk of readStream(response.body)) if (res.write(chunk) === false) await new Promise((resolve$2) => {
11213
- res.once("drain", resolve$2);
11282
+ for await (let chunk of readStream(response.body)) if (res.write(chunk) === false) await new Promise((resolve$3) => {
11283
+ res.once("drain", resolve$3);
11214
11284
  });
11215
11285
  }
11216
11286
  res.end();
@@ -17752,12 +17822,12 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
17752
17822
  if (resolved.protocol !== "file:") return resolved;
17753
17823
  return finalizeResolution(resolved, base);
17754
17824
  }
17755
- function fileURLToPath$1(id) {
17825
+ function fileURLToPath$2(id) {
17756
17826
  if (typeof id === "string" && !id.startsWith("file://")) return normalizeSlash(id);
17757
17827
  return normalizeSlash(fileURLToPath(id));
17758
17828
  }
17759
17829
  function pathToFileURL$1(id) {
17760
- return pathToFileURL(fileURLToPath$1(id)).toString();
17830
+ return pathToFileURL(fileURLToPath$2(id)).toString();
17761
17831
  }
17762
17832
  function normalizeid(id) {
17763
17833
  if (typeof id !== "string") id = id.toString();
@@ -17786,11 +17856,11 @@ function _tryModuleResolve(id, url, conditions) {
17786
17856
  }
17787
17857
  }
17788
17858
  function _resolve(id, options = {}) {
17789
- if (typeof id !== "string") if (id instanceof URL) id = fileURLToPath$1(id);
17859
+ if (typeof id !== "string") if (id instanceof URL) id = fileURLToPath$2(id);
17790
17860
  else throw new TypeError("input must be a `string` or `URL`");
17791
17861
  if (/(node|data|http|https):/.test(id)) return id;
17792
17862
  if (BUILTIN_MODULES.has(id)) return "node:" + id;
17793
- if (id.startsWith("file://")) id = fileURLToPath$1(id);
17863
+ if (id.startsWith("file://")) id = fileURLToPath$2(id);
17794
17864
  if (isAbsolute$1(id)) try {
17795
17865
  if (statSync(id).isFile()) return pathToFileURL$1(id);
17796
17866
  } catch (error) {
@@ -17825,7 +17895,7 @@ function resolveSync(id, options) {
17825
17895
  return _resolve(id, options);
17826
17896
  }
17827
17897
  function resolvePathSync(id, options) {
17828
- return fileURLToPath$1(resolveSync(id, options));
17898
+ return fileURLToPath$2(resolveSync(id, options));
17829
17899
  }
17830
17900
 
17831
17901
  //#endregion
@@ -18434,7 +18504,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
18434
18504
  const validateAndAddEnvironmentName = createEnvironmentNameValidator();
18435
18505
  const entryWorkerResolvedConfig = resolveWorkerConfig({
18436
18506
  root,
18437
- configPath: getValidatedWranglerConfigPath(root, pluginConfig.configPath),
18507
+ configPath: getValidatedWranglerConfigPath(root, pluginConfig.configPath ?? prefixedEnv.CLOUDFLARE_VITE_WRANGLER_CONFIG_PATH),
18438
18508
  env: cloudflareEnv,
18439
18509
  configCustomizer: pluginConfig.config,
18440
18510
  visitedConfigPaths: configPaths
@@ -18551,8 +18621,8 @@ for (let i$1 = 0; i$1 < 64; i$1++) {
18551
18621
  intToChar[i$1] = c;
18552
18622
  charToInt[c] = i$1;
18553
18623
  }
18554
- function encodeInteger(builder, num, relative$1) {
18555
- let delta = num - relative$1;
18624
+ function encodeInteger(builder, num, relative$2) {
18625
+ let delta = num - relative$2;
18556
18626
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
18557
18627
  do {
18558
18628
  let clamped = delta & 31;
@@ -18792,7 +18862,7 @@ function guessIndent(code) {
18792
18862
  }, Infinity);
18793
18863
  return new Array(min + 1).join(" ");
18794
18864
  }
18795
- function getRelativePath$1(from, to) {
18865
+ function getRelativePath(from, to) {
18796
18866
  const fromParts = from.split(/[/\\]/);
18797
18867
  const toParts = to.split(/[/\\]/);
18798
18868
  fromParts.pop();
@@ -19072,7 +19142,7 @@ var MagicString = class MagicString {
19072
19142
  });
19073
19143
  return {
19074
19144
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
19075
- sources: [options.source ? getRelativePath$1(options.file || "", options.source) : options.file || ""],
19145
+ sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
19076
19146
  sourcesContent: options.includeContent ? [this.original] : void 0,
19077
19147
  names,
19078
19148
  mappings: mappings.raw,
@@ -25698,9 +25768,9 @@ function validateWorkerEnvironmentOptions(resolvedPluginConfig, resolvedViteConf
25698
25768
  for (const environmentName of resolvedPluginConfig.environmentNameToWorkerMap.keys()) {
25699
25769
  const environmentOptions = resolvedViteConfig.environments[environmentName];
25700
25770
  assert(environmentOptions, `Missing environment config for "${environmentName}"`);
25701
- const { resolve: resolve$2 } = environmentOptions;
25771
+ const { resolve: resolve$3 } = environmentOptions;
25702
25772
  const disallowedEnvironmentOptions = {};
25703
- if (resolve$2.external === true || resolve$2.external.length) disallowedEnvironmentOptions.resolveExternal = resolve$2.external;
25773
+ if (resolve$3.external === true || resolve$3.external.length) disallowedEnvironmentOptions.resolveExternal = resolve$3.external;
25704
25774
  if (Object.keys(disallowedEnvironmentOptions).length) disallowedEnvironmentOptionsMap.set(environmentName, disallowedEnvironmentOptions);
25705
25775
  }
25706
25776
  if (disallowedEnvironmentOptionsMap.size) {
@@ -25833,14 +25903,14 @@ const getLocalHosts = () => {
25833
25903
  for (const _interface of Object.values(interfaces)) for (const config of _interface) results.add(config.address);
25834
25904
  return results;
25835
25905
  };
25836
- const checkAvailablePort = (options) => new Promise((resolve$2, reject) => {
25906
+ const checkAvailablePort = (options) => new Promise((resolve$3, reject) => {
25837
25907
  const server = net.createServer();
25838
25908
  server.unref();
25839
25909
  server.on("error", reject);
25840
25910
  server.listen(options, () => {
25841
25911
  const { port } = server.address();
25842
25912
  server.close(() => {
25843
- resolve$2(port);
25913
+ resolve$3(port);
25844
25914
  });
25845
25915
  });
25846
25916
  });
@@ -26069,8 +26139,8 @@ var CancelablePromise = class {
26069
26139
  this.#isRejected = false;
26070
26140
  this.#isCancelled = false;
26071
26141
  this.#cancelHandlers = [];
26072
- this.#promise = new Promise((resolve$2, reject) => {
26073
- this.#resolve = resolve$2;
26142
+ this.#promise = new Promise((resolve$3, reject) => {
26143
+ this.#resolve = resolve$3;
26074
26144
  this.#reject = reject;
26075
26145
  const onResolve = (value) => {
26076
26146
  if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
@@ -26202,15 +26272,15 @@ const getFormData = (options) => {
26202
26272
  return formData;
26203
26273
  }
26204
26274
  };
26205
- const resolve$1 = async (options, resolver) => {
26275
+ const resolve$2 = async (options, resolver) => {
26206
26276
  if (typeof resolver === "function") return resolver(options);
26207
26277
  return resolver;
26208
26278
  };
26209
26279
  const getHeaders = async (config, options) => {
26210
- const token = await resolve$1(options, config.TOKEN);
26211
- const username = await resolve$1(options, config.USERNAME);
26212
- const password = await resolve$1(options, config.PASSWORD);
26213
- const additionalHeaders = await resolve$1(options, config.HEADERS);
26280
+ const token = await resolve$2(options, config.TOKEN);
26281
+ const username = await resolve$2(options, config.USERNAME);
26282
+ const password = await resolve$2(options, config.PASSWORD);
26283
+ const additionalHeaders = await resolve$2(options, config.HEADERS);
26214
26284
  const headers = Object.entries({
26215
26285
  Accept: "application/json",
26216
26286
  ...additionalHeaders,
@@ -26332,14 +26402,14 @@ const buildApiResult = (config, options, req) => {
26332
26402
  * @throws ApiError
26333
26403
  */
26334
26404
  const request = (config, options) => {
26335
- return new CancelablePromise(async (resolve$2, reject, onCancel) => {
26405
+ return new CancelablePromise(async (resolve$3, reject, onCancel) => {
26336
26406
  try {
26337
26407
  const req = await executeRequest(config, options, onCancel);
26338
26408
  if (!req) return;
26339
26409
  const result = buildApiResult(config, options, req);
26340
26410
  debugLogResponse(config, result);
26341
26411
  catchErrorCodes(options, result);
26342
- resolve$2(result.body);
26412
+ resolve$3(result.body);
26343
26413
  } catch (error) {
26344
26414
  reject(error);
26345
26415
  }
@@ -26763,10 +26833,10 @@ async function constructBuildCommand(options, logger) {
26763
26833
  }
26764
26834
  function dockerBuild(dockerPath, options) {
26765
26835
  let errorHandled = false;
26766
- let resolve$2;
26836
+ let resolve$3;
26767
26837
  let reject;
26768
26838
  const ready = new Promise((res, rej) => {
26769
- resolve$2 = res;
26839
+ resolve$3 = res;
26770
26840
  reject = rej;
26771
26841
  });
26772
26842
  const child = spawn(dockerPath, options.buildCmd, {
@@ -26783,7 +26853,7 @@ function dockerBuild(dockerPath, options) {
26783
26853
  child.stdin.end();
26784
26854
  }
26785
26855
  child.on("exit", (code) => {
26786
- if (code === 0) resolve$2();
26856
+ if (code === 0) resolve$3();
26787
26857
  else if (!errorHandled) {
26788
26858
  errorHandled = true;
26789
26859
  reject(new UserError(`Docker build exited with code: ${code}`));
@@ -26845,9 +26915,9 @@ async function dockerLoginImageRegistry(pathToDocker, domain) {
26845
26915
  });
26846
26916
  child.stdin.write(credentials.password);
26847
26917
  child.stdin.end();
26848
- await new Promise((resolve$2, reject) => {
26918
+ await new Promise((resolve$3, reject) => {
26849
26919
  child.on("close", (code) => {
26850
- if (code === 0) resolve$2();
26920
+ if (code === 0) resolve$3();
26851
26921
  else reject(new UserError(`Login failed with code: ${code}`));
26852
26922
  });
26853
26923
  });
@@ -26870,7 +26940,7 @@ const getDevContainerImageName = (name, tag) => {
26870
26940
  //#endregion
26871
26941
  //#region ../containers-shared/src/inspect.ts
26872
26942
  async function dockerImageInspect(dockerPath, options) {
26873
- return new Promise((resolve$2, reject) => {
26943
+ return new Promise((resolve$3, reject) => {
26874
26944
  const proc = spawn(dockerPath, [
26875
26945
  "image",
26876
26946
  "inspect",
@@ -26888,7 +26958,7 @@ async function dockerImageInspect(dockerPath, options) {
26888
26958
  proc.stderr.on("data", (chunk) => stderr += chunk);
26889
26959
  proc.on("close", (code) => {
26890
26960
  if (code !== 0) return reject(new UserError(`failed inspecting image locally: ${stderr.trim()}`));
26891
- resolve$2(stdout.trim());
26961
+ resolve$3(stdout.trim());
26892
26962
  });
26893
26963
  proc.on("error", (err) => reject(err));
26894
26964
  });
@@ -26899,10 +26969,10 @@ async function dockerImageInspect(dockerPath, options) {
26899
26969
  /** helper for simple docker command call that don't require any io handling */
26900
26970
  const runDockerCmd = (dockerPath, args, stdio) => {
26901
26971
  let aborted = false;
26902
- let resolve$2;
26972
+ let resolve$3;
26903
26973
  let reject;
26904
26974
  const ready = new Promise((res, rej) => {
26905
- resolve$2 = res;
26975
+ resolve$3 = res;
26906
26976
  reject = rej;
26907
26977
  });
26908
26978
  const child = spawn(dockerPath, args, {
@@ -26912,7 +26982,7 @@ const runDockerCmd = (dockerPath, args, stdio) => {
26912
26982
  });
26913
26983
  let errorHandled = false;
26914
26984
  child.on("close", (code) => {
26915
- if (code === 0 || aborted) resolve$2({ aborted });
26985
+ if (code === 0 || aborted) resolve$3({ aborted });
26916
26986
  else if (!errorHandled) {
26917
26987
  errorHandled = true;
26918
26988
  reject(new UserError(`Docker command exited with code: ${code}`));
@@ -27222,546 +27292,517 @@ function getContainerOptions(options) {
27222
27292
  }
27223
27293
 
27224
27294
  //#endregion
27225
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/utils.js
27226
- var require_utils$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/utils.js": ((exports) => {
27227
- Object.defineProperty(exports, "__esModule", { value: true });
27228
- exports.normalizePath = exports.convertSlashes = exports.cleanPath = void 0;
27229
- const path_1$4 = __require$1("path");
27230
- function cleanPath(path$1) {
27231
- let normalized = (0, path_1$4.normalize)(path$1);
27232
- if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep) normalized = normalized.substring(0, normalized.length - 1);
27233
- return normalized;
27234
- }
27235
- exports.cleanPath = cleanPath;
27236
- const SLASHES_REGEX = /[\\/]/g;
27237
- function convertSlashes(path$1, separator) {
27238
- return path$1.replace(SLASHES_REGEX, separator);
27239
- }
27240
- exports.convertSlashes = convertSlashes;
27241
- function normalizePath$1(path$1, options) {
27242
- const { resolvePaths, normalizePath: normalizePath$2, pathSeparator } = options;
27243
- const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
27244
- if (resolvePaths) path$1 = (0, path_1$4.resolve)(path$1);
27245
- if (normalizePath$2 || pathNeedsCleaning) path$1 = cleanPath(path$1);
27246
- if (path$1 === ".") return "";
27247
- return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
27248
- }
27249
- exports.normalizePath = normalizePath$1;
27250
- }) });
27251
-
27252
- //#endregion
27253
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js
27254
- var require_join_path = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js": ((exports) => {
27255
- Object.defineProperty(exports, "__esModule", { value: true });
27256
- exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
27257
- const path_1$3 = __require$1("path");
27258
- const utils_1$1 = require_utils$1();
27259
- function joinPathWithBasePath(filename, directoryPath) {
27260
- return directoryPath + filename;
27261
- }
27262
- exports.joinPathWithBasePath = joinPathWithBasePath;
27263
- function joinPathWithRelativePath(root, options) {
27264
- return function(filename, directoryPath) {
27265
- if (directoryPath.startsWith(root)) return directoryPath.replace(root, "") + filename;
27266
- else return (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
27267
- };
27295
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
27296
+ var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
27297
+ function cleanPath(path$1) {
27298
+ let normalized = normalize(path$1);
27299
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
27300
+ return normalized;
27301
+ }
27302
+ const SLASHES_REGEX = /[\\/]/g;
27303
+ function convertSlashes(path$1, separator) {
27304
+ return path$1.replace(SLASHES_REGEX, separator);
27305
+ }
27306
+ const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
27307
+ function isRootDirectory(path$1) {
27308
+ return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
27309
+ }
27310
+ function normalizePath$1(path$1, options) {
27311
+ const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
27312
+ const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
27313
+ if (resolvePaths) path$1 = resolve$1(path$1);
27314
+ if (normalizePath$1$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
27315
+ if (path$1 === ".") return "";
27316
+ return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
27317
+ }
27318
+ function joinPathWithBasePath(filename, directoryPath) {
27319
+ return directoryPath + filename;
27320
+ }
27321
+ function joinPathWithRelativePath(root, options) {
27322
+ return function(filename, directoryPath) {
27323
+ if (directoryPath.startsWith(root)) return directoryPath.slice(root.length) + filename;
27324
+ else return convertSlashes(relative$1(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
27325
+ };
27326
+ }
27327
+ function joinPath(filename) {
27328
+ return filename;
27329
+ }
27330
+ function joinDirectoryPath(filename, directoryPath, separator) {
27331
+ return directoryPath + filename + separator;
27332
+ }
27333
+ function build$7(root, options) {
27334
+ const { relativePaths, includeBasePath } = options;
27335
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
27336
+ }
27337
+ function pushDirectoryWithRelativePath(root) {
27338
+ return function(directoryPath, paths) {
27339
+ paths.push(directoryPath.substring(root.length) || ".");
27340
+ };
27341
+ }
27342
+ function pushDirectoryFilterWithRelativePath(root) {
27343
+ return function(directoryPath, paths, filters) {
27344
+ const relativePath = directoryPath.substring(root.length) || ".";
27345
+ if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
27346
+ };
27347
+ }
27348
+ const pushDirectory = (directoryPath, paths) => {
27349
+ paths.push(directoryPath || ".");
27350
+ };
27351
+ const pushDirectoryFilter = (directoryPath, paths, filters) => {
27352
+ const path$1 = directoryPath || ".";
27353
+ if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
27354
+ };
27355
+ const empty$2 = () => {};
27356
+ function build$6(root, options) {
27357
+ const { includeDirs, filters, relativePaths } = options;
27358
+ if (!includeDirs) return empty$2;
27359
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
27360
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
27361
+ }
27362
+ const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
27363
+ if (filters.every((filter) => filter(filename, false))) counts.files++;
27364
+ };
27365
+ const pushFileFilter = (filename, paths, _counts, filters) => {
27366
+ if (filters.every((filter) => filter(filename, false))) paths.push(filename);
27367
+ };
27368
+ const pushFileCount = (_filename, _paths, counts, _filters) => {
27369
+ counts.files++;
27370
+ };
27371
+ const pushFile = (filename, paths) => {
27372
+ paths.push(filename);
27373
+ };
27374
+ const empty$1 = () => {};
27375
+ function build$5(options) {
27376
+ const { excludeFiles, filters, onlyCounts } = options;
27377
+ if (excludeFiles) return empty$1;
27378
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
27379
+ else if (onlyCounts) return pushFileCount;
27380
+ else return pushFile;
27381
+ }
27382
+ const getArray = (paths) => {
27383
+ return paths;
27384
+ };
27385
+ const getArrayGroup = () => {
27386
+ return [""].slice(0, 0);
27387
+ };
27388
+ function build$4(options) {
27389
+ return options.group ? getArrayGroup : getArray;
27390
+ }
27391
+ const groupFiles = (groups, directory, files) => {
27392
+ groups.push({
27393
+ directory,
27394
+ files,
27395
+ dir: directory
27396
+ });
27397
+ };
27398
+ const empty = () => {};
27399
+ function build$3(options) {
27400
+ return options.group ? groupFiles : empty;
27401
+ }
27402
+ const resolveSymlinksAsync = function(path$1, state, callback$1) {
27403
+ const { queue, fs: fs$3, options: { suppressErrors } } = state;
27404
+ queue.enqueue();
27405
+ fs$3.realpath(path$1, (error, resolvedPath) => {
27406
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
27407
+ fs$3.stat(resolvedPath, (error$1, stat) => {
27408
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
27409
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
27410
+ callback$1(stat, resolvedPath);
27411
+ queue.dequeue(null, state);
27412
+ });
27413
+ });
27414
+ };
27415
+ const resolveSymlinks = function(path$1, state, callback$1) {
27416
+ const { queue, fs: fs$3, options: { suppressErrors } } = state;
27417
+ queue.enqueue();
27418
+ try {
27419
+ const resolvedPath = fs$3.realpathSync(path$1);
27420
+ const stat = fs$3.statSync(resolvedPath);
27421
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
27422
+ callback$1(stat, resolvedPath);
27423
+ } catch (e) {
27424
+ if (!suppressErrors) throw e;
27268
27425
  }
27269
- function joinPath$1(filename) {
27270
- return filename;
27426
+ };
27427
+ function build$2(options, isSynchronous) {
27428
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
27429
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
27430
+ }
27431
+ function isRecursive(path$1, resolved, state) {
27432
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
27433
+ let parent = dirname$1(path$1);
27434
+ let depth$1 = 1;
27435
+ while (parent !== state.root && depth$1 < 2) {
27436
+ const resolvedPath = state.symlinks.get(parent);
27437
+ if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
27438
+ else parent = dirname$1(parent);
27271
27439
  }
27272
- function joinDirectoryPath(filename, directoryPath, separator) {
27273
- return directoryPath + filename + separator;
27440
+ state.symlinks.set(path$1, resolved);
27441
+ return depth$1 > 1;
27442
+ }
27443
+ function isRecursiveUsingRealPaths(resolved, state) {
27444
+ return state.visited.includes(resolved + state.options.pathSeparator);
27445
+ }
27446
+ const onlyCountsSync = (state) => {
27447
+ return state.counts;
27448
+ };
27449
+ const groupsSync = (state) => {
27450
+ return state.groups;
27451
+ };
27452
+ const defaultSync = (state) => {
27453
+ return state.paths;
27454
+ };
27455
+ const limitFilesSync = (state) => {
27456
+ return state.paths.slice(0, state.options.maxFiles);
27457
+ };
27458
+ const onlyCountsAsync = (state, error, callback$1) => {
27459
+ report(error, callback$1, state.counts, state.options.suppressErrors);
27460
+ return null;
27461
+ };
27462
+ const defaultAsync = (state, error, callback$1) => {
27463
+ report(error, callback$1, state.paths, state.options.suppressErrors);
27464
+ return null;
27465
+ };
27466
+ const limitFilesAsync = (state, error, callback$1) => {
27467
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
27468
+ return null;
27469
+ };
27470
+ const groupsAsync = (state, error, callback$1) => {
27471
+ report(error, callback$1, state.groups, state.options.suppressErrors);
27472
+ return null;
27473
+ };
27474
+ function report(error, callback$1, output, suppressErrors) {
27475
+ if (error && !suppressErrors) callback$1(error, output);
27476
+ else callback$1(null, output);
27477
+ }
27478
+ function build$1(options, isSynchronous) {
27479
+ const { onlyCounts, group, maxFiles } = options;
27480
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
27481
+ else if (group) return isSynchronous ? groupsSync : groupsAsync;
27482
+ else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
27483
+ else return isSynchronous ? defaultSync : defaultAsync;
27484
+ }
27485
+ const readdirOpts = { withFileTypes: true };
27486
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
27487
+ state.queue.enqueue();
27488
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
27489
+ const { fs: fs$3 } = state;
27490
+ state.visited.push(crawlPath);
27491
+ state.counts.directories++;
27492
+ fs$3.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
27493
+ callback$1(entries, directoryPath, currentDepth);
27494
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
27495
+ });
27496
+ };
27497
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
27498
+ const { fs: fs$3 } = state;
27499
+ if (currentDepth < 0) return;
27500
+ state.visited.push(crawlPath);
27501
+ state.counts.directories++;
27502
+ let entries = [];
27503
+ try {
27504
+ entries = fs$3.readdirSync(crawlPath || ".", readdirOpts);
27505
+ } catch (e) {
27506
+ if (!state.options.suppressErrors) throw e;
27274
27507
  }
27275
- exports.joinDirectoryPath = joinDirectoryPath;
27276
- function build$7(root, options) {
27277
- const { relativePaths, includeBasePath } = options;
27278
- return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath$1;
27508
+ callback$1(entries, directoryPath, currentDepth);
27509
+ };
27510
+ function build(isSynchronous) {
27511
+ return isSynchronous ? walkSync : walkAsync;
27512
+ }
27513
+ /**
27514
+ * This is a custom stateless queue to track concurrent async fs calls.
27515
+ * It increments a counter whenever a call is queued and decrements it
27516
+ * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
27517
+ */
27518
+ var Queue = class {
27519
+ count = 0;
27520
+ constructor(onQueueEmpty) {
27521
+ this.onQueueEmpty = onQueueEmpty;
27279
27522
  }
27280
- exports.build = build$7;
27281
- }) });
27282
-
27283
- //#endregion
27284
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js
27285
- var require_push_directory = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js": ((exports) => {
27286
- Object.defineProperty(exports, "__esModule", { value: true });
27287
- exports.build = void 0;
27288
- function pushDirectoryWithRelativePath(root) {
27289
- return function(directoryPath, paths) {
27290
- paths.push(directoryPath.substring(root.length) || ".");
27291
- };
27523
+ enqueue() {
27524
+ this.count++;
27525
+ return this.count;
27292
27526
  }
27293
- function pushDirectoryFilterWithRelativePath(root) {
27294
- return function(directoryPath, paths, filters) {
27295
- const relativePath = directoryPath.substring(root.length) || ".";
27296
- if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
27297
- };
27527
+ dequeue(error, output) {
27528
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
27529
+ this.onQueueEmpty(error, output);
27530
+ if (error) {
27531
+ output.controller.abort();
27532
+ this.onQueueEmpty = void 0;
27533
+ }
27534
+ }
27298
27535
  }
27299
- const pushDirectory$1 = (directoryPath, paths) => {
27300
- paths.push(directoryPath || ".");
27301
- };
27302
- const pushDirectoryFilter = (directoryPath, paths, filters) => {
27303
- const path$1 = directoryPath || ".";
27304
- if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
27305
- };
27306
- const empty$2 = () => {};
27307
- function build$6(root, options) {
27308
- const { includeDirs, filters, relativePaths } = options;
27309
- if (!includeDirs) return empty$2;
27310
- if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
27311
- return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
27312
- }
27313
- exports.build = build$6;
27314
- }) });
27315
-
27316
- //#endregion
27317
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js
27318
- var require_push_file = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js": ((exports) => {
27319
- Object.defineProperty(exports, "__esModule", { value: true });
27320
- exports.build = void 0;
27321
- const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
27322
- if (filters.every((filter) => filter(filename, false))) counts.files++;
27323
- };
27324
- const pushFileFilter = (filename, paths, _counts, filters) => {
27325
- if (filters.every((filter) => filter(filename, false))) paths.push(filename);
27326
- };
27327
- const pushFileCount = (_filename, _paths, counts, _filters) => {
27328
- counts.files++;
27329
- };
27330
- const pushFile$1 = (filename, paths) => {
27331
- paths.push(filename);
27332
- };
27333
- const empty$1 = () => {};
27334
- function build$5(options) {
27335
- const { excludeFiles, filters, onlyCounts } = options;
27336
- if (excludeFiles) return empty$1;
27337
- if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
27338
- else if (onlyCounts) return pushFileCount;
27339
- else return pushFile$1;
27340
- }
27341
- exports.build = build$5;
27342
- }) });
27343
-
27344
- //#endregion
27345
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js
27346
- var require_get_array = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js": ((exports) => {
27347
- Object.defineProperty(exports, "__esModule", { value: true });
27348
- exports.build = void 0;
27349
- const getArray$1 = (paths) => {
27350
- return paths;
27351
- };
27352
- const getArrayGroup = () => {
27353
- return [""].slice(0, 0);
27354
- };
27355
- function build$4(options) {
27356
- return options.group ? getArrayGroup : getArray$1;
27536
+ };
27537
+ var Counter = class {
27538
+ _files = 0;
27539
+ _directories = 0;
27540
+ set files(num) {
27541
+ this._files = num;
27357
27542
  }
27358
- exports.build = build$4;
27359
- }) });
27360
-
27361
- //#endregion
27362
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js
27363
- var require_group_files = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js": ((exports) => {
27364
- Object.defineProperty(exports, "__esModule", { value: true });
27365
- exports.build = void 0;
27366
- const groupFiles$1 = (groups, directory, files) => {
27367
- groups.push({
27368
- directory,
27369
- files,
27370
- dir: directory
27371
- });
27372
- };
27373
- const empty = () => {};
27374
- function build$3(options) {
27375
- return options.group ? groupFiles$1 : empty;
27543
+ get files() {
27544
+ return this._files;
27376
27545
  }
27377
- exports.build = build$3;
27378
- }) });
27379
-
27380
- //#endregion
27381
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js
27382
- var require_resolve_symlink = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js": ((exports) => {
27383
- var __importDefault$1 = exports && exports.__importDefault || function(mod) {
27384
- return mod && mod.__esModule ? mod : { "default": mod };
27385
- };
27386
- Object.defineProperty(exports, "__esModule", { value: true });
27387
- exports.build = void 0;
27388
- const fs_1$1 = __importDefault$1(__require$1("fs"));
27389
- const path_1$2 = __require$1("path");
27390
- const resolveSymlinksAsync = function(path$1, state, callback$1) {
27391
- const { queue, options: { suppressErrors } } = state;
27392
- queue.enqueue();
27393
- fs_1$1.default.realpath(path$1, (error, resolvedPath) => {
27394
- if (error) return queue.dequeue(suppressErrors ? null : error, state);
27395
- fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
27396
- if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
27397
- if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
27398
- callback$1(stat, resolvedPath);
27399
- queue.dequeue(null, state);
27400
- });
27401
- });
27402
- };
27403
- const resolveSymlinks = function(path$1, state, callback$1) {
27404
- const { queue, options: { suppressErrors } } = state;
27405
- queue.enqueue();
27406
- try {
27407
- const resolvedPath = fs_1$1.default.realpathSync(path$1);
27408
- const stat = fs_1$1.default.statSync(resolvedPath);
27409
- if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
27410
- callback$1(stat, resolvedPath);
27411
- } catch (e) {
27412
- if (!suppressErrors) throw e;
27413
- }
27414
- };
27415
- function build$2(options, isSynchronous) {
27416
- if (!options.resolveSymlinks || options.excludeSymlinks) return null;
27417
- return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
27418
- }
27419
- exports.build = build$2;
27420
- function isRecursive(path$1, resolved, state) {
27421
- if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
27422
- let parent = (0, path_1$2.dirname)(path$1);
27423
- let depth$1 = 1;
27424
- while (parent !== state.root && depth$1 < 2) {
27425
- const resolvedPath = state.symlinks.get(parent);
27426
- if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
27427
- else parent = (0, path_1$2.dirname)(parent);
27428
- }
27429
- state.symlinks.set(path$1, resolved);
27430
- return depth$1 > 1;
27431
- }
27432
- function isRecursiveUsingRealPaths(resolved, state) {
27433
- return state.visited.includes(resolved + state.options.pathSeparator);
27546
+ set directories(num) {
27547
+ this._directories = num;
27434
27548
  }
27435
- }) });
27436
-
27437
- //#endregion
27438
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js
27439
- var require_invoke_callback = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js": ((exports) => {
27440
- Object.defineProperty(exports, "__esModule", { value: true });
27441
- exports.build = void 0;
27442
- const onlyCountsSync = (state) => {
27443
- return state.counts;
27444
- };
27445
- const groupsSync = (state) => {
27446
- return state.groups;
27447
- };
27448
- const defaultSync = (state) => {
27449
- return state.paths;
27450
- };
27451
- const limitFilesSync = (state) => {
27452
- return state.paths.slice(0, state.options.maxFiles);
27453
- };
27454
- const onlyCountsAsync = (state, error, callback$1) => {
27455
- report(error, callback$1, state.counts, state.options.suppressErrors);
27456
- return null;
27457
- };
27458
- const defaultAsync = (state, error, callback$1) => {
27459
- report(error, callback$1, state.paths, state.options.suppressErrors);
27460
- return null;
27461
- };
27462
- const limitFilesAsync = (state, error, callback$1) => {
27463
- report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
27464
- return null;
27465
- };
27466
- const groupsAsync = (state, error, callback$1) => {
27467
- report(error, callback$1, state.groups, state.options.suppressErrors);
27468
- return null;
27469
- };
27470
- function report(error, callback$1, output, suppressErrors) {
27471
- if (error && !suppressErrors) callback$1(error, output);
27472
- else callback$1(null, output);
27473
- }
27474
- function build$1(options, isSynchronous) {
27475
- const { onlyCounts, group, maxFiles } = options;
27476
- if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
27477
- else if (group) return isSynchronous ? groupsSync : groupsAsync;
27478
- else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
27479
- else return isSynchronous ? defaultSync : defaultAsync;
27480
- }
27481
- exports.build = build$1;
27482
- }) });
27483
-
27484
- //#endregion
27485
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js
27486
- var require_walk_directory = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js": ((exports) => {
27487
- var __importDefault = exports && exports.__importDefault || function(mod) {
27488
- return mod && mod.__esModule ? mod : { "default": mod };
27489
- };
27490
- Object.defineProperty(exports, "__esModule", { value: true });
27491
- exports.build = void 0;
27492
- const fs_1 = __importDefault(__require$1("fs"));
27493
- const readdirOpts = { withFileTypes: true };
27494
- const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
27495
- if (currentDepth < 0) return state.queue.dequeue(null, state);
27496
- state.visited.push(crawlPath);
27497
- state.counts.directories++;
27498
- state.queue.enqueue();
27499
- fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
27500
- callback$1(entries, directoryPath, currentDepth);
27501
- state.queue.dequeue(state.options.suppressErrors ? null : error, state);
27502
- });
27503
- };
27504
- const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
27505
- if (currentDepth < 0) return;
27506
- state.visited.push(crawlPath);
27507
- state.counts.directories++;
27508
- let entries = [];
27509
- try {
27510
- entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
27511
- } catch (e) {
27512
- if (!state.options.suppressErrors) throw e;
27513
- }
27514
- callback$1(entries, directoryPath, currentDepth);
27515
- };
27516
- function build(isSynchronous) {
27517
- return isSynchronous ? walkSync : walkAsync;
27549
+ get directories() {
27550
+ return this._directories;
27518
27551
  }
27519
- exports.build = build;
27520
- }) });
27521
-
27522
- //#endregion
27523
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js
27524
- var require_queue = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js": ((exports) => {
27525
- Object.defineProperty(exports, "__esModule", { value: true });
27526
- exports.Queue = void 0;
27527
27552
  /**
27528
- * This is a custom stateless queue to track concurrent async fs calls.
27529
- * It increments a counter whenever a call is queued and decrements it
27530
- * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
27553
+ * @deprecated use `directories` instead
27531
27554
  */
27532
- var Queue = class {
27533
- onQueueEmpty;
27534
- count = 0;
27535
- constructor(onQueueEmpty) {
27536
- this.onQueueEmpty = onQueueEmpty;
27537
- }
27538
- enqueue() {
27539
- this.count++;
27540
- }
27541
- dequeue(error, output) {
27542
- if (--this.count <= 0 || error) this.onQueueEmpty(error, output);
27543
- }
27544
- };
27545
- exports.Queue = Queue;
27546
- }) });
27547
-
27548
- //#endregion
27549
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js
27550
- var require_counter = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js": ((exports) => {
27551
- Object.defineProperty(exports, "__esModule", { value: true });
27552
- exports.Counter = void 0;
27553
- var Counter = class {
27554
- _files = 0;
27555
- _directories = 0;
27556
- set files(num) {
27557
- this._files = num;
27558
- }
27559
- get files() {
27560
- return this._files;
27561
- }
27562
- set directories(num) {
27563
- this._directories = num;
27564
- }
27565
- get directories() {
27566
- return this._directories;
27567
- }
27568
- /**
27569
- * @deprecated use `directories` instead
27570
- */
27571
- /* c8 ignore next 3 */
27572
- get dirs() {
27573
- return this._directories;
27555
+ /* c8 ignore next 3 */
27556
+ get dirs() {
27557
+ return this._directories;
27558
+ }
27559
+ };
27560
+ /**
27561
+ * AbortController is not supported on Node 14 so we use this until we can drop
27562
+ * support for Node 14.
27563
+ */
27564
+ var Aborter = class {
27565
+ aborted = false;
27566
+ abort() {
27567
+ this.aborted = true;
27568
+ }
27569
+ };
27570
+ var Walker = class {
27571
+ root;
27572
+ isSynchronous;
27573
+ state;
27574
+ joinPath;
27575
+ pushDirectory;
27576
+ pushFile;
27577
+ getArray;
27578
+ groupFiles;
27579
+ resolveSymlink;
27580
+ walkDirectory;
27581
+ callbackInvoker;
27582
+ constructor(root, options, callback$1) {
27583
+ this.isSynchronous = !callback$1;
27584
+ this.callbackInvoker = build$1(options, this.isSynchronous);
27585
+ this.root = normalizePath$1(root, options);
27586
+ this.state = {
27587
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
27588
+ paths: [""].slice(0, 0),
27589
+ groups: [],
27590
+ counts: new Counter(),
27591
+ options,
27592
+ queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
27593
+ symlinks: /* @__PURE__ */ new Map(),
27594
+ visited: [""].slice(0, 0),
27595
+ controller: new Aborter(),
27596
+ fs: options.fs || nativeFs$1
27597
+ };
27598
+ this.joinPath = build$7(this.root, options);
27599
+ this.pushDirectory = build$6(this.root, options);
27600
+ this.pushFile = build$5(options);
27601
+ this.getArray = build$4(options);
27602
+ this.groupFiles = build$3(options);
27603
+ this.resolveSymlink = build$2(options, this.isSynchronous);
27604
+ this.walkDirectory = build(this.isSynchronous);
27605
+ }
27606
+ start() {
27607
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
27608
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
27609
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
27610
+ }
27611
+ walk = (entries, directoryPath, depth$1) => {
27612
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
27613
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
27614
+ const files = this.getArray(this.state.paths);
27615
+ for (let i$1 = 0; i$1 < entries.length; ++i$1) {
27616
+ const entry = entries[i$1];
27617
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
27618
+ const filename = this.joinPath(entry.name, directoryPath);
27619
+ this.pushFile(filename, files, this.state.counts, filters);
27620
+ } else if (entry.isDirectory()) {
27621
+ let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
27622
+ if (exclude && exclude(entry.name, path$1)) continue;
27623
+ this.pushDirectory(path$1, paths, filters);
27624
+ this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
27625
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
27626
+ let path$1 = joinPathWithBasePath(entry.name, directoryPath);
27627
+ this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
27628
+ if (stat.isDirectory()) {
27629
+ resolvedPath = normalizePath$1(resolvedPath, this.state.options);
27630
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
27631
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
27632
+ } else {
27633
+ resolvedPath = useRealPaths ? resolvedPath : path$1;
27634
+ const filename = basename(resolvedPath);
27635
+ const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
27636
+ resolvedPath = this.joinPath(filename, directoryPath$1);
27637
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
27638
+ }
27639
+ });
27640
+ }
27574
27641
  }
27642
+ this.groupFiles(this.state.groups, directoryPath, files);
27575
27643
  };
27576
- exports.Counter = Counter;
27577
- }) });
27578
-
27579
- //#endregion
27580
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js
27581
- var require_walker = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js": ((exports) => {
27582
- var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
27583
- if (k2 === void 0) k2 = k;
27584
- var desc = Object.getOwnPropertyDescriptor(m, k);
27585
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
27586
- enumerable: true,
27587
- get: function() {
27588
- return m[k];
27589
- }
27590
- };
27591
- Object.defineProperty(o, k2, desc);
27592
- }) : (function(o, m, k, k2) {
27593
- if (k2 === void 0) k2 = k;
27594
- o[k2] = m[k];
27595
- }));
27596
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
27597
- Object.defineProperty(o, "default", {
27598
- enumerable: true,
27599
- value: v
27644
+ };
27645
+ function promise(root, options) {
27646
+ return new Promise((resolve$1$1, reject) => {
27647
+ callback(root, options, (err, output) => {
27648
+ if (err) return reject(err);
27649
+ resolve$1$1(output);
27600
27650
  });
27601
- }) : function(o, v) {
27602
- o["default"] = v;
27603
27651
  });
27604
- var __importStar = exports && exports.__importStar || function(mod) {
27605
- if (mod && mod.__esModule) return mod;
27606
- var result = {};
27607
- if (mod != null) {
27608
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
27609
- }
27610
- __setModuleDefault(result, mod);
27611
- return result;
27652
+ }
27653
+ function callback(root, options, callback$1) {
27654
+ new Walker(root, options, callback$1).start();
27655
+ }
27656
+ function sync(root, options) {
27657
+ return new Walker(root, options).start();
27658
+ }
27659
+ var APIBuilder = class {
27660
+ constructor(root, options) {
27661
+ this.root = root;
27662
+ this.options = options;
27663
+ }
27664
+ withPromise() {
27665
+ return promise(this.root, this.options);
27666
+ }
27667
+ withCallback(cb) {
27668
+ callback(this.root, this.options, cb);
27669
+ }
27670
+ sync() {
27671
+ return sync(this.root, this.options);
27672
+ }
27673
+ };
27674
+ let pm = null;
27675
+ /* c8 ignore next 6 */
27676
+ try {
27677
+ __require.resolve("picomatch");
27678
+ pm = __require("picomatch");
27679
+ } catch {}
27680
+ var Builder = class {
27681
+ globCache = {};
27682
+ options = {
27683
+ maxDepth: Infinity,
27684
+ suppressErrors: true,
27685
+ pathSeparator: sep,
27686
+ filters: []
27612
27687
  };
27613
- Object.defineProperty(exports, "__esModule", { value: true });
27614
- exports.Walker = void 0;
27615
- const path_1$1 = __require$1("path");
27616
- const utils_1 = require_utils$1();
27617
- const joinPath = __importStar(require_join_path());
27618
- const pushDirectory = __importStar(require_push_directory());
27619
- const pushFile = __importStar(require_push_file());
27620
- const getArray = __importStar(require_get_array());
27621
- const groupFiles = __importStar(require_group_files());
27622
- const resolveSymlink = __importStar(require_resolve_symlink());
27623
- const invokeCallback = __importStar(require_invoke_callback());
27624
- const walkDirectory = __importStar(require_walk_directory());
27625
- const queue_1 = require_queue();
27626
- const counter_1 = require_counter();
27627
- var Walker = class {
27628
- root;
27629
- isSynchronous;
27630
- state;
27631
- joinPath;
27632
- pushDirectory;
27633
- pushFile;
27634
- getArray;
27635
- groupFiles;
27636
- resolveSymlink;
27637
- walkDirectory;
27638
- callbackInvoker;
27639
- constructor(root, options, callback$1) {
27640
- this.isSynchronous = !callback$1;
27641
- this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
27642
- this.root = (0, utils_1.normalizePath)(root, options);
27643
- this.state = {
27644
- root: this.root.slice(0, -1),
27645
- paths: [""].slice(0, 0),
27646
- groups: [],
27647
- counts: new counter_1.Counter(),
27648
- options,
27649
- queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
27650
- symlinks: /* @__PURE__ */ new Map(),
27651
- visited: [""].slice(0, 0)
27652
- };
27653
- this.joinPath = joinPath.build(this.root, options);
27654
- this.pushDirectory = pushDirectory.build(this.root, options);
27655
- this.pushFile = pushFile.build(options);
27656
- this.getArray = getArray.build(options);
27657
- this.groupFiles = groupFiles.build(options);
27658
- this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
27659
- this.walkDirectory = walkDirectory.build(this.isSynchronous);
27660
- }
27661
- start() {
27662
- this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
27663
- return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
27664
- }
27665
- walk = (entries, directoryPath, depth$1) => {
27666
- const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator } } = this.state;
27667
- if (signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
27668
- this.pushDirectory(directoryPath, paths, filters);
27669
- const files = this.getArray(this.state.paths);
27670
- for (let i$1 = 0; i$1 < entries.length; ++i$1) {
27671
- const entry = entries[i$1];
27672
- if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
27673
- const filename = this.joinPath(entry.name, directoryPath);
27674
- this.pushFile(filename, files, this.state.counts, filters);
27675
- } else if (entry.isDirectory()) {
27676
- let path$1 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
27677
- if (exclude && exclude(entry.name, path$1)) continue;
27678
- this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
27679
- } else if (entry.isSymbolicLink() && this.resolveSymlink) {
27680
- let path$1 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
27681
- this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
27682
- if (stat.isDirectory()) {
27683
- resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
27684
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
27685
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
27686
- } else {
27687
- resolvedPath = useRealPaths ? resolvedPath : path$1;
27688
- const filename = (0, path_1$1.basename)(resolvedPath);
27689
- const directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
27690
- resolvedPath = this.joinPath(filename, directoryPath$1);
27691
- this.pushFile(resolvedPath, files, this.state.counts, filters);
27692
- }
27693
- });
27694
- }
27695
- }
27696
- this.groupFiles(this.state.groups, directoryPath, files);
27688
+ globFunction;
27689
+ constructor(options) {
27690
+ this.options = {
27691
+ ...this.options,
27692
+ ...options
27697
27693
  };
27698
- };
27699
- exports.Walker = Walker;
27700
- }) });
27701
-
27702
- //#endregion
27703
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/async.js
27704
- var require_async = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/async.js": ((exports) => {
27705
- Object.defineProperty(exports, "__esModule", { value: true });
27706
- exports.callback = exports.promise = void 0;
27707
- const walker_1$1 = require_walker();
27708
- function promise(root, options) {
27709
- return new Promise((resolve$2, reject) => {
27710
- callback(root, options, (err, output) => {
27711
- if (err) return reject(err);
27712
- resolve$2(output);
27713
- });
27714
- });
27694
+ this.globFunction = this.options.globFunction;
27715
27695
  }
27716
- exports.promise = promise;
27717
- function callback(root, options, callback$1) {
27718
- new walker_1$1.Walker(root, options, callback$1).start();
27696
+ group() {
27697
+ this.options.group = true;
27698
+ return this;
27719
27699
  }
27720
- exports.callback = callback;
27721
- }) });
27722
-
27723
- //#endregion
27724
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js
27725
- var require_sync = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js": ((exports) => {
27726
- Object.defineProperty(exports, "__esModule", { value: true });
27727
- exports.sync = void 0;
27728
- const walker_1 = require_walker();
27729
- function sync(root, options) {
27730
- return new walker_1.Walker(root, options).start();
27731
- }
27732
- exports.sync = sync;
27733
- }) });
27734
-
27735
- //#endregion
27736
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js
27737
- var require_api_builder = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js": ((exports) => {
27738
- Object.defineProperty(exports, "__esModule", { value: true });
27739
- exports.APIBuilder = void 0;
27740
- const async_1 = require_async();
27741
- const sync_1 = require_sync();
27742
- var APIBuilder = class {
27743
- root;
27744
- options;
27745
- constructor(root, options) {
27746
- this.root = root;
27747
- this.options = options;
27748
- }
27749
- withPromise() {
27750
- return (0, async_1.promise)(this.root, this.options);
27751
- }
27752
- withCallback(cb) {
27753
- (0, async_1.callback)(this.root, this.options, cb);
27754
- }
27755
- sync() {
27756
- return (0, sync_1.sync)(this.root, this.options);
27757
- }
27758
- };
27759
- exports.APIBuilder = APIBuilder;
27760
- }) });
27700
+ withPathSeparator(separator) {
27701
+ this.options.pathSeparator = separator;
27702
+ return this;
27703
+ }
27704
+ withBasePath() {
27705
+ this.options.includeBasePath = true;
27706
+ return this;
27707
+ }
27708
+ withRelativePaths() {
27709
+ this.options.relativePaths = true;
27710
+ return this;
27711
+ }
27712
+ withDirs() {
27713
+ this.options.includeDirs = true;
27714
+ return this;
27715
+ }
27716
+ withMaxDepth(depth$1) {
27717
+ this.options.maxDepth = depth$1;
27718
+ return this;
27719
+ }
27720
+ withMaxFiles(limit) {
27721
+ this.options.maxFiles = limit;
27722
+ return this;
27723
+ }
27724
+ withFullPaths() {
27725
+ this.options.resolvePaths = true;
27726
+ this.options.includeBasePath = true;
27727
+ return this;
27728
+ }
27729
+ withErrors() {
27730
+ this.options.suppressErrors = false;
27731
+ return this;
27732
+ }
27733
+ withSymlinks({ resolvePaths = true } = {}) {
27734
+ this.options.resolveSymlinks = true;
27735
+ this.options.useRealPaths = resolvePaths;
27736
+ return this.withFullPaths();
27737
+ }
27738
+ withAbortSignal(signal) {
27739
+ this.options.signal = signal;
27740
+ return this;
27741
+ }
27742
+ normalize() {
27743
+ this.options.normalizePath = true;
27744
+ return this;
27745
+ }
27746
+ filter(predicate) {
27747
+ this.options.filters.push(predicate);
27748
+ return this;
27749
+ }
27750
+ onlyDirs() {
27751
+ this.options.excludeFiles = true;
27752
+ this.options.includeDirs = true;
27753
+ return this;
27754
+ }
27755
+ exclude(predicate) {
27756
+ this.options.exclude = predicate;
27757
+ return this;
27758
+ }
27759
+ onlyCounts() {
27760
+ this.options.onlyCounts = true;
27761
+ return this;
27762
+ }
27763
+ crawl(root) {
27764
+ return new APIBuilder(root || ".", this.options);
27765
+ }
27766
+ withGlobFunction(fn) {
27767
+ this.globFunction = fn;
27768
+ return this;
27769
+ }
27770
+ /**
27771
+ * @deprecated Pass options using the constructor instead:
27772
+ * ```ts
27773
+ * new fdir(options).crawl("/path/to/root");
27774
+ * ```
27775
+ * This method will be removed in v7.0
27776
+ */
27777
+ /* c8 ignore next 4 */
27778
+ crawlWithOptions(root, options) {
27779
+ this.options = {
27780
+ ...this.options,
27781
+ ...options
27782
+ };
27783
+ return new APIBuilder(root || ".", this.options);
27784
+ }
27785
+ glob(...patterns) {
27786
+ if (this.globFunction) return this.globWithOptions(patterns);
27787
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
27788
+ }
27789
+ globWithOptions(patterns, ...options) {
27790
+ const globFn = this.globFunction || pm;
27791
+ /* c8 ignore next 5 */
27792
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
27793
+ var isMatch = this.globCache[patterns.join("\0")];
27794
+ if (!isMatch) {
27795
+ isMatch = globFn(patterns, ...options);
27796
+ this.globCache[patterns.join("\0")] = isMatch;
27797
+ }
27798
+ this.options.filters.push((path$1) => isMatch(path$1));
27799
+ return this;
27800
+ }
27801
+ };
27761
27802
 
27762
27803
  //#endregion
27763
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js
27764
- var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js": ((exports, module) => {
27804
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
27805
+ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js": ((exports, module) => {
27765
27806
  const WIN_SLASH = "\\\\/";
27766
27807
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
27767
27808
  /**
@@ -27841,6 +27882,7 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
27841
27882
  REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
27842
27883
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
27843
27884
  REPLACEMENTS: {
27885
+ __proto__: null,
27844
27886
  "***": "*",
27845
27887
  "**/**": "**",
27846
27888
  "**/**/**": "**"
@@ -27924,8 +27966,8 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
27924
27966
  }) });
27925
27967
 
27926
27968
  //#endregion
27927
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js
27928
- var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js": ((exports) => {
27969
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
27970
+ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js": ((exports) => {
27929
27971
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
27930
27972
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
27931
27973
  exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
@@ -27973,8 +28015,8 @@ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
27973
28015
  }) });
27974
28016
 
27975
28017
  //#endregion
27976
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js
27977
- var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js": ((exports, module) => {
28018
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
28019
+ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js": ((exports, module) => {
27978
28020
  const utils$3 = require_utils();
27979
28021
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
27980
28022
  const isPathSeparator = (code) => {
@@ -28261,8 +28303,8 @@ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pico
28261
28303
  }) });
28262
28304
 
28263
28305
  //#endregion
28264
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js
28265
- var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js": ((exports, module) => {
28306
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
28307
+ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js": ((exports, module) => {
28266
28308
  const constants$2 = require_constants();
28267
28309
  const utils$2 = require_utils();
28268
28310
  /**
@@ -29120,8 +29162,8 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
29120
29162
  }) });
29121
29163
 
29122
29164
  //#endregion
29123
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js
29124
- var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
29165
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
29166
+ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
29125
29167
  const scan = require_scan();
29126
29168
  const parse = require_parse();
29127
29169
  const utils$1 = require_utils();
@@ -29413,8 +29455,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
29413
29455
  }) });
29414
29456
 
29415
29457
  //#endregion
29416
- //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js
29417
- var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js": ((exports, module) => {
29458
+ //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
29459
+ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js": ((exports, module) => {
29418
29460
  const pico = require_picomatch$1();
29419
29461
  const utils = require_utils();
29420
29462
  function picomatch$1(glob, options, returnState = false) {
@@ -29429,213 +29471,38 @@ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
29429
29471
  }) });
29430
29472
 
29431
29473
  //#endregion
29432
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js
29433
- var require_builder = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js": ((exports) => {
29434
- Object.defineProperty(exports, "__esModule", { value: true });
29435
- exports.Builder = void 0;
29436
- const path_1 = __require$1("path");
29437
- const api_builder_1 = require_api_builder();
29438
- var pm = null;
29439
- /* c8 ignore next 6 */
29440
- try {
29441
- __require$1.resolve("picomatch");
29442
- pm = require_picomatch();
29443
- } catch (_e) {}
29444
- var Builder = class {
29445
- globCache = {};
29446
- options = {
29447
- maxDepth: Infinity,
29448
- suppressErrors: true,
29449
- pathSeparator: path_1.sep,
29450
- filters: []
29451
- };
29452
- globFunction;
29453
- constructor(options) {
29454
- this.options = {
29455
- ...this.options,
29456
- ...options
29457
- };
29458
- this.globFunction = this.options.globFunction;
29459
- }
29460
- group() {
29461
- this.options.group = true;
29462
- return this;
29463
- }
29464
- withPathSeparator(separator) {
29465
- this.options.pathSeparator = separator;
29466
- return this;
29467
- }
29468
- withBasePath() {
29469
- this.options.includeBasePath = true;
29470
- return this;
29471
- }
29472
- withRelativePaths() {
29473
- this.options.relativePaths = true;
29474
- return this;
29475
- }
29476
- withDirs() {
29477
- this.options.includeDirs = true;
29478
- return this;
29479
- }
29480
- withMaxDepth(depth$1) {
29481
- this.options.maxDepth = depth$1;
29482
- return this;
29483
- }
29484
- withMaxFiles(limit) {
29485
- this.options.maxFiles = limit;
29486
- return this;
29487
- }
29488
- withFullPaths() {
29489
- this.options.resolvePaths = true;
29490
- this.options.includeBasePath = true;
29491
- return this;
29492
- }
29493
- withErrors() {
29494
- this.options.suppressErrors = false;
29495
- return this;
29496
- }
29497
- withSymlinks({ resolvePaths = true } = {}) {
29498
- this.options.resolveSymlinks = true;
29499
- this.options.useRealPaths = resolvePaths;
29500
- return this.withFullPaths();
29501
- }
29502
- withAbortSignal(signal) {
29503
- this.options.signal = signal;
29504
- return this;
29505
- }
29506
- normalize() {
29507
- this.options.normalizePath = true;
29508
- return this;
29509
- }
29510
- filter(predicate) {
29511
- this.options.filters.push(predicate);
29512
- return this;
29513
- }
29514
- onlyDirs() {
29515
- this.options.excludeFiles = true;
29516
- this.options.includeDirs = true;
29517
- return this;
29518
- }
29519
- exclude(predicate) {
29520
- this.options.exclude = predicate;
29521
- return this;
29522
- }
29523
- onlyCounts() {
29524
- this.options.onlyCounts = true;
29525
- return this;
29526
- }
29527
- crawl(root) {
29528
- return new api_builder_1.APIBuilder(root || ".", this.options);
29529
- }
29530
- withGlobFunction(fn) {
29531
- this.globFunction = fn;
29532
- return this;
29533
- }
29534
- /**
29535
- * @deprecated Pass options using the constructor instead:
29536
- * ```ts
29537
- * new fdir(options).crawl("/path/to/root");
29538
- * ```
29539
- * This method will be removed in v7.0
29540
- */
29541
- /* c8 ignore next 4 */
29542
- crawlWithOptions(root, options) {
29543
- this.options = {
29544
- ...this.options,
29545
- ...options
29546
- };
29547
- return new api_builder_1.APIBuilder(root || ".", this.options);
29548
- }
29549
- glob(...patterns) {
29550
- if (this.globFunction) return this.globWithOptions(patterns);
29551
- return this.globWithOptions(patterns, ...[{ dot: true }]);
29552
- }
29553
- globWithOptions(patterns, ...options) {
29554
- const globFn = this.globFunction || pm;
29555
- /* c8 ignore next 5 */
29556
- if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
29557
- var isMatch = this.globCache[patterns.join("\0")];
29558
- if (!isMatch) {
29559
- isMatch = globFn(patterns, ...options);
29560
- this.globCache[patterns.join("\0")] = isMatch;
29561
- }
29562
- this.options.filters.push((path$1) => isMatch(path$1));
29563
- return this;
29564
- }
29565
- };
29566
- exports.Builder = Builder;
29567
- }) });
29568
-
29569
- //#endregion
29570
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js
29571
- var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js": ((exports) => {
29572
- Object.defineProperty(exports, "__esModule", { value: true });
29573
- }) });
29574
-
29575
- //#endregion
29576
- //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js
29577
- var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js": ((exports) => {
29578
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
29579
- if (k2 === void 0) k2 = k;
29580
- var desc = Object.getOwnPropertyDescriptor(m, k);
29581
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
29582
- enumerable: true,
29583
- get: function() {
29584
- return m[k];
29585
- }
29586
- };
29587
- Object.defineProperty(o, k2, desc);
29588
- }) : (function(o, m, k, k2) {
29589
- if (k2 === void 0) k2 = k;
29590
- o[k2] = m[k];
29591
- }));
29592
- var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
29593
- for (var p$1 in m) if (p$1 !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p$1)) __createBinding(exports$1, m, p$1);
29594
- };
29595
- Object.defineProperty(exports, "__esModule", { value: true });
29596
- exports.fdir = void 0;
29597
- const builder_1 = require_builder();
29598
- Object.defineProperty(exports, "fdir", {
29599
- enumerable: true,
29600
- get: function() {
29601
- return builder_1.Builder;
29602
- }
29603
- });
29604
- __exportStar(require_types(), exports);
29605
- }) });
29606
-
29607
- //#endregion
29608
- //#region ../../node_modules/.pnpm/tinyglobby@0.2.12/node_modules/tinyglobby/dist/index.mjs
29609
- var import_dist = require_dist();
29474
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
29610
29475
  var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
29611
- var import_picomatch$1 = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
29612
- var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
29613
- function getPartialMatcher(patterns, options) {
29476
+ const isReadonlyArray = Array.isArray;
29477
+ const isWin = process.platform === "win32";
29478
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
29479
+ function getPartialMatcher(patterns, options = {}) {
29614
29480
  const patternsCount = patterns.length;
29615
29481
  const patternsParts = Array(patternsCount);
29616
- const regexes = Array(patternsCount);
29482
+ const matchers = Array(patternsCount);
29483
+ const globstarEnabled = !options.noglobstar;
29617
29484
  for (let i$1 = 0; i$1 < patternsCount; i$1++) {
29618
29485
  const parts = splitPattern(patterns[i$1]);
29619
29486
  patternsParts[i$1] = parts;
29620
29487
  const partsCount = parts.length;
29621
- const partRegexes = Array(partsCount);
29622
- for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch$1.default.makeRe(parts[j], options);
29623
- regexes[i$1] = partRegexes;
29488
+ const partMatchers = Array(partsCount);
29489
+ for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
29490
+ matchers[i$1] = partMatchers;
29624
29491
  }
29625
29492
  return (input) => {
29626
29493
  const inputParts = input.split("/");
29627
29494
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
29628
29495
  for (let i$1 = 0; i$1 < patterns.length; i$1++) {
29629
29496
  const patternParts = patternsParts[i$1];
29630
- const regex = regexes[i$1];
29497
+ const matcher = matchers[i$1];
29631
29498
  const inputPatternCount = inputParts.length;
29632
29499
  const minParts = Math.min(inputPatternCount, patternParts.length);
29633
29500
  let j = 0;
29634
29501
  while (j < minParts) {
29635
29502
  const part = patternParts[j];
29636
29503
  if (part.includes("/")) return true;
29637
- if (!regex[j].test(inputParts[j])) break;
29638
- if (part === "**") return true;
29504
+ if (!matcher[j](inputParts[j])) break;
29505
+ if (globstarEnabled && part === "**") return true;
29639
29506
  j++;
29640
29507
  }
29641
29508
  if (j === inputPatternCount) return true;
@@ -29643,45 +29510,102 @@ function getPartialMatcher(patterns, options) {
29643
29510
  return false;
29644
29511
  };
29645
29512
  }
29646
- var splitPatternOptions = { parts: true };
29647
- function splitPattern(path2) {
29648
- var _a;
29649
- const result = import_picomatch$1.default.scan(path2, splitPatternOptions);
29650
- return ((_a = result.parts) == null ? void 0 : _a.length) ? result.parts : [path2];
29651
- }
29652
- var isWin = process.platform === "win32";
29653
- var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
29654
- var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
29655
- var escapePosixPath = (path2) => path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
29656
- var escapeWin32Path = (path2) => path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
29657
- var escapePath = isWin ? escapeWin32Path : escapePosixPath;
29513
+ /* node:coverage ignore next 2 */
29514
+ const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
29515
+ const isRoot = isWin ? (p$1) => WIN32_ROOT_DIR.test(p$1) : (p$1) => p$1 === "/";
29516
+ function buildFormat(cwd, root, absolute$1) {
29517
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
29518
+ if (absolute$1) {
29519
+ const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
29520
+ return (p$1, isDir) => p$1.slice(start, isDir ? -1 : void 0) || ".";
29521
+ }
29522
+ const prefix = root.slice(cwd.length + 1);
29523
+ if (prefix) return (p$1, isDir) => {
29524
+ if (p$1 === ".") return prefix;
29525
+ const result = `${prefix}/${p$1}`;
29526
+ return isDir ? result.slice(0, -1) : result;
29527
+ };
29528
+ return (p$1, isDir) => isDir && p$1 !== "." ? p$1.slice(0, -1) : p$1;
29529
+ }
29530
+ if (absolute$1) return (p$1) => posix.relative(cwd, p$1) || ".";
29531
+ return (p$1) => posix.relative(cwd, `${root}/${p$1}`) || ".";
29532
+ }
29533
+ function buildRelative(cwd, root) {
29534
+ if (root.startsWith(`${cwd}/`)) {
29535
+ const prefix = root.slice(cwd.length + 1);
29536
+ return (p$1) => `${prefix}/${p$1}`;
29537
+ }
29538
+ return (p$1) => {
29539
+ const result = posix.relative(cwd, `${root}/${p$1}`);
29540
+ if (p$1.endsWith("/") && result !== "") return `${result}/`;
29541
+ return result || ".";
29542
+ };
29543
+ }
29544
+ const splitPatternOptions = { parts: true };
29545
+ function splitPattern(path$1) {
29546
+ var _result$parts;
29547
+ const result = import_picomatch.default.scan(path$1, splitPatternOptions);
29548
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
29549
+ }
29550
+ const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
29551
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
29552
+ const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
29553
+ const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
29554
+ /**
29555
+ * Escapes a path's special characters depending on the platform.
29556
+ * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
29557
+ */
29558
+ /* node:coverage ignore next */
29559
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
29560
+ /**
29561
+ * Checks if a pattern has dynamic parts.
29562
+ *
29563
+ * Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
29564
+ *
29565
+ * - Doesn't necessarily return `false` on patterns that include `\`.
29566
+ * - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
29567
+ * - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
29568
+ * - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
29569
+ *
29570
+ * @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
29571
+ */
29658
29572
  function isDynamicPattern(pattern, options) {
29659
- if ((options == null ? void 0 : options.caseSensitiveMatch) === false) return true;
29660
- const scan$2 = import_picomatch$1.default.scan(pattern);
29573
+ if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
29574
+ const scan$2 = import_picomatch.default.scan(pattern);
29661
29575
  return scan$2.isGlob || scan$2.negated;
29662
29576
  }
29663
29577
  function log(...tasks) {
29664
29578
  console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
29665
29579
  }
29666
- var PARENT_DIRECTORY = /^(\/?\.\.)+/;
29667
- var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
29668
- var BACKSLASHES = /\\/g;
29580
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
29581
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
29582
+ const BACKSLASHES = /\\/g;
29669
29583
  function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
29670
29584
  let result = pattern;
29671
29585
  if (pattern.endsWith("/")) result = pattern.slice(0, -1);
29672
29586
  if (!result.endsWith("*") && expandDirectories) result += "/**";
29673
- if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapePath(cwd), result);
29587
+ const escapedCwd = escapePath(cwd);
29588
+ if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
29674
29589
  else result = posix.normalize(result);
29675
29590
  const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
29676
- if (parentDirectoryMatch == null ? void 0 : parentDirectoryMatch[0]) {
29677
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0]);
29678
- if (props.root.length > potentialRoot.length) {
29591
+ const parts = splitPattern(result);
29592
+ if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
29593
+ const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
29594
+ let i$1 = 0;
29595
+ const cwdParts = escapedCwd.split("/");
29596
+ while (i$1 < n$1 && parts[i$1 + n$1] === cwdParts[cwdParts.length + i$1 - n$1]) {
29597
+ result = result.slice(0, (n$1 - i$1 - 1) * 3) + result.slice((n$1 - i$1) * 3 + parts[i$1 + n$1].length + 1) || ".";
29598
+ i$1++;
29599
+ }
29600
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i$1 * 3));
29601
+ if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
29679
29602
  props.root = potentialRoot;
29680
- props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
29603
+ props.depthOffset = -n$1 + i$1;
29681
29604
  }
29682
- } else if (!isIgnore && props.depthOffset >= 0) {
29683
- const parts = splitPattern(result);
29684
- props.commonPath ??= parts;
29605
+ }
29606
+ if (!isIgnore && props.depthOffset >= 0) {
29607
+ var _props$commonPath;
29608
+ (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
29685
29609
  const newCommonPath = [];
29686
29610
  const length = Math.min(props.commonPath.length, parts.length);
29687
29611
  for (let i$1 = 0; i$1 < length; i$1++) {
@@ -29695,13 +29619,12 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
29695
29619
  }
29696
29620
  props.depthOffset = newCommonPath.length;
29697
29621
  props.commonPath = newCommonPath;
29698
- props.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
29622
+ props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
29699
29623
  }
29700
29624
  return result;
29701
29625
  }
29702
- function processPatterns({ patterns, ignore: ignore$1 = [], expandDirectories = true }, cwd, props) {
29626
+ function processPatterns({ patterns = ["**/*"], ignore: ignore$1 = [], expandDirectories = true }, cwd, props) {
29703
29627
  if (typeof patterns === "string") patterns = [patterns];
29704
- else if (!patterns) patterns = ["**/*"];
29705
29628
  if (typeof ignore$1 === "string") ignore$1 = [ignore$1];
29706
29629
  const matchPatterns = [];
29707
29630
  const ignorePatterns = [];
@@ -29719,68 +29642,90 @@ function processPatterns({ patterns, ignore: ignore$1 = [], expandDirectories =
29719
29642
  ignore: ignorePatterns
29720
29643
  };
29721
29644
  }
29722
- function getRelativePath(path2, cwd, root) {
29723
- return posix.relative(cwd, `${root}/${path2}`) || ".";
29724
- }
29725
- function processPath(path2, cwd, root, isDirectory$1, absolute$1) {
29726
- const relativePath = absolute$1 ? path2.slice(root.length + 1) || "." : path2;
29727
- if (root === cwd) return isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
29728
- return getRelativePath(relativePath, cwd, root);
29729
- }
29730
- function formatPaths(paths, cwd, root) {
29645
+ function formatPaths(paths, relative$2) {
29731
29646
  for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
29732
- const path2 = paths[i$1];
29733
- paths[i$1] = getRelativePath(path2, cwd, root) + (!path2 || path2.endsWith("/") ? "/" : "");
29647
+ const path$1 = paths[i$1];
29648
+ paths[i$1] = relative$2(path$1);
29734
29649
  }
29735
29650
  return paths;
29736
29651
  }
29737
- function crawl(options, cwd, sync$1) {
29738
- if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
29739
- if (options.debug) log("globbing with options:", options, "cwd:", cwd);
29740
- if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
29652
+ function normalizeCwd(cwd) {
29653
+ if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
29654
+ if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
29655
+ return path.resolve(cwd).replace(BACKSLASHES, "/");
29656
+ }
29657
+ function getCrawler(patterns, inputOptions = {}) {
29658
+ const options = process.env.TINYGLOBBY_DEBUG ? {
29659
+ ...inputOptions,
29660
+ debug: true
29661
+ } : inputOptions;
29662
+ const cwd = normalizeCwd(options.cwd);
29663
+ if (options.debug) log("globbing with:", {
29664
+ patterns,
29665
+ options,
29666
+ cwd
29667
+ });
29668
+ if (Array.isArray(patterns) && patterns.length === 0) return [{
29669
+ sync: () => [],
29670
+ withPromise: async () => []
29671
+ }, false];
29741
29672
  const props = {
29742
29673
  root: cwd,
29743
29674
  commonPath: null,
29744
29675
  depthOffset: 0
29745
29676
  };
29746
- const processed = processPatterns(options, cwd, props);
29747
- const nocase = options.caseSensitiveMatch === false;
29677
+ const processed = processPatterns({
29678
+ ...options,
29679
+ patterns
29680
+ }, cwd, props);
29748
29681
  if (options.debug) log("internal processing patterns:", processed);
29749
- const matcher = (0, import_picomatch.default)(processed.match, {
29682
+ const matchOptions = {
29750
29683
  dot: options.dot,
29751
- nocase,
29684
+ nobrace: options.braceExpansion === false,
29685
+ nocase: options.caseSensitiveMatch === false,
29686
+ noextglob: options.extglob === false,
29687
+ noglobstar: options.globstar === false,
29688
+ posix: true
29689
+ };
29690
+ const matcher = (0, import_picomatch.default)(processed.match, {
29691
+ ...matchOptions,
29752
29692
  ignore: processed.ignore
29753
29693
  });
29754
- const ignore$1 = (0, import_picomatch.default)(processed.ignore, {
29755
- dot: options.dot,
29756
- nocase
29757
- });
29758
- const partialMatcher = getPartialMatcher(processed.match, {
29759
- dot: options.dot,
29760
- nocase
29761
- });
29694
+ const ignore$1 = (0, import_picomatch.default)(processed.ignore, matchOptions);
29695
+ const partialMatcher = getPartialMatcher(processed.match, matchOptions);
29696
+ const format$2 = buildFormat(cwd, props.root, options.absolute);
29697
+ const formatExclude = options.absolute ? format$2 : buildFormat(cwd, props.root, true);
29762
29698
  const fdirOptions = {
29763
29699
  filters: [options.debug ? (p$1, isDirectory$1) => {
29764
- const path2 = processPath(p$1, cwd, props.root, isDirectory$1, options.absolute);
29765
- const matches = matcher(path2);
29766
- if (matches) log(`matched ${path2}`);
29700
+ const path$1 = format$2(p$1, isDirectory$1);
29701
+ const matches = matcher(path$1);
29702
+ if (matches) log(`matched ${path$1}`);
29767
29703
  return matches;
29768
- } : (p$1, isDirectory$1) => matcher(processPath(p$1, cwd, props.root, isDirectory$1, options.absolute))],
29704
+ } : (p$1, isDirectory$1) => matcher(format$2(p$1, isDirectory$1))],
29769
29705
  exclude: options.debug ? (_, p$1) => {
29770
- const relativePath = processPath(p$1, cwd, props.root, true, true);
29706
+ const relativePath = formatExclude(p$1, true);
29771
29707
  const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
29772
29708
  if (skipped) log(`skipped ${p$1}`);
29773
29709
  else log(`crawling ${p$1}`);
29774
29710
  return skipped;
29775
29711
  } : (_, p$1) => {
29776
- const relativePath = processPath(p$1, cwd, props.root, true, true);
29712
+ const relativePath = formatExclude(p$1, true);
29777
29713
  return relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
29778
29714
  },
29715
+ fs: options.fs ? {
29716
+ readdir: options.fs.readdir || nativeFs.readdir,
29717
+ readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
29718
+ realpath: options.fs.realpath || nativeFs.realpath,
29719
+ realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
29720
+ stat: options.fs.stat || nativeFs.stat,
29721
+ statSync: options.fs.statSync || nativeFs.statSync
29722
+ } : void 0,
29779
29723
  pathSeparator: "/",
29780
29724
  relativePaths: true,
29781
- resolveSymlinks: true
29725
+ resolveSymlinks: true,
29726
+ signal: options.signal
29782
29727
  };
29783
- if (options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
29728
+ if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
29784
29729
  if (options.absolute) {
29785
29730
  fdirOptions.relativePaths = false;
29786
29731
  fdirOptions.resolvePaths = true;
@@ -29797,17 +29742,16 @@ function crawl(options, cwd, sync$1) {
29797
29742
  props.root = props.root.replace(BACKSLASHES, "");
29798
29743
  const root = props.root;
29799
29744
  if (options.debug) log("internal properties:", props);
29800
- const api = new import_dist.fdir(fdirOptions).crawl(root);
29801
- if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
29802
- return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
29745
+ const relative$2 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
29746
+ return [new Builder(fdirOptions).crawl(root), relative$2];
29803
29747
  }
29804
29748
  function globSync(patternsOrOptions, options) {
29805
- if (patternsOrOptions && (options == null ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
29806
- const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
29807
- ...options,
29808
- patterns: patternsOrOptions
29809
- } : patternsOrOptions;
29810
- return crawl(opts, opts.cwd ? path.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/"), true);
29749
+ if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
29750
+ const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
29751
+ const opts = isModern ? options : patternsOrOptions;
29752
+ const [crawler, relative$2] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
29753
+ if (!relative$2) return crawler.sync();
29754
+ return formatPaths(crawler.sync(), relative$2);
29811
29755
  }
29812
29756
 
29813
29757
  //#endregion
@@ -29970,13 +29914,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
29970
29914
  ],
29971
29915
  unsafeUseModuleFallbackService: true,
29972
29916
  unsafeInspectorProxy: inputInspectorPort !== false,
29973
- unsafeDirectSockets: environmentName === resolvedPluginConfig.entryWorkerEnvironmentName ? [{
29974
- serviceName: VITE_PROXY_WORKER_NAME,
29975
- proxy: true
29976
- }, ...Object.entries(exportTypes).filter(([_, type]) => type === "WorkerEntrypoint").map(([entrypoint]) => ({
29977
- entrypoint,
29978
- proxy: true
29979
- }))] : [],
29917
+ ...environmentName === resolvedPluginConfig.entryWorkerEnvironmentName && { unsafeOverrideFetchWorker: VITE_PROXY_WORKER_NAME },
29980
29918
  unsafeEvalBinding: "__VITE_UNSAFE_EVAL__",
29981
29919
  serviceBindings: {
29982
29920
  ...workerOptions.serviceBindings,
@@ -30070,7 +30008,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
30070
30008
  const inputInspectorPort = await getInputInspectorPort(ctx, vitePreviewServer);
30071
30009
  const { resolvedPluginConfig, resolvedViteConfig } = ctx;
30072
30010
  const containerTagToOptionsMap = /* @__PURE__ */ new Map();
30073
- const workers = (await Promise.all(resolvedPluginConfig.workers.map(async (workerConfig, i$1) => {
30011
+ const workers = (await Promise.all(resolvedPluginConfig.workers.map(async (workerConfig) => {
30074
30012
  const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
30075
30013
  const preExistingRemoteProxySessionData = workerConfig.configPath ? remoteProxySessionsDataMap.get(workerConfig.configPath) : void 0;
30076
30014
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await wrangler.maybeStartOrUpdateRemoteProxySession({
@@ -30101,10 +30039,6 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
30101
30039
  ...workerOptions,
30102
30040
  name: workerOptions.name ?? workerConfig.name,
30103
30041
  unsafeInspectorProxy: inputInspectorPort !== false,
30104
- unsafeDirectSockets: i$1 === 0 ? [{
30105
- entrypoint: void 0,
30106
- proxy: true
30107
- }] : [],
30108
30042
  ...miniflareWorkerOptions.main ? getPreviewModules(miniflareWorkerOptions.main, modulesRules) : {
30109
30043
  modules: true,
30110
30044
  script: ""
@@ -31028,17 +30962,17 @@ const baseOpen = async (options) => {
31028
30962
  if (platform === "darwin" && appArguments.length > 0) cliArguments.push("--args", ...appArguments);
31029
30963
  if (options.target) cliArguments.push(options.target);
31030
30964
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
31031
- if (options.wait) return new Promise((resolve$2, reject) => {
30965
+ if (options.wait) return new Promise((resolve$3, reject) => {
31032
30966
  subprocess.once("error", reject);
31033
30967
  subprocess.once("close", (exitCode) => {
31034
30968
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
31035
30969
  reject(/* @__PURE__ */ new Error(`Exited with code ${exitCode}`));
31036
30970
  return;
31037
30971
  }
31038
- resolve$2(subprocess);
30972
+ resolve$3(subprocess);
31039
30973
  });
31040
30974
  });
31041
- if (isFallbackAttempt) return new Promise((resolve$2, reject) => {
30975
+ if (isFallbackAttempt) return new Promise((resolve$3, reject) => {
31042
30976
  subprocess.once("error", reject);
31043
30977
  subprocess.once("spawn", () => {
31044
30978
  subprocess.once("close", (exitCode) => {
@@ -31048,16 +30982,16 @@ const baseOpen = async (options) => {
31048
30982
  return;
31049
30983
  }
31050
30984
  subprocess.unref();
31051
- resolve$2(subprocess);
30985
+ resolve$3(subprocess);
31052
30986
  });
31053
30987
  });
31054
30988
  });
31055
30989
  subprocess.unref();
31056
- return new Promise((resolve$2, reject) => {
30990
+ return new Promise((resolve$3, reject) => {
31057
30991
  subprocess.once("error", reject);
31058
30992
  subprocess.once("spawn", () => {
31059
30993
  subprocess.off("error", reject);
31060
- resolve$2(subprocess);
30994
+ resolve$3(subprocess);
31061
30995
  });
31062
30996
  });
31063
30997
  };