yeknal 1.4.0 → 1.4.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.
- package/bin/yeknal.js +32 -2
- package/package.json +1 -1
package/bin/yeknal.js
CHANGED
|
@@ -477,9 +477,36 @@ const SCAN_IGNORE_DIRS = new Set([
|
|
|
477
477
|
"node_modules", ".git", ".next", "dist", "build", ".cache", ".output",
|
|
478
478
|
"coverage", ".nyc_output", "__pycache__", ".venv", "venv", "env",
|
|
479
479
|
".terraform", "vendor", "target", "bin", "obj", ".nuxt", ".svelte-kit",
|
|
480
|
-
".vercel", ".netlify", ".turbo", "out", ".parcel-cache", "tmp",
|
|
480
|
+
".astro", ".vercel", ".netlify", ".turbo", "out", ".parcel-cache", "tmp",
|
|
481
481
|
]);
|
|
482
482
|
|
|
483
|
+
// Dependency backups and similarly named generated/build directories are
|
|
484
|
+
// commonly left beside the working tree after reinstalls or builds.
|
|
485
|
+
const SCAN_IGNORE_DIR_PATTERNS = [
|
|
486
|
+
/^node_modules(?:\.|[-_])(?:bak|backup)(?:[-_.]|$)/i,
|
|
487
|
+
/^(?:vendor|bower_components|\.venv|venv|env)(?:\.|[-_])(?:bak|backup)(?:[-_.]|$)/i,
|
|
488
|
+
/^(?:build|dist|out|coverage|generated|__generated__)(?:\.|[-_])(?:bak|backup)(?:[-_.]|$)/i,
|
|
489
|
+
];
|
|
490
|
+
|
|
491
|
+
// Generated source/config files can contain copied secrets or noisy bundled
|
|
492
|
+
// content that is not the project's authored implementation.
|
|
493
|
+
const SCAN_IGNORE_FILE_PATTERNS = [
|
|
494
|
+
/\.min\.(?:js|css|mjs|cjs)$/i,
|
|
495
|
+
/\.(?:bundle|chunk|generated|gen)\.[^.]+$/i,
|
|
496
|
+
/(?:^|[._-])generated(?:[._-]|$)/i,
|
|
497
|
+
/\.d\.ts$/i,
|
|
498
|
+
/\.map$/i,
|
|
499
|
+
];
|
|
500
|
+
|
|
501
|
+
function isScanIgnoredDirectory(name) {
|
|
502
|
+
const nameLC = name.toLowerCase();
|
|
503
|
+
return SCAN_IGNORE_DIRS.has(nameLC) || SCAN_IGNORE_DIR_PATTERNS.some((pattern) => pattern.test(name));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function isScanIgnoredFile(name) {
|
|
507
|
+
return SCAN_IGNORE_FILE_PATTERNS.some((pattern) => pattern.test(name));
|
|
508
|
+
}
|
|
509
|
+
|
|
483
510
|
const SCAN_SOURCE_EXTENSIONS = new Set([
|
|
484
511
|
".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs",
|
|
485
512
|
".py", ".rb", ".php", ".go", ".rs", ".java", ".cs",
|
|
@@ -555,13 +582,16 @@ async function walkProjectFiles(rootDir) {
|
|
|
555
582
|
const fullPath = path.join(dir, entry.name);
|
|
556
583
|
|
|
557
584
|
if (entry.isDirectory()) {
|
|
558
|
-
if (!
|
|
585
|
+
if (!isScanIgnoredDirectory(entry.name)) {
|
|
559
586
|
await walk(fullPath, depth + 1);
|
|
560
587
|
}
|
|
561
588
|
continue;
|
|
562
589
|
}
|
|
563
590
|
|
|
564
591
|
if (entry.isFile()) {
|
|
592
|
+
if (isScanIgnoredFile(entry.name)) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
565
595
|
const ext = path.extname(entry.name).toLowerCase();
|
|
566
596
|
const nameLC = entry.name.toLowerCase();
|
|
567
597
|
if (SCAN_ALL_EXTENSIONS.has(ext) || nameLC.startsWith(".env")) {
|