pickier 0.1.23 → 0.1.25

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/bin/cli.js CHANGED
@@ -16536,6 +16536,7 @@ ${lines.slice(bodyRange.from + 1, bodyRange.to + 1).join(`
16536
16536
  if (openParenIdx !== -1) {
16537
16537
  let isTypeSignature = false;
16538
16538
  let angleDepthBack = 0;
16539
+ let parenDepthBack = 0;
16539
16540
  for (let k = openParenIdx - 1;k >= 0; k--) {
16540
16541
  const ch = line[k];
16541
16542
  if (ch === ">") {
@@ -16547,10 +16548,13 @@ ${lines.slice(bodyRange.from + 1, bodyRange.to + 1).join(`
16547
16548
  angleDepthBack--;
16548
16549
  continue;
16549
16550
  }
16550
- isTypeSignature = true;
16551
- break;
16551
+ if (parenDepthBack === 0) {
16552
+ isTypeSignature = true;
16553
+ break;
16554
+ }
16555
+ continue;
16552
16556
  }
16553
- if (ch === ":" && angleDepthBack === 0) {
16557
+ if (ch === ":" && angleDepthBack === 0 && parenDepthBack === 0) {
16554
16558
  isTypeSignature = true;
16555
16559
  break;
16556
16560
  }
@@ -16558,11 +16562,34 @@ ${lines.slice(bodyRange.from + 1, bodyRange.to + 1).join(`
16558
16562
  continue;
16559
16563
  if (ch === ",")
16560
16564
  continue;
16561
- if (ch === "=" || ch === "(" || ch === "{" || ch === "[") {
16565
+ if (ch === ")") {
16566
+ parenDepthBack++;
16567
+ continue;
16568
+ }
16569
+ if (ch === "(") {
16570
+ parenDepthBack--;
16571
+ continue;
16572
+ }
16573
+ if (ch === "|" || ch === "&") {
16574
+ isTypeSignature = true;
16562
16575
  break;
16563
16576
  }
16577
+ if (ch === "=" || ch === "{" || ch === "[") {
16578
+ if (parenDepthBack >= 0)
16579
+ break;
16580
+ continue;
16581
+ }
16564
16582
  if (ch !== " " && ch !== "\t" && !/[\w.]/.test(ch)) {
16565
- break;
16583
+ if (parenDepthBack >= 0)
16584
+ break;
16585
+ }
16586
+ }
16587
+ if (!isTypeSignature) {
16588
+ const beforeParen = line.slice(0, openParenIdx);
16589
+ if (/^\s*(?:export\s+)?(?:declare\s+)?type\s+\w[\w$]*\s*(?:<[^>]*>)?\s*=\s*$/.test(beforeParen)) {
16590
+ isTypeSignature = true;
16591
+ } else if (/\bas\s+$/.test(beforeParen)) {
16592
+ isTypeSignature = true;
16566
16593
  }
16567
16594
  }
16568
16595
  if (isTypeSignature) {
@@ -18969,16 +18996,12 @@ var init_heading_increment = __esm(() => {
18969
18996
  check: (text, ctx) => {
18970
18997
  const issues = [];
18971
18998
  const lines = text.split(/\r?\n/);
18999
+ const inCode = getCodeBlockLines(lines);
18972
19000
  let previousLevel = 0;
18973
- let inFence = false;
18974
19001
  for (let i = 0;i < lines.length; i++) {
18975
- const line = lines[i];
18976
- if (/^(?:`{3,}|~{3,})/.test(line.trim())) {
18977
- inFence = !inFence;
18978
- continue;
18979
- }
18980
- if (inFence)
19002
+ if (inCode.has(i))
18981
19003
  continue;
19004
+ const line = lines[i];
18982
19005
  const atxMatch = line.match(/^(#{1,6})\s/);
18983
19006
  if (atxMatch) {
18984
19007
  const level = atxMatch[1].length;
@@ -18996,6 +19019,29 @@ var init_heading_increment = __esm(() => {
18996
19019
  }
18997
19020
  }
18998
19021
  return issues;
19022
+ },
19023
+ fix: (text) => {
19024
+ const lines = text.split(/\r?\n/);
19025
+ const inCode = getCodeBlockLines(lines);
19026
+ let previousLevel = 0;
19027
+ let changed = false;
19028
+ for (let i = 0;i < lines.length; i++) {
19029
+ if (inCode.has(i))
19030
+ continue;
19031
+ const line = lines[i];
19032
+ const atxMatch = line.match(/^(#{1,6})(\s.*)$/);
19033
+ if (!atxMatch)
19034
+ continue;
19035
+ const original = atxMatch[1].length;
19036
+ const allowed = previousLevel === 0 ? original : Math.min(original, previousLevel + 1);
19037
+ if (allowed !== original) {
19038
+ lines[i] = "#".repeat(allowed) + atxMatch[2];
19039
+ changed = true;
19040
+ }
19041
+ previousLevel = allowed;
19042
+ }
19043
+ return changed ? lines.join(`
19044
+ `) : text;
18999
19045
  }
19000
19046
  };
19001
19047
  });
@@ -19373,6 +19419,42 @@ var init_link_image_reference_definitions = __esm(() => {
19373
19419
  }
19374
19420
  }
19375
19421
  return issues;
19422
+ },
19423
+ fix: (text) => {
19424
+ const lines = text.split(/\r?\n/);
19425
+ const inCode = getCodeBlockLines(lines);
19426
+ const defLines = new Map;
19427
+ for (let i = 0;i < lines.length; i++) {
19428
+ if (inCode.has(i))
19429
+ continue;
19430
+ const m = lines[i].match(/^\s*\[([^\]]+)\]:\s*\S+/);
19431
+ if (m)
19432
+ defLines.set(i, m[1].toLowerCase());
19433
+ }
19434
+ if (defLines.size === 0)
19435
+ return text;
19436
+ const usages = new Set;
19437
+ for (let i = 0;i < lines.length; i++) {
19438
+ if (inCode.has(i))
19439
+ continue;
19440
+ if (defLines.has(i))
19441
+ continue;
19442
+ const line = lines[i];
19443
+ const refMatches = line.matchAll(/\[([^\]]+)\](?:\[([^\]]*)\])?(?!\()/g);
19444
+ for (const m of refMatches) {
19445
+ const label = (m[2] && m[2].length > 0 ? m[2] : m[1]).toLowerCase();
19446
+ usages.add(label);
19447
+ }
19448
+ }
19449
+ const toRemove = new Set;
19450
+ for (const [idx, label] of defLines) {
19451
+ if (!usages.has(label))
19452
+ toRemove.add(idx);
19453
+ }
19454
+ if (toRemove.size === 0)
19455
+ return text;
19456
+ return lines.filter((_, idx) => !toRemove.has(idx)).join(`
19457
+ `);
19376
19458
  }
