pruny 1.43.9 → 1.43.10

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15889,13 +15889,13 @@ var import_fast_glob9 = __toESM(require_out4(), 1);
15889
15889
  import { readFileSync as readFileSync9, existsSync as existsSync7 } from "node:fs";
15890
15890
  import { join as join7 } from "node:path";
15891
15891
  var LINK_PATTERNS = [
15892
- /<Link\s+[^>]*href\s*=\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15893
- /router\.(push|replace)\s*\(\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15894
- /(?:redirect|permanentRedirect)\s*\(\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15895
- /href\s*:\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15896
- /<a\s+[^>]*href\s*=\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15897
- /revalidatePath\s*\(\s*['"`](\/[^'"`\s{}$]+)['"`]/g,
15898
- /pathname\s*===?\s*['"`](\/[^'"`\s{}$]+)['"`]/g
15892
+ /<Link\s+[^>]*href\s*=\s*(?:\{\s*)?['"`](\/[^'"`\s]+)['"`](?:\s*\})?/g,
15893
+ /router\.(push|replace)\s*\(\s*['"`](\/[^'"`\s]+)['"`]/g,
15894
+ /(?:redirect|permanentRedirect)\s*\(\s*['"`](\/[^'"`\s]+)['"`]/g,
15895
+ /href\s*:\s*['"`](\/[^'"`\s]+)['"`]/g,
15896
+ /<a\s+[^>]*href\s*=\s*(?:\{\s*)?['"`](\/[^'"`\s]+)['"`](?:\s*\})?/g,
15897
+ /revalidatePath\s*\(\s*['"`](\/[^'"`\s]+)['"`]/g,
15898
+ /pathname\s*===?\s*['"`](\/[^'"`\s]+)['"`]/g
15899
15899
  ];
15900
15900
  function extractPath(match2) {
15901
15901
  if (match2[2] && match2[2].startsWith("/"))
@@ -15904,6 +15904,11 @@ function extractPath(match2) {
15904
15904
  return match2[1];
15905
15905
  return null;
15906
15906
  }
15907
+ function normalizePath(raw) {
15908
+ let out = raw.replace(/\$\{[^}]*\}/g, "[id]");
15909
+ out = out.replace(/[{}]/g, "");
15910
+ return out;
15911
+ }
15907
15912
  function shouldSkipPath(path2) {
15908
15913
  if (/^https?:\/\//.test(path2))
15909
15914
  return true;
@@ -15997,7 +16002,7 @@ function isGitignoredPublicFile(appDir, linkPath) {
15997
16002
  continue;
15998
16003
  try {
15999
16004
  const patterns = readFileSync9(gitignorePath, "utf-8").split(`
16000
- `).map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
16005
+ `).map((l) => l.trim()).filter((l) => l && !l.startsWith("#") && !l.startsWith("!"));
16001
16006
  for (const pattern of patterns) {
16002
16007
  if (minimatch(publicRelPath, pattern, { dot: true }) || minimatch(linkPath.slice(1), pattern, { dot: true }) || minimatch(`**/public${linkPath}`, pattern, { dot: true })) {
16003
16008
  return true;
@@ -16073,9 +16078,10 @@ async function scanBrokenLinks(config) {
16073
16078
  pattern.lastIndex = 0;
16074
16079
  let match2;
16075
16080
  while ((match2 = pattern.exec(content)) !== null) {
16076
- const rawPath = extractPath(match2);
16077
- if (!rawPath)
16081
+ const extracted = extractPath(match2);
16082
+ if (!extracted)
16078
16083
  continue;
16084
+ const rawPath = normalizePath(extracted);
16079
16085
  if (shouldSkipPath(rawPath))
16080
16086
  continue;
16081
16087
  const cleaned = cleanPath(rawPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruny",
3
- "version": "1.43.9",
3
+ "version": "1.43.10",
4
4
  "description": "Find and remove unused Next.js API routes & Nest.js Controllers",
5
5
  "type": "module",
6
6
  "files": [