flowlint 0.7.8 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9,6 +9,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __commonJS = (cb, mod) => function __require2() {
10
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
11
  };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
12
16
  var __copyProps = (to, from, except, desc) => {
13
17
  if (from && typeof from === "object" || typeof from === "function") {
14
18
  for (let key of __getOwnPropNames(from))
@@ -25,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
29
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
30
  mod
27
31
  ));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
33
 
29
34
  // node_modules/commander/lib/error.js
30
35
  var require_error = __commonJS({
@@ -1195,7 +1200,7 @@ var require_command = __commonJS({
1195
1200
  "use strict";
1196
1201
  var EventEmitter2 = require("events").EventEmitter;
1197
1202
  var childProcess = require("child_process");
1198
- var path5 = require("path");
1203
+ var path4 = require("path");
1199
1204
  var fs3 = require("fs");
1200
1205
  var process2 = require("process");
1201
1206
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2208,11 +2213,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2208
2213
  let launchWithNode = false;
2209
2214
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2210
2215
  function findFile(baseDir, baseName) {
2211
- const localBin = path5.resolve(baseDir, baseName);
2216
+ const localBin = path4.resolve(baseDir, baseName);
2212
2217
  if (fs3.existsSync(localBin)) return localBin;
2213
- if (sourceExt.includes(path5.extname(baseName))) return void 0;
2218
+ if (sourceExt.includes(path4.extname(baseName))) return void 0;
2214
2219
  const foundExt = sourceExt.find(
2215
- (ext2) => fs3.existsSync(`${localBin}${ext2}`)
2220
+ (ext) => fs3.existsSync(`${localBin}${ext}`)
2216
2221
  );
2217
2222
  if (foundExt) return `${localBin}${foundExt}`;
2218
2223
  return void 0;
@@ -2228,17 +2233,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2228
2233
  } catch {
2229
2234
  resolvedScriptPath = this._scriptPath;
2230
2235
  }
2231
- executableDir = path5.resolve(
2232
- path5.dirname(resolvedScriptPath),
2236
+ executableDir = path4.resolve(
2237
+ path4.dirname(resolvedScriptPath),
2233
2238
  executableDir
2234
2239
  );
2235
2240
  }
2236
2241
  if (executableDir) {
2237
2242
  let localFile = findFile(executableDir, executableFile);
2238
2243
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2239
- const legacyName = path5.basename(
2244
+ const legacyName = path4.basename(
2240
2245
  this._scriptPath,
2241
- path5.extname(this._scriptPath)
2246
+ path4.extname(this._scriptPath)
2242
2247
  );
2243
2248
  if (legacyName !== this._name) {
2244
2249
  localFile = findFile(
@@ -2249,7 +2254,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2249
2254
  }
2250
2255
  executableFile = localFile || executableFile;
2251
2256
  }
2252
- launchWithNode = sourceExt.includes(path5.extname(executableFile));
2257
+ launchWithNode = sourceExt.includes(path4.extname(executableFile));
2253
2258
  let proc2;
2254
2259
  if (process2.platform !== "win32") {
2255
2260
  if (launchWithNode) {
@@ -3164,7 +3169,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3164
3169
  * @return {Command}
3165
3170
  */
3166
3171
  nameFromFilename(filename) {
3167
- this._name = path5.basename(filename, path5.extname(filename));
3172
+ this._name = path4.basename(filename, path4.extname(filename));
3168
3173
  return this;
3169
3174
  }
3170
3175
  /**
@@ -3178,9 +3183,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3178
3183
  * @param {string} [path]
3179
3184
  * @return {(string|null|Command)}
3180
3185
  */
3181
- executableDir(path6) {
3182
- if (path6 === void 0) return this._executableDir;
3183
- this._executableDir = path6;
3186
+ executableDir(path5) {
3187
+ if (path5 === void 0) return this._executableDir;
3188
+ this._executableDir = path5;
3184
3189
  return this;
3185
3190
  }
3186
3191
  /**
@@ -3403,20 +3408,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
3403
3408
  let debugOption;
3404
3409
  let debugHost = "127.0.0.1";
3405
3410
  let debugPort = "9229";
3406
- let match2;
3407
- if ((match2 = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
3408
- debugOption = match2[1];
3409
- } else if ((match2 = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
3410
- debugOption = match2[1];
3411
- if (/^\d+$/.test(match2[3])) {
3412
- debugPort = match2[3];
3411
+ let match;
3412
+ if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
3413
+ debugOption = match[1];
3414
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
3415
+ debugOption = match[1];
3416
+ if (/^\d+$/.test(match[3])) {
3417
+ debugPort = match[3];
3413
3418
  } else {
3414
- debugHost = match2[3];
3419
+ debugHost = match[3];
3415
3420
  }
3416
- } else if ((match2 = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
3417
- debugOption = match2[1];
3418
- debugHost = match2[3];
3419
- debugPort = match2[4];
3421
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
3422
+ debugOption = match[1];
3423
+ debugHost = match[3];
3424
+ debugPort = match[4];
3420
3425
  }
3421
3426
  if (debugOption && debugPort !== "0") {
3422
3427
  return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
@@ -3609,17 +3614,17 @@ var require_visit = __commonJS({
3609
3614
  visit.BREAK = BREAK;
3610
3615
  visit.SKIP = SKIP;
3611
3616
  visit.REMOVE = REMOVE;
3612
- function visit_(key, node, visitor, path5) {
3613
- const ctrl = callVisitor(key, node, visitor, path5);
3617
+ function visit_(key, node, visitor, path4) {
3618
+ const ctrl = callVisitor(key, node, visitor, path4);
3614
3619
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3615
- replaceNode(key, path5, ctrl);
3616
- return visit_(key, ctrl, visitor, path5);
3620
+ replaceNode(key, path4, ctrl);
3621
+ return visit_(key, ctrl, visitor, path4);
3617
3622
  }
3618
3623
  if (typeof ctrl !== "symbol") {
3619
3624
  if (identity.isCollection(node)) {
3620
- path5 = Object.freeze(path5.concat(node));
3625
+ path4 = Object.freeze(path4.concat(node));
3621
3626
  for (let i = 0; i < node.items.length; ++i) {
3622
- const ci = visit_(i, node.items[i], visitor, path5);
3627
+ const ci = visit_(i, node.items[i], visitor, path4);
3623
3628
  if (typeof ci === "number")
3624
3629
  i = ci - 1;
3625
3630
  else if (ci === BREAK)
@@ -3630,13 +3635,13 @@ var require_visit = __commonJS({
3630
3635
  }
3631
3636
  }
3632
3637
  } else if (identity.isPair(node)) {
3633
- path5 = Object.freeze(path5.concat(node));
3634
- const ck = visit_("key", node.key, visitor, path5);
3638
+ path4 = Object.freeze(path4.concat(node));
3639
+ const ck = visit_("key", node.key, visitor, path4);
3635
3640
  if (ck === BREAK)
3636
3641
  return BREAK;
3637
3642
  else if (ck === REMOVE)
3638
3643
  node.key = null;
3639
- const cv = visit_("value", node.value, visitor, path5);
3644
+ const cv = visit_("value", node.value, visitor, path4);
3640
3645
  if (cv === BREAK)
3641
3646
  return BREAK;
3642
3647
  else if (cv === REMOVE)
@@ -3657,17 +3662,17 @@ var require_visit = __commonJS({
3657
3662
  visitAsync.BREAK = BREAK;
3658
3663
  visitAsync.SKIP = SKIP;
3659
3664
  visitAsync.REMOVE = REMOVE;
3660
- async function visitAsync_(key, node, visitor, path5) {
3661
- const ctrl = await callVisitor(key, node, visitor, path5);
3665
+ async function visitAsync_(key, node, visitor, path4) {
3666
+ const ctrl = await callVisitor(key, node, visitor, path4);
3662
3667
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3663
- replaceNode(key, path5, ctrl);
3664
- return visitAsync_(key, ctrl, visitor, path5);
3668
+ replaceNode(key, path4, ctrl);
3669
+ return visitAsync_(key, ctrl, visitor, path4);
3665
3670
  }
3666
3671
  if (typeof ctrl !== "symbol") {
3667
3672
  if (identity.isCollection(node)) {
3668
- path5 = Object.freeze(path5.concat(node));
3673
+ path4 = Object.freeze(path4.concat(node));
3669
3674
  for (let i = 0; i < node.items.length; ++i) {
3670
- const ci = await visitAsync_(i, node.items[i], visitor, path5);
3675
+ const ci = await visitAsync_(i, node.items[i], visitor, path4);
3671
3676
  if (typeof ci === "number")
3672
3677
  i = ci - 1;
3673
3678
  else if (ci === BREAK)
@@ -3678,13 +3683,13 @@ var require_visit = __commonJS({
3678
3683
  }
3679
3684
  }
3680
3685
  } else if (identity.isPair(node)) {
3681
- path5 = Object.freeze(path5.concat(node));
3682
- const ck = await visitAsync_("key", node.key, visitor, path5);
3686
+ path4 = Object.freeze(path4.concat(node));
3687
+ const ck = await visitAsync_("key", node.key, visitor, path4);
3683
3688
  if (ck === BREAK)
3684
3689
  return BREAK;
3685
3690
  else if (ck === REMOVE)
3686
3691
  node.key = null;
3687
- const cv = await visitAsync_("value", node.value, visitor, path5);
3692
+ const cv = await visitAsync_("value", node.value, visitor, path4);
3688
3693
  if (cv === BREAK)
3689
3694
  return BREAK;
3690
3695
  else if (cv === REMOVE)
@@ -3711,23 +3716,23 @@ var require_visit = __commonJS({
3711
3716
  }
3712
3717
  return visitor;
3713
3718
  }
3714
- function callVisitor(key, node, visitor, path5) {
3719
+ function callVisitor(key, node, visitor, path4) {
3715
3720
  if (typeof visitor === "function")
3716
- return visitor(key, node, path5);
3721
+ return visitor(key, node, path4);
3717
3722
  if (identity.isMap(node))
3718
- return visitor.Map?.(key, node, path5);
3723
+ return visitor.Map?.(key, node, path4);
3719
3724
  if (identity.isSeq(node))
3720
- return visitor.Seq?.(key, node, path5);
3725
+ return visitor.Seq?.(key, node, path4);
3721
3726
  if (identity.isPair(node))
3722
- return visitor.Pair?.(key, node, path5);
3727
+ return visitor.Pair?.(key, node, path4);
3723
3728
  if (identity.isScalar(node))
3724
- return visitor.Scalar?.(key, node, path5);
3729
+ return visitor.Scalar?.(key, node, path4);
3725
3730
  if (identity.isAlias(node))
3726
- return visitor.Alias?.(key, node, path5);
3731
+ return visitor.Alias?.(key, node, path4);
3727
3732
  return void 0;
3728
3733
  }
3729
- function replaceNode(key, path5, node) {
3730
- const parent = path5[path5.length - 1];
3734
+ function replaceNode(key, path4, node) {
3735
+ const parent = path4[path4.length - 1];
3731
3736
  if (identity.isCollection(parent)) {
3732
3737
  parent.items[key] = node;
3733
3738
  } else if (identity.isPair(parent)) {
@@ -4263,8 +4268,8 @@ var require_createNode = __commonJS({
4263
4268
  var defaultTagPrefix = "tag:yaml.org,2002:";
4264
4269
  function findTagObject(value, tagName, tags) {
4265
4270
  if (tagName) {
4266
- const match2 = tags.filter((t) => t.tag === tagName);
4267
- const tagObj = match2.find((t) => !t.format) ?? match2[0];
4271
+ const match = tags.filter((t) => t.tag === tagName);
4272
+ const tagObj = match.find((t) => !t.format) ?? match[0];
4268
4273
  if (!tagObj)
4269
4274
  throw new Error(`Tag ${tagName} not found`);
4270
4275
  return tagObj;
@@ -4335,10 +4340,10 @@ var require_Collection = __commonJS({
4335
4340
  var createNode = require_createNode();
4336
4341
  var identity = require_identity();
4337
4342
  var Node = require_Node();
4338
- function collectionFromPath(schema, path5, value) {
4343
+ function collectionFromPath(schema, path4, value) {
4339
4344
  let v = value;
4340
- for (let i = path5.length - 1; i >= 0; --i) {
4341
- const k = path5[i];
4345
+ for (let i = path4.length - 1; i >= 0; --i) {
4346
+ const k = path4[i];
4342
4347
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
4343
4348
  const a = [];
4344
4349
  a[k] = v;
@@ -4357,7 +4362,7 @@ var require_Collection = __commonJS({
4357
4362
  sourceObjects: /* @__PURE__ */ new Map()
4358
4363
  });
4359
4364
  }
4360
- var isEmptyPath = (path5) => path5 == null || typeof path5 === "object" && !!path5[Symbol.iterator]().next().done;
4365
+ var isEmptyPath = (path4) => path4 == null || typeof path4 === "object" && !!path4[Symbol.iterator]().next().done;
4361
4366
  var Collection = class extends Node.NodeBase {
4362
4367
  constructor(type, schema) {
4363
4368
  super(type);
@@ -4387,11 +4392,11 @@ var require_Collection = __commonJS({
4387
4392
  * be a Pair instance or a `{ key, value }` object, which may not have a key
4388
4393
  * that already exists in the map.
4389
4394
  */
4390
- addIn(path5, value) {
4391
- if (isEmptyPath(path5))
4395
+ addIn(path4, value) {
4396
+ if (isEmptyPath(path4))
4392
4397
  this.add(value);
4393
4398
  else {
4394
- const [key, ...rest] = path5;
4399
+ const [key, ...rest] = path4;
4395
4400
  const node = this.get(key, true);
4396
4401
  if (identity.isCollection(node))
4397
4402
  node.addIn(rest, value);
@@ -4405,8 +4410,8 @@ var require_Collection = __commonJS({
4405
4410
  * Removes a value from the collection.
4406
4411
  * @returns `true` if the item was found and removed.
4407
4412
  */
4408
- deleteIn(path5) {
4409
- const [key, ...rest] = path5;
4413
+ deleteIn(path4) {
4414
+ const [key, ...rest] = path4;
4410
4415
  if (rest.length === 0)
4411
4416
  return this.delete(key);
4412
4417
  const node = this.get(key, true);
@@ -4420,8 +4425,8 @@ var require_Collection = __commonJS({
4420
4425
  * scalar values from their surrounding node; to disable set `keepScalar` to
4421
4426
  * `true` (collections are always returned intact).
4422
4427
  */
4423
- getIn(path5, keepScalar) {
4424
- const [key, ...rest] = path5;
4428
+ getIn(path4, keepScalar) {
4429
+ const [key, ...rest] = path4;
4425
4430
  const node = this.get(key, true);
4426
4431
  if (rest.length === 0)
4427
4432
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -4439,8 +4444,8 @@ var require_Collection = __commonJS({
4439
4444
  /**
4440
4445
  * Checks if the collection includes a value with the key `key`.
4441
4446
  */
4442
- hasIn(path5) {
4443
- const [key, ...rest] = path5;
4447
+ hasIn(path4) {
4448
+ const [key, ...rest] = path4;
4444
4449
  if (rest.length === 0)
4445
4450
  return this.has(key);
4446
4451
  const node = this.get(key, true);
@@ -4450,8 +4455,8 @@ var require_Collection = __commonJS({
4450
4455
  * Sets a value in this collection. For `!!set`, `value` needs to be a
4451
4456
  * boolean to add/remove the item from the set.
4452
4457
  */
4453
- setIn(path5, value) {
4454
- const [key, ...rest] = path5;
4458
+ setIn(path4, value) {
4459
+ const [key, ...rest] = path4;
4455
4460
  if (rest.length === 0) {
4456
4461
  this.set(key, value);
4457
4462
  } else {
@@ -4958,21 +4963,21 @@ var require_stringify = __commonJS({
4958
4963
  }
4959
4964
  function getTagObject(tags, item) {
4960
4965
  if (item.tag) {
4961
- const match2 = tags.filter((t) => t.tag === item.tag);
4962
- if (match2.length > 0)
4963
- return match2.find((t) => t.format === item.format) ?? match2[0];
4966
+ const match = tags.filter((t) => t.tag === item.tag);
4967
+ if (match.length > 0)
4968
+ return match.find((t) => t.format === item.format) ?? match[0];
4964
4969
  }
4965
4970
  let tagObj = void 0;
4966
4971
  let obj;
4967
4972
  if (identity.isScalar(item)) {
4968
4973
  obj = item.value;
4969
- let match2 = tags.filter((t) => t.identify?.(obj));
4970
- if (match2.length > 1) {
4971
- const testMatch = match2.filter((t) => t.test);
4974
+ let match = tags.filter((t) => t.identify?.(obj));
4975
+ if (match.length > 1) {
4976
+ const testMatch = match.filter((t) => t.test);
4972
4977
  if (testMatch.length > 0)
4973
- match2 = testMatch;
4978
+ match = testMatch;
4974
4979
  }
4975
- tagObj = match2.find((t) => t.format === item.format) ?? match2.find((t) => !t.format);
4980
+ tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
4976
4981
  } else {
4977
4982
  obj = item;
4978
4983
  tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
@@ -6604,13 +6609,13 @@ var require_timestamp = __commonJS({
6604
6609
  // assumed to be 00:00:00Z (start of day, UTC).
6605
6610
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
6606
6611
  resolve(str) {
6607
- const match2 = str.match(timestamp.test);
6608
- if (!match2)
6612
+ const match = str.match(timestamp.test);
6613
+ if (!match)
6609
6614
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
6610
- const [, year, month, day, hour, minute, second] = match2.map(Number);
6611
- const millisec = match2[7] ? Number((match2[7] + "00").substr(1, 3)) : 0;
6615
+ const [, year, month, day, hour, minute, second] = match.map(Number);
6616
+ const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
6612
6617
  let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
6613
- const tz = match2[8];
6618
+ const tz = match[8];
6614
6619
  if (tz && tz !== "Z") {
6615
6620
  let d = parseSexagesimal(tz, false);
6616
6621
  if (Math.abs(d) < 30)
@@ -6955,9 +6960,9 @@ var require_Document = __commonJS({
6955
6960
  this.contents.add(value);
6956
6961
  }
6957
6962
  /** Adds a value to the document. */
6958
- addIn(path5, value) {
6963
+ addIn(path4, value) {
6959
6964
  if (assertCollection(this.contents))
6960
- this.contents.addIn(path5, value);
6965
+ this.contents.addIn(path4, value);
6961
6966
  }
6962
6967
  /**
6963
6968
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -7032,14 +7037,14 @@ var require_Document = __commonJS({
7032
7037
  * Removes a value from the document.
7033
7038
  * @returns `true` if the item was found and removed.
7034
7039
  */
7035
- deleteIn(path5) {
7036
- if (Collection.isEmptyPath(path5)) {
7040
+ deleteIn(path4) {
7041
+ if (Collection.isEmptyPath(path4)) {
7037
7042
  if (this.contents == null)
7038
7043
  return false;
7039
7044
  this.contents = null;
7040
7045
  return true;
7041
7046
  }
7042
- return assertCollection(this.contents) ? this.contents.deleteIn(path5) : false;
7047
+ return assertCollection(this.contents) ? this.contents.deleteIn(path4) : false;
7043
7048
  }
7044
7049
  /**
7045
7050
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -7054,10 +7059,10 @@ var require_Document = __commonJS({
7054
7059
  * scalar values from their surrounding node; to disable set `keepScalar` to
7055
7060
  * `true` (collections are always returned intact).
7056
7061
  */
7057
- getIn(path5, keepScalar) {
7058
- if (Collection.isEmptyPath(path5))
7062
+ getIn(path4, keepScalar) {
7063
+ if (Collection.isEmptyPath(path4))
7059
7064
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
7060
- return identity.isCollection(this.contents) ? this.contents.getIn(path5, keepScalar) : void 0;
7065
+ return identity.isCollection(this.contents) ? this.contents.getIn(path4, keepScalar) : void 0;
7061
7066
  }
7062
7067
  /**
7063
7068
  * Checks if the document includes a value with the key `key`.
@@ -7068,10 +7073,10 @@ var require_Document = __commonJS({
7068
7073
  /**
7069
7074
  * Checks if the document includes a value at `path`.
7070
7075
  */
7071
- hasIn(path5) {
7072
- if (Collection.isEmptyPath(path5))
7076
+ hasIn(path4) {
7077
+ if (Collection.isEmptyPath(path4))
7073
7078
  return this.contents !== void 0;
7074
- return identity.isCollection(this.contents) ? this.contents.hasIn(path5) : false;
7079
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path4) : false;
7075
7080
  }
7076
7081
  /**
7077
7082
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -7088,13 +7093,13 @@ var require_Document = __commonJS({
7088
7093
  * Sets a value in this document. For `!!set`, `value` needs to be a
7089
7094
  * boolean to add/remove the item from the set.
7090
7095
  */
7091
- setIn(path5, value) {
7092
- if (Collection.isEmptyPath(path5)) {
7096
+ setIn(path4, value) {
7097
+ if (Collection.isEmptyPath(path4)) {
7093
7098
  this.contents = value;
7094
7099
  } else if (this.contents == null) {
7095
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path5), value);
7100
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path4), value);
7096
7101
  } else if (assertCollection(this.contents)) {
7097
- this.contents.setIn(path5, value);
7102
+ this.contents.setIn(path4, value);
7098
7103
  }
7099
7104
  }
7100
7105
  /**
@@ -7480,10 +7485,10 @@ var require_resolve_block_map = __commonJS({
7480
7485
  let offset = bm.offset;
7481
7486
  let commentEnd = null;
7482
7487
  for (const collItem of bm.items) {
7483
- const { start, key, sep: sep2, value } = collItem;
7488
+ const { start, key, sep, value } = collItem;
7484
7489
  const keyProps = resolveProps.resolveProps(start, {
7485
7490
  indicator: "explicit-key-ind",
7486
- next: key ?? sep2?.[0],
7491
+ next: key ?? sep?.[0],
7487
7492
  offset,
7488
7493
  onError,
7489
7494
  parentIndent: bm.indent,
@@ -7497,7 +7502,7 @@ var require_resolve_block_map = __commonJS({
7497
7502
  else if ("indent" in key && key.indent !== bm.indent)
7498
7503
  onError(offset, "BAD_INDENT", startColMsg);
7499
7504
  }
7500
- if (!keyProps.anchor && !keyProps.tag && !sep2) {
7505
+ if (!keyProps.anchor && !keyProps.tag && !sep) {
7501
7506
  commentEnd = keyProps.end;
7502
7507
  if (keyProps.comment) {
7503
7508
  if (map.comment)
@@ -7521,7 +7526,7 @@ var require_resolve_block_map = __commonJS({
7521
7526
  ctx.atKey = false;
7522
7527
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
7523
7528
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
7524
- const valueProps = resolveProps.resolveProps(sep2 ?? [], {
7529
+ const valueProps = resolveProps.resolveProps(sep ?? [], {
7525
7530
  indicator: "map-value-ind",
7526
7531
  next: value,
7527
7532
  offset: keyNode.range[2],
@@ -7537,7 +7542,7 @@ var require_resolve_block_map = __commonJS({
7537
7542
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
7538
7543
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
7539
7544
  }
7540
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep2, null, valueProps, onError);
7545
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
7541
7546
  if (ctx.schema.compat)
7542
7547
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
7543
7548
  offset = valueNode.range[2];
@@ -7628,7 +7633,7 @@ var require_resolve_end = __commonJS({
7628
7633
  let comment = "";
7629
7634
  if (end) {
7630
7635
  let hasSpace = false;
7631
- let sep2 = "";
7636
+ let sep = "";
7632
7637
  for (const token of end) {
7633
7638
  const { source, type } = token;
7634
7639
  switch (type) {
@@ -7642,13 +7647,13 @@ var require_resolve_end = __commonJS({
7642
7647
  if (!comment)
7643
7648
  comment = cb;
7644
7649
  else
7645
- comment += sep2 + cb;
7646
- sep2 = "";
7650
+ comment += sep + cb;
7651
+ sep = "";
7647
7652
  break;
7648
7653
  }
7649
7654
  case "newline":
7650
7655
  if (comment)
7651
- sep2 += source;
7656
+ sep += source;
7652
7657
  hasSpace = true;
7653
7658
  break;
7654
7659
  default:
@@ -7691,18 +7696,18 @@ var require_resolve_flow_collection = __commonJS({
7691
7696
  let offset = fc.offset + fc.start.source.length;
7692
7697
  for (let i = 0; i < fc.items.length; ++i) {
7693
7698
  const collItem = fc.items[i];
7694
- const { start, key, sep: sep2, value } = collItem;
7699
+ const { start, key, sep, value } = collItem;
7695
7700
  const props = resolveProps.resolveProps(start, {
7696
7701
  flow: fcName,
7697
7702
  indicator: "explicit-key-ind",
7698
- next: key ?? sep2?.[0],
7703
+ next: key ?? sep?.[0],
7699
7704
  offset,
7700
7705
  onError,
7701
7706
  parentIndent: fc.indent,
7702
7707
  startOnNewline: false
7703
7708
  });
7704
7709
  if (!props.found) {
7705
- if (!props.anchor && !props.tag && !sep2 && !value) {
7710
+ if (!props.anchor && !props.tag && !sep && !value) {
7706
7711
  if (i === 0 && props.comma)
7707
7712
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
7708
7713
  else if (i < fc.items.length - 1)
@@ -7756,8 +7761,8 @@ var require_resolve_flow_collection = __commonJS({
7756
7761
  }
7757
7762
  }
7758
7763
  }
7759
- if (!isMap && !sep2 && !props.found) {
7760
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep2, null, props, onError);
7764
+ if (!isMap && !sep && !props.found) {
7765
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
7761
7766
  coll.items.push(valueNode);
7762
7767
  offset = valueNode.range[2];
7763
7768
  if (isBlock(value))
@@ -7769,7 +7774,7 @@ var require_resolve_flow_collection = __commonJS({
7769
7774
  if (isBlock(key))
7770
7775
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
7771
7776
  ctx.atKey = false;
7772
- const valueProps = resolveProps.resolveProps(sep2 ?? [], {
7777
+ const valueProps = resolveProps.resolveProps(sep ?? [], {
7773
7778
  flow: fcName,
7774
7779
  indicator: "map-value-ind",
7775
7780
  next: value,
@@ -7780,8 +7785,8 @@ var require_resolve_flow_collection = __commonJS({
7780
7785
  });
7781
7786
  if (valueProps.found) {
7782
7787
  if (!isMap && !props.found && ctx.options.strict) {
7783
- if (sep2)
7784
- for (const st of sep2) {
7788
+ if (sep)
7789
+ for (const st of sep) {
7785
7790
  if (st === valueProps.found)
7786
7791
  break;
7787
7792
  if (st.type === "newline") {
@@ -7798,7 +7803,7 @@ var require_resolve_flow_collection = __commonJS({
7798
7803
  else
7799
7804
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
7800
7805
  }
7801
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep2, null, valueProps, onError) : null;
7806
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError) : null;
7802
7807
  if (valueNode) {
7803
7808
  if (isBlock(value))
7804
7809
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -7978,7 +7983,7 @@ var require_resolve_block_scalar = __commonJS({
7978
7983
  chompStart = i + 1;
7979
7984
  }
7980
7985
  let value = "";
7981
- let sep2 = "";
7986
+ let sep = "";
7982
7987
  let prevMoreIndented = false;
7983
7988
  for (let i = 0; i < contentStart; ++i)
7984
7989
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -7995,24 +8000,24 @@ var require_resolve_block_scalar = __commonJS({
7995
8000
  indent = "";
7996
8001
  }
7997
8002
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
7998
- value += sep2 + indent.slice(trimIndent) + content;
7999
- sep2 = "\n";
8003
+ value += sep + indent.slice(trimIndent) + content;
8004
+ sep = "\n";
8000
8005
  } else if (indent.length > trimIndent || content[0] === " ") {
8001
- if (sep2 === " ")
8002
- sep2 = "\n";
8003
- else if (!prevMoreIndented && sep2 === "\n")
8004
- sep2 = "\n\n";
8005
- value += sep2 + indent.slice(trimIndent) + content;
8006
- sep2 = "\n";
8006
+ if (sep === " ")
8007
+ sep = "\n";
8008
+ else if (!prevMoreIndented && sep === "\n")
8009
+ sep = "\n\n";
8010
+ value += sep + indent.slice(trimIndent) + content;
8011
+ sep = "\n";
8007
8012
  prevMoreIndented = true;
8008
8013
  } else if (content === "") {
8009
- if (sep2 === "\n")
8014
+ if (sep === "\n")
8010
8015
  value += "\n";
8011
8016
  else
8012
- sep2 = "\n";
8017
+ sep = "\n";
8013
8018
  } else {
8014
- value += sep2 + content;
8015
- sep2 = " ";
8019
+ value += sep + content;
8020
+ sep = " ";
8016
8021
  prevMoreIndented = false;
8017
8022
  }
8018
8023
  }
@@ -8190,29 +8195,29 @@ var require_resolve_flow_scalar = __commonJS({
8190
8195
  first = /(.*?)[ \t]*\r?\n/sy;
8191
8196
  line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
8192
8197
  }
8193
- let match2 = first.exec(source);
8194
- if (!match2)
8198
+ let match = first.exec(source);
8199
+ if (!match)
8195
8200
  return source;
8196
- let res = match2[1];
8197
- let sep2 = " ";
8201
+ let res = match[1];
8202
+ let sep = " ";
8198
8203
  let pos = first.lastIndex;
8199
8204
  line.lastIndex = pos;
8200
- while (match2 = line.exec(source)) {
8201
- if (match2[1] === "") {
8202
- if (sep2 === "\n")
8203
- res += sep2;
8205
+ while (match = line.exec(source)) {
8206
+ if (match[1] === "") {
8207
+ if (sep === "\n")
8208
+ res += sep;
8204
8209
  else
8205
- sep2 = "\n";
8210
+ sep = "\n";
8206
8211
  } else {
8207
- res += sep2 + match2[1];
8208
- sep2 = " ";
8212
+ res += sep + match[1];
8213
+ sep = " ";
8209
8214
  }
8210
8215
  pos = line.lastIndex;
8211
8216
  }
8212
8217
  const last = /[ \t]*(.*)/sy;
8213
8218
  last.lastIndex = pos;
8214
- match2 = last.exec(source);
8215
- return res + sep2 + (match2?.[1] ?? "");
8219
+ match = last.exec(source);
8220
+ return res + sep + (match?.[1] ?? "");
8216
8221
  }
8217
8222
  function doubleQuotedValue(source, onError) {
8218
8223
  let res = "";
@@ -8333,7 +8338,7 @@ var require_compose_scalar = __commonJS({
8333
8338
  var resolveBlockScalar = require_resolve_block_scalar();
8334
8339
  var resolveFlowScalar = require_resolve_flow_scalar();
8335
8340
  function composeScalar(ctx, token, tagToken, onError) {
8336
- const { value, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
8341
+ const { value, type, comment, range } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
8337
8342
  const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
8338
8343
  let tag;
8339
8344
  if (ctx.options.stringKeys && ctx.atKey) {
@@ -8353,7 +8358,7 @@ var require_compose_scalar = __commonJS({
8353
8358
  onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
8354
8359
  scalar = new Scalar.Scalar(value);
8355
8360
  }
8356
- scalar.range = range2;
8361
+ scalar.range = range;
8357
8362
  scalar.source = value;
8358
8363
  if (type)
8359
8364
  scalar.type = type;
@@ -9014,14 +9019,14 @@ var require_cst_stringify = __commonJS({
9014
9019
  }
9015
9020
  }
9016
9021
  }
9017
- function stringifyItem({ start, key, sep: sep2, value }) {
9022
+ function stringifyItem({ start, key, sep, value }) {
9018
9023
  let res = "";
9019
9024
  for (const st of start)
9020
9025
  res += st.source;
9021
9026
  if (key)
9022
9027
  res += stringifyToken(key);
9023
- if (sep2)
9024
- for (const st of sep2)
9028
+ if (sep)
9029
+ for (const st of sep)
9025
9030
  res += st.source;
9026
9031
  if (value)
9027
9032
  res += stringifyToken(value);
@@ -9046,9 +9051,9 @@ var require_cst_visit = __commonJS({
9046
9051
  visit.BREAK = BREAK;
9047
9052
  visit.SKIP = SKIP;
9048
9053
  visit.REMOVE = REMOVE;
9049
- visit.itemAtPath = (cst, path5) => {
9054
+ visit.itemAtPath = (cst, path4) => {
9050
9055
  let item = cst;
9051
- for (const [field, index] of path5) {
9056
+ for (const [field, index] of path4) {
9052
9057
  const tok = item?.[field];
9053
9058
  if (tok && "items" in tok) {
9054
9059
  item = tok.items[index];
@@ -9057,23 +9062,23 @@ var require_cst_visit = __commonJS({
9057
9062
  }
9058
9063
  return item;
9059
9064
  };
9060
- visit.parentCollection = (cst, path5) => {
9061
- const parent = visit.itemAtPath(cst, path5.slice(0, -1));
9062
- const field = path5[path5.length - 1][0];
9065
+ visit.parentCollection = (cst, path4) => {
9066
+ const parent = visit.itemAtPath(cst, path4.slice(0, -1));
9067
+ const field = path4[path4.length - 1][0];
9063
9068
  const coll = parent?.[field];
9064
9069
  if (coll && "items" in coll)
9065
9070
  return coll;
9066
9071
  throw new Error("Parent collection not found");
9067
9072
  };
9068
- function _visit(path5, item, visitor) {
9069
- let ctrl = visitor(item, path5);
9073
+ function _visit(path4, item, visitor) {
9074
+ let ctrl = visitor(item, path4);
9070
9075
  if (typeof ctrl === "symbol")
9071
9076
  return ctrl;
9072
9077
  for (const field of ["key", "value"]) {
9073
9078
  const token = item[field];
9074
9079
  if (token && "items" in token) {
9075
9080
  for (let i = 0; i < token.items.length; ++i) {
9076
- const ci = _visit(Object.freeze(path5.concat([[field, i]])), token.items[i], visitor);
9081
+ const ci = _visit(Object.freeze(path4.concat([[field, i]])), token.items[i], visitor);
9077
9082
  if (typeof ci === "number")
9078
9083
  i = ci - 1;
9079
9084
  else if (ci === BREAK)
@@ -9084,10 +9089,10 @@ var require_cst_visit = __commonJS({
9084
9089
  }
9085
9090
  }
9086
9091
  if (typeof ctrl === "function" && field === "key")
9087
- ctrl = ctrl(item, path5);
9092
+ ctrl = ctrl(item, path4);
9088
9093
  }
9089
9094
  }
9090
- return typeof ctrl === "function" ? ctrl(item, path5) : ctrl;
9095
+ return typeof ctrl === "function" ? ctrl(item, path4) : ctrl;
9091
9096
  }
9092
9097
  exports2.visit = visit;
9093
9098
  }
@@ -10171,18 +10176,18 @@ var require_parser = __commonJS({
10171
10176
  if (this.type === "map-value-ind") {
10172
10177
  const prev = getPrevProps(this.peek(2));
10173
10178
  const start = getFirstKeyStartProps(prev);
10174
- let sep2;
10179
+ let sep;
10175
10180
  if (scalar.end) {
10176
- sep2 = scalar.end;
10177
- sep2.push(this.sourceToken);
10181
+ sep = scalar.end;
10182
+ sep.push(this.sourceToken);
10178
10183
  delete scalar.end;
10179
10184
  } else
10180
- sep2 = [this.sourceToken];
10185
+ sep = [this.sourceToken];
10181
10186
  const map = {
10182
10187
  type: "block-map",
10183
10188
  offset: scalar.offset,
10184
10189
  indent: scalar.indent,
10185
- items: [{ start, key: scalar, sep: sep2 }]
10190
+ items: [{ start, key: scalar, sep }]
10186
10191
  };
10187
10192
  this.onKeyLine = true;
10188
10193
  this.stack[this.stack.length - 1] = map;
@@ -10335,15 +10340,15 @@ var require_parser = __commonJS({
10335
10340
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
10336
10341
  const start2 = getFirstKeyStartProps(it.start);
10337
10342
  const key = it.key;
10338
- const sep2 = it.sep;
10339
- sep2.push(this.sourceToken);
10343
+ const sep = it.sep;
10344
+ sep.push(this.sourceToken);
10340
10345
  delete it.key;
10341
10346
  delete it.sep;
10342
10347
  this.stack.push({
10343
10348
  type: "block-map",
10344
10349
  offset: this.offset,
10345
10350
  indent: this.indent,
10346
- items: [{ start: start2, key, sep: sep2 }]
10351
+ items: [{ start: start2, key, sep }]
10347
10352
  });
10348
10353
  } else if (start.length > 0) {
10349
10354
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -10537,13 +10542,13 @@ var require_parser = __commonJS({
10537
10542
  const prev = getPrevProps(parent);
10538
10543
  const start = getFirstKeyStartProps(prev);
10539
10544
  fixFlowSeqItems(fc);
10540
- const sep2 = fc.end.splice(1, fc.end.length);
10541
- sep2.push(this.sourceToken);
10545
+ const sep = fc.end.splice(1, fc.end.length);
10546
+ sep.push(this.sourceToken);
10542
10547
  const map = {
10543
10548
  type: "block-map",
10544
10549
  offset: fc.offset,
10545
10550
  indent: fc.indent,
10546
- items: [{ start, key: fc, sep: sep2 }]
10551
+ items: [{ start, key: fc, sep }]
10547
10552
  };
10548
10553
  this.onKeyLine = true;
10549
10554
  this.stack[this.stack.length - 1] = map;
@@ -12290,37 +12295,37 @@ var require_dataType = __commonJS({
12290
12295
  DataType2[DataType2["Wrong"] = 1] = "Wrong";
12291
12296
  })(DataType || (exports2.DataType = DataType = {}));
12292
12297
  function getSchemaTypes(schema) {
12293
- const types2 = getJSONTypes(schema.type);
12294
- const hasNull = types2.includes("null");
12298
+ const types = getJSONTypes(schema.type);
12299
+ const hasNull = types.includes("null");
12295
12300
  if (hasNull) {
12296
12301
  if (schema.nullable === false)
12297
12302
  throw new Error("type: null contradicts nullable: false");
12298
12303
  } else {
12299
- if (!types2.length && schema.nullable !== void 0) {
12304
+ if (!types.length && schema.nullable !== void 0) {
12300
12305
  throw new Error('"nullable" cannot be used without "type"');
12301
12306
  }
12302
12307
  if (schema.nullable === true)
12303
- types2.push("null");
12308
+ types.push("null");
12304
12309
  }
12305
- return types2;
12310
+ return types;
12306
12311
  }
12307
12312
  exports2.getSchemaTypes = getSchemaTypes;
12308
12313
  function getJSONTypes(ts) {
12309
- const types2 = Array.isArray(ts) ? ts : ts ? [ts] : [];
12310
- if (types2.every(rules_1.isJSONType))
12311
- return types2;
12312
- throw new Error("type must be JSONType or JSONType[]: " + types2.join(","));
12314
+ const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
12315
+ if (types.every(rules_1.isJSONType))
12316
+ return types;
12317
+ throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
12313
12318
  }
12314
12319
  exports2.getJSONTypes = getJSONTypes;
12315
- function coerceAndCheckDataType(it, types2) {
12320
+ function coerceAndCheckDataType(it, types) {
12316
12321
  const { gen, data, opts } = it;
12317
- const coerceTo = coerceToTypes(types2, opts.coerceTypes);
12318
- const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
12322
+ const coerceTo = coerceToTypes(types, opts.coerceTypes);
12323
+ const checkTypes = types.length > 0 && !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
12319
12324
  if (checkTypes) {
12320
- const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
12325
+ const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
12321
12326
  gen.if(wrongType, () => {
12322
12327
  if (coerceTo.length)
12323
- coerceData(it, types2, coerceTo);
12328
+ coerceData(it, types, coerceTo);
12324
12329
  else
12325
12330
  reportTypeError(it);
12326
12331
  });
@@ -12329,15 +12334,15 @@ var require_dataType = __commonJS({
12329
12334
  }
12330
12335
  exports2.coerceAndCheckDataType = coerceAndCheckDataType;
12331
12336
  var COERCIBLE = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
12332
- function coerceToTypes(types2, coerceTypes) {
12333
- return coerceTypes ? types2.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
12337
+ function coerceToTypes(types, coerceTypes) {
12338
+ return coerceTypes ? types.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
12334
12339
  }
12335
- function coerceData(it, types2, coerceTo) {
12340
+ function coerceData(it, types, coerceTo) {
12336
12341
  const { gen, data, opts } = it;
12337
12342
  const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
12338
12343
  const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
12339
12344
  if (opts.coerceTypes === "array") {
12340
- gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
12345
+ gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
12341
12346
  }
12342
12347
  gen.if((0, codegen_1._)`${coerced} !== undefined`);
12343
12348
  for (const t of coerceTo) {
@@ -12413,19 +12418,19 @@ var require_dataType = __commonJS({
12413
12418
  return checkDataType(dataTypes[0], data, strictNums, correct);
12414
12419
  }
12415
12420
  let cond;
12416
- const types2 = (0, util_1.toHash)(dataTypes);
12417
- if (types2.array && types2.object) {
12421
+ const types = (0, util_1.toHash)(dataTypes);
12422
+ if (types.array && types.object) {
12418
12423
  const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
12419
- cond = types2.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
12420
- delete types2.null;
12421
- delete types2.array;
12422
- delete types2.object;
12424
+ cond = types.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
12425
+ delete types.null;
12426
+ delete types.array;
12427
+ delete types.object;
12423
12428
  } else {
12424
12429
  cond = codegen_1.nil;
12425
12430
  }
12426
- if (types2.number)
12427
- delete types2.integer;
12428
- for (const t in types2)
12431
+ if (types.number)
12432
+ delete types.integer;
12433
+ for (const t in types)
12429
12434
  cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
12430
12435
  return cond;
12431
12436
  }
@@ -13230,9 +13235,9 @@ var require_validate = __commonJS({
13230
13235
  function typeAndKeywords(it, errsCount) {
13231
13236
  if (it.opts.jtd)
13232
13237
  return schemaKeywords(it, [], false, errsCount);
13233
- const types2 = (0, dataType_1.getSchemaTypes)(it.schema);
13234
- const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types2);
13235
- schemaKeywords(it, types2, !checkedTypes, errsCount);
13238
+ const types = (0, dataType_1.getSchemaTypes)(it.schema);
13239
+ const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types);
13240
+ schemaKeywords(it, types, !checkedTypes, errsCount);
13236
13241
  }
13237
13242
  function checkRefsAndKeywords(it) {
13238
13243
  const { schema, errSchemaPath, opts, self } = it;
@@ -13282,7 +13287,7 @@ var require_validate = __commonJS({
13282
13287
  if (items instanceof codegen_1.Name)
13283
13288
  gen.assign((0, codegen_1._)`${evaluated}.items`, items);
13284
13289
  }
13285
- function schemaKeywords(it, types2, typeErrors, errsCount) {
13290
+ function schemaKeywords(it, types, typeErrors, errsCount) {
13286
13291
  const { gen, schema, data, allErrors, opts, self } = it;
13287
13292
  const { RULES } = self;
13288
13293
  if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
@@ -13290,7 +13295,7 @@ var require_validate = __commonJS({
13290
13295
  return;
13291
13296
  }
13292
13297
  if (!opts.jtd)
13293
- checkStrictTypes(it, types2);
13298
+ checkStrictTypes(it, types);
13294
13299
  gen.block(() => {
13295
13300
  for (const group of RULES.rules)
13296
13301
  groupKeywords(group);
@@ -13302,7 +13307,7 @@ var require_validate = __commonJS({
13302
13307
  if (group.type) {
13303
13308
  gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
13304
13309
  iterateKeywords(it, group);
13305
- if (types2.length === 1 && types2[0] === group.type && typeErrors) {
13310
+ if (types.length === 1 && types[0] === group.type && typeErrors) {
13306
13311
  gen.else();
13307
13312
  (0, dataType_2.reportTypeError)(it);
13308
13313
  }
@@ -13326,27 +13331,27 @@ var require_validate = __commonJS({
13326
13331
  }
13327
13332
  });
13328
13333
  }
13329
- function checkStrictTypes(it, types2) {
13334
+ function checkStrictTypes(it, types) {
13330
13335
  if (it.schemaEnv.meta || !it.opts.strictTypes)
13331
13336
  return;
13332
- checkContextTypes(it, types2);
13337
+ checkContextTypes(it, types);
13333
13338
  if (!it.opts.allowUnionTypes)
13334
- checkMultipleTypes(it, types2);
13339
+ checkMultipleTypes(it, types);
13335
13340
  checkKeywordTypes(it, it.dataTypes);
13336
13341
  }
13337
- function checkContextTypes(it, types2) {
13338
- if (!types2.length)
13342
+ function checkContextTypes(it, types) {
13343
+ if (!types.length)
13339
13344
  return;
13340
13345
  if (!it.dataTypes.length) {
13341
- it.dataTypes = types2;
13346
+ it.dataTypes = types;
13342
13347
  return;
13343
13348
  }
13344
- types2.forEach((t) => {
13349
+ types.forEach((t) => {
13345
13350
  if (!includesType(it.dataTypes, t)) {
13346
13351
  strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
13347
13352
  }
13348
13353
  });
13349
- narrowSchemaTypes(it, types2);
13354
+ narrowSchemaTypes(it, types);
13350
13355
  }
13351
13356
  function checkMultipleTypes(it, ts) {
13352
13357
  if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
@@ -14014,8 +14019,8 @@ var require_utils = __commonJS({
14014
14019
  }
14015
14020
  return ind;
14016
14021
  }
14017
- function removeDotSegments(path5) {
14018
- let input = path5;
14022
+ function removeDotSegments(path4) {
14023
+ let input = path4;
14019
14024
  const output = [];
14020
14025
  let nextSlash = -1;
14021
14026
  let len = 0;
@@ -14214,8 +14219,8 @@ var require_schemes = __commonJS({
14214
14219
  wsComponent.secure = void 0;
14215
14220
  }
14216
14221
  if (wsComponent.resourceName) {
14217
- const [path5, query] = wsComponent.resourceName.split("?");
14218
- wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
14222
+ const [path4, query] = wsComponent.resourceName.split("?");
14223
+ wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
14219
14224
  wsComponent.query = query;
14220
14225
  wsComponent.resourceName = void 0;
14221
14226
  }
@@ -17581,6 +17586,13 @@ var require_dist2 = __commonJS({
17581
17586
  }
17582
17587
  });
17583
17588
 
17589
+ // src/cli.ts
17590
+ var cli_exports = {};
17591
+ __export(cli_exports, {
17592
+ program: () => program2
17593
+ });
17594
+ module.exports = __toCommonJS(cli_exports);
17595
+
17584
17596
  // node_modules/commander/esm.mjs
17585
17597
  var import_index = __toESM(require_commander(), 1);
17586
17598
  var {
@@ -17600,1561 +17612,13 @@ var {
17600
17612
 
17601
17613
  // src/commands/scan.ts
17602
17614
  var fs = __toESM(require("fs"));
17603
- var path3 = __toESM(require("path"));
17604
-
17605
- // node_modules/@isaacs/balanced-match/dist/esm/index.js
17606
- var balanced = (a, b, str) => {
17607
- const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
17608
- const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
17609
- const r = ma !== null && mb != null && range(ma, mb, str);
17610
- return r && {
17611
- start: r[0],
17612
- end: r[1],
17613
- pre: str.slice(0, r[0]),
17614
- body: str.slice(r[0] + ma.length, r[1]),
17615
- post: str.slice(r[1] + mb.length)
17616
- };
17617
- };
17618
- var maybeMatch = (reg, str) => {
17619
- const m = str.match(reg);
17620
- return m ? m[0] : null;
17621
- };
17622
- var range = (a, b, str) => {
17623
- let begs, beg, left, right = void 0, result;
17624
- let ai = str.indexOf(a);
17625
- let bi = str.indexOf(b, ai + 1);
17626
- let i = ai;
17627
- if (ai >= 0 && bi > 0) {
17628
- if (a === b) {
17629
- return [ai, bi];
17630
- }
17631
- begs = [];
17632
- left = str.length;
17633
- while (i >= 0 && !result) {
17634
- if (i === ai) {
17635
- begs.push(i);
17636
- ai = str.indexOf(a, i + 1);
17637
- } else if (begs.length === 1) {
17638
- const r = begs.pop();
17639
- if (r !== void 0)
17640
- result = [r, bi];
17641
- } else {
17642
- beg = begs.pop();
17643
- if (beg !== void 0 && beg < left) {
17644
- left = beg;
17645
- right = bi;
17646
- }
17647
- bi = str.indexOf(b, i + 1);
17648
- }
17649
- i = ai < bi && ai >= 0 ? ai : bi;
17650
- }
17651
- if (begs.length && right !== void 0) {
17652
- result = [left, right];
17653
- }
17654
- }
17655
- return result;
17656
- };
17657
-
17658
- // node_modules/@isaacs/brace-expansion/dist/esm/index.js
17659
- var escSlash = "\0SLASH" + Math.random() + "\0";
17660
- var escOpen = "\0OPEN" + Math.random() + "\0";
17661
- var escClose = "\0CLOSE" + Math.random() + "\0";
17662
- var escComma = "\0COMMA" + Math.random() + "\0";
17663
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
17664
- var escSlashPattern = new RegExp(escSlash, "g");
17665
- var escOpenPattern = new RegExp(escOpen, "g");
17666
- var escClosePattern = new RegExp(escClose, "g");
17667
- var escCommaPattern = new RegExp(escComma, "g");
17668
- var escPeriodPattern = new RegExp(escPeriod, "g");
17669
- var slashPattern = /\\\\/g;
17670
- var openPattern = /\\{/g;
17671
- var closePattern = /\\}/g;
17672
- var commaPattern = /\\,/g;
17673
- var periodPattern = /\\./g;
17674
- function numeric(str) {
17675
- return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
17676
- }
17677
- function escapeBraces(str) {
17678
- return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
17679
- }
17680
- function unescapeBraces(str) {
17681
- return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
17682
- }
17683
- function parseCommaParts(str) {
17684
- if (!str) {
17685
- return [""];
17686
- }
17687
- const parts = [];
17688
- const m = balanced("{", "}", str);
17689
- if (!m) {
17690
- return str.split(",");
17691
- }
17692
- const { pre, body, post } = m;
17693
- const p = pre.split(",");
17694
- p[p.length - 1] += "{" + body + "}";
17695
- const postParts = parseCommaParts(post);
17696
- if (post.length) {
17697
- ;
17698
- p[p.length - 1] += postParts.shift();
17699
- p.push.apply(p, postParts);
17700
- }
17701
- parts.push.apply(parts, p);
17702
- return parts;
17703
- }
17704
- function expand(str) {
17705
- if (!str) {
17706
- return [];
17707
- }
17708
- if (str.slice(0, 2) === "{}") {
17709
- str = "\\{\\}" + str.slice(2);
17710
- }
17711
- return expand_(escapeBraces(str), true).map(unescapeBraces);
17712
- }
17713
- function embrace(str) {
17714
- return "{" + str + "}";
17715
- }
17716
- function isPadded(el) {
17717
- return /^-?0\d/.test(el);
17718
- }
17719
- function lte(i, y) {
17720
- return i <= y;
17721
- }
17722
- function gte(i, y) {
17723
- return i >= y;
17724
- }
17725
- function expand_(str, isTop) {
17726
- const expansions = [];
17727
- const m = balanced("{", "}", str);
17728
- if (!m)
17729
- return [str];
17730
- const pre = m.pre;
17731
- const post = m.post.length ? expand_(m.post, false) : [""];
17732
- if (/\$$/.test(m.pre)) {
17733
- for (let k = 0; k < post.length; k++) {
17734
- const expansion = pre + "{" + m.body + "}" + post[k];
17735
- expansions.push(expansion);
17736
- }
17737
- } else {
17738
- const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
17739
- const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
17740
- const isSequence = isNumericSequence || isAlphaSequence;
17741
- const isOptions = m.body.indexOf(",") >= 0;
17742
- if (!isSequence && !isOptions) {
17743
- if (m.post.match(/,(?!,).*\}/)) {
17744
- str = m.pre + "{" + m.body + escClose + m.post;
17745
- return expand_(str);
17746
- }
17747
- return [str];
17748
- }
17749
- let n;
17750
- if (isSequence) {
17751
- n = m.body.split(/\.\./);
17752
- } else {
17753
- n = parseCommaParts(m.body);
17754
- if (n.length === 1 && n[0] !== void 0) {
17755
- n = expand_(n[0], false).map(embrace);
17756
- if (n.length === 1) {
17757
- return post.map((p) => m.pre + n[0] + p);
17758
- }
17759
- }
17760
- }
17761
- let N;
17762
- if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
17763
- const x = numeric(n[0]);
17764
- const y = numeric(n[1]);
17765
- const width = Math.max(n[0].length, n[1].length);
17766
- let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
17767
- let test = lte;
17768
- const reverse = y < x;
17769
- if (reverse) {
17770
- incr *= -1;
17771
- test = gte;
17772
- }
17773
- const pad = n.some(isPadded);
17774
- N = [];
17775
- for (let i = x; test(i, y); i += incr) {
17776
- let c;
17777
- if (isAlphaSequence) {
17778
- c = String.fromCharCode(i);
17779
- if (c === "\\") {
17780
- c = "";
17781
- }
17782
- } else {
17783
- c = String(i);
17784
- if (pad) {
17785
- const need = width - c.length;
17786
- if (need > 0) {
17787
- const z = new Array(need + 1).join("0");
17788
- if (i < 0) {
17789
- c = "-" + z + c.slice(1);
17790
- } else {
17791
- c = z + c;
17792
- }
17793
- }
17794
- }
17795
- }
17796
- N.push(c);
17797
- }
17798
- } else {
17799
- N = [];
17800
- for (let j = 0; j < n.length; j++) {
17801
- N.push.apply(N, expand_(n[j], false));
17802
- }
17803
- }
17804
- for (let j = 0; j < N.length; j++) {
17805
- for (let k = 0; k < post.length; k++) {
17806
- const expansion = pre + N[j] + post[k];
17807
- if (!isTop || isSequence || expansion) {
17808
- expansions.push(expansion);
17809
- }
17810
- }
17811
- }
17812
- }
17813
- return expansions;
17814
- }
17815
-
17816
- // node_modules/minimatch/dist/esm/assert-valid-pattern.js
17817
- var MAX_PATTERN_LENGTH = 1024 * 64;
17818
- var assertValidPattern = (pattern) => {
17819
- if (typeof pattern !== "string") {
17820
- throw new TypeError("invalid pattern");
17821
- }
17822
- if (pattern.length > MAX_PATTERN_LENGTH) {
17823
- throw new TypeError("pattern is too long");
17824
- }
17825
- };
17826
-
17827
- // node_modules/minimatch/dist/esm/brace-expressions.js
17828
- var posixClasses = {
17829
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
17830
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
17831
- "[:ascii:]": ["\\x00-\\x7f", false],
17832
- "[:blank:]": ["\\p{Zs}\\t", true],
17833
- "[:cntrl:]": ["\\p{Cc}", true],
17834
- "[:digit:]": ["\\p{Nd}", true],
17835
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
17836
- "[:lower:]": ["\\p{Ll}", true],
17837
- "[:print:]": ["\\p{C}", true],
17838
- "[:punct:]": ["\\p{P}", true],
17839
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
17840
- "[:upper:]": ["\\p{Lu}", true],
17841
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
17842
- "[:xdigit:]": ["A-Fa-f0-9", false]
17843
- };
17844
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
17845
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
17846
- var rangesToString = (ranges) => ranges.join("");
17847
- var parseClass = (glob2, position) => {
17848
- const pos = position;
17849
- if (glob2.charAt(pos) !== "[") {
17850
- throw new Error("not in a brace expression");
17851
- }
17852
- const ranges = [];
17853
- const negs = [];
17854
- let i = pos + 1;
17855
- let sawStart = false;
17856
- let uflag = false;
17857
- let escaping = false;
17858
- let negate = false;
17859
- let endPos = pos;
17860
- let rangeStart = "";
17861
- WHILE: while (i < glob2.length) {
17862
- const c = glob2.charAt(i);
17863
- if ((c === "!" || c === "^") && i === pos + 1) {
17864
- negate = true;
17865
- i++;
17866
- continue;
17867
- }
17868
- if (c === "]" && sawStart && !escaping) {
17869
- endPos = i + 1;
17870
- break;
17871
- }
17872
- sawStart = true;
17873
- if (c === "\\") {
17874
- if (!escaping) {
17875
- escaping = true;
17876
- i++;
17877
- continue;
17878
- }
17879
- }
17880
- if (c === "[" && !escaping) {
17881
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
17882
- if (glob2.startsWith(cls, i)) {
17883
- if (rangeStart) {
17884
- return ["$.", false, glob2.length - pos, true];
17885
- }
17886
- i += cls.length;
17887
- if (neg)
17888
- negs.push(unip);
17889
- else
17890
- ranges.push(unip);
17891
- uflag = uflag || u;
17892
- continue WHILE;
17893
- }
17894
- }
17895
- }
17896
- escaping = false;
17897
- if (rangeStart) {
17898
- if (c > rangeStart) {
17899
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
17900
- } else if (c === rangeStart) {
17901
- ranges.push(braceEscape(c));
17902
- }
17903
- rangeStart = "";
17904
- i++;
17905
- continue;
17906
- }
17907
- if (glob2.startsWith("-]", i + 1)) {
17908
- ranges.push(braceEscape(c + "-"));
17909
- i += 2;
17910
- continue;
17911
- }
17912
- if (glob2.startsWith("-", i + 1)) {
17913
- rangeStart = c;
17914
- i += 2;
17915
- continue;
17916
- }
17917
- ranges.push(braceEscape(c));
17918
- i++;
17919
- }
17920
- if (endPos < i) {
17921
- return ["", false, 0, false];
17922
- }
17923
- if (!ranges.length && !negs.length) {
17924
- return ["$.", false, glob2.length - pos, true];
17925
- }
17926
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
17927
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
17928
- return [regexpEscape(r), false, endPos - pos, false];
17929
- }
17930
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
17931
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
17932
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
17933
- return [comb, uflag, endPos - pos, true];
17934
- };
17935
-
17936
- // node_modules/minimatch/dist/esm/unescape.js
17937
- var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
17938
- if (magicalBraces) {
17939
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
17940
- }
17941
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
17942
- };
17943
-
17944
- // node_modules/minimatch/dist/esm/ast.js
17945
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
17946
- var isExtglobType = (c) => types.has(c);
17947
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
17948
- var startNoDot = "(?!\\.)";
17949
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
17950
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
17951
- var reSpecials = new Set("().*{}+?[]^$\\!");
17952
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
17953
- var qmark = "[^/]";
17954
- var star = qmark + "*?";
17955
- var starNoEmpty = qmark + "+?";
17956
- var AST = class _AST {
17957
- type;
17958
- #root;
17959
- #hasMagic;
17960
- #uflag = false;
17961
- #parts = [];
17962
- #parent;
17963
- #parentIndex;
17964
- #negs;
17965
- #filledNegs = false;
17966
- #options;
17967
- #toString;
17968
- // set to true if it's an extglob with no children
17969
- // (which really means one child of '')
17970
- #emptyExt = false;
17971
- constructor(type, parent, options = {}) {
17972
- this.type = type;
17973
- if (type)
17974
- this.#hasMagic = true;
17975
- this.#parent = parent;
17976
- this.#root = this.#parent ? this.#parent.#root : this;
17977
- this.#options = this.#root === this ? options : this.#root.#options;
17978
- this.#negs = this.#root === this ? [] : this.#root.#negs;
17979
- if (type === "!" && !this.#root.#filledNegs)
17980
- this.#negs.push(this);
17981
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
17982
- }
17983
- get hasMagic() {
17984
- if (this.#hasMagic !== void 0)
17985
- return this.#hasMagic;
17986
- for (const p of this.#parts) {
17987
- if (typeof p === "string")
17988
- continue;
17989
- if (p.type || p.hasMagic)
17990
- return this.#hasMagic = true;
17991
- }
17992
- return this.#hasMagic;
17993
- }
17994
- // reconstructs the pattern
17995
- toString() {
17996
- if (this.#toString !== void 0)
17997
- return this.#toString;
17998
- if (!this.type) {
17999
- return this.#toString = this.#parts.map((p) => String(p)).join("");
18000
- } else {
18001
- return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
18002
- }
18003
- }
18004
- #fillNegs() {
18005
- if (this !== this.#root)
18006
- throw new Error("should only call on root");
18007
- if (this.#filledNegs)
18008
- return this;
18009
- this.toString();
18010
- this.#filledNegs = true;
18011
- let n;
18012
- while (n = this.#negs.pop()) {
18013
- if (n.type !== "!")
18014
- continue;
18015
- let p = n;
18016
- let pp = p.#parent;
18017
- while (pp) {
18018
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
18019
- for (const part of n.#parts) {
18020
- if (typeof part === "string") {
18021
- throw new Error("string part in extglob AST??");
18022
- }
18023
- part.copyIn(pp.#parts[i]);
18024
- }
18025
- }
18026
- p = pp;
18027
- pp = p.#parent;
18028
- }
18029
- }
18030
- return this;
18031
- }
18032
- push(...parts) {
18033
- for (const p of parts) {
18034
- if (p === "")
18035
- continue;
18036
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
18037
- throw new Error("invalid part: " + p);
18038
- }
18039
- this.#parts.push(p);
18040
- }
18041
- }
18042
- toJSON() {
18043
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
18044
- if (this.isStart() && !this.type)
18045
- ret.unshift([]);
18046
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
18047
- ret.push({});
18048
- }
18049
- return ret;
18050
- }
18051
- isStart() {
18052
- if (this.#root === this)
18053
- return true;
18054
- if (!this.#parent?.isStart())
18055
- return false;
18056
- if (this.#parentIndex === 0)
18057
- return true;
18058
- const p = this.#parent;
18059
- for (let i = 0; i < this.#parentIndex; i++) {
18060
- const pp = p.#parts[i];
18061
- if (!(pp instanceof _AST && pp.type === "!")) {
18062
- return false;
18063
- }
18064
- }
18065
- return true;
18066
- }
18067
- isEnd() {
18068
- if (this.#root === this)
18069
- return true;
18070
- if (this.#parent?.type === "!")
18071
- return true;
18072
- if (!this.#parent?.isEnd())
18073
- return false;
18074
- if (!this.type)
18075
- return this.#parent?.isEnd();
18076
- const pl = this.#parent ? this.#parent.#parts.length : 0;
18077
- return this.#parentIndex === pl - 1;
18078
- }
18079
- copyIn(part) {
18080
- if (typeof part === "string")
18081
- this.push(part);
18082
- else
18083
- this.push(part.clone(this));
18084
- }
18085
- clone(parent) {
18086
- const c = new _AST(this.type, parent);
18087
- for (const p of this.#parts) {
18088
- c.copyIn(p);
18089
- }
18090
- return c;
18091
- }
18092
- static #parseAST(str, ast, pos, opt) {
18093
- let escaping = false;
18094
- let inBrace = false;
18095
- let braceStart = -1;
18096
- let braceNeg = false;
18097
- if (ast.type === null) {
18098
- let i2 = pos;
18099
- let acc2 = "";
18100
- while (i2 < str.length) {
18101
- const c = str.charAt(i2++);
18102
- if (escaping || c === "\\") {
18103
- escaping = !escaping;
18104
- acc2 += c;
18105
- continue;
18106
- }
18107
- if (inBrace) {
18108
- if (i2 === braceStart + 1) {
18109
- if (c === "^" || c === "!") {
18110
- braceNeg = true;
18111
- }
18112
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
18113
- inBrace = false;
18114
- }
18115
- acc2 += c;
18116
- continue;
18117
- } else if (c === "[") {
18118
- inBrace = true;
18119
- braceStart = i2;
18120
- braceNeg = false;
18121
- acc2 += c;
18122
- continue;
18123
- }
18124
- if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
18125
- ast.push(acc2);
18126
- acc2 = "";
18127
- const ext2 = new _AST(c, ast);
18128
- i2 = _AST.#parseAST(str, ext2, i2, opt);
18129
- ast.push(ext2);
18130
- continue;
18131
- }
18132
- acc2 += c;
18133
- }
18134
- ast.push(acc2);
18135
- return i2;
18136
- }
18137
- let i = pos + 1;
18138
- let part = new _AST(null, ast);
18139
- const parts = [];
18140
- let acc = "";
18141
- while (i < str.length) {
18142
- const c = str.charAt(i++);
18143
- if (escaping || c === "\\") {
18144
- escaping = !escaping;
18145
- acc += c;
18146
- continue;
18147
- }
18148
- if (inBrace) {
18149
- if (i === braceStart + 1) {
18150
- if (c === "^" || c === "!") {
18151
- braceNeg = true;
18152
- }
18153
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
18154
- inBrace = false;
18155
- }
18156
- acc += c;
18157
- continue;
18158
- } else if (c === "[") {
18159
- inBrace = true;
18160
- braceStart = i;
18161
- braceNeg = false;
18162
- acc += c;
18163
- continue;
18164
- }
18165
- if (isExtglobType(c) && str.charAt(i) === "(") {
18166
- part.push(acc);
18167
- acc = "";
18168
- const ext2 = new _AST(c, part);
18169
- part.push(ext2);
18170
- i = _AST.#parseAST(str, ext2, i, opt);
18171
- continue;
18172
- }
18173
- if (c === "|") {
18174
- part.push(acc);
18175
- acc = "";
18176
- parts.push(part);
18177
- part = new _AST(null, ast);
18178
- continue;
18179
- }
18180
- if (c === ")") {
18181
- if (acc === "" && ast.#parts.length === 0) {
18182
- ast.#emptyExt = true;
18183
- }
18184
- part.push(acc);
18185
- acc = "";
18186
- ast.push(...parts, part);
18187
- return i;
18188
- }
18189
- acc += c;
18190
- }
18191
- ast.type = null;
18192
- ast.#hasMagic = void 0;
18193
- ast.#parts = [str.substring(pos - 1)];
18194
- return i;
18195
- }
18196
- static fromGlob(pattern, options = {}) {
18197
- const ast = new _AST(null, void 0, options);
18198
- _AST.#parseAST(pattern, ast, 0, options);
18199
- return ast;
18200
- }
18201
- // returns the regular expression if there's magic, or the unescaped
18202
- // string if not.
18203
- toMMPattern() {
18204
- if (this !== this.#root)
18205
- return this.#root.toMMPattern();
18206
- const glob2 = this.toString();
18207
- const [re, body, hasMagic2, uflag] = this.toRegExpSource();
18208
- const anyMagic = hasMagic2 || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob2.toUpperCase() !== glob2.toLowerCase();
18209
- if (!anyMagic) {
18210
- return body;
18211
- }
18212
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
18213
- return Object.assign(new RegExp(`^${re}$`, flags), {
18214
- _src: re,
18215
- _glob: glob2
18216
- });
18217
- }
18218
- get options() {
18219
- return this.#options;
18220
- }
18221
- // returns the string match, the regexp source, whether there's magic
18222
- // in the regexp (so a regular expression is required) and whether or
18223
- // not the uflag is needed for the regular expression (for posix classes)
18224
- // TODO: instead of injecting the start/end at this point, just return
18225
- // the BODY of the regexp, along with the start/end portions suitable
18226
- // for binding the start/end in either a joined full-path makeRe context
18227
- // (where we bind to (^|/), or a standalone matchPart context (where
18228
- // we bind to ^, and not /). Otherwise slashes get duped!
18229
- //
18230
- // In part-matching mode, the start is:
18231
- // - if not isStart: nothing
18232
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
18233
- // - if dots allowed or not possible: ^
18234
- // - if dots possible and not allowed: ^(?!\.)
18235
- // end is:
18236
- // - if not isEnd(): nothing
18237
- // - else: $
18238
- //
18239
- // In full-path matching mode, we put the slash at the START of the
18240
- // pattern, so start is:
18241
- // - if first pattern: same as part-matching mode
18242
- // - if not isStart(): nothing
18243
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
18244
- // - if dots allowed or not possible: /
18245
- // - if dots possible and not allowed: /(?!\.)
18246
- // end is:
18247
- // - if last pattern, same as part-matching mode
18248
- // - else nothing
18249
- //
18250
- // Always put the (?:$|/) on negated tails, though, because that has to be
18251
- // there to bind the end of the negated pattern portion, and it's easier to
18252
- // just stick it in now rather than try to inject it later in the middle of
18253
- // the pattern.
18254
- //
18255
- // We can just always return the same end, and leave it up to the caller
18256
- // to know whether it's going to be used joined or in parts.
18257
- // And, if the start is adjusted slightly, can do the same there:
18258
- // - if not isStart: nothing
18259
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
18260
- // - if dots allowed or not possible: (?:/|^)
18261
- // - if dots possible and not allowed: (?:/|^)(?!\.)
18262
- //
18263
- // But it's better to have a simpler binding without a conditional, for
18264
- // performance, so probably better to return both start options.
18265
- //
18266
- // Then the caller just ignores the end if it's not the first pattern,
18267
- // and the start always gets applied.
18268
- //
18269
- // But that's always going to be $ if it's the ending pattern, or nothing,
18270
- // so the caller can just attach $ at the end of the pattern when building.
18271
- //
18272
- // So the todo is:
18273
- // - better detect what kind of start is needed
18274
- // - return both flavors of starting pattern
18275
- // - attach $ at the end of the pattern when creating the actual RegExp
18276
- //
18277
- // Ah, but wait, no, that all only applies to the root when the first pattern
18278
- // is not an extglob. If the first pattern IS an extglob, then we need all
18279
- // that dot prevention biz to live in the extglob portions, because eg
18280
- // +(*|.x*) can match .xy but not .yx.
18281
- //
18282
- // So, return the two flavors if it's #root and the first child is not an
18283
- // AST, otherwise leave it to the child AST to handle it, and there,
18284
- // use the (?:^|/) style of start binding.
18285
- //
18286
- // Even simplified further:
18287
- // - Since the start for a join is eg /(?!\.) and the start for a part
18288
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
18289
- // or start or whatever) and prepend ^ or / at the Regexp construction.
18290
- toRegExpSource(allowDot) {
18291
- const dot = allowDot ?? !!this.#options.dot;
18292
- if (this.#root === this)
18293
- this.#fillNegs();
18294
- if (!this.type) {
18295
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
18296
- const src = this.#parts.map((p) => {
18297
- const [re, _, hasMagic2, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
18298
- this.#hasMagic = this.#hasMagic || hasMagic2;
18299
- this.#uflag = this.#uflag || uflag;
18300
- return re;
18301
- }).join("");
18302
- let start2 = "";
18303
- if (this.isStart()) {
18304
- if (typeof this.#parts[0] === "string") {
18305
- const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
18306
- if (!dotTravAllowed) {
18307
- const aps = addPatternStart;
18308
- const needNoTrav = (
18309
- // dots are allowed, and the pattern starts with [ or .
18310
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
18311
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
18312
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
18313
- );
18314
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
18315
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
18316
- }
18317
- }
18318
- }
18319
- let end = "";
18320
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
18321
- end = "(?:$|\\/)";
18322
- }
18323
- const final2 = start2 + src + end;
18324
- return [
18325
- final2,
18326
- unescape2(src),
18327
- this.#hasMagic = !!this.#hasMagic,
18328
- this.#uflag
18329
- ];
18330
- }
18331
- const repeated = this.type === "*" || this.type === "+";
18332
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
18333
- let body = this.#partsToRegExp(dot);
18334
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
18335
- const s = this.toString();
18336
- this.#parts = [s];
18337
- this.type = null;
18338
- this.#hasMagic = void 0;
18339
- return [s, unescape2(this.toString()), false, false];
18340
- }
18341
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
18342
- if (bodyDotAllowed === body) {
18343
- bodyDotAllowed = "";
18344
- }
18345
- if (bodyDotAllowed) {
18346
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
18347
- }
18348
- let final = "";
18349
- if (this.type === "!" && this.#emptyExt) {
18350
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
18351
- } else {
18352
- const close = this.type === "!" ? (
18353
- // !() must match something,but !(x) can match ''
18354
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
18355
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
18356
- final = start + body + close;
18357
- }
18358
- return [
18359
- final,
18360
- unescape2(body),
18361
- this.#hasMagic = !!this.#hasMagic,
18362
- this.#uflag
18363
- ];
18364
- }
18365
- #partsToRegExp(dot) {
18366
- return this.#parts.map((p) => {
18367
- if (typeof p === "string") {
18368
- throw new Error("string type in extglob ast??");
18369
- }
18370
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
18371
- this.#uflag = this.#uflag || uflag;
18372
- return re;
18373
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
18374
- }
18375
- static #parseGlob(glob2, hasMagic2, noEmpty = false) {
18376
- let escaping = false;
18377
- let re = "";
18378
- let uflag = false;
18379
- for (let i = 0; i < glob2.length; i++) {
18380
- const c = glob2.charAt(i);
18381
- if (escaping) {
18382
- escaping = false;
18383
- re += (reSpecials.has(c) ? "\\" : "") + c;
18384
- continue;
18385
- }
18386
- if (c === "\\") {
18387
- if (i === glob2.length - 1) {
18388
- re += "\\\\";
18389
- } else {
18390
- escaping = true;
18391
- }
18392
- continue;
18393
- }
18394
- if (c === "[") {
18395
- const [src, needUflag, consumed, magic] = parseClass(glob2, i);
18396
- if (consumed) {
18397
- re += src;
18398
- uflag = uflag || needUflag;
18399
- i += consumed - 1;
18400
- hasMagic2 = hasMagic2 || magic;
18401
- continue;
18402
- }
18403
- }
18404
- if (c === "*") {
18405
- re += noEmpty && glob2 === "*" ? starNoEmpty : star;
18406
- hasMagic2 = true;
18407
- continue;
18408
- }
18409
- if (c === "?") {
18410
- re += qmark;
18411
- hasMagic2 = true;
18412
- continue;
18413
- }
18414
- re += regExpEscape(c);
18415
- }
18416
- return [re, unescape2(glob2), !!hasMagic2, uflag];
18417
- }
18418
- };
18419
-
18420
- // node_modules/minimatch/dist/esm/escape.js
18421
- var escape2 = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
18422
- if (magicalBraces) {
18423
- return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
18424
- }
18425
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
18426
- };
17615
+ var path2 = __toESM(require("path"));
18427
17616
 
18428
- // node_modules/minimatch/dist/esm/index.js
18429
- var minimatch = (p, pattern, options = {}) => {
18430
- assertValidPattern(pattern);
18431
- if (!options.nocomment && pattern.charAt(0) === "#") {
18432
- return false;
18433
- }
18434
- return new Minimatch(pattern, options).match(p);
18435
- };
18436
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
18437
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
18438
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
18439
- var starDotExtTestNocase = (ext2) => {
18440
- ext2 = ext2.toLowerCase();
18441
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
18442
- };
18443
- var starDotExtTestNocaseDot = (ext2) => {
18444
- ext2 = ext2.toLowerCase();
18445
- return (f) => f.toLowerCase().endsWith(ext2);
18446
- };
18447
- var starDotStarRE = /^\*+\.\*+$/;
18448
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
18449
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
18450
- var dotStarRE = /^\.\*+$/;
18451
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
18452
- var starRE = /^\*+$/;
18453
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
18454
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
18455
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
18456
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
18457
- const noext = qmarksTestNoExt([$0]);
18458
- if (!ext2)
18459
- return noext;
18460
- ext2 = ext2.toLowerCase();
18461
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
18462
- };
18463
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
18464
- const noext = qmarksTestNoExtDot([$0]);
18465
- if (!ext2)
18466
- return noext;
18467
- ext2 = ext2.toLowerCase();
18468
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
18469
- };
18470
- var qmarksTestDot = ([$0, ext2 = ""]) => {
18471
- const noext = qmarksTestNoExtDot([$0]);
18472
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
18473
- };
18474
- var qmarksTest = ([$0, ext2 = ""]) => {
18475
- const noext = qmarksTestNoExt([$0]);
18476
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
18477
- };
18478
- var qmarksTestNoExt = ([$0]) => {
18479
- const len = $0.length;
18480
- return (f) => f.length === len && !f.startsWith(".");
18481
- };
18482
- var qmarksTestNoExtDot = ([$0]) => {
18483
- const len = $0.length;
18484
- return (f) => f.length === len && f !== "." && f !== "..";
18485
- };
18486
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
18487
- var path = {
18488
- win32: { sep: "\\" },
18489
- posix: { sep: "/" }
18490
- };
18491
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
18492
- minimatch.sep = sep;
18493
- var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
18494
- minimatch.GLOBSTAR = GLOBSTAR;
18495
- var qmark2 = "[^/]";
18496
- var star2 = qmark2 + "*?";
18497
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
18498
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
18499
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
18500
- minimatch.filter = filter;
18501
- var ext = (a, b = {}) => Object.assign({}, a, b);
18502
- var defaults = (def) => {
18503
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
18504
- return minimatch;
18505
- }
18506
- const orig = minimatch;
18507
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
18508
- return Object.assign(m, {
18509
- Minimatch: class Minimatch extends orig.Minimatch {
18510
- constructor(pattern, options = {}) {
18511
- super(pattern, ext(def, options));
18512
- }
18513
- static defaults(options) {
18514
- return orig.defaults(ext(def, options)).Minimatch;
18515
- }
18516
- },
18517
- AST: class AST extends orig.AST {
18518
- /* c8 ignore start */
18519
- constructor(type, parent, options = {}) {
18520
- super(type, parent, ext(def, options));
18521
- }
18522
- /* c8 ignore stop */
18523
- static fromGlob(pattern, options = {}) {
18524
- return orig.AST.fromGlob(pattern, ext(def, options));
18525
- }
18526
- },
18527
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
18528
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
18529
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
18530
- defaults: (options) => orig.defaults(ext(def, options)),
18531
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
18532
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
18533
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
18534
- sep: orig.sep,
18535
- GLOBSTAR
18536
- });
18537
- };
18538
- minimatch.defaults = defaults;
18539
- var braceExpand = (pattern, options = {}) => {
18540
- assertValidPattern(pattern);
18541
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
18542
- return [pattern];
18543
- }
18544
- return expand(pattern);
18545
- };
18546
- minimatch.braceExpand = braceExpand;
18547
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
18548
- minimatch.makeRe = makeRe;
18549
- var match = (list, pattern, options = {}) => {
18550
- const mm = new Minimatch(pattern, options);
18551
- list = list.filter((f) => mm.match(f));
18552
- if (mm.options.nonull && !list.length) {
18553
- list.push(pattern);
18554
- }
18555
- return list;
18556
- };
18557
- minimatch.match = match;
18558
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
18559
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
18560
- var Minimatch = class {
18561
- options;
18562
- set;
18563
- pattern;
18564
- windowsPathsNoEscape;
18565
- nonegate;
18566
- negate;
18567
- comment;
18568
- empty;
18569
- preserveMultipleSlashes;
18570
- partial;
18571
- globSet;
18572
- globParts;
18573
- nocase;
18574
- isWindows;
18575
- platform;
18576
- windowsNoMagicRoot;
18577
- regexp;
18578
- constructor(pattern, options = {}) {
18579
- assertValidPattern(pattern);
18580
- options = options || {};
18581
- this.options = options;
18582
- this.pattern = pattern;
18583
- this.platform = options.platform || defaultPlatform;
18584
- this.isWindows = this.platform === "win32";
18585
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
18586
- if (this.windowsPathsNoEscape) {
18587
- this.pattern = this.pattern.replace(/\\/g, "/");
18588
- }
18589
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
18590
- this.regexp = null;
18591
- this.negate = false;
18592
- this.nonegate = !!options.nonegate;
18593
- this.comment = false;
18594
- this.empty = false;
18595
- this.partial = !!options.partial;
18596
- this.nocase = !!this.options.nocase;
18597
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
18598
- this.globSet = [];
18599
- this.globParts = [];
18600
- this.set = [];
18601
- this.make();
18602
- }
18603
- hasMagic() {
18604
- if (this.options.magicalBraces && this.set.length > 1) {
18605
- return true;
18606
- }
18607
- for (const pattern of this.set) {
18608
- for (const part of pattern) {
18609
- if (typeof part !== "string")
18610
- return true;
18611
- }
18612
- }
18613
- return false;
18614
- }
18615
- debug(..._) {
18616
- }
18617
- make() {
18618
- const pattern = this.pattern;
18619
- const options = this.options;
18620
- if (!options.nocomment && pattern.charAt(0) === "#") {
18621
- this.comment = true;
18622
- return;
18623
- }
18624
- if (!pattern) {
18625
- this.empty = true;
18626
- return;
18627
- }
18628
- this.parseNegate();
18629
- this.globSet = [...new Set(this.braceExpand())];
18630
- if (options.debug) {
18631
- this.debug = (...args) => console.error(...args);
18632
- }
18633
- this.debug(this.pattern, this.globSet);
18634
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
18635
- this.globParts = this.preprocess(rawGlobParts);
18636
- this.debug(this.pattern, this.globParts);
18637
- let set = this.globParts.map((s, _, __) => {
18638
- if (this.isWindows && this.windowsNoMagicRoot) {
18639
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
18640
- const isDrive = /^[a-z]:/i.test(s[0]);
18641
- if (isUNC) {
18642
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
18643
- } else if (isDrive) {
18644
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
18645
- }
18646
- }
18647
- return s.map((ss) => this.parse(ss));
18648
- });
18649
- this.debug(this.pattern, set);
18650
- this.set = set.filter((s) => s.indexOf(false) === -1);
18651
- if (this.isWindows) {
18652
- for (let i = 0; i < this.set.length; i++) {
18653
- const p = this.set[i];
18654
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
18655
- p[2] = "?";
18656
- }
18657
- }
18658
- }
18659
- this.debug(this.pattern, this.set);
18660
- }
18661
- // various transforms to equivalent pattern sets that are
18662
- // faster to process in a filesystem walk. The goal is to
18663
- // eliminate what we can, and push all ** patterns as far
18664
- // to the right as possible, even if it increases the number
18665
- // of patterns that we have to process.
18666
- preprocess(globParts) {
18667
- if (this.options.noglobstar) {
18668
- for (let i = 0; i < globParts.length; i++) {
18669
- for (let j = 0; j < globParts[i].length; j++) {
18670
- if (globParts[i][j] === "**") {
18671
- globParts[i][j] = "*";
18672
- }
18673
- }
18674
- }
18675
- }
18676
- const { optimizationLevel = 1 } = this.options;
18677
- if (optimizationLevel >= 2) {
18678
- globParts = this.firstPhasePreProcess(globParts);
18679
- globParts = this.secondPhasePreProcess(globParts);
18680
- } else if (optimizationLevel >= 1) {
18681
- globParts = this.levelOneOptimize(globParts);
18682
- } else {
18683
- globParts = this.adjascentGlobstarOptimize(globParts);
18684
- }
18685
- return globParts;
18686
- }
18687
- // just get rid of adjascent ** portions
18688
- adjascentGlobstarOptimize(globParts) {
18689
- return globParts.map((parts) => {
18690
- let gs = -1;
18691
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
18692
- let i = gs;
18693
- while (parts[i + 1] === "**") {
18694
- i++;
18695
- }
18696
- if (i !== gs) {
18697
- parts.splice(gs, i - gs);
18698
- }
18699
- }
18700
- return parts;
18701
- });
18702
- }
18703
- // get rid of adjascent ** and resolve .. portions
18704
- levelOneOptimize(globParts) {
18705
- return globParts.map((parts) => {
18706
- parts = parts.reduce((set, part) => {
18707
- const prev = set[set.length - 1];
18708
- if (part === "**" && prev === "**") {
18709
- return set;
18710
- }
18711
- if (part === "..") {
18712
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
18713
- set.pop();
18714
- return set;
18715
- }
18716
- }
18717
- set.push(part);
18718
- return set;
18719
- }, []);
18720
- return parts.length === 0 ? [""] : parts;
18721
- });
18722
- }
18723
- levelTwoFileOptimize(parts) {
18724
- if (!Array.isArray(parts)) {
18725
- parts = this.slashSplit(parts);
18726
- }
18727
- let didSomething = false;
18728
- do {
18729
- didSomething = false;
18730
- if (!this.preserveMultipleSlashes) {
18731
- for (let i = 1; i < parts.length - 1; i++) {
18732
- const p = parts[i];
18733
- if (i === 1 && p === "" && parts[0] === "")
18734
- continue;
18735
- if (p === "." || p === "") {
18736
- didSomething = true;
18737
- parts.splice(i, 1);
18738
- i--;
18739
- }
18740
- }
18741
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
18742
- didSomething = true;
18743
- parts.pop();
18744
- }
18745
- }
18746
- let dd = 0;
18747
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
18748
- const p = parts[dd - 1];
18749
- if (p && p !== "." && p !== ".." && p !== "**") {
18750
- didSomething = true;
18751
- parts.splice(dd - 1, 2);
18752
- dd -= 2;
18753
- }
18754
- }
18755
- } while (didSomething);
18756
- return parts.length === 0 ? [""] : parts;
18757
- }
18758
- // First phase: single-pattern processing
18759
- // <pre> is 1 or more portions
18760
- // <rest> is 1 or more portions
18761
- // <p> is any portion other than ., .., '', or **
18762
- // <e> is . or ''
18763
- //
18764
- // **/.. is *brutal* for filesystem walking performance, because
18765
- // it effectively resets the recursive walk each time it occurs,
18766
- // and ** cannot be reduced out by a .. pattern part like a regexp
18767
- // or most strings (other than .., ., and '') can be.
18768
- //
18769
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
18770
- // <pre>/<e>/<rest> -> <pre>/<rest>
18771
- // <pre>/<p>/../<rest> -> <pre>/<rest>
18772
- // **/**/<rest> -> **/<rest>
18773
- //
18774
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
18775
- // this WOULD be allowed if ** did follow symlinks, or * didn't
18776
- firstPhasePreProcess(globParts) {
18777
- let didSomething = false;
18778
- do {
18779
- didSomething = false;
18780
- for (let parts of globParts) {
18781
- let gs = -1;
18782
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
18783
- let gss = gs;
18784
- while (parts[gss + 1] === "**") {
18785
- gss++;
18786
- }
18787
- if (gss > gs) {
18788
- parts.splice(gs + 1, gss - gs);
18789
- }
18790
- let next = parts[gs + 1];
18791
- const p = parts[gs + 2];
18792
- const p2 = parts[gs + 3];
18793
- if (next !== "..")
18794
- continue;
18795
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
18796
- continue;
18797
- }
18798
- didSomething = true;
18799
- parts.splice(gs, 1);
18800
- const other = parts.slice(0);
18801
- other[gs] = "**";
18802
- globParts.push(other);
18803
- gs--;
18804
- }
18805
- if (!this.preserveMultipleSlashes) {
18806
- for (let i = 1; i < parts.length - 1; i++) {
18807
- const p = parts[i];
18808
- if (i === 1 && p === "" && parts[0] === "")
18809
- continue;
18810
- if (p === "." || p === "") {
18811
- didSomething = true;
18812
- parts.splice(i, 1);
18813
- i--;
18814
- }
18815
- }
18816
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
18817
- didSomething = true;
18818
- parts.pop();
18819
- }
18820
- }
18821
- let dd = 0;
18822
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
18823
- const p = parts[dd - 1];
18824
- if (p && p !== "." && p !== ".." && p !== "**") {
18825
- didSomething = true;
18826
- const needDot = dd === 1 && parts[dd + 1] === "**";
18827
- const splin = needDot ? ["."] : [];
18828
- parts.splice(dd - 1, 2, ...splin);
18829
- if (parts.length === 0)
18830
- parts.push("");
18831
- dd -= 2;
18832
- }
18833
- }
18834
- }
18835
- } while (didSomething);
18836
- return globParts;
18837
- }
18838
- // second phase: multi-pattern dedupes
18839
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
18840
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
18841
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
18842
- //
18843
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
18844
- // ^-- not valid because ** doens't follow symlinks
18845
- secondPhasePreProcess(globParts) {
18846
- for (let i = 0; i < globParts.length - 1; i++) {
18847
- for (let j = i + 1; j < globParts.length; j++) {
18848
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
18849
- if (matched) {
18850
- globParts[i] = [];
18851
- globParts[j] = matched;
18852
- break;
18853
- }
18854
- }
18855
- }
18856
- return globParts.filter((gs) => gs.length);
18857
- }
18858
- partsMatch(a, b, emptyGSMatch = false) {
18859
- let ai = 0;
18860
- let bi = 0;
18861
- let result = [];
18862
- let which = "";
18863
- while (ai < a.length && bi < b.length) {
18864
- if (a[ai] === b[bi]) {
18865
- result.push(which === "b" ? b[bi] : a[ai]);
18866
- ai++;
18867
- bi++;
18868
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
18869
- result.push(a[ai]);
18870
- ai++;
18871
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
18872
- result.push(b[bi]);
18873
- bi++;
18874
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
18875
- if (which === "b")
18876
- return false;
18877
- which = "a";
18878
- result.push(a[ai]);
18879
- ai++;
18880
- bi++;
18881
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
18882
- if (which === "a")
18883
- return false;
18884
- which = "b";
18885
- result.push(b[bi]);
18886
- ai++;
18887
- bi++;
18888
- } else {
18889
- return false;
18890
- }
18891
- }
18892
- return a.length === b.length && result;
18893
- }
18894
- parseNegate() {
18895
- if (this.nonegate)
18896
- return;
18897
- const pattern = this.pattern;
18898
- let negate = false;
18899
- let negateOffset = 0;
18900
- for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
18901
- negate = !negate;
18902
- negateOffset++;
18903
- }
18904
- if (negateOffset)
18905
- this.pattern = pattern.slice(negateOffset);
18906
- this.negate = negate;
18907
- }
18908
- // set partial to true to test if, for example,
18909
- // "/a/b" matches the start of "/*/b/*/d"
18910
- // Partial means, if you run out of file before you run
18911
- // out of pattern, then that's fine, as long as all
18912
- // the parts match.
18913
- matchOne(file, pattern, partial = false) {
18914
- const options = this.options;
18915
- if (this.isWindows) {
18916
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
18917
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
18918
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
18919
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
18920
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
18921
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
18922
- if (typeof fdi === "number" && typeof pdi === "number") {
18923
- const [fd, pd] = [file[fdi], pattern[pdi]];
18924
- if (fd.toLowerCase() === pd.toLowerCase()) {
18925
- pattern[pdi] = fd;
18926
- if (pdi > fdi) {
18927
- pattern = pattern.slice(pdi);
18928
- } else if (fdi > pdi) {
18929
- file = file.slice(fdi);
18930
- }
18931
- }
18932
- }
18933
- }
18934
- const { optimizationLevel = 1 } = this.options;
18935
- if (optimizationLevel >= 2) {
18936
- file = this.levelTwoFileOptimize(file);
18937
- }
18938
- this.debug("matchOne", this, { file, pattern });
18939
- this.debug("matchOne", file.length, pattern.length);
18940
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
18941
- this.debug("matchOne loop");
18942
- var p = pattern[pi];
18943
- var f = file[fi];
18944
- this.debug(pattern, p, f);
18945
- if (p === false) {
18946
- return false;
18947
- }
18948
- if (p === GLOBSTAR) {
18949
- this.debug("GLOBSTAR", [pattern, p, f]);
18950
- var fr = fi;
18951
- var pr = pi + 1;
18952
- if (pr === pl) {
18953
- this.debug("** at the end");
18954
- for (; fi < fl; fi++) {
18955
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
18956
- return false;
18957
- }
18958
- return true;
18959
- }
18960
- while (fr < fl) {
18961
- var swallowee = file[fr];
18962
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
18963
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
18964
- this.debug("globstar found match!", fr, fl, swallowee);
18965
- return true;
18966
- } else {
18967
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
18968
- this.debug("dot detected!", file, fr, pattern, pr);
18969
- break;
18970
- }
18971
- this.debug("globstar swallow a segment, and continue");
18972
- fr++;
18973
- }
18974
- }
18975
- if (partial) {
18976
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
18977
- if (fr === fl) {
18978
- return true;
18979
- }
18980
- }
18981
- return false;
18982
- }
18983
- let hit;
18984
- if (typeof p === "string") {
18985
- hit = f === p;
18986
- this.debug("string match", p, f, hit);
18987
- } else {
18988
- hit = p.test(f);
18989
- this.debug("pattern match", p, f, hit);
18990
- }
18991
- if (!hit)
18992
- return false;
18993
- }
18994
- if (fi === fl && pi === pl) {
18995
- return true;
18996
- } else if (fi === fl) {
18997
- return partial;
18998
- } else if (pi === pl) {
18999
- return fi === fl - 1 && file[fi] === "";
19000
- } else {
19001
- throw new Error("wtf?");
19002
- }
19003
- }
19004
- braceExpand() {
19005
- return braceExpand(this.pattern, this.options);
19006
- }
19007
- parse(pattern) {
19008
- assertValidPattern(pattern);
19009
- const options = this.options;
19010
- if (pattern === "**")
19011
- return GLOBSTAR;
19012
- if (pattern === "")
19013
- return "";
19014
- let m;
19015
- let fastTest = null;
19016
- if (m = pattern.match(starRE)) {
19017
- fastTest = options.dot ? starTestDot : starTest;
19018
- } else if (m = pattern.match(starDotExtRE)) {
19019
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
19020
- } else if (m = pattern.match(qmarksRE)) {
19021
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
19022
- } else if (m = pattern.match(starDotStarRE)) {
19023
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
19024
- } else if (m = pattern.match(dotStarRE)) {
19025
- fastTest = dotStarTest;
19026
- }
19027
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
19028
- if (fastTest && typeof re === "object") {
19029
- Reflect.defineProperty(re, "test", { value: fastTest });
19030
- }
19031
- return re;
19032
- }
19033
- makeRe() {
19034
- if (this.regexp || this.regexp === false)
19035
- return this.regexp;
19036
- const set = this.set;
19037
- if (!set.length) {
19038
- this.regexp = false;
19039
- return this.regexp;
19040
- }
19041
- const options = this.options;
19042
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
19043
- const flags = new Set(options.nocase ? ["i"] : []);
19044
- let re = set.map((pattern) => {
19045
- const pp = pattern.map((p) => {
19046
- if (p instanceof RegExp) {
19047
- for (const f of p.flags.split(""))
19048
- flags.add(f);
19049
- }
19050
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
19051
- });
19052
- pp.forEach((p, i) => {
19053
- const next = pp[i + 1];
19054
- const prev = pp[i - 1];
19055
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
19056
- return;
19057
- }
19058
- if (prev === void 0) {
19059
- if (next !== void 0 && next !== GLOBSTAR) {
19060
- pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
19061
- } else {
19062
- pp[i] = twoStar;
19063
- }
19064
- } else if (next === void 0) {
19065
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
19066
- } else if (next !== GLOBSTAR) {
19067
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
19068
- pp[i + 1] = GLOBSTAR;
19069
- }
19070
- });
19071
- const filtered = pp.filter((p) => p !== GLOBSTAR);
19072
- if (this.partial && filtered.length >= 1) {
19073
- const prefixes = [];
19074
- for (let i = 1; i <= filtered.length; i++) {
19075
- prefixes.push(filtered.slice(0, i).join("/"));
19076
- }
19077
- return "(?:" + prefixes.join("|") + ")";
19078
- }
19079
- return filtered.join("/");
19080
- }).join("|");
19081
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
19082
- re = "^" + open + re + close + "$";
19083
- if (this.partial) {
19084
- re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
19085
- }
19086
- if (this.negate)
19087
- re = "^(?!" + re + ").+$";
19088
- try {
19089
- this.regexp = new RegExp(re, [...flags].join(""));
19090
- } catch (ex) {
19091
- this.regexp = false;
19092
- }
19093
- return this.regexp;
19094
- }
19095
- slashSplit(p) {
19096
- if (this.preserveMultipleSlashes) {
19097
- return p.split("/");
19098
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
19099
- return ["", ...p.split(/\/+/)];
19100
- } else {
19101
- return p.split(/\/+/);
19102
- }
19103
- }
19104
- match(f, partial = this.partial) {
19105
- this.debug("match", f, this.pattern);
19106
- if (this.comment) {
19107
- return false;
19108
- }
19109
- if (this.empty) {
19110
- return f === "";
19111
- }
19112
- if (f === "/" && partial) {
19113
- return true;
19114
- }
19115
- const options = this.options;
19116
- if (this.isWindows) {
19117
- f = f.split("\\").join("/");
19118
- }
19119
- const ff = this.slashSplit(f);
19120
- this.debug(this.pattern, "split", ff);
19121
- const set = this.set;
19122
- this.debug(this.pattern, "set", set);
19123
- let filename = ff[ff.length - 1];
19124
- if (!filename) {
19125
- for (let i = ff.length - 2; !filename && i >= 0; i--) {
19126
- filename = ff[i];
19127
- }
19128
- }
19129
- for (let i = 0; i < set.length; i++) {
19130
- const pattern = set[i];
19131
- let file = ff;
19132
- if (options.matchBase && pattern.length === 1) {
19133
- file = [filename];
19134
- }
19135
- const hit = this.matchOne(file, pattern, partial);
19136
- if (hit) {
19137
- if (options.flipNegate) {
19138
- return true;
19139
- }
19140
- return !this.negate;
19141
- }
19142
- }
19143
- if (options.flipNegate) {
19144
- return false;
19145
- }
19146
- return this.negate;
19147
- }
19148
- static defaults(def) {
19149
- return minimatch.defaults(def).Minimatch;
19150
- }
19151
- };
19152
- minimatch.AST = AST;
19153
- minimatch.Minimatch = Minimatch;
19154
- minimatch.escape = escape2;
19155
- minimatch.unescape = unescape2;
17617
+ // node_modules/glob/dist/esm/index.js
17618
+ var import_minimatch6 = require("minimatch");
19156
17619
 
19157
17620
  // node_modules/glob/dist/esm/glob.js
17621
+ var import_minimatch4 = require("minimatch");
19158
17622
  var import_node_url2 = require("url");
19159
17623
 
19160
17624
  // node_modules/lru-cache/dist/esm/index.js
@@ -21731,12 +20195,12 @@ var PathBase = class {
21731
20195
  /**
21732
20196
  * Get the Path object referenced by the string path, resolved from this Path
21733
20197
  */
21734
- resolve(path5) {
21735
- if (!path5) {
20198
+ resolve(path4) {
20199
+ if (!path4) {
21736
20200
  return this;
21737
20201
  }
21738
- const rootPath = this.getRootString(path5);
21739
- const dir = path5.substring(rootPath.length);
20202
+ const rootPath = this.getRootString(path4);
20203
+ const dir = path4.substring(rootPath.length);
21740
20204
  const dirParts = dir.split(this.splitSep);
21741
20205
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
21742
20206
  return result;
@@ -22488,8 +20952,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
22488
20952
  /**
22489
20953
  * @internal
22490
20954
  */
22491
- getRootString(path5) {
22492
- return import_node_path.win32.parse(path5).root;
20955
+ getRootString(path4) {
20956
+ return import_node_path.win32.parse(path4).root;
22493
20957
  }
22494
20958
  /**
22495
20959
  * @internal
@@ -22535,8 +20999,8 @@ var PathPosix = class _PathPosix extends PathBase {
22535
20999
  /**
22536
21000
  * @internal
22537
21001
  */
22538
- getRootString(path5) {
22539
- return path5.startsWith("/") ? "/" : "";
21002
+ getRootString(path4) {
21003
+ return path4.startsWith("/") ? "/" : "";
22540
21004
  }
22541
21005
  /**
22542
21006
  * @internal
@@ -22585,7 +21049,7 @@ var PathScurryBase = class {
22585
21049
  *
22586
21050
  * @internal
22587
21051
  */
22588
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs3 = defaultFS } = {}) {
21052
+ constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs: fs3 = defaultFS } = {}) {
22589
21053
  this.#fs = fsFromOption(fs3);
22590
21054
  if (cwd instanceof URL || cwd.startsWith("file://")) {
22591
21055
  cwd = (0, import_node_url.fileURLToPath)(cwd);
@@ -22596,7 +21060,7 @@ var PathScurryBase = class {
22596
21060
  this.#resolveCache = new ResolveCache();
22597
21061
  this.#resolvePosixCache = new ResolveCache();
22598
21062
  this.#children = new ChildrenCache(childrenCacheSize);
22599
- const split = cwdPath.substring(this.rootPath.length).split(sep2);
21063
+ const split = cwdPath.substring(this.rootPath.length).split(sep);
22600
21064
  if (split.length === 1 && !split[0]) {
22601
21065
  split.pop();
22602
21066
  }
@@ -22625,11 +21089,11 @@ var PathScurryBase = class {
22625
21089
  /**
22626
21090
  * Get the depth of a provided path, string, or the cwd
22627
21091
  */
22628
- depth(path5 = this.cwd) {
22629
- if (typeof path5 === "string") {
22630
- path5 = this.cwd.resolve(path5);
21092
+ depth(path4 = this.cwd) {
21093
+ if (typeof path4 === "string") {
21094
+ path4 = this.cwd.resolve(path4);
22631
21095
  }
22632
- return path5.depth();
21096
+ return path4.depth();
22633
21097
  }
22634
21098
  /**
22635
21099
  * Return the cache of child entries. Exposed so subclasses can create
@@ -22855,9 +21319,9 @@ var PathScurryBase = class {
22855
21319
  opts = entry;
22856
21320
  entry = this.cwd;
22857
21321
  }
22858
- const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts;
21322
+ const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
22859
21323
  const results = [];
22860
- if (!filter2 || filter2(entry)) {
21324
+ if (!filter || filter(entry)) {
22861
21325
  results.push(withFileTypes ? entry : entry.fullpath());
22862
21326
  }
22863
21327
  const dirs = /* @__PURE__ */ new Set();
@@ -22876,7 +21340,7 @@ var PathScurryBase = class {
22876
21340
  }
22877
21341
  };
22878
21342
  for (const e of entries) {
22879
- if (!filter2 || filter2(e)) {
21343
+ if (!filter || filter(e)) {
22880
21344
  results.push(withFileTypes ? e : e.fullpath());
22881
21345
  }
22882
21346
  if (follow && e.isSymbolicLink()) {
@@ -22907,16 +21371,16 @@ var PathScurryBase = class {
22907
21371
  opts = entry;
22908
21372
  entry = this.cwd;
22909
21373
  }
22910
- const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts;
21374
+ const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
22911
21375
  const results = [];
22912
- if (!filter2 || filter2(entry)) {
21376
+ if (!filter || filter(entry)) {
22913
21377
  results.push(withFileTypes ? entry : entry.fullpath());
22914
21378
  }
22915
21379
  const dirs = /* @__PURE__ */ new Set([entry]);
22916
21380
  for (const dir of dirs) {
22917
21381
  const entries = dir.readdirSync();
22918
21382
  for (const e of entries) {
22919
- if (!filter2 || filter2(e)) {
21383
+ if (!filter || filter(e)) {
22920
21384
  results.push(withFileTypes ? e : e.fullpath());
22921
21385
  }
22922
21386
  let r = e;
@@ -22969,15 +21433,15 @@ var PathScurryBase = class {
22969
21433
  opts = entry;
22970
21434
  entry = this.cwd;
22971
21435
  }
22972
- const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts;
22973
- if (!filter2 || filter2(entry)) {
21436
+ const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
21437
+ if (!filter || filter(entry)) {
22974
21438
  yield withFileTypes ? entry : entry.fullpath();
22975
21439
  }
22976
21440
  const dirs = /* @__PURE__ */ new Set([entry]);
22977
21441
  for (const dir of dirs) {
22978
21442
  const entries = dir.readdirSync();
22979
21443
  for (const e of entries) {
22980
- if (!filter2 || filter2(e)) {
21444
+ if (!filter || filter(e)) {
22981
21445
  yield withFileTypes ? e : e.fullpath();
22982
21446
  }
22983
21447
  let r = e;
@@ -23000,9 +21464,9 @@ var PathScurryBase = class {
23000
21464
  opts = entry;
23001
21465
  entry = this.cwd;
23002
21466
  }
23003
- const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts;
21467
+ const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
23004
21468
  const results = new Minipass({ objectMode: true });
23005
- if (!filter2 || filter2(entry)) {
21469
+ if (!filter || filter(entry)) {
23006
21470
  results.write(withFileTypes ? entry : entry.fullpath());
23007
21471
  }
23008
21472
  const dirs = /* @__PURE__ */ new Set();
@@ -23035,7 +21499,7 @@ var PathScurryBase = class {
23035
21499
  }
23036
21500
  }
23037
21501
  for (const e of entries) {
23038
- if (e && (!filter2 || filter2(e))) {
21502
+ if (e && (!filter || filter(e))) {
23039
21503
  if (!results.write(withFileTypes ? e : e.fullpath())) {
23040
21504
  paused = true;
23041
21505
  }
@@ -23069,10 +21533,10 @@ var PathScurryBase = class {
23069
21533
  opts = entry;
23070
21534
  entry = this.cwd;
23071
21535
  }
23072
- const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts;
21536
+ const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
23073
21537
  const results = new Minipass({ objectMode: true });
23074
21538
  const dirs = /* @__PURE__ */ new Set();
23075
- if (!filter2 || filter2(entry)) {
21539
+ if (!filter || filter(entry)) {
23076
21540
  results.write(withFileTypes ? entry : entry.fullpath());
23077
21541
  }
23078
21542
  const queue = [entry];
@@ -23090,7 +21554,7 @@ var PathScurryBase = class {
23090
21554
  dirs.add(dir);
23091
21555
  const entries = dir.readdirSync();
23092
21556
  for (const e of entries) {
23093
- if (!filter2 || filter2(e)) {
21557
+ if (!filter || filter(e)) {
23094
21558
  if (!results.write(withFileTypes ? e : e.fullpath())) {
23095
21559
  paused = true;
23096
21560
  }
@@ -23116,9 +21580,9 @@ var PathScurryBase = class {
23116
21580
  process2();
23117
21581
  return results;
23118
21582
  }
23119
- chdir(path5 = this.cwd) {
21583
+ chdir(path4 = this.cwd) {
23120
21584
  const oldCwd = this.cwd;
23121
- this.cwd = typeof path5 === "string" ? this.cwd.resolve(path5) : path5;
21585
+ this.cwd = typeof path4 === "string" ? this.cwd.resolve(path4) : path4;
23122
21586
  this.cwd[setAsCwd](oldCwd);
23123
21587
  }
23124
21588
  };
@@ -23193,6 +21657,7 @@ var Path = process.platform === "win32" ? PathWin32 : PathPosix;
23193
21657
  var PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
23194
21658
 
23195
21659
  // node_modules/glob/dist/esm/pattern.js
21660
+ var import_minimatch = require("minimatch");
23196
21661
  var isPatternList = (pl) => pl.length >= 1;
23197
21662
  var isGlobList = (gl) => gl.length >= 1;
23198
21663
  var Pattern = class _Pattern {
@@ -23269,7 +21734,7 @@ var Pattern = class _Pattern {
23269
21734
  * true of if pattern() returns GLOBSTAR
23270
21735
  */
23271
21736
  isGlobstar() {
23272
- return this.#patternList[this.#index] === GLOBSTAR;
21737
+ return this.#patternList[this.#index] === import_minimatch.GLOBSTAR;
23273
21738
  }
23274
21739
  /**
23275
21740
  * true if pattern() returns a regexp
@@ -23358,7 +21823,8 @@ var Pattern = class _Pattern {
23358
21823
  };
23359
21824
 
23360
21825
  // node_modules/glob/dist/esm/ignore.js
23361
- var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
21826
+ var import_minimatch2 = require("minimatch");
21827
+ var defaultPlatform = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
23362
21828
  var Ignore = class {
23363
21829
  relative;
23364
21830
  relativeChildren;
@@ -23366,7 +21832,7 @@ var Ignore = class {
23366
21832
  absoluteChildren;
23367
21833
  platform;
23368
21834
  mmopts;
23369
- constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform2 }) {
21835
+ constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform }) {
23370
21836
  this.relative = [];
23371
21837
  this.absolute = [];
23372
21838
  this.relativeChildren = [];
@@ -23387,7 +21853,7 @@ var Ignore = class {
23387
21853
  this.add(ign);
23388
21854
  }
23389
21855
  add(ign) {
23390
- const mm = new Minimatch(ign, this.mmopts);
21856
+ const mm = new import_minimatch2.Minimatch(ign, this.mmopts);
23391
21857
  for (let i = 0; i < mm.set.length; i++) {
23392
21858
  const parsed = mm.set[i];
23393
21859
  const globParts = mm.globParts[i];
@@ -23399,7 +21865,7 @@ var Ignore = class {
23399
21865
  globParts.shift();
23400
21866
  }
23401
21867
  const p = new Pattern(parsed, globParts, 0, this.platform);
23402
- const m = new Minimatch(p.globString(), this.mmopts);
21868
+ const m = new import_minimatch2.Minimatch(p.globString(), this.mmopts);
23403
21869
  const children = globParts[globParts.length - 1] === "**";
23404
21870
  const absolute = p.isAbsolute();
23405
21871
  if (absolute)
@@ -23445,6 +21911,7 @@ var Ignore = class {
23445
21911
  };
23446
21912
 
23447
21913
  // node_modules/glob/dist/esm/processor.js
21914
+ var import_minimatch3 = require("minimatch");
23448
21915
  var HasWalkedCache = class _HasWalkedCache {
23449
21916
  store;
23450
21917
  constructor(store = /* @__PURE__ */ new Map()) {
@@ -23474,8 +21941,8 @@ var MatchRecord = class {
23474
21941
  }
23475
21942
  // match, absolute, ifdir
23476
21943
  entries() {
23477
- return [...this.store.entries()].map(([path5, n]) => [
23478
- path5,
21944
+ return [...this.store.entries()].map(([path4, n]) => [
21945
+ path4,
23479
21946
  !!(n & 2),
23480
21947
  !!(n & 1)
23481
21948
  ]);
@@ -23562,7 +22029,7 @@ var Processor = class _Processor {
23562
22029
  const ifDir = p === ".." || p === "" || p === ".";
23563
22030
  this.matches.add(t.resolve(p), absolute, ifDir);
23564
22031
  continue;
23565
- } else if (p === GLOBSTAR) {
22032
+ } else if (p === import_minimatch3.GLOBSTAR) {
23566
22033
  if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
23567
22034
  this.subwalks.add(t, pattern);
23568
22035
  }
@@ -23604,7 +22071,7 @@ var Processor = class _Processor {
23604
22071
  const absolute = pattern.isAbsolute();
23605
22072
  const p = pattern.pattern();
23606
22073
  const rest = pattern.rest();
23607
- if (p === GLOBSTAR) {
22074
+ if (p === import_minimatch3.GLOBSTAR) {
23608
22075
  results.testGlobstar(e, pattern, rest, absolute);
23609
22076
  } else if (p instanceof RegExp) {
23610
22077
  results.testRegExp(e, p, rest, absolute);
@@ -23680,9 +22147,9 @@ var GlobUtil = class {
23680
22147
  signal;
23681
22148
  maxDepth;
23682
22149
  includeChildMatches;
23683
- constructor(patterns, path5, opts) {
22150
+ constructor(patterns, path4, opts) {
23684
22151
  this.patterns = patterns;
23685
- this.path = path5;
22152
+ this.path = path4;
23686
22153
  this.opts = opts;
23687
22154
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
23688
22155
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -23701,11 +22168,11 @@ var GlobUtil = class {
23701
22168
  });
23702
22169
  }
23703
22170
  }
23704
- #ignored(path5) {
23705
- return this.seen.has(path5) || !!this.#ignore?.ignored?.(path5);
22171
+ #ignored(path4) {
22172
+ return this.seen.has(path4) || !!this.#ignore?.ignored?.(path4);
23706
22173
  }
23707
- #childrenIgnored(path5) {
23708
- return !!this.#ignore?.childrenIgnored?.(path5);
22174
+ #childrenIgnored(path4) {
22175
+ return !!this.#ignore?.childrenIgnored?.(path4);
23709
22176
  }
23710
22177
  // backpressure mechanism
23711
22178
  pause() {
@@ -23920,8 +22387,8 @@ var GlobUtil = class {
23920
22387
  };
23921
22388
  var GlobWalker = class extends GlobUtil {
23922
22389
  matches = /* @__PURE__ */ new Set();
23923
- constructor(patterns, path5, opts) {
23924
- super(patterns, path5, opts);
22390
+ constructor(patterns, path4, opts) {
22391
+ super(patterns, path4, opts);
23925
22392
  }
23926
22393
  matchEmit(e) {
23927
22394
  this.matches.add(e);
@@ -23958,8 +22425,8 @@ var GlobWalker = class extends GlobUtil {
23958
22425
  };
23959
22426
  var GlobStream = class extends GlobUtil {
23960
22427
  results;
23961
- constructor(patterns, path5, opts) {
23962
- super(patterns, path5, opts);
22428
+ constructor(patterns, path4, opts) {
22429
+ super(patterns, path4, opts);
23963
22430
  this.results = new Minipass({
23964
22431
  signal: this.signal,
23965
22432
  objectMode: true
@@ -23993,7 +22460,7 @@ var GlobStream = class extends GlobUtil {
23993
22460
  };
23994
22461
 
23995
22462
  // node_modules/glob/dist/esm/glob.js
23996
- var defaultPlatform3 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
22463
+ var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
23997
22464
  var Glob = class {
23998
22465
  absolute;
23999
22466
  cwd;
@@ -24085,7 +22552,7 @@ var Glob = class {
24085
22552
  pattern = pattern.map((p) => p.includes("/") ? p : `./**/${p}`);
24086
22553
  }
24087
22554
  this.pattern = pattern;
24088
- this.platform = opts.platform || defaultPlatform3;
22555
+ this.platform = opts.platform || defaultPlatform2;
24089
22556
  this.opts = { ...opts, platform: this.platform };
24090
22557
  if (opts.scurry) {
24091
22558
  this.scurry = opts.scurry;
@@ -24117,7 +22584,7 @@ var Glob = class {
24117
22584
  windowsPathsNoEscape: this.windowsPathsNoEscape,
24118
22585
  debug: !!this.opts.debug
24119
22586
  };
24120
- const mms = this.pattern.map((p) => new Minimatch(p, mmo));
22587
+ const mms = this.pattern.map((p) => new import_minimatch4.Minimatch(p, mmo));
24121
22588
  const [matchSet, globParts] = mms.reduce((set, m) => {
24122
22589
  set[0].push(...m.set);
24123
22590
  set[1].push(...m.globParts);
@@ -24193,18 +22660,20 @@ var Glob = class {
24193
22660
  };
24194
22661
 
24195
22662
  // node_modules/glob/dist/esm/has-magic.js
22663
+ var import_minimatch5 = require("minimatch");
24196
22664
  var hasMagic = (pattern, options = {}) => {
24197
22665
  if (!Array.isArray(pattern)) {
24198
22666
  pattern = [pattern];
24199
22667
  }
24200
22668
  for (const p of pattern) {
24201
- if (new Minimatch(p, options).hasMagic())
22669
+ if (new import_minimatch5.Minimatch(p, options).hasMagic())
24202
22670
  return true;
24203
22671
  }
24204
22672
  return false;
24205
22673
  };
24206
22674
 
24207
22675
  // node_modules/glob/dist/esm/index.js
22676
+ var import_minimatch7 = require("minimatch");
24208
22677
  function globStreamSync(pattern, options = {}) {
24209
22678
  return new Glob(pattern, options).streamSync();
24210
22679
  }
@@ -24247,12 +22716,13 @@ var glob = Object.assign(glob_, {
24247
22716
  iterateSync,
24248
22717
  Glob,
24249
22718
  hasMagic,
24250
- escape: escape2,
24251
- unescape: unescape2
22719
+ escape: import_minimatch6.escape,
22720
+ unescape: import_minimatch6.unescape
24252
22721
  });
24253
22722
  glob.glob = glob;
24254
22723
 
24255
22724
  // src/commands/scan.ts
22725
+ var import_minimatch8 = require("minimatch");
24256
22726
  var import_picocolors = __toESM(require_picocolors());
24257
22727
 
24258
22728
  // node_modules/@replikanti/flowlint-core/dist/index.mjs
@@ -24563,8 +23033,8 @@ function isTerminalNode(type, name) {
24563
23033
  return TERMINAL_NODE_PATTERNS.some((pattern) => label.includes(pattern));
24564
23034
  }
24565
23035
  function readNumber(source, paths) {
24566
- for (const path5 of paths) {
24567
- const value = path5.split(".").reduce((acc, key) => acc ? acc[key] : void 0, source);
23036
+ for (const path4 of paths) {
23037
+ const value = path4.split(".").reduce((acc, key) => acc ? acc[key] : void 0, source);
24568
23038
  if (typeof value === "number") return value;
24569
23039
  if (typeof value === "string" && !Number.isNaN(Number(value))) return Number(value);
24570
23040
  }
@@ -24699,7 +23169,7 @@ function validateN8nWorkflow(data) {
24699
23169
  const validate = getValidator();
24700
23170
  if (!validate(data)) {
24701
23171
  const errors = (validate.errors || []).map((err) => {
24702
- const path5 = err.instancePath || err.schemaPath;
23172
+ const path4 = err.instancePath || err.schemaPath;
24703
23173
  const message = err.message || "Validation error";
24704
23174
  let suggestion = "";
24705
23175
  if (err.keyword === "required") {
@@ -24711,7 +23181,7 @@ function validateN8nWorkflow(data) {
24711
23181
  } else if (err.keyword === "minLength") {
24712
23182
  suggestion = "This field cannot be empty.";
24713
23183
  }
24714
- return { path: path5, message, suggestion };
23184
+ return { path: path4, message, suggestion };
24715
23185
  });
24716
23186
  throw new ValidationError(errors);
24717
23187
  }
@@ -25456,11 +23926,11 @@ function loadConfigFromFile(configPath) {
25456
23926
  function loadConfigFromCwd() {
25457
23927
  try {
25458
23928
  const fs3 = __require("fs");
25459
- const path5 = __require("path");
23929
+ const path4 = __require("path");
25460
23930
  const candidates = [".flowlint.yml", ".flowlint.yaml", "flowlint.config.yml"];
25461
23931
  const cwd = process.cwd();
25462
23932
  for (const candidate of candidates) {
25463
- const configPath = path5.join(cwd, candidate);
23933
+ const configPath = path4.join(cwd, candidate);
25464
23934
  if (fs3.existsSync(configPath)) {
25465
23935
  const content = fs3.readFileSync(configPath, "utf-8");
25466
23936
  return parseConfig(content);
@@ -25481,23 +23951,23 @@ function countFindingsBySeverity(findings) {
25481
23951
  }
25482
23952
 
25483
23953
  // src/reporters/junit.ts
25484
- var path2 = __toESM(require("path"));
23954
+ var path = __toESM(require("path"));
25485
23955
  function formatJunit(findings) {
25486
23956
  const byFile = findings.reduce((acc, finding) => {
25487
- const file = finding.location?.file || "unknown";
23957
+ const file = finding.path || "unknown";
25488
23958
  if (!acc[file]) acc[file] = [];
25489
23959
  acc[file].push(finding);
25490
23960
  return acc;
25491
23961
  }, {});
25492
23962
  let xml = '<?xml version="1.0" encoding="UTF-8"?>\n<testsuites>\n';
25493
23963
  for (const [file, fileFindings] of Object.entries(byFile)) {
25494
- const filename = path2.basename(file);
23964
+ const filename = path.basename(file);
25495
23965
  const failures = fileFindings.length;
25496
23966
  xml += ` <testsuite name="${filename}" tests="${failures}" failures="${failures}" errors="0" skipped="0" timestamp="${(/* @__PURE__ */ new Date()).toISOString()}" time="0" hostname="flowlint">
25497
23967
  `;
25498
23968
  for (const finding of fileFindings) {
25499
- const line = finding.location?.range?.start?.line || 0;
25500
- const rule = finding.ruleId || "unknown-rule";
23969
+ const line = finding.line || 0;
23970
+ const rule = finding.rule || "unknown-rule";
25501
23971
  const msg = finding.message || "";
25502
23972
  xml += ` <testcase classname="${file}" name="${rule}" time="0">
25503
23973
  `;
@@ -25593,22 +24063,74 @@ function formatJson(findings, stats) {
25593
24063
  }, null, 2);
25594
24064
  }
25595
24065
 
24066
+ // src/reporters/github-actions.ts
24067
+ function formatGithubActions(findings) {
24068
+ return findings.map((f) => {
24069
+ const level = mapSeverityToGithub(f.severity);
24070
+ const file = f.path ? `file=${f.path},` : "";
24071
+ const line = f.line ? `line=${f.line},` : "";
24072
+ const message = f.message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
24073
+ return `::${level} ${file}${line}::${message}`;
24074
+ }).join("\n");
24075
+ }
24076
+ function mapSeverityToGithub(severity) {
24077
+ switch (severity) {
24078
+ case "must":
24079
+ return "error";
24080
+ case "should":
24081
+ return "warning";
24082
+ case "nit":
24083
+ return "notice";
24084
+ default:
24085
+ return "warning";
24086
+ }
24087
+ }
24088
+
25596
24089
  // src/commands/scan.ts
25597
- var scanCommand = new Command("scan").description("Scan workflow files for issues").argument("[path]", "Directory or file to scan", ".").option("--config <path>", "Path to .flowlint.yml config file").option("--format <format>", "Output format: stylish|json|junit|sarif", "stylish").option("--fail-on-error", "Exit with code 1 if errors found", false).action(async (scanPath, options) => {
24090
+ var scanCommand = new Command("scan").description("Scan workflow files (directory or single file) for issues").argument("[path]", "Directory or workflow file to scan", ".").option("--config <path>", "Path to .flowlint.yml config file").option("--format <format>", "Output format: stylish|json|junit|sarif|github-actions", "stylish").option("--fail-on-error", "Exit with code 1 if errors found", false).action(async (scanPath, options) => {
25598
24091
  try {
25599
- const absolutePath = path3.resolve(process.cwd(), scanPath);
24092
+ const absolutePath = path2.resolve(process.cwd(), scanPath);
25600
24093
  const isStylish = options.format === "stylish";
24094
+ let stats;
24095
+ try {
24096
+ stats = fs.statSync(absolutePath);
24097
+ } catch (error) {
24098
+ if (error.code === "ENOENT") {
24099
+ console.error(import_picocolors.default.red(`Error: Path not found: ${scanPath}`));
24100
+ process.exit(1);
24101
+ }
24102
+ throw error;
24103
+ }
24104
+ const isFile = stats.isFile();
24105
+ const isDirectory = stats.isDirectory();
24106
+ if (!isFile && !isDirectory) {
24107
+ console.error(import_picocolors.default.red(`Error: Path is neither a file nor a directory: ${scanPath}`));
24108
+ process.exit(1);
24109
+ }
25601
24110
  const config = options.config ? loadConfig(options.config) : loadConfig();
25602
- const patterns = config.files.include.map(
25603
- (p) => path3.join(absolutePath, p).replace(/\\/g, "/")
25604
- );
25605
- const ignorePatterns = config.files.ignore.map(
25606
- (p) => path3.join(absolutePath, p).replace(/\\/g, "/")
25607
- );
25608
- const files = await glob(patterns, {
25609
- ignore: ignorePatterns,
25610
- nodir: true
25611
- });
24111
+ let files = [];
24112
+ if (isDirectory) {
24113
+ const patterns = config.files.include.map(
24114
+ (p) => path2.join(absolutePath, p).replace(/\\/g, "/")
24115
+ );
24116
+ const ignorePatterns = config.files.ignore.map(
24117
+ (p) => path2.join(absolutePath, p).replace(/\\/g, "/")
24118
+ );
24119
+ files = await glob(patterns, {
24120
+ ignore: ignorePatterns,
24121
+ nodir: true
24122
+ });
24123
+ } else if (isFile) {
24124
+ files = [absolutePath];
24125
+ const relativeScanPath = path2.relative(process.cwd(), absolutePath).replace(/\\/g, "/");
24126
+ const isIncluded = config.files.include.some((p) => (0, import_minimatch8.minimatch)(relativeScanPath, p));
24127
+ const isIgnored = config.files.ignore.some((p) => (0, import_minimatch8.minimatch)(relativeScanPath, p));
24128
+ if (!isIncluded || isIgnored) {
24129
+ if (isStylish) {
24130
+ console.log(import_picocolors.default.yellow(`Warning: File "${relativeScanPath}" does not match configured patterns or is ignored.`));
24131
+ }
24132
+ }
24133
+ }
25612
24134
  if (files.length === 0) {
25613
24135
  if (isStylish) console.log(import_picocolors.default.yellow("No workflow files found."));
25614
24136
  return;
@@ -25622,7 +24144,7 @@ var scanCommand = new Command("scan").description("Scan workflow files for issue
25622
24144
  for (const file of files) {
25623
24145
  try {
25624
24146
  const content = fs.readFileSync(file, "utf-8");
25625
- const relativePath = path3.relative(process.cwd(), file);
24147
+ const relativePath = path2.relative(process.cwd(), file);
25626
24148
  const graph = parseN8n(content);
25627
24149
  const findings = runAllRules(graph, {
25628
24150
  path: relativePath,
@@ -25647,18 +24169,18 @@ var scanCommand = new Command("scan").description("Scan workflow files for issue
25647
24169
  rule: "validation-error",
25648
24170
  message: error instanceof Error ? error.message : String(error),
25649
24171
  severity: "must",
25650
- path: path3.relative(process.cwd(), file),
24172
+ path: path2.relative(process.cwd(), file),
25651
24173
  line: 0
25652
24174
  });
25653
24175
  errorCount++;
25654
24176
  if (isStylish) {
25655
24177
  if (error instanceof ValidationError) {
25656
- console.log(import_picocolors.default.red("x " + path3.relative(process.cwd(), file) + ": Validation error"));
24178
+ console.log(import_picocolors.default.red("x " + path2.relative(process.cwd(), file) + ": Validation error"));
25657
24179
  error.errors.forEach((e) => {
25658
24180
  console.log(import_picocolors.default.gray(" " + e.path + ": " + e.message));
25659
24181
  });
25660
24182
  } else {
25661
- console.log(import_picocolors.default.red("x " + path3.relative(process.cwd(), file) + ": " + (error instanceof Error ? error.message : String(error))));
24183
+ console.log(import_picocolors.default.red("x " + path2.relative(process.cwd(), file) + ": " + (error instanceof Error ? error.message : String(error))));
25662
24184
  }
25663
24185
  }
25664
24186
  }
@@ -25673,6 +24195,9 @@ var scanCommand = new Command("scan").description("Scan workflow files for issue
25673
24195
  case "sarif":
25674
24196
  console.log(formatSarif(allFindings));
25675
24197
  break;
24198
+ case "github-actions":
24199
+ console.log(formatGithubActions(allFindings));
24200
+ break;
25676
24201
  case "stylish":
25677
24202
  default:
25678
24203
  const summary = countFindingsBySeverity(allFindings);
@@ -25694,11 +24219,11 @@ var scanCommand = new Command("scan").description("Scan workflow files for issue
25694
24219
 
25695
24220
  // src/commands/init.ts
25696
24221
  var fs2 = __toESM(require("fs"));
25697
- var path4 = __toESM(require("path"));
24222
+ var path3 = __toESM(require("path"));
25698
24223
  var import_picocolors2 = __toESM(require_picocolors());
25699
24224
  var import_yaml3 = __toESM(require_dist());
25700
24225
  var initCommand = new Command("init").description("Initialize FlowLint configuration in the current directory").option("--force", "Overwrite existing config file", false).action((options) => {
25701
- const configPath = path4.join(process.cwd(), ".flowlint.yml");
24226
+ const configPath = path3.join(process.cwd(), ".flowlint.yml");
25702
24227
  if (fs2.existsSync(configPath) && !options.force) {
25703
24228
  console.log(import_picocolors2.default.yellow(".flowlint.yml already exists. Use --force to overwrite."));
25704
24229
  return;
@@ -25722,12 +24247,19 @@ var initCommand = new Command("init").description("Initialize FlowLint configura
25722
24247
  });
25723
24248
 
25724
24249
  // src/cli.ts
24250
+ var import_meta = {};
25725
24251
  var program2 = new Command();
25726
- program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.7.8");
24252
+ program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.8.1");
25727
24253
  program2.addCommand(scanCommand);
25728
24254
  program2.addCommand(initCommand);
25729
- program2.parse(process.argv);
25730
- if (!process.argv.slice(2).length) {
25731
- program2.outputHelp();
24255
+ if (import_meta.url === `file://${process.argv[1]}`) {
24256
+ program2.parse(process.argv);
24257
+ if (!process.argv.slice(2).length) {
24258
+ program2.outputHelp();
24259
+ }
25732
24260
  }
24261
+ // Annotate the CommonJS export names for ESM import in node:
24262
+ 0 && (module.exports = {
24263
+ program
24264
+ });
25733
24265
  //# sourceMappingURL=cli.js.map