19377
19459
  };
19378
19460
  });
@@ -19390,19 +19472,39 @@ var init_link_image_style = __esm(() => {
19390
19472
  check: (text, ctx) => {
19391
19473
  const issues = [];
19392
19474
  const lines = text.split(/\r?\n/);
19475
+ const inCode = getCodeBlockLines(lines);
19393
19476
  const options = ctx.options || {};
19394
19477
  const style = options.style || "consistent";
19395
- let detectedStyle = null;
19396
- let inFence = false;
19478
+ let target = style === "consistent" ? null : style;
19479
+ if (target === null) {
19480
+ let inlineCount = 0;
19481
+ let refCount = 0;
19482
+ let inHtmlCommentScan = false;
19483
+ for (let i = 0;i < lines.length; i++) {
19484
+ if (inCode.has(i))
19485
+ continue;
19486
+ const line = lines[i];
19487
+ if (line.includes("<!--"))
19488
+ inHtmlCommentScan = true;
19489
+ if (line.includes("-->")) {
19490
+ inHtmlCommentScan = false;
19491
+ continue;
19492
+ }
19493
+ if (inHtmlCommentScan)
19494
+ continue;
19495
+ if (/^\s*\[(?:[^\]]+)\]:\s*\S+/.test(line))
19496
+ continue;
19497
+ const scrubbed = stripInlineCode(line);
19498
+ inlineCount += (scrubbed.match(/\[[^\]]+\]\([^)]+\)/g) || []).length;
19499
+ refCount += (scrubbed.match(/\[[^\]]+\]\[(?:[^\]]*)\]/g) || []).length;
19500
+ }
19501
+ target = refCount > inlineCount ? "reference" : "inline";
19502
+ }
19397
19503
  let inHtmlComment = false;
