pruny 1.7.1 → 1.9.0

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 +28 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9351,8 +9351,16 @@ async function scanUnusedExports(config) {
9351
9351
  let allExportsCount = 0;
9352
9352
  const inlineExportRegex = /^export\s+(?:async\s+)?(?:const|let|var|function|type|interface|enum|class)\s+([a-zA-Z0-9_$]+)/gm;
9353
9353
  const blockExportRegex = /^export\s*\{([^}]+)\}/gm;
9354
+ console.log(`\uD83D\uDCDD Scanning ${allFiles.length} files for exports...`);
9355
+ let processedFiles = 0;
9354
9356
  for (const file of allFiles) {
9355
9357
  try {
9358
+ processedFiles++;
9359
+ if (processedFiles % 10 === 0 || processedFiles === allFiles.length) {
9360
+ const percent = Math.round(processedFiles / allFiles.length * 100);
9361
+ const shortFile = file.length > 50 ? "..." + file.slice(-47) : file;
9362
+ process.stdout.write(`\r Progress: ${processedFiles}/${allFiles.length} (${percent}%) - ${shortFile}${" ".repeat(10)}`);
9363
+ }
9356
9364
  const content = readFileSync3(join3(cwd, file), "utf-8");
9357
9365
  totalContents.set(file, content);
9358
9366
  const lines = content.split(`
@@ -9381,6 +9389,9 @@ async function scanUnusedExports(config) {
9381
9389
  }
9382
9390
  } catch {}
9383
9391
  }
9392
+ if (processedFiles > 0) {
9393
+ process.stdout.write("\r" + " ".repeat(60) + "\r");
9394
+ }
9384
9395
  function addExport(file, name, line) {
9385
9396
  if (name && !IGNORED_EXPORT_NAMES.has(name)) {
9386
9397
  if (!exportMap.has(file))
@@ -9391,6 +9402,7 @@ async function scanUnusedExports(config) {
9391
9402
  return false;
9392
9403
  }
9393
9404
  const unusedExports = [];
9405
+ console.log(`\uD83D\uDD0D Checking usage of ${allExportsCount} exports...`);
9394
9406
  for (const [file, exports] of exportMap.entries()) {
9395
9407
  for (const exp of exports) {
9396
9408
  let isUsed = false;
@@ -9689,7 +9701,22 @@ var DEFAULT_CONFIG = {
9689
9701
  dir: "./",
9690
9702
  ignore: {
9691
9703
  routes: [],
9692
- folders: ["node_modules", ".next", "dist", ".git", "coverage", ".turbo"],
9704
+ folders: [
9705
+ "**/node_modules/**",
9706
+ "**/.next/**",
9707
+ "**/dist/**",
9708
+ "**/.git/**",
9709
+ "**/coverage/**",
9710
+ "**/.turbo/**",
9711
+ "**/build/**",
9712
+ "**/out/**",
9713
+ "**/.cache/**",
9714
+ "**/.vercel/**",
9715
+ "**/.contentlayer/**",
9716
+ "**/.docusaurus/**",
9717
+ "**/target/**",
9718
+ "**/vendor/**"
9719
+ ],
9693
9720
  files: [
9694
9721
  "*.test.ts",
9695
9722
  "*.spec.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruny",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "Find and remove unused Next.js API routes & Nest.js Controllers",
5
5
  "type": "module",
6
6
  "files": [