pickier 0.1.22 → 0.1.24

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
@@ -18969,16 +18969,12 @@ var init_heading_increment = __esm(() => {
18969
18969
  check: (text, ctx) => {
18970
18970
  const issues = [];
18971
18971
  const lines = text.split(/\r?\n/);
18972
+ const inCode = getCodeBlockLines(lines);
18972
18973
  let previousLevel = 0;
18973
- let inFence = false;
18974
18974
  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)
18975
+ if (inCode.has(i))
18981
18976
  continue;
18977
+ const line = lines[i];
18982
18978
  const atxMatch = line.match(/^(#{1,6})\s/);
18983
18979
  if (atxMatch) {
18984
18980
  const level = atxMatch[1].length;
@@ -18996,6 +18992,29 @@ var init_heading_increment = __esm(() => {
18996
18992
  }
18997
18993
  }
18998
18994
  return issues;
18995
+ },
18996
+ fix: (text) => {
18997
+ const lines = text.split(/\r?\n/);
18998
+ const inCode = getCodeBlockLines(lines);
18999
+ let previousLevel = 0;
19000
+ let changed = false;
19001
+ for (let i = 0;i < lines.length; i++) {
19002
+ if (inCode.has(i))
19003
+ continue;
19004
+ const line = lines[i];
19005
+ const atxMatch = line.match(/^(#{1,6})(\s.*)$/);
19006
+ if (!atxMatch)
19007
+ continue;
19008
+ const original = atxMatch[1].length;
19009
+ const allowed = previousLevel === 0 ? original : Math.min(original, previousLevel + 1);
19010
+ if (allowed !== original) {
19011
+ lines[i] = "#".repeat(allowed) + atxMatch[2];
19012
+ changed = true;
19013
+ }
19014
+ previousLevel = allowed;
19015
+ }
19016
+ return changed ? lines.join(`
19017
+ `) : text;
18999
19018
  }
19000
19019
  };
19001
19020
  });
@@ -19287,8 +19306,12 @@ var init_link_fragments = __esm(() => {
19287
19306
  check: (text, ctx) => {
19288
19307
  const issues = [];
19289
19308
  const lines = text.split(/\r?\n/);
19309
+ const inCode = getCodeBlockLines(lines);
19290
19310
  const headingIds = new Set;
19291
- for (const line of lines) {
19311
+ for (let li = 0;li < lines.length; li++) {
19312
+ if (inCode.has(li))
19313
+ continue;
19314
+ const line = lines[li];
19292
19315
  const atxMatch = line.match(/^#{1,6}\s+(.+?)(?:\s*#+\s*)?$/);
19293
19316
  if (atxMatch) {
19294
19317
  const headingText = atxMatch[1].trim();
@@ -19297,6 +19320,8 @@ var init_link_fragments = __esm(() => {
19297
19320
  }
19298
19321
  }
19299
19322
  for (let i = 0;i < lines.length; i++) {
19323
+ if (inCode.has(i))
19324
+ continue;
19300
19325
  const line = lines[i];
19301
19326
  const matches = line.matchAll(/\[[^\]]+\]\(#([^)]+)\)/g);
19302
19327
  for (const match of matches) {
@@ -19329,8 +19354,11 @@ var init_link_image_reference_definitions = __esm(() => {
19329
19354
  check: (text, ctx) => {
19330
19355
  const issues = [];
19331
19356
  const lines = text.split(/\r?\n/);
19357
+ const inCode = getCodeBlockLines(lines);
19332
19358
  const definitions = new Map;
19333
19359
  for (let i = 0;i < lines.length; i++) {
19360
+ if (inCode.has(i))
19361
+ continue;
19334
19362
  const line = lines[i];
19335
19363
  const defMatch = line.match(/^\[([^\]]+)\]:\s*\S+/);
19336
19364
  if (defMatch) {
@@ -19338,7 +19366,10 @@ var init_link_image_reference_definitions = __esm(() => {
19338
19366
  }
19339
19367
  }
19340
19368
  const usages = new Set;
19341
- for (const line of lines) {
19369
+ for (let i = 0;i < lines.length; i++) {
19370
+ if (inCode.has(i))
19371
+ continue;
19372
+ const line = lines[i];
19342
19373
  if (line.match(/^\[(?:[^\]]+)\]:\s*\S+/)) {
19343
19374
  continue;
19344
19375
  }
@@ -20309,7 +20340,10 @@ var init_no_reversed_links = __esm(() => {
20309
20340
  check: (text, ctx) => {
20310
20341
  const issues = [];
20311
20342
  const lines = text.split(/\r?\n/);
20343
+ const inCode = getCodeBlockLines(lines);
20312
20344
  for (let i = 0;i < lines.length; i++) {
20345
+ if (inCode.has(i))
20346
+ continue;
20313
20347
  const line = lines[i];
20314
20348
  const matches = line.matchAll(/\(([^)]+)\)\[(?:[^\]]+)\]/g);
20315
20349
  for (const match of matches) {
@@ -20469,7 +20503,10 @@ var init_no_space_in_links = __esm(() => {
20469
20503
  check: (text, ctx) => {
20470
20504
  const issues = [];
20471
20505
  const lines = text.split(/\r?\n/);
20506
+ const inCode = getCodeBlockLines(lines);
20472
20507
  for (let i = 0;i < lines.length; i++) {
20508
+ if (inCode.has(i))
20509
+ continue;
20473
20510
  const line = lines[i];
20474
20511
  const matches = line.matchAll(/\[(\s+(?:\S.*?|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])|\s*(?:\S.*?|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])\s+)\]\([^)]+\)/g);
20475
20512
  for (const match of matches) {
@@ -20715,16 +20752,11 @@ var init_proper_names = __esm(() => {
20715
20752
  if (properNames.length === 0) {
20716
20753
  return issues;
20717
20754
  }
20718
- let inCodeBlock = false;
20755
+ const inCode = getCodeBlockLines(lines);
20719
20756
  for (let i = 0;i < lines.length; i++) {
20720
- const line = lines[i];
20721
- if (/^(?:`{3,}|~{3,})/.test(line)) {
20722
- inCodeBlock = !inCodeBlock;
20757
+ if (inCode.has(i) && !checkCodeBlocks)
20723
20758
  continue;
20724
- }
20725
- if (inCodeBlock && !checkCodeBlocks) {
20726
- continue;
20727
- }
20759
+ const line = lines[i];
20728
20760
  for (const properName of properNames) {
20729
20761
  const regex = new RegExp(`\\b${properName}\\b`, "gi");
20730
20762
  const matches = line.matchAll(regex);
@@ -20954,10 +20986,13 @@ var init_strong_style = __esm(() => {
20954
20986
  check: (text, ctx) => {
20955
20987
  const issues = [];
20956
20988
  const lines = text.split(/\r?\n/);
20989
+ const inCode = getCodeBlockLines(lines);
20957
20990
  const options = ctx.options || {};
20958
20991
  const style = options.style || "consistent";
20959
20992
  let detectedStyle = null;
20960
20993
  for (let i = 0;i < lines.length; i++) {
20994
+ if (inCode.has(i))
20995
+ continue;
20961
20996
  const line = lines[i];
20962
20997
  const asteriskMatches = line.matchAll(/\*\*([^*]+)\*\*/g);
20963
20998
  for (const match of asteriskMatches) {
@@ -21017,27 +21052,51 @@ var init_strong_style = __esm(() => {
21017
21052
  fix: (text, ctx) => {
21018
21053
  const options = ctx.options || {};
21019
21054
  const style = options.style || "consistent";
21055
+ const lines = text.split(/\r?\n/);
21056
+ const inCode = getCodeBlockLines(lines);
21020
21057
  let targetStyle = "asterisk";
21021
21058
  if (style === "asterisk") {
21022
21059
  targetStyle = "asterisk";
21023
21060
  } else if (style === "underscore") {
21024
21061
  targetStyle = "underscore";
21025
21062
  } else if (style === "consistent") {
21026
- const asteriskMatch = text.match(/\*\*([^*]+)\*\*/);
21027
- const underscoreMatch = text.match(/__([^_]+)__/);
21028
- if (asteriskMatch && (!underscoreMatch || asteriskMatch.index < underscoreMatch.index)) {
21063
+ let firstAsterisk = null;
21064
+ let firstUnderscore = null;
21065
+ for (let i = 0;i < lines.length; i++) {
21066
+ if (inCode.has(i))
21067
+ continue;
21068
+ if (firstAsterisk === null) {
21069
+ const m = lines[i].match(/\*\*([^*]+)\*\*/);
21070
+ if (m)
21071
+ firstAsterisk = { line: i, col: m.index };
21072
+ }
21073
+ if (firstUnderscore === null) {
21074
+ const m = lines[i].match(/__([^_]+)__/);
21075
+ if (m)
21076
+ firstUnderscore = { line: i, col: m.index };
21077
+ }
21078
+ if (firstAsterisk && firstUnderscore)
21079
+ break;
21080
+ }
21081
+ const cmp = (a, b) => a.line !== b.line ? a.line - b.line : a.col - b.col;
21082
+ if (firstAsterisk && (!firstUnderscore || cmp(firstAsterisk, firstUnderscore) < 0))
21029
21083
  targetStyle = "asterisk";
21030
- } else if (underscoreMatch) {
21084
+ else if (firstUnderscore)
21031
21085
  targetStyle = "underscore";
21032
- }
21033
21086
  }
21034
- let fixed = text;
21035
- if (targetStyle === "asterisk") {
21036
- fixed = fixed.replace(/__([^_]+)__/g, "**$1**");
21037
- } else {
21038
- fixed = fixed.replace(/\*\*([^*]+)\*\*/g, "__$1__");
21087
+ let changed = false;
21088
+ for (let i = 0;i < lines.length; i++) {
21089
+ if (inCode.has(i))
21090
+ continue;
21091
+ const before = lines[i];
21092
+ const after = targetStyle === "asterisk" ? before.replace(/__([^_]+)__/g, "**$1**") : before.replace(/\*\*([^*]+)\*\*/g, "__$1__");
21093
+ if (after !== before) {
21094
+ lines[i] = after;
21095
+ changed = true;
21096
+ }
21039
21097
  }
21040
- return fixed;
21098
+ return changed ? lines.join(`
21099
+ `) : text;
21041
21100
  }
21042
21101
  };
21043
21102
  });
@@ -22497,7 +22556,20 @@ var init_exports_module_should_be_esm = __esm(() => {
22497
22556
 
22498
22557
  // src/rules/publint/file-does-not-exist.ts
22499
22558
  import { existsSync as existsSync13 } from "fs";
22559
+ import { dirname as dirname7, isAbsolute as isAbsolute4, resolve as resolve12 } from "path";
22560
+ function baseDirectoryMissing(pkgDir, value) {
22561
+ let v = value;
22562
+ while (v.startsWith("./"))
22563
+ v = v.slice(2);
22564
+ const firstSegment = v.split("/")[0];
22565
+ if (!firstSegment || firstSegment === ".." || firstSegment.startsWith("."))
22566
+ return false;
22567
+ const baseDir = isAbsolute4(value) ? dirname7(value).split("/")[0] || "/" : resolve12(pkgDir, firstSegment);
22568
+ return !existsSync13(baseDir);
22569
+ }
22500
22570
  function checkFileRef(value, path, issues, filePath, content, pkgDir) {
22571
+ if (baseDirectoryMissing(pkgDir, value))
22572
+ return;
22501
22573
  const resolved = resolvePkgPath(pkgDir, value);
22502
22574
  if (!fileExistsWithFallbacks(resolved)) {
22503
22575
  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."));
@@ -22531,6 +22603,8 @@ var init_file_does_not_exist = __esm(() => {
22531
22603
  const [value, path] = getPublishedField(pkg, field);
22532
22604
  if (value == null || typeof value !== "string")
22533
22605
  continue;
22606
+ if (baseDirectoryMissing(pkgDir, value))
22607
+ continue;
22534
22608
  const resolved = resolvePkgPath(pkgDir, value);
22535
22609
  if (!fileExistsWithFallbacks(resolved)) {
22536
22610
  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."));
@@ -22557,6 +22631,8 @@ var init_file_does_not_exist = __esm(() => {
22557
22631
  return;
22558
22632
  if (value.includes("*"))
22559
22633
  return;
22634
+ if (baseDirectoryMissing(pkgDir, value))
22635
+ return;
22560
22636
  const resolved = resolvePkgPath(pkgDir, value);
22561
22637
  if (!existsSync13(resolved)) {
22562
22638
  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."));
@@ -22799,7 +22875,7 @@ var init_import_dedupe = __esm(() => {
22799
22875
 
22800
22876
  // src/rules/imports/named.ts
22801
22877
  import { existsSync as existsSync16, readFileSync as readFileSync7 } from "fs";
22802
- import { dirname as dirname7, resolve as resolve12 } from "path";
22878
+ import { dirname as dirname8, resolve as resolve14 } from "path";
22803
22879
  var namedRule;
22804
22880
  var init_named = __esm(() => {
22805
22881
  namedRule = {
@@ -22810,7 +22886,7 @@ var init_named = __esm(() => {
22810
22886
  check: (text, ctx) => {
22811
22887
  const issues = [];
22812
22888
  const lines = text.split(/\r?\n/);
22813
- const currentDir = dirname7(ctx.filePath);
22889
+ const currentDir = dirname8(ctx.filePath);
22814
22890
  for (let i = 0;i < lines.length; i++) {
22815
22891
  const line = lines[i];
22816
22892
  const namedImportMatch = line.match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);
@@ -22823,7 +22899,7 @@ var init_named = __esm(() => {
22823
22899
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22824
22900
  let targetContent = "";
22825
22901
  for (const ext of extensions) {
22826
- const fullPath = resolve12(currentDir, importPath + ext);
22902
+ const fullPath = resolve14(currentDir, importPath + ext);
22827
22903
  if (existsSync16(fullPath)) {
22828
22904
  targetContent = readFileSync7(fullPath, "utf8");
22829
22905
  break;
@@ -22859,7 +22935,7 @@ var init_named = __esm(() => {
22859
22935
 
22860
22936
  // src/rules/imports/no-cycle.ts
22861
22937
  import { existsSync as existsSync17, readFileSync as readFileSync8 } from "fs";
22862
- import { dirname as dirname8, resolve as resolve14 } from "path";
22938
+ import { dirname as dirname9, resolve as resolve15 } from "path";
22863
22939
  var noCycleRule;
22864
22940
  var init_no_cycle = __esm(() => {
22865
22941
  noCycleRule = {
@@ -22884,7 +22960,7 @@ var init_no_cycle = __esm(() => {
22884
22960
  stack.add(filePath);
22885
22961
  try {
22886
22962
  const content = readFileSync8(filePath, "utf8");
22887
- const imports = extractImports(content, dirname8(filePath));
22963
+ const imports = extractImports(content, dirname9(filePath));
22888
22964
  for (const imp of imports) {
22889
22965
  if (detectCycle(imp, [...importChain, imp])) {
22890
22966
  return true;
@@ -22903,7 +22979,7 @@ var init_no_cycle = __esm(() => {
22903
22979
  if (importPath.startsWith(".") || importPath.startsWith("/")) {
22904
22980
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22905
22981
  for (const ext of extensions) {
22906
- const fullPath = resolve14(baseDir, importPath + ext);
22982
+ const fullPath = resolve15(baseDir, importPath + ext);
22907
22983
  if (existsSync17(fullPath)) {
22908
22984
  imports.push(fullPath);
22909
22985
  break;
@@ -22922,7 +22998,7 @@ var init_no_cycle = __esm(() => {
22922
22998
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22923
22999
  let resolvedPath = "";
22924
23000
  for (const ext of extensions) {
22925
- const fullPath = resolve14(dirname8(currentFile), importPath + ext);
23001
+ const fullPath = resolve15(dirname9(currentFile), importPath + ext);
22926
23002
  if (existsSync17(fullPath)) {
22927
23003
  resolvedPath = fullPath;
22928
23004
  break;
@@ -23090,7 +23166,7 @@ var init_no_import_node_modules_by_path = __esm(() => {
23090
23166
 
23091
23167
  // src/rules/imports/no-unresolved.ts
23092
23168
  import { existsSync as existsSync18 } from "fs";
23093
- import { dirname as dirname9, join as join7, resolve as resolve15 } from "path";
23169
+ import { dirname as dirname10, join as join7, resolve as resolve16 } from "path";
23094
23170
  var noUnresolvedRule;
23095
23171
  var init_no_unresolved = __esm(() => {
23096
23172
  noUnresolvedRule = {
@@ -23101,7 +23177,7 @@ var init_no_unresolved = __esm(() => {
23101
23177
  check: (text, ctx) => {
23102
23178
  const issues = [];
23103
23179
  const lines = text.split(/\r?\n/);
23104
- const currentDir = dirname9(ctx.filePath);
23180
+ const currentDir = dirname10(ctx.filePath);
23105
23181
  for (let i = 0;i < lines.length; i++) {
23106
23182
  const line = lines[i];
23107
23183
  const importMatches = [
@@ -23117,7 +23193,7 @@ var init_no_unresolved = __esm(() => {
23117
23193
  const possiblePaths = [];
23118
23194
  const extensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ""];
23119
23195
  for (const ext of extensions) {
23120
- const fullPath = resolve15(currentDir, importPath + ext);
23196
+ const fullPath = resolve16(currentDir, importPath + ext);
23121
23197
  possiblePaths.push(fullPath);
23122
23198
  possiblePaths.push(join7(fullPath, `index${ext}`));
23123
23199
  }
@@ -32260,7 +32336,7 @@ var init_plugins = __esm(() => {
32260
32336
 
32261
32337
  // src/formatter.ts
32262
32338
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
32263
- import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve16 } from "path";
32339
+ import { isAbsolute as isAbsolute5, relative as relative5, resolve as resolve17 } from "path";
32264
32340
  import process18 from "process";
32265
32341
  function getLogger() {
32266
32342
  if (!_logger)
@@ -32392,7 +32468,7 @@ async function runFormat(globs, options) {
32392
32468
  const timeoutMs = ENV.TIMEOUT_MS;
32393
32469
  const isGlobbingOutsideProject = patterns.some((p) => {
32394
32470
  const base = p.replace(/\/?\*\*(?:\/\*+)?$/, "");
32395
- const absBase = isAbsolute4(base) ? base : resolve16(process18.cwd(), base);
32471
+ const absBase = isAbsolute5(base) ? base : resolve17(process18.cwd(), base);
32396
32472
  return !absBase.startsWith(process18.cwd());
32397
32473
  });
32398
32474
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32496,7 +32572,7 @@ __export(exports_linter, {
32496
32572
  applyPlugins: () => applyPlugins
32497
32573
  });
32498
32574
  import { readdirSync as readdirSync6, readFileSync as readFileSync10, statSync as statSync4, writeFileSync as writeFileSync9 } from "fs";
32499
- import { isAbsolute as isAbsolute5, join as join9, relative as relative6, resolve as resolve17 } from "path";
32575
+ import { isAbsolute as isAbsolute6, join as join9, relative as relative6, resolve as resolve18 } from "path";
32500
32576
  import process20 from "process";
32501
32577
  function getLogger2() {
32502
32578
  if (!_logger2)
@@ -32555,7 +32631,7 @@ async function runLintProgrammatic(globs, options, signal) {
32555
32631
  const timeoutMs = ENV.TIMEOUT_MS;
32556
32632
  const isGlobbingOutsideProject = patterns.some((p) => {
32557
32633
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
32558
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32634
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32559
32635
  return !absBase.startsWith(process20.cwd());
32560
32636
  });
32561
32637
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32565,7 +32641,7 @@ async function runLintProgrammatic(globs, options, signal) {
32565
32641
  try {
32566
32642
  const st = statSync4(patterns[0]);
32567
32643
  if (st.isFile()) {
32568
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve17(process20.cwd(), patterns[0]);
32644
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve18(process20.cwd(), patterns[0]);
32569
32645
  entries = [abs];
32570
32646
  }
32571
32647
  } catch {}
@@ -32573,7 +32649,7 @@ async function runLintProgrammatic(globs, options, signal) {
32573
32649
  const simpleDirPattern = patterns.length === 1 && /\*\*\/*\*$/.test(patterns[0]);
32574
32650
  if (!entries.length && simpleDirPattern) {
32575
32651
  const base = patterns[0].replace(/\/?\*\*\/*\*\*$/, "");
32576
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32652
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32577
32653
  try {
32578
32654
  const stack = [rootBase];
32579
32655
  while (stack.length) {
@@ -33675,7 +33751,7 @@ async function runLint(globs, options) {
33675
33751
  getLogger2().info(`[pickier:diagnostics] Glob timeout: ${timeoutMs}ms`);
33676
33752
  const isGlobbingOutsideProject = patterns.some((p) => {
33677
33753
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
33678
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33754
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33679
33755
  return !absBase.startsWith(process20.cwd());
33680
33756
  });
33681
33757
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -33692,7 +33768,7 @@ async function runLint(globs, options) {
33692
33768
  try {
33693
33769
  const st = statSync4(patterns[0]);
33694
33770
  if (st.isFile()) {
33695
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve17(process20.cwd(), patterns[0]);
33771
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve18(process20.cwd(), patterns[0]);
33696
33772
  entries = [abs];
33697
33773
  }
33698
33774
  } catch {}
@@ -33703,7 +33779,7 @@ async function runLint(globs, options) {
33703
33779
  if (enableDiagnostics)
33704
33780
  getLogger2().info(`[pickier:diagnostics] Using fast directory scan for: ${base}`);
33705
33781
  try {
33706
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33782
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33707
33783
  const stack = [rootBase];
33708
33784
  let dirCount = 0;
33709
33785
  while (stack.length) {
@@ -33993,14 +34069,14 @@ __export(exports_run, {
33993
34069
  runUnified: () => runUnified
33994
34070
  });
33995
34071
  import { readFileSync as readFileSync11, statSync as statSync5, writeFileSync as writeFileSync10 } from "fs";
33996
- import { isAbsolute as isAbsolute6, resolve as resolve18 } from "path";
34072
+ import { isAbsolute as isAbsolute7, resolve as resolve19 } from "path";
33997
34073
  import process21 from "process";
33998
34074
  async function runUnified(globs, options) {
33999
34075
  const mode = options.mode || "auto";
34000
34076
  if (mode === "format" && globs.length === 1 && !/[*?[\]{}()!]/.test(globs[0])) {
34001
34077
  try {
34002
34078
  const p = globs[0];
34003
- const filePath = isAbsolute6(p) ? p : resolve18(process21.cwd(), p);
34079
+ const filePath = isAbsolute7(p) ? p : resolve19(process21.cwd(), p);
34004
34080
  const st = statSync5(filePath);
34005
34081
  if (st.isFile()) {
34006
34082
  const cfg = await loadConfigFromPath(options.config);
@@ -34162,7 +34238,7 @@ import process102 from "process";
34162
34238
  import process112 from "process";
34163
34239
  import { stripVTControlCharacters as strip } from "util";
34164
34240
  import { existsSync as existsSync19, lstatSync, readdirSync as readdirSync7 } from "fs";
34165
- import { dirname as dirname10, join as join10 } from "path";
34241
+ import { dirname as dirname11, join as join10 } from "path";
34166
34242
  import process122 from "process";
34167
34243
  import process132 from "process";
34168
34244
  import process142 from "process";
@@ -35780,13 +35856,13 @@ function path(opts) {
35780
35856
  try {
35781
35857
  let searchPath;
35782
35858
  if (!existsSync19(userInput)) {
35783
- searchPath = dirname10(userInput);
35859
+ searchPath = dirname11(userInput);
35784
35860
  } else {
35785
35861
  const stat4 = lstatSync(userInput);
35786
35862
  if (stat4.isDirectory()) {
35787
35863
  searchPath = userInput;
35788
35864
  } else {
35789
- searchPath = dirname10(userInput);
35865
+ searchPath = dirname11(userInput);
35790
35866
  }
35791
35867
  }
35792
35868
  const items = readdirSync7(searchPath).map((item) => {
@@ -37844,7 +37920,7 @@ var require_package = __commonJS((exports, module) => {
37844
37920
  module.exports = {
37845
37921
  name: "pickier",
37846
37922
  type: "module",
37847
- version: "0.1.22",
37923
+ version: "0.1.24",
37848
37924
  description: "Format, lint and more in a fraction of seconds.",
37849
37925
  author: "Chris Breuer <chris@stacksjs.org>",
37850
37926
  license: "MIT",
package/dist/src/index.js CHANGED
@@ -18586,16 +18586,12 @@ var init_heading_increment = __esm(() => {
18586
18586
  check: (text, ctx) => {
18587
18587
  const issues = [];
18588
18588
  const lines = text.split(/\r?\n/);
18589
+ const inCode = getCodeBlockLines(lines);
18589
18590
  let previousLevel = 0;
18590
- let inFence = false;
18591
18591
  for (let i = 0;i < lines.length; i++) {
18592
- const line = lines[i];
18593
- if (/^(?:`{3,}|~{3,})/.test(line.trim())) {
18594
- inFence = !inFence;
18595
- continue;
18596
- }
18597
- if (inFence)
18592
+ if (inCode.has(i))
18598
18593
  continue;
18594
+ const line = lines[i];
18599
18595
  const atxMatch = line.match(/^(#{1,6})\s/);
18600
18596
  if (atxMatch) {
18601
18597
  const level = atxMatch[1].length;
@@ -18613,6 +18609,29 @@ var init_heading_increment = __esm(() => {
18613
18609
  }
18614
18610
  }
18615
18611
  return issues;
18612
+ },
18613
+ fix: (text) => {
18614
+ const lines = text.split(/\r?\n/);
18615
+ const inCode = getCodeBlockLines(lines);
18616
+ let previousLevel = 0;
18617
+ let changed = false;
18618
+ for (let i = 0;i < lines.length; i++) {
18619
+ if (inCode.has(i))
18620
+ continue;
18621
+ const line = lines[i];
18622
+ const atxMatch = line.match(/^(#{1,6})(\s.*)$/);
18623
+ if (!atxMatch)
18624
+ continue;
18625
+ const original = atxMatch[1].length;
18626
+ const allowed = previousLevel === 0 ? original : Math.min(original, previousLevel + 1);
18627
+ if (allowed !== original) {
18628
+ lines[i] = "#".repeat(allowed) + atxMatch[2];
18629
+ changed = true;
18630
+ }
18631
+ previousLevel = allowed;
18632
+ }
18633
+ return changed ? lines.join(`
18634
+ `) : text;
18616
18635
  }
18617
18636
  };
18618
18637
  });
@@ -18904,8 +18923,12 @@ var init_link_fragments = __esm(() => {
18904
18923
  check: (text, ctx) => {
18905
18924
  const issues = [];
18906
18925
  const lines = text.split(/\r?\n/);
18926
+ const inCode = getCodeBlockLines(lines);
18907
18927
  const headingIds = new Set;
18908
- for (const line of lines) {
18928
+ for (let li = 0;li < lines.length; li++) {
18929
+ if (inCode.has(li))
18930
+ continue;
18931
+ const line = lines[li];
18909
18932
  const atxMatch = line.match(/^#{1,6}\s+(.+?)(?:\s*#+\s*)?$/);
18910
18933
  if (atxMatch) {
18911
18934
  const headingText = atxMatch[1].trim();
@@ -18914,6 +18937,8 @@ var init_link_fragments = __esm(() => {
18914
18937
  }
18915
18938
  }
18916
18939
  for (let i = 0;i < lines.length; i++) {
18940
+ if (inCode.has(i))
18941
+ continue;
18917
18942
  const line = lines[i];
18918
18943
  const matches = line.matchAll(/\[[^\]]+\]\(#([^)]+)\)/g);
18919
18944
  for (const match of matches) {
@@ -18946,8 +18971,11 @@ var init_link_image_reference_definitions = __esm(() => {
18946
18971
  check: (text, ctx) => {
18947
18972
  const issues = [];
18948
18973
  const lines = text.split(/\r?\n/);
18974
+ const inCode = getCodeBlockLines(lines);
18949
18975
  const definitions = new Map;
18950
18976
  for (let i = 0;i < lines.length; i++) {
18977
+ if (inCode.has(i))
18978
+ continue;
18951
18979
  const line = lines[i];
18952
18980
  const defMatch = line.match(/^\[([^\]]+)\]:\s*\S+/);
18953
18981
  if (defMatch) {
@@ -18955,7 +18983,10 @@ var init_link_image_reference_definitions = __esm(() => {
18955
18983
  }
18956
18984
  }
18957
18985
  const usages = new Set;
18958
- for (const line of lines) {
18986
+ for (let i = 0;i < lines.length; i++) {
18987
+ if (inCode.has(i))
18988
+ continue;
18989
+ const line = lines[i];
18959
18990
  if (line.match(/^\[(?:[^\]]+)\]:\s*\S+/)) {
18960
18991
  continue;
18961
18992
  }
@@ -19926,7 +19957,10 @@ var init_no_reversed_links = __esm(() => {
19926
19957
  check: (text, ctx) => {
19927
19958
  const issues = [];
19928
19959
  const lines = text.split(/\r?\n/);
19960
+ const inCode = getCodeBlockLines(lines);
19929
19961
  for (let i = 0;i < lines.length; i++) {
19962
+ if (inCode.has(i))
19963
+ continue;
19930
19964
  const line = lines[i];
19931
19965
  const matches = line.matchAll(/\(([^)]+)\)\[(?:[^\]]+)\]/g);
19932
19966
  for (const match of matches) {
@@ -20086,7 +20120,10 @@ var init_no_space_in_links = __esm(() => {
20086
20120
  check: (text, ctx) => {
20087
20121
  const issues = [];
20088
20122
  const lines = text.split(/\r?\n/);
20123
+ const inCode = getCodeBlockLines(lines);
20089
20124
  for (let i = 0;i < lines.length; i++) {
20125
+ if (inCode.has(i))
20126
+ continue;
20090
20127
  const line = lines[i];
20091
20128
  const matches = line.matchAll(/\[(\s+(?:\S.*?|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])|\s*(?:\S.*?|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])\s+)\]\([^)]+\)/g);
20092
20129
  for (const match of matches) {
@@ -20332,16 +20369,11 @@ var init_proper_names = __esm(() => {
20332
20369
  if (properNames.length === 0) {
20333
20370
  return issues;
20334
20371
  }
20335
- let inCodeBlock = false;
20372
+ const inCode = getCodeBlockLines(lines);
20336
20373
  for (let i = 0;i < lines.length; i++) {
20337
- const line = lines[i];
20338
- if (/^(?:`{3,}|~{3,})/.test(line)) {
20339
- inCodeBlock = !inCodeBlock;
20374
+ if (inCode.has(i) && !checkCodeBlocks)
20340
20375
  continue;
20341
- }
20342
- if (inCodeBlock && !checkCodeBlocks) {
20343
- continue;
20344
- }
20376
+ const line = lines[i];
20345
20377
  for (const properName of properNames) {
20346
20378
  const regex = new RegExp(`\\b${properName}\\b`, "gi");
20347
20379
  const matches = line.matchAll(regex);
@@ -20571,10 +20603,13 @@ var init_strong_style = __esm(() => {
20571
20603
  check: (text, ctx) => {
20572
20604
  const issues = [];
20573
20605
  const lines = text.split(/\r?\n/);
20606
+ const inCode = getCodeBlockLines(lines);
20574
20607
  const options = ctx.options || {};
20575
20608
  const style = options.style || "consistent";
20576
20609
  let detectedStyle = null;
20577
20610
  for (let i = 0;i < lines.length; i++) {
20611
+ if (inCode.has(i))
20612
+ continue;
20578
20613
  const line = lines[i];
20579
20614
  const asteriskMatches = line.matchAll(/\*\*([^*]+)\*\*/g);
20580
20615
  for (const match of asteriskMatches) {
@@ -20634,27 +20669,51 @@ var init_strong_style = __esm(() => {
20634
20669
  fix: (text, ctx) => {
20635
20670
  const options = ctx.options || {};
20636
20671
  const style = options.style || "consistent";
20672
+ const lines = text.split(/\r?\n/);
20673
+ const inCode = getCodeBlockLines(lines);
20637
20674
  let targetStyle = "asterisk";
20638
20675
  if (style === "asterisk") {
20639
20676
  targetStyle = "asterisk";
20640
20677
  } else if (style === "underscore") {
20641
20678
  targetStyle = "underscore";
20642
20679
  } else if (style === "consistent") {
20643
- const asteriskMatch = text.match(/\*\*([^*]+)\*\*/);
20644
- const underscoreMatch = text.match(/__([^_]+)__/);
20645
- if (asteriskMatch && (!underscoreMatch || asteriskMatch.index < underscoreMatch.index)) {
20680
+ let firstAsterisk = null;
20681
+ let firstUnderscore = null;
20682
+ for (let i = 0;i < lines.length; i++) {
20683
+ if (inCode.has(i))
20684
+ continue;
20685
+ if (firstAsterisk === null) {
20686
+ const m = lines[i].match(/\*\*([^*]+)\*\*/);
20687
+ if (m)
20688
+ firstAsterisk = { line: i, col: m.index };
20689
+ }
20690
+ if (firstUnderscore === null) {
20691
+ const m = lines[i].match(/__([^_]+)__/);
20692
+ if (m)
20693
+ firstUnderscore = { line: i, col: m.index };
20694
+ }
20695
+ if (firstAsterisk && firstUnderscore)
20696
+ break;
20697
+ }
20698
+ const cmp = (a, b) => a.line !== b.line ? a.line - b.line : a.col - b.col;
20699
+ if (firstAsterisk && (!firstUnderscore || cmp(firstAsterisk, firstUnderscore) < 0))
20646
20700
  targetStyle = "asterisk";
20647
- } else if (underscoreMatch) {
20701
+ else if (firstUnderscore)
20648
20702
  targetStyle = "underscore";
20649
- }
20650
20703
  }
20651
- let fixed = text;
20652
- if (targetStyle === "asterisk") {
20653
- fixed = fixed.replace(/__([^_]+)__/g, "**$1**");
20654
- } else {
20655
- fixed = fixed.replace(/\*\*([^*]+)\*\*/g, "__$1__");
20704
+ let changed = false;
20705
+ for (let i = 0;i < lines.length; i++) {
20706
+ if (inCode.has(i))
20707
+ continue;
20708
+ const before = lines[i];
20709
+ const after = targetStyle === "asterisk" ? before.replace(/__([^_]+)__/g, "**$1**") : before.replace(/\*\*([^*]+)\*\*/g, "__$1__");
20710
+ if (after !== before) {
20711
+ lines[i] = after;
20712
+ changed = true;
20713
+ }
20656
20714
  }
20657
- return fixed;
20715
+ return changed ? lines.join(`
20716
+ `) : text;
20658
20717
  }
20659
20718
  };
20660
20719
  });
@@ -22114,7 +22173,20 @@ var init_exports_module_should_be_esm = __esm(() => {
22114
22173
 
22115
22174
  // src/rules/publint/file-does-not-exist.ts
22116
22175
  import { existsSync as existsSync13 } from "fs";
22176
+ import { dirname as dirname7, isAbsolute as isAbsolute3, resolve as resolve12 } from "path";
22177
+ function baseDirectoryMissing(pkgDir, value) {
22178
+ let v = value;
22179
+ while (v.startsWith("./"))
22180
+ v = v.slice(2);
22181
+ const firstSegment = v.split("/")[0];
22182
+ if (!firstSegment || firstSegment === ".." || firstSegment.startsWith("."))
22183
+ return false;
22184
+ const baseDir = isAbsolute3(value) ? dirname7(value).split("/")[0] || "/" : resolve12(pkgDir, firstSegment);
22185
+ return !existsSync13(baseDir);
22186
+ }
22117
22187
  function checkFileRef(value, path, issues, filePath, content, pkgDir) {
22188
+ if (baseDirectoryMissing(pkgDir, value))
22189
+ return;
22118
22190
  const resolved = resolvePkgPath(pkgDir, value);
22119
22191
  if (!fileExistsWithFallbacks(resolved)) {
22120
22192
  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."));
@@ -22148,6 +22220,8 @@ var init_file_does_not_exist = __esm(() => {
22148
22220
  const [value, path] = getPublishedField(pkg, field);
22149
22221
  if (value == null || typeof value !== "string")
22150
22222
  continue;
22223
+ if (baseDirectoryMissing(pkgDir, value))
22224
+ continue;
22151
22225
  const resolved = resolvePkgPath(pkgDir, value);
22152
22226
  if (!fileExistsWithFallbacks(resolved)) {
22153
22227
  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."));
@@ -22174,6 +22248,8 @@ var init_file_does_not_exist = __esm(() => {
22174
22248
  return;
22175
22249
  if (value.includes("*"))
22176
22250
  return;
22251
+ if (baseDirectoryMissing(pkgDir, value))
22252
+ return;
22177
22253
  const resolved = resolvePkgPath(pkgDir, value);
22178
22254
  if (!existsSync13(resolved)) {
22179
22255
  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."));
@@ -22416,7 +22492,7 @@ var init_import_dedupe = __esm(() => {
22416
22492
 
22417
22493
  // src/rules/imports/named.ts
22418
22494
  import { existsSync as existsSync16, readFileSync as readFileSync6 } from "fs";
22419
- import { dirname as dirname7, resolve as resolve12 } from "path";
22495
+ import { dirname as dirname8, resolve as resolve14 } from "path";
22420
22496
  var namedRule;
22421
22497
  var init_named = __esm(() => {
22422
22498
  namedRule = {
@@ -22427,7 +22503,7 @@ var init_named = __esm(() => {
22427
22503
  check: (text, ctx) => {
22428
22504
  const issues = [];
22429
22505
  const lines = text.split(/\r?\n/);
22430
- const currentDir = dirname7(ctx.filePath);
22506
+ const currentDir = dirname8(ctx.filePath);
22431
22507
  for (let i = 0;i < lines.length; i++) {
22432
22508
  const line = lines[i];
22433
22509
  const namedImportMatch = line.match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);
@@ -22440,7 +22516,7 @@ var init_named = __esm(() => {
22440
22516
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22441
22517
  let targetContent = "";
22442
22518
  for (const ext of extensions) {
22443
- const fullPath = resolve12(currentDir, importPath + ext);
22519
+ const fullPath = resolve14(currentDir, importPath + ext);
22444
22520
  if (existsSync16(fullPath)) {
22445
22521
  targetContent = readFileSync6(fullPath, "utf8");
22446
22522
  break;
@@ -22476,7 +22552,7 @@ var init_named = __esm(() => {
22476
22552
 
22477
22553
  // src/rules/imports/no-cycle.ts
22478
22554
  import { existsSync as existsSync17, readFileSync as readFileSync7 } from "fs";
22479
- import { dirname as dirname8, resolve as resolve14 } from "path";
22555
+ import { dirname as dirname9, resolve as resolve15 } from "path";
22480
22556
  var noCycleRule;
22481
22557
  var init_no_cycle = __esm(() => {
22482
22558
  noCycleRule = {
@@ -22501,7 +22577,7 @@ var init_no_cycle = __esm(() => {
22501
22577
  stack.add(filePath);
22502
22578
  try {
22503
22579
  const content = readFileSync7(filePath, "utf8");
22504
- const imports = extractImports(content, dirname8(filePath));
22580
+ const imports = extractImports(content, dirname9(filePath));
22505
22581
  for (const imp of imports) {
22506
22582
  if (detectCycle(imp, [...importChain, imp])) {
22507
22583
  return true;
@@ -22520,7 +22596,7 @@ var init_no_cycle = __esm(() => {
22520
22596
  if (importPath.startsWith(".") || importPath.startsWith("/")) {
22521
22597
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22522
22598
  for (const ext of extensions) {
22523
- const fullPath = resolve14(baseDir, importPath + ext);
22599
+ const fullPath = resolve15(baseDir, importPath + ext);
22524
22600
  if (existsSync17(fullPath)) {
22525
22601
  imports.push(fullPath);
22526
22602
  break;
@@ -22539,7 +22615,7 @@ var init_no_cycle = __esm(() => {
22539
22615
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22540
22616
  let resolvedPath = "";
22541
22617
  for (const ext of extensions) {
22542
- const fullPath = resolve14(dirname8(currentFile), importPath + ext);
22618
+ const fullPath = resolve15(dirname9(currentFile), importPath + ext);
22543
22619
  if (existsSync17(fullPath)) {
22544
22620
  resolvedPath = fullPath;
22545
22621
  break;
@@ -22707,7 +22783,7 @@ var init_no_import_node_modules_by_path = __esm(() => {
22707
22783
 
22708
22784
  // src/rules/imports/no-unresolved.ts
22709
22785
  import { existsSync as existsSync18 } from "fs";
22710
- import { dirname as dirname9, join as join7, resolve as resolve15 } from "path";
22786
+ import { dirname as dirname10, join as join7, resolve as resolve16 } from "path";
22711
22787
  var noUnresolvedRule;
22712
22788
  var init_no_unresolved = __esm(() => {
22713
22789
  noUnresolvedRule = {
@@ -22718,7 +22794,7 @@ var init_no_unresolved = __esm(() => {
22718
22794
  check: (text, ctx) => {
22719
22795
  const issues = [];
22720
22796
  const lines = text.split(/\r?\n/);
22721
- const currentDir = dirname9(ctx.filePath);
22797
+ const currentDir = dirname10(ctx.filePath);
22722
22798
  for (let i = 0;i < lines.length; i++) {
22723
22799
  const line = lines[i];
22724
22800
  const importMatches = [
@@ -22734,7 +22810,7 @@ var init_no_unresolved = __esm(() => {
22734
22810
  const possiblePaths = [];
22735
22811
  const extensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ""];
22736
22812
  for (const ext of extensions) {
22737
- const fullPath = resolve15(currentDir, importPath + ext);
22813
+ const fullPath = resolve16(currentDir, importPath + ext);
22738
22814
  possiblePaths.push(fullPath);
22739
22815
  possiblePaths.push(join7(fullPath, `index${ext}`));
22740
22816
  }
@@ -31877,7 +31953,7 @@ var init_plugins = __esm(() => {
31877
31953
 
31878
31954
  // src/utils.ts
31879
31955
  import { readdirSync as readdirSync6, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
31880
- import { extname as extname4, isAbsolute as isAbsolute3, join as join9, resolve as resolve16 } from "path";
31956
+ import { extname as extname4, isAbsolute as isAbsolute4, join as join9, resolve as resolve17 } from "path";
31881
31957
  import process18 from "process";
31882
31958
  function globToRegex(pattern) {
31883
31959
  let src = "";
@@ -31962,7 +32038,7 @@ async function glob(patterns, opts = {}) {
31962
32038
  for (const pattern of patterns) {
31963
32039
  const g = new BunGlob(pattern);
31964
32040
  for await (const file of g.scan({ cwd, dot, onlyFiles: opts.onlyFiles ?? true, followSymlinks: false })) {
31965
- const full = isAbsolute3(file) ? file : join9(cwd, file);
32041
+ const full = isAbsolute4(file) ? file : join9(cwd, file);
31966
32042
  const rel = full.startsWith(`${cwd}/`) ? full.slice(cwd.length + 1) : full;
31967
32043
  if (ignore.length && matchesAnyPattern(rel, ignore))
31968
32044
  continue;
@@ -31974,7 +32050,7 @@ async function glob(patterns, opts = {}) {
31974
32050
  const results = [];
31975
32051
  for (const pattern of patterns) {
31976
32052
  if (!/[*?[{]/.test(pattern)) {
31977
- const full = isAbsolute3(pattern) ? pattern : join9(cwd, pattern);
32053
+ const full = isAbsolute4(pattern) ? pattern : join9(cwd, pattern);
31978
32054
  try {
31979
32055
  const st = statSync3(full);
31980
32056
  if (!st.isDirectory()) {
@@ -32115,7 +32191,7 @@ async function loadConfigFromPath(pathLike) {
32115
32191
  } catch {}
32116
32192
  return mergeConfig(defaultConfig2, {});
32117
32193
  }
32118
- const abs = isAbsolute3(pathLike) ? pathLike : resolve16(process18.cwd(), pathLike);
32194
+ const abs = isAbsolute4(pathLike) ? pathLike : resolve17(process18.cwd(), pathLike);
32119
32195
  const ext = extname4(abs).toLowerCase();
32120
32196
  if (ext === ".json") {
32121
32197
  try {
@@ -32259,7 +32335,7 @@ var init_utils4 = __esm(() => {
32259
32335
 
32260
32336
  // src/formatter.ts
32261
32337
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
32262
- import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve17 } from "path";
32338
+ import { isAbsolute as isAbsolute5, relative as relative5, resolve as resolve18 } from "path";
32263
32339
  import process20 from "process";
32264
32340
  function getLogger() {
32265
32341
  if (!_logger)
@@ -32391,7 +32467,7 @@ async function runFormat(globs, options) {
32391
32467
  const timeoutMs = ENV.TIMEOUT_MS;
32392
32468
  const isGlobbingOutsideProject = patterns.some((p) => {
32393
32469
  const base = p.replace(/\/?\*\*(?:\/\*+)?$/, "");
32394
- const absBase = isAbsolute4(base) ? base : resolve17(process20.cwd(), base);
32470
+ const absBase = isAbsolute5(base) ? base : resolve18(process20.cwd(), base);
32395
32471
  return !absBase.startsWith(process20.cwd());
32396
32472
  });
32397
32473
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32495,7 +32571,7 @@ __export(exports_linter, {
32495
32571
  applyPlugins: () => applyPlugins
32496
32572
  });
32497
32573
  import { readdirSync as readdirSync7, readFileSync as readFileSync10, statSync as statSync4, writeFileSync as writeFileSync9 } from "fs";
32498
- import { isAbsolute as isAbsolute5, join as join10, relative as relative6, resolve as resolve18 } from "path";
32574
+ import { isAbsolute as isAbsolute6, join as join10, relative as relative6, resolve as resolve19 } from "path";
32499
32575
  import process21 from "process";
32500
32576
  function getLogger2() {
32501
32577
  if (!_logger2)
@@ -32554,7 +32630,7 @@ async function runLintProgrammatic(globs, options, signal) {
32554
32630
  const timeoutMs = ENV.TIMEOUT_MS;
32555
32631
  const isGlobbingOutsideProject = patterns.some((p) => {
32556
32632
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
32557
- const absBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
32633
+ const absBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
32558
32634
  return !absBase.startsWith(process21.cwd());
32559
32635
  });
32560
32636
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32564,7 +32640,7 @@ async function runLintProgrammatic(globs, options, signal) {
32564
32640
  try {
32565
32641
  const st = statSync4(patterns[0]);
32566
32642
  if (st.isFile()) {
32567
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve18(process21.cwd(), patterns[0]);
32643
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve19(process21.cwd(), patterns[0]);
32568
32644
  entries = [abs];
32569
32645
  }
32570
32646
  } catch {}
@@ -32572,7 +32648,7 @@ async function runLintProgrammatic(globs, options, signal) {
32572
32648
  const simpleDirPattern = patterns.length === 1 && /\*\*\/*\*$/.test(patterns[0]);
32573
32649
  if (!entries.length && simpleDirPattern) {
32574
32650
  const base = patterns[0].replace(/\/?\*\*\/*\*\*$/, "");
32575
- const rootBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
32651
+ const rootBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
32576
32652
  try {
32577
32653
  const stack = [rootBase];
32578
32654
  while (stack.length) {
@@ -33674,7 +33750,7 @@ async function runLint(globs, options) {
33674
33750
  getLogger2().info(`[pickier:diagnostics] Glob timeout: ${timeoutMs}ms`);
33675
33751
  const isGlobbingOutsideProject = patterns.some((p) => {
33676
33752
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
33677
- const absBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
33753
+ const absBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
33678
33754
  return !absBase.startsWith(process21.cwd());
33679
33755
  });
33680
33756
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -33691,7 +33767,7 @@ async function runLint(globs, options) {
33691
33767
  try {
33692
33768
  const st = statSync4(patterns[0]);
33693
33769
  if (st.isFile()) {
33694
- const abs = isAbsolute5(patterns[0]) ? patterns[0] : resolve18(process21.cwd(), patterns[0]);
33770
+ const abs = isAbsolute6(patterns[0]) ? patterns[0] : resolve19(process21.cwd(), patterns[0]);
33695
33771
  entries = [abs];
33696
33772
  }
33697
33773
  } catch {}
@@ -33702,7 +33778,7 @@ async function runLint(globs, options) {
33702
33778
  if (enableDiagnostics)
33703
33779
  getLogger2().info(`[pickier:diagnostics] Using fast directory scan for: ${base}`);
33704
33780
  try {
33705
- const rootBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
33781
+ const rootBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
33706
33782
  const stack = [rootBase];
33707
33783
  let dirCount = 0;
33708
33784
  while (stack.length) {
@@ -33992,14 +34068,14 @@ __export(exports_run, {
33992
34068
  runUnified: () => runUnified
33993
34069
  });
33994
34070
  import { readFileSync as readFileSync11, statSync as statSync5, writeFileSync as writeFileSync10 } from "fs";
33995
- import { isAbsolute as isAbsolute6, resolve as resolve19 } from "path";
34071
+ import { isAbsolute as isAbsolute7, resolve as resolve20 } from "path";
33996
34072
  import process23 from "process";
33997
34073
  async function runUnified(globs, options) {
33998
34074
  const mode = options.mode || "auto";
33999
34075
  if (mode === "format" && globs.length === 1 && !/[*?[\]{}()!]/.test(globs[0])) {
34000
34076
  try {
34001
34077
  const p = globs[0];
34002
- const filePath = isAbsolute6(p) ? p : resolve19(process23.cwd(), p);
34078
+ const filePath = isAbsolute7(p) ? p : resolve20(process23.cwd(), p);
34003
34079
  const st = statSync5(filePath);
34004
34080
  if (st.isFile()) {
34005
34081
  const cfg = await loadConfigFromPath(options.config);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pickier",
3
3
  "type": "module",
4
- "version": "0.1.22",
4
+ "version": "0.1.24",
5
5
  "description": "Format, lint and more in a fraction of seconds.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",