19398
19504
  for (let i = 0;i < lines.length; i++) {
19399
- const line = lines[i];
19400
- if (/^(?:`{3,}|~{3,})/.test(line.trim())) {
19401
- inFence = !inFence;
19402
- continue;
19403
- }
19404
- if (inFence)
19505
+ if (inCode.has(i))
19405
19506
  continue;
19507
+ const line = lines[i];
19406
19508
  if (line.includes("<!--"))
19407
19509
  inHtmlComment = true;
19408
19510
  if (line.includes("-->")) {
@@ -19411,64 +19513,104 @@ var init_link_image_style = __esm(() => {
19411
19513
  }
19412
19514
  if (inHtmlComment)
19413
19515
  continue;
19414
- if (line.match(/^\[(?:[^\]]+)\]:\s*\S+/)) {
19516
+ if (line.match(/^\[(?:[^\]]+)\]:\s*\S+/))
19415
19517
  continue;
19416
- }
19417
19518
  const scrubbed = stripInlineCode(line);
19418
19519
  const inlineMatches = scrubbed.matchAll(/\[[^\]]+\]\([^)]+\)/g);
19419
19520
  for (const match of inlineMatches) {
19420
- if (style === "reference") {
19521
+ if (target === "reference") {
19421
19522
  issues.push({
19422
19523
  filePath: ctx.filePath,
19423
19524
  line: i + 1,
19424
19525
  column: match.index + 1,
19425
19526
  ruleId: "markdown/link-image-style",
19426
- message: "Expected reference style link",
19427
- severity: "error"
19527
+ message: style === "consistent" ? "Link style should be consistent throughout document" : "Expected reference style link",
19528
+ severity: style === "consistent" ? "warning" : "error"
19428
19529
  });
19429
- } else if (style === "consistent") {
19430
- if (detectedStyle === null) {
19431
- detectedStyle = "inline";
19432
- } else if (detectedStyle === "reference") {
19433
- issues.push({
19434
- filePath: ctx.filePath,
19435
- line: i + 1,
19436
- column: match.index + 1,
19437
- ruleId: "markdown/link-image-style",
19438
- message: "Link style should be consistent throughout document",
19439
- severity: "warning"
19440
- });
19441
- }
19442
19530
  }
19443
19531
  }
19444
19532
  const refMatches = scrubbed.matchAll(/\[[^\]]+\]\[(?:[^\]]+)\]/g);
19445
19533
  for (const match of refMatches) {
19446
- if (style === "inline") {
19534
+ if (target === "inline") {
19447
19535
  issues.push({
19448
19536
  filePath: ctx.filePath,
19449
19537
  line: i + 1,
19450
19538
  column: match.index + 1,
19451
19539
  ruleId: "markdown/link-image-style",
19452
- message: "Expected inline style link",
19453
- severity: "error"
19540
+ message: style === "consistent" ? "Link style should be consistent throughout document" : "Expected inline style link",
19541
+ severity: style === "consistent" ? "warning" : "error"
19454
19542
  });
19455
- } else if (style === "consistent") {
19456
- if (detectedStyle === null) {
19457
- detectedStyle = "reference";
19458
- } else if (detectedStyle === "inline") {
19459
- issues.push({
19460
- filePath: ctx.filePath,
19461
- line: i + 1,
19462
- column: match.index + 1,
19463
- ruleId: "markdown/link-image-style",
19464
- message: "Link style should be consistent throughout document",
19465
- severity: "warning"
19466
- });
19467
- }
19468
19543
  }
19469
19544
  }
19470
19545
  }
19471
19546
  return issues;
19547
+ },
19548
+ fix: (text, ctx) => {
19549
+ const options = ctx.options || {};
19550
+ const style = options.style || "consistent";
19551
+ const lines = text.split(/\r?\n/);
19552
+ const inCode = getCodeBlockLines(lines);
19553
+ const defs = new Map;
19554
+ for (let i = 0;i < lines.length; i++) {
19555
+ if (inCode.has(i))
19556
+ continue;
19557
+ const m = lines[i].match(/^\s*\[([^\]]+)\]:\s*(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?\s*$/);
19558
+ if (m) {
19559
+ const label = m[1].toLowerCase();
19560
+ const url = m[2];
19561
+ const title = m[3] ?? m[4] ?? m[5];
19562
+ if (!defs.has(label))
19563
+ defs.set(label, { url, title });
19564
+ }
19565
+ }
19566
+ if (defs.size === 0)
19567
+ return text;
19568
+ let target = style === "reference" ? "reference" : "inline";
19569
+ if (style === "consistent") {
19570
+ let inlineCount = 0;
19571
+ let refCount = 0;
19572
+ for (let i = 0;i < lines.length; i++) {
19573
+ if (inCode.has(i))
19574
+ continue;
19575
+ const line = lines[i];
19576
+ if (/^\s*\[(?:[^\]]+)\]:\s*\S+/.test(line))
19577
+ continue;
19578
+ const scrubbed = stripInlineCode(line);
19579
+ inlineCount += (scrubbed.match(/\[[^\]]+\]\([^)]+\)/g) || []).length;
19580
+ refCount += (scrubbed.match(/\[[^\]]+\]\[(?:[^\]]*)\]/g) || []).length;
19581
+ }
19582
+ target = refCount > inlineCount ? "reference" : "inline";
19583
+ }
19584
+ if (target !== "inline")
19585
+ return text;
19586
+ let changed = false;
19587
+ for (let i = 0;i < lines.length; i++) {
19588
+ if (inCode.has(i))
19589
+ continue;
19590
+ const original = lines[i];
19591
+ if (/^\s*\[(?:[^\]]+)\]:\s*\S+/.test(original))
19592
+ continue;
19593
+ let rewritten = original;
19594
+ for (let pass = 0;pass < 8; pass++) {
19595
+ const next = rewritten.replace(/(!?)\[((?:[^[\]]|\[[^\]]*\]\([^)]*\))+)\]\[([^\]]*)\]/g, (whole, bang, textPart, labelPart) => {
19596
+ const labelKey = (labelPart.trim() === "" ? textPart : labelPart).toLowerCase();
19597
+ const def = defs.get(labelKey);
19598
+ if (!def)
19599
+ return whole;
19600
+ const titlePart = def.title ? ` "${def.title}"` : "";
19601
+ return `${bang}[${textPart}](${def.url}${titlePart})`;
19602
+ });
19603
+ if (next === rewritten)
19604
+ break;
19605
+ rewritten = next;
19606
+ }
19607
+ if (rewritten !== original) {
19608
+ lines[i] = rewritten;
19609
+ changed = true;
19610
+ }
19611
+ }
19612
+ return changed ? lines.join(`
19613
+ `) : text;
19472
19614
  }
19473
19615
  };
19474
19616
  });
@@ -20872,24 +21014,18 @@ var init_single_title = __esm(() => {
20872
21014
  check: (text, ctx) => {
20873
21015
  const issues = [];
20874
21016
  const lines = text.split(/\r?\n/);
21017
+ const inCode = getCodeBlockLines(lines);
20875
21018
  let firstH1Line = -1;
20876
- let inFencedCodeBlock = false;
20877
21019
  for (let i = 0;i < lines.length; i++) {
21020
+ if (inCode.has(i))
21021
+ continue;
20878
21022
  const line = lines[i];
20879
21023
  const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
20880
- if (/^(?:`{3,}|~{3,})/.test(line.trim())) {
20881
- inFencedCodeBlock = !inFencedCodeBlock;
20882
- continue;
20883
- }
20884
- if (inFencedCodeBlock)
20885
- continue;
20886
21024
  let isH1 = false;
20887
- if (/^#\s/.test(line)) {
21025
+ if (/^#\s/.test(line))
20888
21026
  isH1 = true;
20889
- }
20890
- if (/^=+\s*$/.test(nextLine) && line.trim().length > 0) {
21027
+ if (/^=+\s*$/.test(nextLine) && line.trim().length > 0 && !inCode.has(i + 1))
20891
21028
  isH1 = true;
20892
- }
20893
21029
  if (isH1) {
20894
21030
  if (firstH1Line === -1) {
20895
21031
  firstH1Line = i + 1;
@@ -20906,6 +21042,47 @@ var init_single_title = __esm(() => {
20906
21042
  }
20907
21043
  }
20908
21044
  return issues;
21045
+ },
21046
+ fix: (text) => {
21047
+ const lines = text.split(/\r?\n/);
21048
+ const inCode = getCodeBlockLines(lines);
21049
+ const result = [];
21050
+ let seenH1 = false;
21051
+ let changed = false;
21052
+ for (let i = 0;i < lines.length; i++) {
21053
+ if (inCode.has(i)) {
21054
+ result.push(lines[i]);
21055
+ continue;
21056
+ }
21057
+ const line = lines[i];
21058
+ const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
21059
+ const atxH1 = /^#\s/.test(line);
21060
+ const setextH1 = /^=+\s*$/.test(nextLine) && line.trim().length > 0 && !inCode.has(i + 1);
21061
+ if (atxH1) {
21062
+ if (!seenH1) {
21063
+ seenH1 = true;
21064
+ result.push(line);
21065
+ } else {
21066
+ result.push(`#${line}`);
21067
+ changed = true;
21068
+ }
21069
+ continue;
21070
+ }
21071
+ if (setextH1) {
21072
+ if (!seenH1) {
21073
+ seenH1 = true;
21074
+ result.push(line);
21075
+ continue;
21076
+ }
21077
+ result.push(`## ${line.trim()}`);
21078
+ i++;
21079
+ changed = true;
21080
+ continue;
21081
+ }
21082
+ result.push(line);
21083
+ }
21084
+ return changed ? result.join(`
21085
+ `) : text;
20909
21086
  }
20910
21087
  };
20911
21088
  });
