pruny 1.45.0 → 1.45.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 +2 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14992,7 +14992,8 @@ async function scanUnusedExports(config, routes = [], options = {}) {
14992
14992
  const isGeneric = GENERIC_METHOD_NAMES.has(exp.name);
14993
14993
  const hasSelfImport = new RegExp(`import.*\\b${escapeRegExp(exp.name)}\\b.*from`).test(content);
14994
14994
  const hasSelfDecl = new RegExp(`(?:export\\s+)?(?:abstract\\s+)?(?:interface|class|enum)\\s+${escapeRegExp(exp.name)}\\b|` + `(?:export\\s+)?(?:async\\s+)?(?:function)\\s+${escapeRegExp(exp.name)}\\b|` + `(?:export\\s+)?(?:const|let|var|type)\\s+${escapeRegExp(exp.name)}\\s*[=<]`).test(content);
14995
- if (hasSelfDecl && !hasSelfImport)
14995
+ const hasDynamicImportRef = /import\s*\(/.test(content) && new RegExp(`\\.${escapeRegExp(exp.name)}\\b`).test(content);
14996
+ if (hasSelfDecl && !hasSelfImport && !hasDynamicImportRef)
14996
14997
  continue;
14997
14998
  if (!hasIgnoreRanges && !isGeneric) {
14998
14999
  const jsxPattern = new RegExp(`<${exp.name}[\\s/>]`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruny",
3
- "version": "1.45.0",
3
+ "version": "1.45.1",
4
4
  "description": "Find and remove unused Next.js API routes & Nest.js Controllers",
5
5
  "type": "module",
6
6
  "files": [