pruny 1.44.0 → 1.44.1

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 +36 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15980,8 +15980,9 @@ function matchSegments(refSegments, routeSegments, params) {
15980
15980
  const dynMatch = /^\[(.+)\]$/.exec(routeSeg);
15981
15981
  if (dynMatch) {
15982
15982
  const paramName = dynMatch[1];
15983
- if (params && params[paramName]) {
15984
- const ref = refSegments[ri];
15983
+ const ref = refSegments[ri];
15984
+ const isPlaceholder = /^\[.+\]$/.test(ref);
15985
+ if (params && params[paramName] && !isPlaceholder) {
15985
15986
  const allowed = params[paramName];
15986
15987
  let ok = false;
15987
15988
  for (const v of allowed) {
@@ -15997,13 +15998,43 @@ function matchSegments(refSegments, routeSegments, params) {
15997
15998
  si++;
15998
15999
  continue;
15999
16000
  }
16000
- if (refSegments[ri].toLowerCase() !== routeSeg.toLowerCase())
16001
+ const refSeg = refSegments[ri];
16002
+ if (/^\[.+\]$/.test(refSeg)) {
16003
+ ri++;
16004
+ si++;
16005
+ continue;
16006
+ }
16007
+ if (refSeg.toLowerCase() !== routeSeg.toLowerCase())
16001
16008
  return false;
16002
16009
  ri++;
16003
16010
  si++;
16004
16011
  }
16005
16012
  return ri === refSegments.length && si === routeSegments.length;
16006
16013
  }
16014
+ function isRuntimeGeneratedPublicAsset(appDir, linkPath) {
16015
+ if (/^\/(sitemap(?:[-_].+)?\.xml|robots\.txt|manifest\.(?:json|webmanifest)|favicon\.ico|sw\.js|service-worker\.js)$/.test(linkPath)) {
16016
+ return true;
16017
+ }
16018
+ const generatorConfigs = [
16019
+ "next-sitemap.config.js",
16020
+ "next-sitemap.config.mjs",
16021
+ "next-sitemap.config.cjs",
16022
+ "next-sitemap.config.ts"
16023
+ ];
16024
+ if (linkPath.startsWith("/sitemap")) {
16025
+ for (const cfg of generatorConfigs) {
16026
+ if (existsSync7(join7(appDir, cfg)))
16027
+ return true;
16028
+ }
16029
+ for (const ext2 of ["ts", "tsx", "js", "jsx"]) {
16030
+ if (existsSync7(join7(appDir, "app", `sitemap.${ext2}`)))
16031
+ return true;
16032
+ if (existsSync7(join7(appDir, "src/app", `sitemap.${ext2}`)))
16033
+ return true;
16034
+ }
16035
+ }
16036
+ return false;
16037
+ }
16007
16038
  function isGitignoredPublicFile(appDir, linkPath) {
16008
16039
  const publicRelPath = `public${linkPath}`;
16009
16040
  const dirsToCheck = [appDir];
@@ -16118,6 +16149,8 @@ async function scanBrokenLinks(config) {
16118
16149
  continue;
16119
16150
  if (isGitignoredPublicFile(appDir, cleaned))
16120
16151
  continue;
16152
+ if (isRuntimeGeneratedPublicAsset(appDir, cleaned))
16153
+ continue;
16121
16154
  const ignorePatterns = [
16122
16155
  ...config.ignore.links || [],
16123
16156
  ...config.ignore.routes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruny",
3
- "version": "1.44.0",
3
+ "version": "1.44.1",
4
4
  "description": "Find and remove unused Next.js API routes & Nest.js Controllers",
5
5
  "type": "module",
6
6
  "files": [