pickier 0.1.23 → 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
  });
@@ -22537,7 +22556,20 @@ var init_exports_module_should_be_esm = __esm(() => {
22537
22556
 
22538
22557
  // src/rules/publint/file-does-not-exist.ts
22539
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
+ }
22540
22570
  function checkFileRef(value, path, issues, filePath, content, pkgDir) {
22571
+ if (baseDirectoryMissing(pkgDir, value))
22572
+ return;
22541
22573
  const resolved = resolvePkgPath(pkgDir, value);
22542
22574
  if (!fileExistsWithFallbacks(resolved)) {
22543
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."));
@@ -22571,6 +22603,8 @@ var init_file_does_not_exist = __esm(() => {
22571
22603
  const [value, path] = getPublishedField(pkg, field);
22572
22604
  if (value == null || typeof value !== "string")
22573
22605
  continue;
22606
+ if (baseDirectoryMissing(pkgDir, value))
22607
+ continue;
22574
22608
  const resolved = resolvePkgPath(pkgDir, value);
22575
22609
  if (!fileExistsWithFallbacks(resolved)) {
22576
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."));
@@ -22597,6 +22631,8 @@ var init_file_does_not_exist = __esm(() => {
22597
22631
  return;
22598
22632
  if (value.includes("*"))
22599
22633
  return;
22634
+ if (baseDirectoryMissing(pkgDir, value))
22635
+ return;
22600
22636
  const resolved = resolvePkgPath(pkgDir, value);
22601
22637
  if (!existsSync13(resolved)) {
22602
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."));
@@ -22839,7 +22875,7 @@ var init_import_dedupe = __esm(() => {
22839
22875
 
22840
22876
  // src/rules/imports/named.ts
22841
22877
  import { existsSync as existsSync16, readFileSync as readFileSync7 } from "fs";
22842
- import { dirname as dirname7, resolve as resolve12 } from "path";
22878
+ import { dirname as dirname8, resolve as resolve14 } from "path";
22843
22879
  var namedRule;
22844
22880
  var init_named = __esm(() => {
22845
22881
  namedRule = {
@@ -22850,7 +22886,7 @@ var init_named = __esm(() => {
22850
22886
  check: (text, ctx) => {
22851
22887
  const issues = [];
22852
22888
  const lines = text.split(/\r?\n/);
22853
- const currentDir = dirname7(ctx.filePath);
22889
+ const currentDir = dirname8(ctx.filePath);
22854
22890
  for (let i = 0;i < lines.length; i++) {
22855
22891
  const line = lines[i];
22856
22892
  const namedImportMatch = line.match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);
@@ -22863,7 +22899,7 @@ var init_named = __esm(() => {
22863
22899
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22864
22900
  let targetContent = "";
22865
22901
  for (const ext of extensions) {
22866
- const fullPath = resolve12(currentDir, importPath + ext);
22902
+ const fullPath = resolve14(currentDir, importPath + ext);
22867
22903
  if (existsSync16(fullPath)) {
22868
22904
  targetContent = readFileSync7(fullPath, "utf8");
22869
22905
  break;
@@ -22899,7 +22935,7 @@ var init_named = __esm(() => {
22899
22935
 
22900
22936
  // src/rules/imports/no-cycle.ts
22901
22937
  import { existsSync as existsSync17, readFileSync as readFileSync8 } from "fs";
22902
- import { dirname as dirname8, resolve as resolve14 } from "path";
22938
+ import { dirname as dirname9, resolve as resolve15 } from "path";
22903
22939
  var noCycleRule;
22904
22940
  var init_no_cycle = __esm(() => {
22905
22941
  noCycleRule = {
@@ -22924,7 +22960,7 @@ var init_no_cycle = __esm(() => {
22924
22960
  stack.add(filePath);
22925
22961
  try {
22926
22962
  const content = readFileSync8(filePath, "utf8");
22927
- const imports = extractImports(content, dirname8(filePath));
22963
+ const imports = extractImports(content, dirname9(filePath));
22928
22964
  for (const imp of imports) {
22929
22965
  if (detectCycle(imp, [...importChain, imp])) {
22930
22966
  return true;
@@ -22943,7 +22979,7 @@ var init_no_cycle = __esm(() => {
22943
22979
  if (importPath.startsWith(".") || importPath.startsWith("/")) {
22944
22980
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22945
22981
  for (const ext of extensions) {
22946
- const fullPath = resolve14(baseDir, importPath + ext);
22982
+ const fullPath = resolve15(baseDir, importPath + ext);
22947
22983
  if (existsSync17(fullPath)) {
22948
22984
  imports.push(fullPath);
22949
22985
  break;
@@ -22962,7 +22998,7 @@ var init_no_cycle = __esm(() => {
22962
22998
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22963
22999
  let resolvedPath = "";
22964
23000
  for (const ext of extensions) {
22965
- const fullPath = resolve14(dirname8(currentFile), importPath + ext);
23001
+ const fullPath = resolve15(dirname9(currentFile), importPath + ext);
22966
23002
  if (existsSync17(fullPath)) {
22967
23003
  resolvedPath = fullPath;
22968
23004
  break;
@@ -23130,7 +23166,7 @@ var init_no_import_node_modules_by_path = __esm(() => {
23130
23166
 
23131
23167
  // src/rules/imports/no-unresolved.ts
23132
23168
  import { existsSync as existsSync18 } from "fs";
23133
- 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";
23134
23170
  var noUnresolvedRule;
23135
23171
  var init_no_unresolved = __esm(() => {
23136
23172
  noUnresolvedRule = {
@@ -23141,7 +23177,7 @@ var init_no_unresolved = __esm(() => {
23141
23177
  check: (text, ctx) => {
23142
23178
  const issues = [];
23143
23179
  const lines = text.split(/\r?\n/);
23144
- const currentDir = dirname9(ctx.filePath);
23180
+ const currentDir = dirname10(ctx.filePath);
23145
23181
  for (let i = 0;i < lines.length; i++) {
23146
23182
  const line = lines[i];
23147
23183
  const importMatches = [
@@ -23157,7 +23193,7 @@ var init_no_unresolved = __esm(() => {
23157
23193
  const possiblePaths = [];
23158
23194
  const extensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ""];
23159
23195
  for (const ext of extensions) {
23160
- const fullPath = resolve15(currentDir, importPath + ext);
23196
+ const fullPath = resolve16(currentDir, importPath + ext);
23161
23197
  possiblePaths.push(fullPath);
23162
23198
  possiblePaths.push(join7(fullPath, `index${ext}`));
23163
23199
  }
@@ -32300,7 +32336,7 @@ var init_plugins = __esm(() => {
32300
32336
 
32301
32337
  // src/formatter.ts
32302
32338
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
32303
- 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";
32304
32340
  import process18 from "process";
32305
32341
  function getLogger() {
32306
32342
  if (!_logger)
@@ -32432,7 +32468,7 @@ async function runFormat(globs, options) {
32432
32468
  const timeoutMs = ENV.TIMEOUT_MS;
32433
32469
  const isGlobbingOutsideProject = patterns.some((p) => {
32434
32470
  const base = p.replace(/\/?\*\*(?:\/\*+)?$/, "");
32435
- const absBase = isAbsolute4(base) ? base : resolve16(process18.cwd(), base);
32471
+ const absBase = isAbsolute5(base) ? base : resolve17(process18.cwd(), base);
32436
32472
  return !absBase.startsWith(process18.cwd());
32437
32473
  });
32438
32474
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32536,7 +32572,7 @@ __export(exports_linter, {
32536
32572
  applyPlugins: () => applyPlugins
32537
32573
  });
32538
32574
  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";
32575
+ import { isAbsolute as isAbsolute6, join as join9, relative as relative6, resolve as resolve18 } from "path";
32540
32576
  import process20 from "process";
32541
32577
  function getLogger2() {
32542
32578
  if (!_logger2)
@@ -32595,7 +32631,7 @@ async function runLintProgrammatic(globs, options, signal) {
32595
32631
  const timeoutMs = ENV.TIMEOUT_MS;
32596
32632
  const isGlobbingOutsideProject = patterns.some((p) => {
32597
32633
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
32598
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32634
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32599
32635
  return !absBase.startsWith(process20.cwd());
32600
32636
  });
32601
32637
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32605,7 +32641,7 @@ async function runLintProgrammatic(globs, options, signal) {
32605
32641
  try {
32606
32642
  const st = statSync4(patterns[0]);
32607
32643
  if (st.isFile()) {
32608
- 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]);
32609
32645
  entries = [abs];
32610
32646
  }
32611
32647
  } catch {}
@@ -32613,7 +32649,7 @@ async function runLintProgrammatic(globs, options, signal) {
32613
32649
  const simpleDirPattern = patterns.length === 1 && /\*\*\/*\*$/.test(patterns[0]);
32614
32650
  if (!entries.length && simpleDirPattern) {
32615
32651
  const base = patterns[0].replace(/\/?\*\*\/*\*\*$/, "");
32616
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
32652
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
32617
32653
  try {
32618
32654
  const stack = [rootBase];
32619
32655
  while (stack.length) {
@@ -33715,7 +33751,7 @@ async function runLint(globs, options) {
33715
33751
  getLogger2().info(`[pickier:diagnostics] Glob timeout: ${timeoutMs}ms`);
33716
33752
  const isGlobbingOutsideProject = patterns.some((p) => {
33717
33753
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
33718
- const absBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33754
+ const absBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33719
33755
  return !absBase.startsWith(process20.cwd());
33720
33756
  });
33721
33757
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -33732,7 +33768,7 @@ async function runLint(globs, options) {
33732
33768
  try {
33733
33769
  const st = statSync4(patterns[0]);
33734
33770
  if (st.isFile()) {
33735
- 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]);
33736
33772
  entries = [abs];
33737
33773
  }
33738
33774
  } catch {}
@@ -33743,7 +33779,7 @@ async function runLint(globs, options) {
33743
33779
  if (enableDiagnostics)
33744
33780
  getLogger2().info(`[pickier:diagnostics] Using fast directory scan for: ${base}`);
33745
33781
  try {
33746
- const rootBase = isAbsolute5(base) ? base : resolve17(process20.cwd(), base);
33782
+ const rootBase = isAbsolute6(base) ? base : resolve18(process20.cwd(), base);
33747
33783
  const stack = [rootBase];
33748
33784
  let dirCount = 0;
33749
33785
  while (stack.length) {
@@ -34033,14 +34069,14 @@ __export(exports_run, {
34033
34069
  runUnified: () => runUnified
34034
34070
  });
34035
34071
  import { readFileSync as readFileSync11, statSync as statSync5, writeFileSync as writeFileSync10 } from "fs";
34036
- import { isAbsolute as isAbsolute6, resolve as resolve18 } from "path";
34072
+ import { isAbsolute as isAbsolute7, resolve as resolve19 } from "path";
34037
34073
  import process21 from "process";
34038
34074
  async function runUnified(globs, options) {
34039
34075
  const mode = options.mode || "auto";
34040
34076
  if (mode === "format" && globs.length === 1 && !/[*?[\]{}()!]/.test(globs[0])) {
34041
34077
  try {
34042
34078
  const p = globs[0];
34043
- const filePath = isAbsolute6(p) ? p : resolve18(process21.cwd(), p);
34079
+ const filePath = isAbsolute7(p) ? p : resolve19(process21.cwd(), p);
34044
34080
  const st = statSync5(filePath);
34045
34081
  if (st.isFile()) {
34046
34082
  const cfg = await loadConfigFromPath(options.config);
@@ -34202,7 +34238,7 @@ import process102 from "process";
34202
34238
  import process112 from "process";
34203
34239
  import { stripVTControlCharacters as strip } from "util";
34204
34240
  import { existsSync as existsSync19, lstatSync, readdirSync as readdirSync7 } from "fs";
34205
- import { dirname as dirname10, join as join10 } from "path";
34241
+ import { dirname as dirname11, join as join10 } from "path";
34206
34242
  import process122 from "process";
34207
34243
  import process132 from "process";
34208
34244
  import process142 from "process";
@@ -35820,13 +35856,13 @@ function path(opts) {
35820
35856
  try {
35821
35857
  let searchPath;
35822
35858
  if (!existsSync19(userInput)) {
35823
- searchPath = dirname10(userInput);
35859
+ searchPath = dirname11(userInput);
35824
35860
  } else {
35825
35861
  const stat4 = lstatSync(userInput);
35826
35862
  if (stat4.isDirectory()) {
35827
35863
  searchPath = userInput;
35828
35864
  } else {
35829
- searchPath = dirname10(userInput);
35865
+ searchPath = dirname11(userInput);
35830
35866
  }
35831
35867
  }
35832
35868
  const items = readdirSync7(searchPath).map((item) => {
@@ -37884,7 +37920,7 @@ var require_package = __commonJS((exports, module) => {
37884
37920
  module.exports = {
37885
37921
  name: "pickier",
37886
37922
  type: "module",
37887
- version: "0.1.23",
37923
+ version: "0.1.24",
37888
37924
  description: "Format, lint and more in a fraction of seconds.",
37889
37925
  author: "Chris Breuer <chris@stacksjs.org>",
37890
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
  });
@@ -22154,7 +22173,20 @@ var init_exports_module_should_be_esm = __esm(() => {
22154
22173
 
22155
22174
  // src/rules/publint/file-does-not-exist.ts
22156
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
+ }
22157
22187
  function checkFileRef(value, path, issues, filePath, content, pkgDir) {
22188
+ if (baseDirectoryMissing(pkgDir, value))
22189
+ return;
22158
22190
  const resolved = resolvePkgPath(pkgDir, value);
22159
22191
  if (!fileExistsWithFallbacks(resolved)) {
22160
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."));
@@ -22188,6 +22220,8 @@ var init_file_does_not_exist = __esm(() => {
22188
22220
  const [value, path] = getPublishedField(pkg, field);
22189
22221
  if (value == null || typeof value !== "string")
22190
22222
  continue;
22223
+ if (baseDirectoryMissing(pkgDir, value))
22224
+ continue;
22191
22225
  const resolved = resolvePkgPath(pkgDir, value);
22192
22226
  if (!fileExistsWithFallbacks(resolved)) {
22193
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."));
@@ -22214,6 +22248,8 @@ var init_file_does_not_exist = __esm(() => {
22214
22248
  return;
22215
22249
  if (value.includes("*"))
22216
22250
  return;
22251
+ if (baseDirectoryMissing(pkgDir, value))
22252
+ return;
22217
22253
  const resolved = resolvePkgPath(pkgDir, value);
22218
22254
  if (!existsSync13(resolved)) {
22219
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."));
@@ -22456,7 +22492,7 @@ var init_import_dedupe = __esm(() => {
22456
22492
 
22457
22493
  // src/rules/imports/named.ts
22458
22494
  import { existsSync as existsSync16, readFileSync as readFileSync6 } from "fs";
22459
- import { dirname as dirname7, resolve as resolve12 } from "path";
22495
+ import { dirname as dirname8, resolve as resolve14 } from "path";
22460
22496
  var namedRule;
22461
22497
  var init_named = __esm(() => {
22462
22498
  namedRule = {
@@ -22467,7 +22503,7 @@ var init_named = __esm(() => {
22467
22503
  check: (text, ctx) => {
22468
22504
  const issues = [];
22469
22505
  const lines = text.split(/\r?\n/);
22470
- const currentDir = dirname7(ctx.filePath);
22506
+ const currentDir = dirname8(ctx.filePath);
22471
22507
  for (let i = 0;i < lines.length; i++) {
22472
22508
  const line = lines[i];
22473
22509
  const namedImportMatch = line.match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);
@@ -22480,7 +22516,7 @@ var init_named = __esm(() => {
22480
22516
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22481
22517
  let targetContent = "";
22482
22518
  for (const ext of extensions) {
22483
- const fullPath = resolve12(currentDir, importPath + ext);
22519
+ const fullPath = resolve14(currentDir, importPath + ext);
22484
22520
  if (existsSync16(fullPath)) {
22485
22521
  targetContent = readFileSync6(fullPath, "utf8");
22486
22522
  break;
@@ -22516,7 +22552,7 @@ var init_named = __esm(() => {
22516
22552
 
22517
22553
  // src/rules/imports/no-cycle.ts
22518
22554
  import { existsSync as existsSync17, readFileSync as readFileSync7 } from "fs";
22519
- import { dirname as dirname8, resolve as resolve14 } from "path";
22555
+ import { dirname as dirname9, resolve as resolve15 } from "path";
22520
22556
  var noCycleRule;
22521
22557
  var init_no_cycle = __esm(() => {
22522
22558
  noCycleRule = {
@@ -22541,7 +22577,7 @@ var init_no_cycle = __esm(() => {
22541
22577
  stack.add(filePath);
22542
22578
  try {
22543
22579
  const content = readFileSync7(filePath, "utf8");
22544
- const imports = extractImports(content, dirname8(filePath));
22580
+ const imports = extractImports(content, dirname9(filePath));
22545
22581
  for (const imp of imports) {
22546
22582
  if (detectCycle(imp, [...importChain, imp])) {
22547
22583
  return true;
@@ -22560,7 +22596,7 @@ var init_no_cycle = __esm(() => {
22560
22596
  if (importPath.startsWith(".") || importPath.startsWith("/")) {
22561
22597
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22562
22598
  for (const ext of extensions) {
22563
- const fullPath = resolve14(baseDir, importPath + ext);
22599
+ const fullPath = resolve15(baseDir, importPath + ext);
22564
22600
  if (existsSync17(fullPath)) {
22565
22601
  imports.push(fullPath);
22566
22602
  break;
@@ -22579,7 +22615,7 @@ var init_no_cycle = __esm(() => {
22579
22615
  const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
22580
22616
  let resolvedPath = "";
22581
22617
  for (const ext of extensions) {
22582
- const fullPath = resolve14(dirname8(currentFile), importPath + ext);
22618
+ const fullPath = resolve15(dirname9(currentFile), importPath + ext);
22583
22619
  if (existsSync17(fullPath)) {
22584
22620
  resolvedPath = fullPath;
22585
22621
  break;
@@ -22747,7 +22783,7 @@ var init_no_import_node_modules_by_path = __esm(() => {
22747
22783
 
22748
22784
  // src/rules/imports/no-unresolved.ts
22749
22785
  import { existsSync as existsSync18 } from "fs";
22750
- 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";
22751
22787
  var noUnresolvedRule;
22752
22788
  var init_no_unresolved = __esm(() => {
22753
22789
  noUnresolvedRule = {
@@ -22758,7 +22794,7 @@ var init_no_unresolved = __esm(() => {
22758
22794
  check: (text, ctx) => {
22759
22795
  const issues = [];
22760
22796
  const lines = text.split(/\r?\n/);
22761
- const currentDir = dirname9(ctx.filePath);
22797
+ const currentDir = dirname10(ctx.filePath);
22762
22798
  for (let i = 0;i < lines.length; i++) {
22763
22799
  const line = lines[i];
22764
22800
  const importMatches = [
@@ -22774,7 +22810,7 @@ var init_no_unresolved = __esm(() => {
22774
22810
  const possiblePaths = [];
22775
22811
  const extensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ""];
22776
22812
  for (const ext of extensions) {
22777
- const fullPath = resolve15(currentDir, importPath + ext);
22813
+ const fullPath = resolve16(currentDir, importPath + ext);
22778
22814
  possiblePaths.push(fullPath);
22779
22815
  possiblePaths.push(join7(fullPath, `index${ext}`));
22780
22816
  }
@@ -31917,7 +31953,7 @@ var init_plugins = __esm(() => {
31917
31953
 
31918
31954
  // src/utils.ts
31919
31955
  import { readdirSync as readdirSync6, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
31920
- 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";
31921
31957
  import process18 from "process";
31922
31958
  function globToRegex(pattern) {
31923
31959
  let src = "";
@@ -32002,7 +32038,7 @@ async function glob(patterns, opts = {}) {
32002
32038
  for (const pattern of patterns) {
32003
32039
  const g = new BunGlob(pattern);
32004
32040
  for await (const file of g.scan({ cwd, dot, onlyFiles: opts.onlyFiles ?? true, followSymlinks: false })) {
32005
- const full = isAbsolute3(file) ? file : join9(cwd, file);
32041
+ const full = isAbsolute4(file) ? file : join9(cwd, file);
32006
32042
  const rel = full.startsWith(`${cwd}/`) ? full.slice(cwd.length + 1) : full;
32007
32043
  if (ignore.length && matchesAnyPattern(rel, ignore))
32008
32044
  continue;
@@ -32014,7 +32050,7 @@ async function glob(patterns, opts = {}) {
32014
32050
  const results = [];
32015
32051
  for (const pattern of patterns) {
32016
32052
  if (!/[*?[{]/.test(pattern)) {
32017
- const full = isAbsolute3(pattern) ? pattern : join9(cwd, pattern);
32053
+ const full = isAbsolute4(pattern) ? pattern : join9(cwd, pattern);
32018
32054
  try {
32019
32055
  const st = statSync3(full);
32020
32056
  if (!st.isDirectory()) {
@@ -32155,7 +32191,7 @@ async function loadConfigFromPath(pathLike) {
32155
32191
  } catch {}
32156
32192
  return mergeConfig(defaultConfig2, {});
32157
32193
  }
32158
- const abs = isAbsolute3(pathLike) ? pathLike : resolve16(process18.cwd(), pathLike);
32194
+ const abs = isAbsolute4(pathLike) ? pathLike : resolve17(process18.cwd(), pathLike);
32159
32195
  const ext = extname4(abs).toLowerCase();
32160
32196
  if (ext === ".json") {
32161
32197
  try {
@@ -32299,7 +32335,7 @@ var init_utils4 = __esm(() => {
32299
32335
 
32300
32336
  // src/formatter.ts
32301
32337
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
32302
- 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";
32303
32339
  import process20 from "process";
32304
32340
  function getLogger() {
32305
32341
  if (!_logger)
@@ -32431,7 +32467,7 @@ async function runFormat(globs, options) {
32431
32467
  const timeoutMs = ENV.TIMEOUT_MS;
32432
32468
  const isGlobbingOutsideProject = patterns.some((p) => {
32433
32469
  const base = p.replace(/\/?\*\*(?:\/\*+)?$/, "");
32434
- const absBase = isAbsolute4(base) ? base : resolve17(process20.cwd(), base);
32470
+ const absBase = isAbsolute5(base) ? base : resolve18(process20.cwd(), base);
32435
32471
  return !absBase.startsWith(process20.cwd());
32436
32472
  });
32437
32473
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32535,7 +32571,7 @@ __export(exports_linter, {
32535
32571
  applyPlugins: () => applyPlugins
32536
32572
  });
32537
32573
  import { readdirSync as readdirSync7, readFileSync as readFileSync10, statSync as statSync4, writeFileSync as writeFileSync9 } from "fs";
32538
- 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";
32539
32575
  import process21 from "process";
32540
32576
  function getLogger2() {
32541
32577
  if (!_logger2)
@@ -32594,7 +32630,7 @@ async function runLintProgrammatic(globs, options, signal) {
32594
32630
  const timeoutMs = ENV.TIMEOUT_MS;
32595
32631
  const isGlobbingOutsideProject = patterns.some((p) => {
32596
32632
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
32597
- const absBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
32633
+ const absBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
32598
32634
  return !absBase.startsWith(process21.cwd());
32599
32635
  });
32600
32636
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -32604,7 +32640,7 @@ async function runLintProgrammatic(globs, options, signal) {
32604
32640
  try {
32605
32641
  const st = statSync4(patterns[0]);
32606
32642
  if (st.isFile()) {
32607
- 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]);
32608
32644
  entries = [abs];
32609
32645
  }
32610
32646
  } catch {}
@@ -32612,7 +32648,7 @@ async function runLintProgrammatic(globs, options, signal) {
32612
32648
  const simpleDirPattern = patterns.length === 1 && /\*\*\/*\*$/.test(patterns[0]);
32613
32649
  if (!entries.length && simpleDirPattern) {
32614
32650
  const base = patterns[0].replace(/\/?\*\*\/*\*\*$/, "");
32615
- const rootBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
32651
+ const rootBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
32616
32652
  try {
32617
32653
  const stack = [rootBase];
32618
32654
  while (stack.length) {
@@ -33714,7 +33750,7 @@ async function runLint(globs, options) {
33714
33750
  getLogger2().info(`[pickier:diagnostics] Glob timeout: ${timeoutMs}ms`);
33715
33751
  const isGlobbingOutsideProject = patterns.some((p) => {
33716
33752
  const base = p.replace(/\/?\*\*\/*\*\*$/, "");
33717
- const absBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
33753
+ const absBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
33718
33754
  return !absBase.startsWith(process21.cwd());
33719
33755
  });
33720
33756
  const globIgnores = isGlobbingOutsideProject ? [...UNIVERSAL_IGNORES] : cfg.ignores;
@@ -33731,7 +33767,7 @@ async function runLint(globs, options) {
33731
33767
  try {
33732
33768
  const st = statSync4(patterns[0]);
33733
33769
  if (st.isFile()) {
33734
- 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]);
33735
33771
  entries = [abs];
33736
33772
  }
33737
33773
  } catch {}
@@ -33742,7 +33778,7 @@ async function runLint(globs, options) {
33742
33778
  if (enableDiagnostics)
33743
33779
  getLogger2().info(`[pickier:diagnostics] Using fast directory scan for: ${base}`);
33744
33780
  try {
33745
- const rootBase = isAbsolute5(base) ? base : resolve18(process21.cwd(), base);
33781
+ const rootBase = isAbsolute6(base) ? base : resolve19(process21.cwd(), base);
33746
33782
  const stack = [rootBase];
33747
33783
  let dirCount = 0;
33748
33784
  while (stack.length) {
@@ -34032,14 +34068,14 @@ __export(exports_run, {
34032
34068
  runUnified: () => runUnified
34033
34069
  });
34034
34070
  import { readFileSync as readFileSync11, statSync as statSync5, writeFileSync as writeFileSync10 } from "fs";
34035
- import { isAbsolute as isAbsolute6, resolve as resolve19 } from "path";
34071
+ import { isAbsolute as isAbsolute7, resolve as resolve20 } from "path";
34036
34072
  import process23 from "process";
34037
34073
  async function runUnified(globs, options) {
34038
34074
  const mode = options.mode || "auto";
34039
34075
  if (mode === "format" && globs.length === 1 && !/[*?[\]{}()!]/.test(globs[0])) {
34040
34076
  try {
34041
34077
  const p = globs[0];
34042
- const filePath = isAbsolute6(p) ? p : resolve19(process23.cwd(), p);
34078
+ const filePath = isAbsolute7(p) ? p : resolve20(process23.cwd(), p);
34043
34079
  const st = statSync5(filePath);
34044
34080
  if (st.isFile()) {
34045
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.23",
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",