@@ -21506,6 +21683,13 @@ function splitFrontmatter(content) {
21506
21683
  }
21507
21684
  return { header: null, body: content };
21508
21685
  }
21686
+ function markdownOnlyWholeFile(rule) {
21687
+ return {
21688
+ meta: rule.meta,
21689
+ check: (content, context) => context.filePath.endsWith(".md") ? rule.check(content, context) : [],
21690
+ fix: rule.fix ? (content, context) => context.filePath.endsWith(".md") ? rule.fix(content, context) : content : undefined
21691
+ };
21692
+ }
21509
21693
  function markdownOnly(rule) {
21510
21694
  return {
21511
21695
  meta: rule.meta,
@@ -21613,7 +21797,7 @@ var init_markdown = __esm(() => {
21613
21797
  "no-multiple-space-blockquote": markdownOnly(noMultipleSpaceBlockquoteRule),
21614
21798
  "no-blanks-blockquote": markdownOnly(noBlanksBlockquoteRule),
21615
21799
  "blanks-around-fences": markdownOnly(blanksAroundFencesRule),
21616
- "single-trailing-newline": markdownOnly(singleTrailingNewlineRule),
21800
+ "single-trailing-newline": markdownOnlyWholeFile(singleTrailingNewlineRule),
21617
21801
  "blanks-around-tables": markdownOnly(blanksAroundTablesRule),
21618
21802
  "no-reversed-links": markdownOnly(noReversedLinksRule),
21619
21803
  "no-bare-urls": markdownOnly(noBareUrlsRule),
@@ -22537,7 +22721,20 @@ var init_exports_module_should_be_esm = __esm(() => {
22537
22721
 
22538
22722
  // src/rules/publint/file-does-not-exist.ts
22539
22723
  import { existsSync as existsSync13 } from "fs";
22724
+ import { dirname as dirname7, isAbsolute as isAbsolute4, resolve as resolve12 } from "path";
22725
+ function baseDirectoryMissing(pkgDir, value) {
22726
+ let v = value;
22727
+ while (v.startsWith("./"))
22728
+ v = v.slice(2);
22729
+ const firstSegment = v.split("/")[0];
22730
+ if (!firstSegment || firstSegment === ".." || firstSegment.startsWith("."))
22731
+ return false;
22732
+ const baseDir = isAbsolute4(value) ? dirname7(value).split("/")[0] || "/" : resolve12(pkgDir, firstSegment);
22733
+ return !existsSync13(baseDir);
22734
+ }
22540
22735
  function checkFileRef(value, path, issues, filePath, content, pkgDir) {
22736
+ if (baseDirectoryMissing(pkgDir, value))
22737
+ return;
22541
22738
  const resolved = resolvePkgPath(pkgDir, value);
22542
22739
  if (!fileExistsWithFallbacks(resolved)) {
22543
22740
  issues.push(createIssue(filePath, content, path, "publint/file-does-not-exist", `${formatPkgPath(path)} is "${value}" but the file does not exist.`, "error", "The referenced file path cannot be found. Check the path for typos."));
@@ -22571,6 +22768,8 @@ var init_file_does_not_exist = __esm(() => {
22571
22768
  const [value, path] = getPublishedField(pkg, field);
22572
22769
  if (value == null || typeof value !== "string")
22573
22770
  continue;
22771
+ if (baseDirectoryMissing(pkgDir, value))
22772
+ continue;
22574
22773
  const resolved = resolvePkgPath(pkgDir, value);
22575
22774
  if (!fileExistsWithFallbacks(resolved)) {
22576
22775
  issues.push(createIssue(context.filePath, content, path, "publint/file-does-not-exist", `${formatPkgPath(path)} is "${value}" but the file does not exist.`, "error", "The referenced file path cannot be found. Check the path for typos."));
@@ -22597,6 +22796,8 @@ var init_file_does_not_exist = __esm(() => {
22597
22796
  return;
22598
22797
  if (value.includes("*"))
22599
22798
  return;
22799
+ if (baseDirectoryMissing(pkgDir, value))
22800
+ return;
22600
22801
  const resolved = resolvePkgPath(pkgDir, value);
22601
22802
  if (!existsSync13(resolved)) {
22602
22803
  issues.push(createIssue(context.filePath, content, ctx.path, "publint/file-does-not-exist", `${formatPkgPath(ctx.path)} is "${value}" but the file does not exist.`, "error", "The referenced file path cannot be found. Check the path for typos."));
@@ -22839,7 +23040,7 @@ var init_import_dedupe = __esm(() => {
22839
23040
 
22840
23041
  // src/rules/imports/named.ts
22841
23042
  import { existsSync as existsSync16, readFileSync as readFileSync7 } from "fs";
22842
- import { dirname as dirname7, resolve as resolve12 } from "path";
23043
+ import { dirname as dirname8, resolve as resolve14 } from "path";
22843
23044
  var namedRule;
22844
23045
  var init_named = __esm(() => {
22845
23046
  namedRule = {
@@ -22850,7 +23051,7 @@ var init_named = __esm(() => {
22850
23051
  check: (text, ctx) => {
22851
23052
  const issues = [];
22852
23053
  const lines = text.split(/\r?\n/);
22853
- const currentDir = dirname7(ctx.filePath);
23054
+ const currentDir = dirname8(ctx.filePath);
22854
23055
  for (let i = 0;i < lines.length; i++) {
22855
23056
  const line = lines[i];
22856
23057
  const namedImportMatch = line.match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);
@@ -22863,7 +23064,7 @@ var init_named = __esm(() => {
22863
23064
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22864
23065
  let targetContent = "";
22865
23066
  for (const ext of extensions) {
22866
- const fullPath = resolve12(currentDir, importPath + ext);
23067
+ const fullPath = resolve14(currentDir, importPath + ext);
22867
23068
  if (existsSync16(fullPath)) {
22868
23069
  targetContent = readFileSync7(fullPath, "utf8");
22869
23070
  break;
@@ -22899,7 +23100,7 @@ var init_named = __esm(() => {
22899
23100
 
22900
23101
  // src/rules/imports/no-cycle.ts
22901
23102
  import { existsSync as existsSync17, readFileSync as readFileSync8 } from "fs";
22902
- import { dirname as dirname8, resolve as resolve14 } from "path";
23103
+ import { dirname as dirname9, resolve as resolve15 } from "path";
22903
23104
  var noCycleRule;
22904
23105
  var init_no_cycle = __esm(() => {
22905
23106
  noCycleRule = {
@@ -22924,7 +23125,7 @@ var init_no_cycle = __esm(() => {
22924
23125
  stack.add(filePath);
22925
23126
  try {
22926
23127
  const content = readFileSync8(filePath, "utf8");
22927
- const imports = extractImports(content, dirname8(filePath));
23128
+ const imports = extractImports(content, dirname9(filePath));
22928
23129
  for (const imp of imports) {
22929
23130
  if (detectCycle(imp, [...importChain, imp])) {
22930
23131
  return true;
@@ -22943,7 +23144,7 @@ var init_no_cycle = __esm(() => {
22943
23144
  if (importPath.startsWith(".") || importPath.startsWith("/")) {
22944
23145
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22945
23146
  for (const ext of extensions) {
22946
- const fullPath = resolve14(baseDir, importPath + ext);
23147
+ const fullPath = resolve15(baseDir, importPath + ext);
22947
23148
  if (existsSync17(fullPath)) {
22948
23149
  imports.push(fullPath);
22949
23150
  break;
@@ -22962,7 +23163,7 @@ var init_no_cycle = __esm(() => {
22962
23163
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22963
23164
  let resolvedPath = "";
22964
23165
  for (const ext of extensions) {
22965
- const fullPath = resolve14(dirname8(currentFile), importPath + ext);
23166
+ const fullPath = resolve15(dirname9(currentFile), importPath + ext);
22966
23167
  if (existsSync17(fullPath)) {
22967
23168
  resolvedPath = fullPath;
22968
23169
  break;
@@ -23130,7 +23331,7 @@ var init_no_import_node_modules_by_path = __esm(() => {
23130
23331
 
23131
23332
  // src/rules/imports/no-unresolved.ts
23132
23333
  import { existsSync as existsSync18 } from "fs";
23133
- import { dirname as dirname9, join as join7, resolve as resolve15 } from "path";
23334
+ import { dirname as dirname10, join as join7, resolve as resolve16 } from "path";
23134
23335
  var noUnresolvedRule;
23135
23336
  var init_no_unresolved = __esm(() => {
23136
23337
  noUnresolvedRule = {
@@ -23141,7 +23342,7 @@ var init_no_unresolved = __esm(() => {
23141
23342
  check: (text, ctx) => {
23142
23343
  const issues = [];
23143
23344
  const lines = text.split(/\r?\n/);
23144
- const currentDir = dirname9(ctx.filePath);
23345
+ const currentDir = dirname10(ctx.filePath);
23145
23346
  for (let i = 0;i < lines.length; i++) {
23146
23347
  const line = lines[i];
23147
23348
  const importMatches = [
@@ -23157,7 +23358,7 @@ var init_no_unresolved = __esm(() => {
23157
23358
  const possiblePaths = [];
23158
23359
  const extensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ""];
23159
23360
  for (const ext of extensions) {
23160
- const fullPath = resolve15(currentDir, importPath + ext);
23361
+ const fullPath = resolve16(currentDir, importPath + ext);
23161
23362
  possiblePaths.push(fullPath);
23162
23363
  possiblePaths.push(join7(fullPath, `index${ext}`));
23163
23364
  }
@@ -32300,7 +32501,7 @@ var init_plugins = __esm(() => {
32300
32501
 
32301
32502
  // src/formatter.ts
32302
32503
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
32303
- import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve16 } from "path";
32504
+ import { isAbsolute as isAbsolute5, relative as relative5, resolve as resolve17 } from "path";
32304
32505
  import process18 from "process";
32305
32506
  function getLogger() {
32306
32507
  if (!_logger)
@@ -32432,7 +32633,7 @@ async function runFormat(globs, options) {
32432
32633
  const timeoutMs = ENV.TIMEOUT_MS;
32433
32634
  const isGlobbingOutsideProject = patterns.some((p) => {
32434
32635
  const base = p.replace(/\/?\*\*(?:\/\*+)?$/, "");
32435
- const absBase = isAbsolute4(base) ? base : resolve16(process18.cwd(), base);
32636
+ const absBase = isAbsolute5(base) ? base : resolve17(process18.cwd(), base);
32436
32637
  return !absBase.startsWith(process18.cwd());
32437
32638
  });
32438
32639
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32536,7 +32737,7 @@ __export(exports_linter, {
32536
32737
  applyPlugins: () => applyPlugins
32537
32738
  });
32538
32739
  import { readdirSync as readdirSync6, readFileSync as readFileSync10, statSync as statSync4, writeFileSync as writeFileSync9 } from "fs";
32539
- import { isAbsolute as isAbsolute5, join as join9, relative as relative6, resolve as resolve17 } from "path";
32740
+ import { isAbsolute as isAbsolute6, join as join9, relative as relative6, resolve as resolve18 } from "path";
32540
32741
  import process20 from "process";
32541
32742
  function getLogger2() {
32542
32743
  if (!_logger2)
@@ -32595,7 +32796,7 @@ async function runLintProgrammatic(globs, options, signal) {
32595
32796
  const timeoutMs = ENV.TIMEOUT_MS;
32596
32797
  const isGlobbingOutsideProject = patterns.some((p) => {
32597
32798
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
32598
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32799
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32599
32800
  return !absBase.startsWith(process20.cwd());
32600
32801
  });
32601
32802
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32605,7 +32806,7 @@ async function runLintProgrammatic(globs, options, signal) {
32605
32806
  try {
32606
32807
  const st = statSync4(patterns[0]);
32607
32808
  if (st.isFile()) {
32608
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve17(process20.cwd(), patterns[0]);
32809
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve18(process20.cwd(), patterns[0]);
32609
32810
  entries = [abs];
32610
32811
  }
32611
32812
  } catch {}
@@ -32613,7 +32814,7 @@ async function runLintProgrammatic(globs, options, signal) {
32613
32814
  const simpleDirPattern = patterns.length === 1 && /\*\*\/*\*$/.test(patterns[0]);
32614
32815
  if (!entries.length && simpleDirPattern) {
32615
32816
  const base = patterns[0].replace(/\/?\*\*\/*\*\*$/, "");
32616
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32817
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32617
32818
  try {
32618
32819
  const stack = [rootBase];
32619
32820
  while (stack.length) {
@@ -33715,7 +33916,7 @@ async function runLint(globs, options) {
33715
33916
  getLogger2().info(`[pickier:diagnostics] Glob timeout: ${timeoutMs}ms`);
33716
33917
  const isGlobbingOutsideProject = patterns.some((p) => {
33717
33918
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
33718
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33919
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33719
33920
  return !absBase.startsWith(process20.cwd());
33720
33921
  });
33721
33922
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -33732,7 +33933,7 @@ async function runLint(globs, options) {
33732
33933
  try {
33733
33934
  const st = statSync4(patterns[0]);
33734
33935
  if (st.isFile()) {
33735
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve17(process20.cwd(), patterns[0]);
33936
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve18(process20.cwd(), patterns[0]);
33736
33937
  entries = [abs];
33737
33938
  }
33738
33939
  } catch {}
@@ -33743,7 +33944,7 @@ async function runLint(globs, options) {
33743
33944
  if (enableDiagnostics)
33744
33945
  getLogger2().info(`[pickier:diagnostics] Using fast directory scan for: ${base}`);
33745
33946
  try {
33746
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33947
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33747
33948
  const stack = [rootBase];
33748
33949
  let dirCount = 0;
33749
33950
  while (stack.length) {
@@ -34033,14 +34234,14 @@ __export(exports_run, {
34033
34234
  runUnified: () => runUnified
34034
34235
  });
34035
34236
  import { readFileSync as readFileSync11, statSync as statSync5, writeFileSync as writeFileSync10 } from "fs";
34036
- import { isAbsolute as isAbsolute6, resolve as resolve18 } from "path";
34237
+ import { isAbsolute as isAbsolute7, resolve as resolve19 } from "path";
34037
34238
  import process21 from "process";
34038
34239
  async function runUnified(globs, options) {
34039
34240
  const mode = options.mode || "auto";
34040
34241
  if (mode === "format" && globs.length === 1 && !/[*?[\]{}()!]/.test(globs[0])) {
34041
34242
  try {
34042
34243
  const p = globs[0];
34043
- const filePath = isAbsolute6(p) ? p : resolve18(process21.cwd(), p);
34244
+ const filePath = isAbsolute7(p) ? p : resolve19(process21.cwd(), p);
34044
34245
  const st = statSync5(filePath);
34045
34246
  if (st.isFile()) {
34046
34247
  const cfg = await loadConfigFromPath(options.config);
@@ -34202,7 +34403,7 @@ import process102 from "process";
34202
34403
  import process112 from "process";
34203
34404
  import { stripVTControlCharacters as strip } from "util";
34204
34405
  import { existsSync as existsSync19, lstatSync, readdirSync as readdirSync7 } from "fs";
34205
- import { dirname as dirname10, join as join10 } from "path";
34406
+ import { dirname as dirname11, join as join10 } from "path";
34206
34407
  import process122 from "process";
34207
34408
  import process132 from "process";
34208
34409
  import process142 from "process";
@@ -35820,13 +36021,13 @@ function path(opts) {
35820
36021
  try {
35821
36022
  let searchPath;
35822
36023
  if (!existsSync19(userInput)) {
35823
- searchPath = dirname10(userInput);
36024
+ searchPath = dirname11(userInput);
35824
36025
  } else {
35825
36026
  const stat4 = lstatSync(userInput);
35826
36027
  if (stat4.isDirectory()) {
35827
36028
  searchPath = userInput;
35828
36029
  } else {
35829
- searchPath = dirname10(userInput);
36030
+ searchPath = dirname11(userInput);
35830
36031
  }
35831
36032
  }
35832
36033
  const items = readdirSync7(searchPath).map((item) => {
@@ -37884,7 +38085,7 @@ var require_package = __commonJS((exports, module) => {
37884
38085
  module.exports = {
37885
38086
  name: "pickier",
37886
38087
  type: "module",
37887
- version: "0.1.23",
38088
+ version: "0.1.25",
37888
38089
  description: "Format, lint and more in a fraction of seconds.",
37889
38090
  author: "Chris Breuer <chris@stacksjs.org>",
37890
38091
  license: "MIT",