flowlint 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -965,7 +965,7 @@ var require_command = __commonJS({
965
965
  "use strict";
966
966
  var EventEmitter2 = require("events").EventEmitter;
967
967
  var childProcess = require("child_process");
968
- var path4 = require("path");
968
+ var path5 = require("path");
969
969
  var fs3 = require("fs");
970
970
  var process2 = require("process");
971
971
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1898,9 +1898,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1898
1898
  let launchWithNode = false;
1899
1899
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1900
1900
  function findFile(baseDir, baseName) {
1901
- const localBin = path4.resolve(baseDir, baseName);
1901
+ const localBin = path5.resolve(baseDir, baseName);
1902
1902
  if (fs3.existsSync(localBin)) return localBin;
1903
- if (sourceExt.includes(path4.extname(baseName))) return void 0;
1903
+ if (sourceExt.includes(path5.extname(baseName))) return void 0;
1904
1904
  const foundExt = sourceExt.find(
1905
1905
  (ext2) => fs3.existsSync(`${localBin}${ext2}`)
1906
1906
  );
@@ -1918,17 +1918,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1918
1918
  } catch (err) {
1919
1919
  resolvedScriptPath = this._scriptPath;
1920
1920
  }
1921
- executableDir = path4.resolve(
1922
- path4.dirname(resolvedScriptPath),
1921
+ executableDir = path5.resolve(
1922
+ path5.dirname(resolvedScriptPath),
1923
1923
  executableDir
1924
1924
  );
1925
1925
  }
1926
1926
  if (executableDir) {
1927
1927
  let localFile = findFile(executableDir, executableFile);
1928
1928
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1929
- const legacyName = path4.basename(
1929
+ const legacyName = path5.basename(
1930
1930
  this._scriptPath,
1931
- path4.extname(this._scriptPath)
1931
+ path5.extname(this._scriptPath)
1932
1932
  );
1933
1933
  if (legacyName !== this._name) {
1934
1934
  localFile = findFile(
@@ -1939,7 +1939,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1939
1939
  }
1940
1940
  executableFile = localFile || executableFile;
1941
1941
  }
1942
- launchWithNode = sourceExt.includes(path4.extname(executableFile));
1942
+ launchWithNode = sourceExt.includes(path5.extname(executableFile));
1943
1943
  let proc2;
1944
1944
  if (process2.platform !== "win32") {
1945
1945
  if (launchWithNode) {
@@ -2779,7 +2779,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2779
2779
  * @return {Command}
2780
2780
  */
2781
2781
  nameFromFilename(filename) {
2782
- this._name = path4.basename(filename, path4.extname(filename));
2782
+ this._name = path5.basename(filename, path5.extname(filename));
2783
2783
  return this;
2784
2784
  }
2785
2785
  /**
@@ -2793,9 +2793,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2793
2793
  * @param {string} [path]
2794
2794
  * @return {(string|null|Command)}
2795
2795
  */
2796
- executableDir(path5) {
2797
- if (path5 === void 0) return this._executableDir;
2798
- this._executableDir = path5;
2796
+ executableDir(path6) {
2797
+ if (path6 === void 0) return this._executableDir;
2798
+ this._executableDir = path6;
2799
2799
  return this;
2800
2800
  }
2801
2801
  /**
@@ -3385,17 +3385,17 @@ var require_visit = __commonJS({
3385
3385
  visit.BREAK = BREAK;
3386
3386
  visit.SKIP = SKIP;
3387
3387
  visit.REMOVE = REMOVE;
3388
- function visit_(key, node, visitor, path4) {
3389
- const ctrl = callVisitor(key, node, visitor, path4);
3388
+ function visit_(key, node, visitor, path5) {
3389
+ const ctrl = callVisitor(key, node, visitor, path5);
3390
3390
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3391
- replaceNode(key, path4, ctrl);
3392
- return visit_(key, ctrl, visitor, path4);
3391
+ replaceNode(key, path5, ctrl);
3392
+ return visit_(key, ctrl, visitor, path5);
3393
3393
  }
3394
3394
  if (typeof ctrl !== "symbol") {
3395
3395
  if (identity.isCollection(node)) {
3396
- path4 = Object.freeze(path4.concat(node));
3396
+ path5 = Object.freeze(path5.concat(node));
3397
3397
  for (let i = 0; i < node.items.length; ++i) {
3398
- const ci = visit_(i, node.items[i], visitor, path4);
3398
+ const ci = visit_(i, node.items[i], visitor, path5);
3399
3399
  if (typeof ci === "number")
3400
3400
  i = ci - 1;
3401
3401
  else if (ci === BREAK)
@@ -3406,13 +3406,13 @@ var require_visit = __commonJS({
3406
3406
  }
3407
3407
  }
3408
3408
  } else if (identity.isPair(node)) {
3409
- path4 = Object.freeze(path4.concat(node));
3410
- const ck = visit_("key", node.key, visitor, path4);
3409
+ path5 = Object.freeze(path5.concat(node));
3410
+ const ck = visit_("key", node.key, visitor, path5);
3411
3411
  if (ck === BREAK)
3412
3412
  return BREAK;
3413
3413
  else if (ck === REMOVE)
3414
3414
  node.key = null;
3415
- const cv = visit_("value", node.value, visitor, path4);
3415
+ const cv = visit_("value", node.value, visitor, path5);
3416
3416
  if (cv === BREAK)
3417
3417
  return BREAK;
3418
3418
  else if (cv === REMOVE)
@@ -3433,17 +3433,17 @@ var require_visit = __commonJS({
3433
3433
  visitAsync.BREAK = BREAK;
3434
3434
  visitAsync.SKIP = SKIP;
3435
3435
  visitAsync.REMOVE = REMOVE;
3436
- async function visitAsync_(key, node, visitor, path4) {
3437
- const ctrl = await callVisitor(key, node, visitor, path4);
3436
+ async function visitAsync_(key, node, visitor, path5) {
3437
+ const ctrl = await callVisitor(key, node, visitor, path5);
3438
3438
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3439
- replaceNode(key, path4, ctrl);
3440
- return visitAsync_(key, ctrl, visitor, path4);
3439
+ replaceNode(key, path5, ctrl);
3440
+ return visitAsync_(key, ctrl, visitor, path5);
3441
3441
  }
3442
3442
  if (typeof ctrl !== "symbol") {
3443
3443
  if (identity.isCollection(node)) {
3444
- path4 = Object.freeze(path4.concat(node));
3444
+ path5 = Object.freeze(path5.concat(node));
3445
3445
  for (let i = 0; i < node.items.length; ++i) {
3446
- const ci = await visitAsync_(i, node.items[i], visitor, path4);
3446
+ const ci = await visitAsync_(i, node.items[i], visitor, path5);
3447
3447
  if (typeof ci === "number")
3448
3448
  i = ci - 1;
3449
3449
  else if (ci === BREAK)
@@ -3454,13 +3454,13 @@ var require_visit = __commonJS({
3454
3454
  }
3455
3455
  }
3456
3456
  } else if (identity.isPair(node)) {
3457
- path4 = Object.freeze(path4.concat(node));
3458
- const ck = await visitAsync_("key", node.key, visitor, path4);
3457
+ path5 = Object.freeze(path5.concat(node));
3458
+ const ck = await visitAsync_("key", node.key, visitor, path5);
3459
3459
  if (ck === BREAK)
3460
3460
  return BREAK;
3461
3461
  else if (ck === REMOVE)
3462
3462
  node.key = null;
3463
- const cv = await visitAsync_("value", node.value, visitor, path4);
3463
+ const cv = await visitAsync_("value", node.value, visitor, path5);
3464
3464
  if (cv === BREAK)
3465
3465
  return BREAK;
3466
3466
  else if (cv === REMOVE)
@@ -3487,23 +3487,23 @@ var require_visit = __commonJS({
3487
3487
  }
3488
3488
  return visitor;
3489
3489
  }
3490
- function callVisitor(key, node, visitor, path4) {
3490
+ function callVisitor(key, node, visitor, path5) {
3491
3491
  if (typeof visitor === "function")
3492
- return visitor(key, node, path4);
3492
+ return visitor(key, node, path5);
3493
3493
  if (identity.isMap(node))
3494
- return visitor.Map?.(key, node, path4);
3494
+ return visitor.Map?.(key, node, path5);
3495
3495
  if (identity.isSeq(node))
3496
- return visitor.Seq?.(key, node, path4);
3496
+ return visitor.Seq?.(key, node, path5);
3497
3497
  if (identity.isPair(node))
3498
- return visitor.Pair?.(key, node, path4);
3498
+ return visitor.Pair?.(key, node, path5);
3499
3499
  if (identity.isScalar(node))
3500
- return visitor.Scalar?.(key, node, path4);
3500
+ return visitor.Scalar?.(key, node, path5);
3501
3501
  if (identity.isAlias(node))
3502
- return visitor.Alias?.(key, node, path4);
3502
+ return visitor.Alias?.(key, node, path5);
3503
3503
  return void 0;
3504
3504
  }
3505
- function replaceNode(key, path4, node) {
3506
- const parent = path4[path4.length - 1];
3505
+ function replaceNode(key, path5, node) {
3506
+ const parent = path5[path5.length - 1];
3507
3507
  if (identity.isCollection(parent)) {
3508
3508
  parent.items[key] = node;
3509
3509
  } else if (identity.isPair(parent)) {
@@ -4111,10 +4111,10 @@ var require_Collection = __commonJS({
4111
4111
  var createNode = require_createNode();
4112
4112
  var identity = require_identity();
4113
4113
  var Node = require_Node();
4114
- function collectionFromPath(schema, path4, value) {
4114
+ function collectionFromPath(schema, path5, value) {
4115
4115
  let v = value;
4116
- for (let i = path4.length - 1; i >= 0; --i) {
4117
- const k = path4[i];
4116
+ for (let i = path5.length - 1; i >= 0; --i) {
4117
+ const k = path5[i];
4118
4118
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
4119
4119
  const a = [];
4120
4120
  a[k] = v;
@@ -4133,7 +4133,7 @@ var require_Collection = __commonJS({
4133
4133
  sourceObjects: /* @__PURE__ */ new Map()
4134
4134
  });
4135
4135
  }
4136
- var isEmptyPath = (path4) => path4 == null || typeof path4 === "object" && !!path4[Symbol.iterator]().next().done;
4136
+ var isEmptyPath = (path5) => path5 == null || typeof path5 === "object" && !!path5[Symbol.iterator]().next().done;
4137
4137
  var Collection = class extends Node.NodeBase {
4138
4138
  constructor(type, schema) {
4139
4139
  super(type);
@@ -4163,11 +4163,11 @@ var require_Collection = __commonJS({
4163
4163
  * be a Pair instance or a `{ key, value }` object, which may not have a key
4164
4164
  * that already exists in the map.
4165
4165
  */
4166
- addIn(path4, value) {
4167
- if (isEmptyPath(path4))
4166
+ addIn(path5, value) {
4167
+ if (isEmptyPath(path5))
4168
4168
  this.add(value);
4169
4169
  else {
4170
- const [key, ...rest] = path4;
4170
+ const [key, ...rest] = path5;
4171
4171
  const node = this.get(key, true);
4172
4172
  if (identity.isCollection(node))
4173
4173
  node.addIn(rest, value);
@@ -4181,8 +4181,8 @@ var require_Collection = __commonJS({
4181
4181
  * Removes a value from the collection.
4182
4182
  * @returns `true` if the item was found and removed.
4183
4183
  */
4184
- deleteIn(path4) {
4185
- const [key, ...rest] = path4;
4184
+ deleteIn(path5) {
4185
+ const [key, ...rest] = path5;
4186
4186
  if (rest.length === 0)
4187
4187
  return this.delete(key);
4188
4188
  const node = this.get(key, true);
@@ -4196,8 +4196,8 @@ var require_Collection = __commonJS({
4196
4196
  * scalar values from their surrounding node; to disable set `keepScalar` to
4197
4197
  * `true` (collections are always returned intact).
4198
4198
  */
4199
- getIn(path4, keepScalar) {
4200
- const [key, ...rest] = path4;
4199
+ getIn(path5, keepScalar) {
4200
+ const [key, ...rest] = path5;
4201
4201
  const node = this.get(key, true);
4202
4202
  if (rest.length === 0)
4203
4203
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -4215,8 +4215,8 @@ var require_Collection = __commonJS({
4215
4215
  /**
4216
4216
  * Checks if the collection includes a value with the key `key`.
4217
4217
  */
4218
- hasIn(path4) {
4219
- const [key, ...rest] = path4;
4218
+ hasIn(path5) {
4219
+ const [key, ...rest] = path5;
4220
4220
  if (rest.length === 0)
4221
4221
  return this.has(key);
4222
4222
  const node = this.get(key, true);
@@ -4226,8 +4226,8 @@ var require_Collection = __commonJS({
4226
4226
  * Sets a value in this collection. For `!!set`, `value` needs to be a
4227
4227
  * boolean to add/remove the item from the set.
4228
4228
  */
4229
- setIn(path4, value) {
4230
- const [key, ...rest] = path4;
4229
+ setIn(path5, value) {
4230
+ const [key, ...rest] = path5;
4231
4231
  if (rest.length === 0) {
4232
4232
  this.set(key, value);
4233
4233
  } else {
@@ -6731,9 +6731,9 @@ var require_Document = __commonJS({
6731
6731
  this.contents.add(value);
6732
6732
  }
6733
6733
  /** Adds a value to the document. */
6734
- addIn(path4, value) {
6734
+ addIn(path5, value) {
6735
6735
  if (assertCollection(this.contents))
6736
- this.contents.addIn(path4, value);
6736
+ this.contents.addIn(path5, value);
6737
6737
  }
6738
6738
  /**
6739
6739
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -6808,14 +6808,14 @@ var require_Document = __commonJS({
6808
6808
  * Removes a value from the document.
6809
6809
  * @returns `true` if the item was found and removed.
6810
6810
  */
6811
- deleteIn(path4) {
6812
- if (Collection.isEmptyPath(path4)) {
6811
+ deleteIn(path5) {
6812
+ if (Collection.isEmptyPath(path5)) {
6813
6813
  if (this.contents == null)
6814
6814
  return false;
6815
6815
  this.contents = null;
6816
6816
  return true;
6817
6817
  }
6818
- return assertCollection(this.contents) ? this.contents.deleteIn(path4) : false;
6818
+ return assertCollection(this.contents) ? this.contents.deleteIn(path5) : false;
6819
6819
  }
6820
6820
  /**
6821
6821
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -6830,10 +6830,10 @@ var require_Document = __commonJS({
6830
6830
  * scalar values from their surrounding node; to disable set `keepScalar` to
6831
6831
  * `true` (collections are always returned intact).
6832
6832
  */
6833
- getIn(path4, keepScalar) {
6834
- if (Collection.isEmptyPath(path4))
6833
+ getIn(path5, keepScalar) {
6834
+ if (Collection.isEmptyPath(path5))
6835
6835
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
6836
- return identity.isCollection(this.contents) ? this.contents.getIn(path4, keepScalar) : void 0;
6836
+ return identity.isCollection(this.contents) ? this.contents.getIn(path5, keepScalar) : void 0;
6837
6837
  }
6838
6838
  /**
6839
6839
  * Checks if the document includes a value with the key `key`.
@@ -6844,10 +6844,10 @@ var require_Document = __commonJS({
6844
6844
  /**
6845
6845
  * Checks if the document includes a value at `path`.
6846
6846
  */
6847
- hasIn(path4) {
6848
- if (Collection.isEmptyPath(path4))
6847
+ hasIn(path5) {
6848
+ if (Collection.isEmptyPath(path5))
6849
6849
  return this.contents !== void 0;
6850
- return identity.isCollection(this.contents) ? this.contents.hasIn(path4) : false;
6850
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path5) : false;
6851
6851
  }
6852
6852
  /**
6853
6853
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -6864,13 +6864,13 @@ var require_Document = __commonJS({
6864
6864
  * Sets a value in this document. For `!!set`, `value` needs to be a
6865
6865
  * boolean to add/remove the item from the set.
6866
6866
  */
6867
- setIn(path4, value) {
6868
- if (Collection.isEmptyPath(path4)) {
6867
+ setIn(path5, value) {
6868
+ if (Collection.isEmptyPath(path5)) {
6869
6869
  this.contents = value;
6870
6870
  } else if (this.contents == null) {
6871
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path4), value);
6871
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path5), value);
6872
6872
  } else if (assertCollection(this.contents)) {
6873
- this.contents.setIn(path4, value);
6873
+ this.contents.setIn(path5, value);
6874
6874
  }
6875
6875
  }
6876
6876
  /**
@@ -8822,9 +8822,9 @@ var require_cst_visit = __commonJS({
8822
8822
  visit.BREAK = BREAK;
8823
8823
  visit.SKIP = SKIP;
8824
8824
  visit.REMOVE = REMOVE;
8825
- visit.itemAtPath = (cst, path4) => {
8825
+ visit.itemAtPath = (cst, path5) => {
8826
8826
  let item = cst;
8827
- for (const [field, index] of path4) {
8827
+ for (const [field, index] of path5) {
8828
8828
  const tok = item?.[field];
8829
8829
  if (tok && "items" in tok) {
8830
8830
  item = tok.items[index];
@@ -8833,23 +8833,23 @@ var require_cst_visit = __commonJS({
8833
8833
  }
8834
8834
  return item;
8835
8835
  };
8836
- visit.parentCollection = (cst, path4) => {
8837
- const parent = visit.itemAtPath(cst, path4.slice(0, -1));
8838
- const field = path4[path4.length - 1][0];
8836
+ visit.parentCollection = (cst, path5) => {
8837
+ const parent = visit.itemAtPath(cst, path5.slice(0, -1));
8838
+ const field = path5[path5.length - 1][0];
8839
8839
  const coll = parent?.[field];
8840
8840
  if (coll && "items" in coll)
8841
8841
  return coll;
8842
8842
  throw new Error("Parent collection not found");
8843
8843
  };
8844
- function _visit(path4, item, visitor) {
8845
- let ctrl = visitor(item, path4);
8844
+ function _visit(path5, item, visitor) {
8845
+ let ctrl = visitor(item, path5);
8846
8846
  if (typeof ctrl === "symbol")
8847
8847
  return ctrl;
8848
8848
  for (const field of ["key", "value"]) {
8849
8849
  const token = item[field];
8850
8850
  if (token && "items" in token) {
8851
8851
  for (let i = 0; i < token.items.length; ++i) {
8852
- const ci = _visit(Object.freeze(path4.concat([[field, i]])), token.items[i], visitor);
8852
+ const ci = _visit(Object.freeze(path5.concat([[field, i]])), token.items[i], visitor);
8853
8853
  if (typeof ci === "number")
8854
8854
  i = ci - 1;
8855
8855
  else if (ci === BREAK)
@@ -8860,10 +8860,10 @@ var require_cst_visit = __commonJS({
8860
8860
  }
8861
8861
  }
8862
8862
  if (typeof ctrl === "function" && field === "key")
8863
- ctrl = ctrl(item, path4);
8863
+ ctrl = ctrl(item, path5);
8864
8864
  }
8865
8865
  }
8866
- return typeof ctrl === "function" ? ctrl(item, path4) : ctrl;
8866
+ return typeof ctrl === "function" ? ctrl(item, path5) : ctrl;
8867
8867
  }
8868
8868
  exports2.visit = visit;
8869
8869
  }
@@ -13790,8 +13790,8 @@ var require_utils = __commonJS({
13790
13790
  }
13791
13791
  return ind;
13792
13792
  }
13793
- function removeDotSegments(path4) {
13794
- let input = path4;
13793
+ function removeDotSegments(path5) {
13794
+ let input = path5;
13795
13795
  const output = [];
13796
13796
  let nextSlash = -1;
13797
13797
  let len = 0;
@@ -13990,8 +13990,8 @@ var require_schemes = __commonJS({
13990
13990
  wsComponent.secure = void 0;
13991
13991
  }
13992
13992
  if (wsComponent.resourceName) {
13993
- const [path4, query] = wsComponent.resourceName.split("?");
13994
- wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
13993
+ const [path5, query] = wsComponent.resourceName.split("?");
13994
+ wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
13995
13995
  wsComponent.query = query;
13996
13996
  wsComponent.resourceName = void 0;
13997
13997
  }
@@ -17376,7 +17376,7 @@ var {
17376
17376
 
17377
17377
  // src/commands/scan.ts
17378
17378
  var fs = __toESM(require("fs"));
17379
- var path2 = __toESM(require("path"));
17379
+ var path3 = __toESM(require("path"));
17380
17380
 
17381
17381
  // node_modules/minimatch/dist/esm/index.js
17382
17382
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
@@ -21227,12 +21227,12 @@ var PathBase = class {
21227
21227
  /**
21228
21228
  * Get the Path object referenced by the string path, resolved from this Path
21229
21229
  */
21230
- resolve(path4) {
21231
- if (!path4) {
21230
+ resolve(path5) {
21231
+ if (!path5) {
21232
21232
  return this;
21233
21233
  }
21234
- const rootPath = this.getRootString(path4);
21235
- const dir = path4.substring(rootPath.length);
21234
+ const rootPath = this.getRootString(path5);
21235
+ const dir = path5.substring(rootPath.length);
21236
21236
  const dirParts = dir.split(this.splitSep);
21237
21237
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
21238
21238
  return result;
@@ -21984,8 +21984,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
21984
21984
  /**
21985
21985
  * @internal
21986
21986
  */
21987
- getRootString(path4) {
21988
- return import_node_path.win32.parse(path4).root;
21987
+ getRootString(path5) {
21988
+ return import_node_path.win32.parse(path5).root;
21989
21989
  }
21990
21990
  /**
21991
21991
  * @internal
@@ -22031,8 +22031,8 @@ var PathPosix = class _PathPosix extends PathBase {
22031
22031
  /**
22032
22032
  * @internal
22033
22033
  */
22034
- getRootString(path4) {
22035
- return path4.startsWith("/") ? "/" : "";
22034
+ getRootString(path5) {
22035
+ return path5.startsWith("/") ? "/" : "";
22036
22036
  }
22037
22037
  /**
22038
22038
  * @internal
@@ -22121,11 +22121,11 @@ var PathScurryBase = class {
22121
22121
  /**
22122
22122
  * Get the depth of a provided path, string, or the cwd
22123
22123
  */
22124
- depth(path4 = this.cwd) {
22125
- if (typeof path4 === "string") {
22126
- path4 = this.cwd.resolve(path4);
22124
+ depth(path5 = this.cwd) {
22125
+ if (typeof path5 === "string") {
22126
+ path5 = this.cwd.resolve(path5);
22127
22127
  }
22128
- return path4.depth();
22128
+ return path5.depth();
22129
22129
  }
22130
22130
  /**
22131
22131
  * Return the cache of child entries. Exposed so subclasses can create
@@ -22612,9 +22612,9 @@ var PathScurryBase = class {
22612
22612
  process2();
22613
22613
  return results;
22614
22614
  }
22615
- chdir(path4 = this.cwd) {
22615
+ chdir(path5 = this.cwd) {
22616
22616
  const oldCwd = this.cwd;
22617
- this.cwd = typeof path4 === "string" ? this.cwd.resolve(path4) : path4;
22617
+ this.cwd = typeof path5 === "string" ? this.cwd.resolve(path5) : path5;
22618
22618
  this.cwd[setAsCwd](oldCwd);
22619
22619
  }
22620
22620
  };
@@ -22970,8 +22970,8 @@ var MatchRecord = class {
22970
22970
  }
22971
22971
  // match, absolute, ifdir
22972
22972
  entries() {
22973
- return [...this.store.entries()].map(([path4, n]) => [
22974
- path4,
22973
+ return [...this.store.entries()].map(([path5, n]) => [
22974
+ path5,
22975
22975
  !!(n & 2),
22976
22976
  !!(n & 1)
22977
22977
  ]);
@@ -23176,9 +23176,9 @@ var GlobUtil = class {
23176
23176
  signal;
23177
23177
  maxDepth;
23178
23178
  includeChildMatches;
23179
- constructor(patterns, path4, opts) {
23179
+ constructor(patterns, path5, opts) {
23180
23180
  this.patterns = patterns;
23181
- this.path = path4;
23181
+ this.path = path5;
23182
23182
  this.opts = opts;
23183
23183
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
23184
23184
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -23197,11 +23197,11 @@ var GlobUtil = class {
23197
23197
  });
23198
23198
  }
23199
23199
  }
23200
- #ignored(path4) {
23201
- return this.seen.has(path4) || !!this.#ignore?.ignored?.(path4);
23200
+ #ignored(path5) {
23201
+ return this.seen.has(path5) || !!this.#ignore?.ignored?.(path5);
23202
23202
  }
23203
- #childrenIgnored(path4) {
23204
- return !!this.#ignore?.childrenIgnored?.(path4);
23203
+ #childrenIgnored(path5) {
23204
+ return !!this.#ignore?.childrenIgnored?.(path5);
23205
23205
  }
23206
23206
  // backpressure mechanism
23207
23207
  pause() {
@@ -23416,8 +23416,8 @@ var GlobUtil = class {
23416
23416
  };
23417
23417
  var GlobWalker = class extends GlobUtil {
23418
23418
  matches = /* @__PURE__ */ new Set();
23419
- constructor(patterns, path4, opts) {
23420
- super(patterns, path4, opts);
23419
+ constructor(patterns, path5, opts) {
23420
+ super(patterns, path5, opts);
23421
23421
  }
23422
23422
  matchEmit(e) {
23423
23423
  this.matches.add(e);
@@ -23454,8 +23454,8 @@ var GlobWalker = class extends GlobUtil {
23454
23454
  };
23455
23455
  var GlobStream = class extends GlobUtil {
23456
23456
  results;
23457
- constructor(patterns, path4, opts) {
23458
- super(patterns, path4, opts);
23457
+ constructor(patterns, path5, opts) {
23458
+ super(patterns, path5, opts);
23459
23459
  this.results = new Minipass({
23460
23460
  signal: this.signal,
23461
23461
  objectMode: true
@@ -24059,8 +24059,8 @@ function isTerminalNode(type, name) {
24059
24059
  return TERMINAL_NODE_PATTERNS.some((pattern) => label.includes(pattern));
24060
24060
  }
24061
24061
  function readNumber(source, paths) {
24062
- for (const path4 of paths) {
24063
- const value = path4.split(".").reduce((acc, key) => acc ? acc[key] : void 0, source);
24062
+ for (const path5 of paths) {
24063
+ const value = path5.split(".").reduce((acc, key) => acc ? acc[key] : void 0, source);
24064
24064
  if (typeof value === "number") return value;
24065
24065
  if (typeof value === "string" && !Number.isNaN(Number(value))) return Number(value);
24066
24066
  }
@@ -24195,7 +24195,7 @@ function validateN8nWorkflow(data) {
24195
24195
  const validate = getValidator();
24196
24196
  if (!validate(data)) {
24197
24197
  const errors = (validate.errors || []).map((err) => {
24198
- const path4 = err.instancePath || err.schemaPath;
24198
+ const path5 = err.instancePath || err.schemaPath;
24199
24199
  const message = err.message || "Validation error";
24200
24200
  let suggestion = "";
24201
24201
  if (err.keyword === "required") {
@@ -24207,7 +24207,7 @@ function validateN8nWorkflow(data) {
24207
24207
  } else if (err.keyword === "minLength") {
24208
24208
  suggestion = "This field cannot be empty.";
24209
24209
  }
24210
- return { path: path4, message, suggestion };
24210
+ return { path: path5, message, suggestion };
24211
24211
  });
24212
24212
  throw new ValidationError(errors);
24213
24213
  }
@@ -24854,11 +24854,11 @@ function loadConfigFromFile(configPath) {
24854
24854
  function loadConfigFromCwd() {
24855
24855
  try {
24856
24856
  const fs3 = __require("fs");
24857
- const path4 = __require("path");
24857
+ const path5 = __require("path");
24858
24858
  const candidates = [".flowlint.yml", ".flowlint.yaml", "flowlint.config.yml"];
24859
24859
  const cwd = process.cwd();
24860
24860
  for (const candidate of candidates) {
24861
- const configPath = path4.join(cwd, candidate);
24861
+ const configPath = path5.join(cwd, candidate);
24862
24862
  if (fs3.existsSync(configPath)) {
24863
24863
  const content = fs3.readFileSync(configPath, "utf-8");
24864
24864
  return parseConfig(content);
@@ -24878,32 +24878,146 @@ function countFindingsBySeverity(findings) {
24878
24878
  };
24879
24879
  }
24880
24880
 
24881
+ // src/reporters/junit.ts
24882
+ var path2 = __toESM(require("path"));
24883
+ function formatJunit(findings) {
24884
+ const byFile = findings.reduce((acc, finding) => {
24885
+ const file = finding.path || "unknown";
24886
+ if (!acc[file]) acc[file] = [];
24887
+ acc[file].push(finding);
24888
+ return acc;
24889
+ }, {});
24890
+ let xml = '<?xml version="1.0" encoding="UTF-8"?>\n<testsuites>\n';
24891
+ for (const [file, fileFindings] of Object.entries(byFile)) {
24892
+ const filename = path2.basename(file);
24893
+ const failures = fileFindings.length;
24894
+ xml += ` <testsuite name="${filename}" tests="${failures}" failures="${failures}" errors="0" skipped="0" timestamp="${(/* @__PURE__ */ new Date()).toISOString()}" time="0" hostname="flowlint">
24895
+ `;
24896
+ for (const finding of fileFindings) {
24897
+ xml += ` <testcase classname="${file}" name="${finding.rule}" time="0">
24898
+ `;
24899
+ xml += ` <failure message="${escapeXml(finding.message)}" type="${finding.severity}">Line ${finding.line || 0}: ${escapeXml(finding.raw_details || "")}</failure>
24900
+ `;
24901
+ xml += ` </testcase>
24902
+ `;
24903
+ }
24904
+ xml += ` </testsuite>
24905
+ `;
24906
+ }
24907
+ xml += "</testsuites>";
24908
+ return xml;
24909
+ }
24910
+ function escapeXml(unsafe) {
24911
+ if (!unsafe) return "";
24912
+ return unsafe.replace(/[<>&'"]/g, (c) => {
24913
+ switch (c) {
24914
+ case "<":
24915
+ return "&lt;";
24916
+ case ">":
24917
+ return "&gt;";
24918
+ case "&":
24919
+ return "&amp;";
24920
+ case "'":
24921
+ return "&apos;";
24922
+ case '"':
24923
+ return "&quot;";
24924
+ default:
24925
+ return c;
24926
+ }
24927
+ });
24928
+ }
24929
+
24930
+ // src/reporters/sarif.ts
24931
+ function formatSarif(findings) {
24932
+ const rules2 = new Set(findings.map((f) => f.rule));
24933
+ const rulesList = Array.from(rules2).map((ruleId) => ({
24934
+ id: ruleId,
24935
+ shortDescription: { text: ruleId },
24936
+ helpUri: `https://flowlint.dev/rules/${ruleId}`
24937
+ }));
24938
+ const results = findings.map((f) => ({
24939
+ ruleId: f.rule,
24940
+ level: mapSeverityToSarif(f.severity),
24941
+ message: { text: f.message },
24942
+ locations: [{
24943
+ physicalLocation: {
24944
+ artifactLocation: { uri: f.path || "unknown" },
24945
+ region: {
24946
+ startLine: f.line || 1,
24947
+ startColumn: 1
24948
+ }
24949
+ }
24950
+ }]
24951
+ }));
24952
+ const report = {
24953
+ version: "2.1.0",
24954
+ $schema: "http://json.schemastore.org/sarif-2.1.0-rtm.4",
24955
+ runs: [{
24956
+ tool: {
24957
+ driver: {
24958
+ name: "FlowLint",
24959
+ informationUri: "https://flowlint.dev",
24960
+ rules: rulesList
24961
+ }
24962
+ },
24963
+ results
24964
+ }]
24965
+ };
24966
+ return JSON.stringify(report, null, 2);
24967
+ }
24968
+ function mapSeverityToSarif(severity) {
24969
+ switch (severity) {
24970
+ case "must":
24971
+ return "error";
24972
+ case "should":
24973
+ return "warning";
24974
+ case "nit":
24975
+ return "note";
24976
+ default:
24977
+ return "warning";
24978
+ }
24979
+ }
24980
+
24981
+ // src/reporters/json.ts
24982
+ function formatJson(findings, stats) {
24983
+ return JSON.stringify({
24984
+ findings,
24985
+ summary: countFindingsBySeverity(findings),
24986
+ filesScanned: stats.files,
24987
+ errors: stats.errors
24988
+ }, null, 2);
24989
+ }
24990
+
24881
24991
  // src/commands/scan.ts
24882
- 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", "stylish").option("--fail-on-error", "Exit with code 1 if errors found", false).action(async (scanPath, options) => {
24992
+ 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) => {
24883
24993
  try {
24884
- const absolutePath = path2.resolve(process.cwd(), scanPath);
24994
+ const absolutePath = path3.resolve(process.cwd(), scanPath);
24995
+ const isStylish = options.format === "stylish";
24885
24996
  const config = options.config ? loadConfig(options.config) : loadConfig();
24886
24997
  const patterns = config.files.include.map(
24887
- (p) => path2.join(absolutePath, p).replace(/\\/g, "/")
24998
+ (p) => path3.join(absolutePath, p).replace(/\\/g, "/")
24888
24999
  );
24889
25000
  const ignorePatterns = config.files.ignore.map(
24890
- (p) => path2.join(absolutePath, p).replace(/\\/g, "/")
25001
+ (p) => path3.join(absolutePath, p).replace(/\\/g, "/")
24891
25002
  );
24892
25003
  const files = await glob(patterns, {
24893
25004
  ignore: ignorePatterns,
24894
25005
  nodir: true
24895
25006
  });
24896
25007
  if (files.length === 0) {
24897
- console.log(import_picocolors.default.yellow("No workflow files found."));
25008
+ if (isStylish) console.log(import_picocolors.default.yellow("No workflow files found."));
24898
25009
  return;
24899
25010
  }
24900
- console.log(import_picocolors.default.blue("Scanning " + files.length + " file(s)..."));
25011
+ if (isStylish) {
25012
+ console.log(import_picocolors.default.blue("Scanning " + files.length + " file(s)..."));
25013
+ console.log("");
25014
+ }
24901
25015
  const allFindings = [];
24902
25016
  let errorCount = 0;
24903
25017
  for (const file of files) {
24904
25018
  try {
24905
25019
  const content = fs.readFileSync(file, "utf-8");
24906
- const relativePath = path2.relative(process.cwd(), file);
25020
+ const relativePath = path3.relative(process.cwd(), file);
24907
25021
  const graph = parseN8n(content);
24908
25022
  const findings = runAllRules(graph, {
24909
25023
  path: relativePath,
@@ -24911,74 +25025,75 @@ var scanCommand = new Command("scan").description("Scan workflow files for issue
24911
25025
  nodeLines: graph.meta.nodeLines
24912
25026
  });
24913
25027
  allFindings.push(...findings);
24914
- } catch (error) {
24915
- if (error instanceof ValidationError) {
24916
- console.log(import_picocolors.default.red("x " + path2.relative(process.cwd(), file) + ": Validation error"));
24917
- error.errors.forEach((e) => {
24918
- console.log(import_picocolors.default.gray(" " + e.path + ": " + e.message));
25028
+ if (isStylish && findings.length > 0) {
25029
+ console.log(import_picocolors.default.underline(relativePath));
25030
+ findings.forEach((f) => {
25031
+ const color = f.severity === "must" ? import_picocolors.default.red : f.severity === "should" ? import_picocolors.default.yellow : import_picocolors.default.gray;
25032
+ const line = f.line ? `:${f.line}` : "";
25033
+ console.log(` ${color(f.severity.padEnd(6))} ${f.rule} ${f.message}${import_picocolors.default.gray(line)}`);
24919
25034
  });
24920
- } else {
24921
- console.log(import_picocolors.default.red("x " + path2.relative(process.cwd(), file) + ": " + (error instanceof Error ? error.message : String(error))));
25035
+ console.log("");
25036
+ }
25037
+ if (findings.some((f) => f.severity === "must")) {
25038
+ errorCount++;
24922
25039
  }
25040
+ } catch (error) {
25041
+ allFindings.push({
25042
+ rule: "validation-error",
25043
+ message: error instanceof Error ? error.message : String(error),
25044
+ severity: "must",
25045
+ path: path3.relative(process.cwd(), file),
25046
+ line: 0
25047
+ });
24923
25048
  errorCount++;
25049
+ if (isStylish) {
25050
+ if (error instanceof ValidationError) {
25051
+ console.log(import_picocolors.default.red("x " + path3.relative(process.cwd(), file) + ": Validation error"));
25052
+ error.errors.forEach((e) => {
25053
+ console.log(import_picocolors.default.gray(" " + e.path + ": " + e.message));
25054
+ });
25055
+ } else {
25056
+ console.log(import_picocolors.default.red("x " + path3.relative(process.cwd(), file) + ": " + (error instanceof Error ? error.message : String(error))));
25057
+ }
25058
+ }
24924
25059
  }
24925
25060
  }
24926
- if (options.format === "json") {
24927
- console.log(JSON.stringify({
24928
- findings: allFindings,
24929
- summary: countFindingsBySeverity(allFindings),
24930
- filesScanned: files.length,
24931
- errors: errorCount
24932
- }, null, 2));
24933
- } else {
24934
- printStylishOutput(allFindings);
24935
- }
24936
- const summary = countFindingsBySeverity(allFindings);
24937
- console.log("");
24938
- console.log(import_picocolors.default.bold("Summary:"));
24939
- console.log(" Files scanned: " + files.length);
24940
- console.log(" " + import_picocolors.default.red("Errors (must): " + summary.must));
24941
- console.log(" " + import_picocolors.default.yellow("Warnings (should): " + summary.should));
24942
- console.log(" " + import_picocolors.default.blue("Notes (nit): " + summary.nit));
24943
- if (options.failOnError && summary.must > 0) {
25061
+ switch (options.format) {
25062
+ case "json":
25063
+ console.log(formatJson(allFindings, { files: files.length, errors: errorCount }));
25064
+ break;
25065
+ case "junit":
25066
+ console.log(formatJunit(allFindings));
25067
+ break;
25068
+ case "sarif":
25069
+ console.log(formatSarif(allFindings));
25070
+ break;
25071
+ case "stylish":
25072
+ default:
25073
+ const summary = countFindingsBySeverity(allFindings);
25074
+ console.log("Summary:");
25075
+ console.log(` Files scanned: ${files.length}`);
25076
+ console.log(` Errors (must): ${import_picocolors.default.red(summary.must)}`);
25077
+ console.log(` Warnings (should): ${import_picocolors.default.yellow(summary.should)}`);
25078
+ console.log(` Notes (nit): ${import_picocolors.default.gray(summary.nit)}`);
25079
+ break;
25080
+ }
25081
+ if (options.failOnError && errorCount > 0) {
24944
25082
  process.exit(1);
24945
25083
  }
24946
25084
  } catch (error) {
24947
- console.error(import_picocolors.default.red("Error:"), error instanceof Error ? error.message : String(error));
24948
- process.exit(2);
25085
+ console.error(import_picocolors.default.red("Error: " + (error instanceof Error ? error.message : String(error))));
25086
+ process.exit(1);
24949
25087
  }
24950
25088
  });
24951
- function printStylishOutput(findings) {
24952
- if (findings.length === 0) {
24953
- console.log(import_picocolors.default.green("No issues found!"));
24954
- return;
24955
- }
24956
- const byFile = /* @__PURE__ */ new Map();
24957
- for (const finding of findings) {
24958
- const existing = byFile.get(finding.path) || [];
24959
- existing.push(finding);
24960
- byFile.set(finding.path, existing);
24961
- }
24962
- for (const [file, fileFindings] of byFile) {
24963
- console.log("");
24964
- console.log(import_picocolors.default.underline(file));
24965
- for (const finding of fileFindings) {
24966
- const severityColor = finding.severity === "must" ? import_picocolors.default.red : finding.severity === "should" ? import_picocolors.default.yellow : import_picocolors.default.blue;
24967
- const line = finding.line ? ":" + finding.line : "";
24968
- console.log(
24969
- " " + severityColor(finding.severity.padEnd(6)) + " " + import_picocolors.default.gray(finding.rule) + " " + finding.message + import_picocolors.default.gray(line)
24970
- );
24971
- }
24972
- }
24973
- }
24974
25089
 
24975
25090
  // src/commands/init.ts
24976
25091
  var fs2 = __toESM(require("fs"));
24977
- var path3 = __toESM(require("path"));
25092
+ var path4 = __toESM(require("path"));
24978
25093
  var import_picocolors2 = __toESM(require_picocolors());
24979
25094
  var import_yaml3 = __toESM(require_dist());
24980
25095
  var initCommand = new Command("init").description("Initialize FlowLint configuration in the current directory").option("--force", "Overwrite existing config file", false).action((options) => {
24981
- const configPath = path3.join(process.cwd(), ".flowlint.yml");
25096
+ const configPath = path4.join(process.cwd(), ".flowlint.yml");
24982
25097
  if (fs2.existsSync(configPath) && !options.force) {
24983
25098
  console.log(import_picocolors2.default.yellow(".flowlint.yml already exists. Use --force to overwrite."));
24984
25099
  return;
@@ -25003,7 +25118,7 @@ var initCommand = new Command("init").description("Initialize FlowLint configura
25003
25118
 
25004
25119
  // src/cli.ts
25005
25120
  var program2 = new Command();
25006
- program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.6.2");
25121
+ program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.7.0");
25007
25122
  program2.addCommand(scanCommand);
25008
25123
  program2.addCommand(initCommand);
25009
25124
  program2.parse(process.argv);