swynx-lite 1.0.1 → 1.0.2

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Business Source License 1.1
2
+
3
+ Licensor: Swynx (swynx.io)
4
+ Licensed Work: Swynx Lite
5
+ Change Date: Four years from each release date
6
+ Change License: Apache License, Version 2.0
7
+
8
+ For the full BSL 1.1 license text, see: https://mariadb.com/bsl11/
9
+
10
+ Additional Use Grant: You may use the Licensed Work for any purpose,
11
+ including production use, without charge. You may not use the Licensed
12
+ Work to build a competing dead code detection product or service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swynx-lite",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Dead code detection and cleanup for 35 languages",
5
5
  "type": "module",
6
6
  "bin": {
@@ -108,7 +108,7 @@ export function renderScanOutput(results, options = {}) {
108
108
  }
109
109
 
110
110
  if (!verbose && deadFiles.length > 5) {
111
- lines.push(` ${c(DIM, `... and ${deadFiles.length - 5} more`, nc)}`);
111
+ lines.push(` ${c(DIM, `... and ${deadFiles.length - 5} more (use --verbose to show all)`, nc)}`);
112
112
  }
113
113
 
114
114
  lines.push('');
@@ -130,7 +130,7 @@ export function renderScanOutput(results, options = {}) {
130
130
  }
131
131
 
132
132
  if (!verbose && partialFiles.length > 5) {
133
- lines.push(` ${c(DIM, `... and ${partialFiles.length - 5} more`, nc)}`);
133
+ lines.push(` ${c(DIM, `... and ${partialFiles.length - 5} more (use --verbose to show all)`, nc)}`);
134
134
  }
135
135
 
136
136
  lines.push('');
@@ -5979,6 +5979,13 @@ export async function findDeadCode(jsAnalysis, importGraph, projectPath = null,
5979
5979
  }
5980
5980
  if (!content) continue;
5981
5981
 
5982
+ // Developer-override: skip files with explicit "keep" comments in the first ~50 lines
5983
+ // Matches: DO NOT DELETE, DO NOT REMOVE, KEEP THIS FILE, @preserve
5984
+ const head = content.slice(0, 2000);
5985
+ if (/\b(DO\s+NOT\s+(DELETE|REMOVE)|KEEP\s+THIS\s+FILE|@preserve)\b/i.test(head)) {
5986
+ continue;
5987
+ }
5988
+
5982
5989
  // A8: Skip git history when there are many dead files (>200) to avoid thousands of subprocess forks
5983
5990
  // Only fetch git history for the first 200 dead files (sorted by size later)
5984
5991
  const gitHistory = results.fullyDeadFiles.length < 200
@@ -521,7 +521,10 @@ export async function parseJavaScript(file) {
521
521
 
522
522
  } catch (parseError) {
523
523
  // Fallback to regex parsing for files Babel can't handle
524
- console.warn(`[Parser] Babel failed for ${relativePath}, using regex fallback: ${parseError.message}`);
524
+ // Suppress warnings for Vue/Svelte — Babel can't parse the full SFC, regex fallback is expected
525
+ if (!isVueSFC && process.env.SWYNX_VERBOSE) {
526
+ console.warn(`[Parser] Babel failed for ${relativePath}, using regex fallback: ${parseError.message}`);
527
+ }
525
528
  return parseWithRegex(filePath, relativePath, content, lines);
526
529
  }
527
530
  }