superjs-core 0.2.0 → 0.3.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 (37) hide show
  1. package/dist/async/index.js.map +1 -1
  2. package/dist/collection/index.js.map +1 -1
  3. package/dist/core/index.js.map +1 -1
  4. package/dist/crypto/index.js.map +1 -1
  5. package/dist/date/index.js.map +1 -1
  6. package/dist/dep-exray/analyzer/index.d.ts +7 -0
  7. package/dist/dep-exray/analyzer/index.js +68 -0
  8. package/dist/dep-exray/analyzer/index.js.map +1 -0
  9. package/dist/dep-exray/cli.d.ts +1 -0
  10. package/dist/dep-exray/cli.js +389 -0
  11. package/dist/dep-exray/cli.js.map +1 -0
  12. package/dist/dep-exray/index.d.ts +5 -0
  13. package/dist/dep-exray/index.js +440 -0
  14. package/dist/dep-exray/index.js.map +1 -0
  15. package/dist/dep-exray/known-mappings.d.ts +17 -0
  16. package/dist/dep-exray/known-mappings.js +122 -0
  17. package/dist/dep-exray/known-mappings.js.map +1 -0
  18. package/dist/dep-exray/reporter/index.d.ts +5 -0
  19. package/dist/dep-exray/reporter/index.js +75 -0
  20. package/dist/dep-exray/reporter/index.js.map +1 -0
  21. package/dist/dep-exray/scanner/index.d.ts +5 -0
  22. package/dist/dep-exray/scanner/index.js +299 -0
  23. package/dist/dep-exray/scanner/index.js.map +1 -0
  24. package/dist/dep-exray/types.d.ts +38 -0
  25. package/dist/dep-exray/types.js +1 -0
  26. package/dist/dep-exray/types.js.map +1 -0
  27. package/dist/index.d.ts +6 -1
  28. package/dist/index.js +439 -814
  29. package/dist/index.js.map +1 -1
  30. package/dist/io/index.js.map +1 -1
  31. package/dist/math/index.d.ts +1 -664
  32. package/dist/math/index.js +1 -822
  33. package/dist/math/index.js.map +1 -1
  34. package/dist/path/index.js.map +1 -1
  35. package/dist/string/index.js.map +1 -1
  36. package/dist/type/index.js.map +1 -1
  37. package/package.json +44 -5
@@ -0,0 +1,389 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/dep-exray/cli.ts
4
+ import { Command } from "commander";
5
+
6
+ // src/dep-exray/scanner/index.ts
7
+ import { readFileSync, readdirSync, existsSync } from "fs";
8
+ import { join, basename } from "path";
9
+
10
+ // src/dep-exray/known-mappings.ts
11
+ var KNOWN_MAPPINGS = [
12
+ {
13
+ name: "lodash",
14
+ size: "4.2 MB",
15
+ replacement: "jscore-core",
16
+ confidence: "high",
17
+ autoPrReady: true,
18
+ reason: "Most lodash functions have direct replacements in jscore-core with 99% API compatibility",
19
+ detectionPattern: `from ['"]lodash['"]|require\\(['"]lodash['"]\\)`
20
+ },
21
+ {
22
+ name: "moment",
23
+ size: "2.5 MB",
24
+ replacement: "jscore-core/date",
25
+ confidence: "high",
26
+ autoPrReady: true,
27
+ reason: "date utilities in jscore-core cover 95% of common moment use cases",
28
+ detectionPattern: `from ['"]moment['"]|require\\(['"]moment['"]\\)`
29
+ },
30
+ {
31
+ name: "date-fns",
32
+ size: "1.2 MB (tree-shaked ~50KB)",
33
+ replacement: "jscore-core/date",
34
+ confidence: "medium",
35
+ autoPrReady: false,
36
+ reason: "Partially overlapping \u2014 jscore-core covers basic date ops but not all locale support",
37
+ detectionPattern: `from ['"]date-fns['"]|require\\(['"]date-fns['"]\\)`
38
+ },
39
+ {
40
+ name: "axios",
41
+ size: "1.6 MB",
42
+ replacement: "native fetch + jscore-core/async/retry",
43
+ confidence: "medium",
44
+ autoPrReady: false,
45
+ reason: "Native fetch covers most use cases; needs manual review for interceptors",
46
+ detectionPattern: `from ['"]axios['"]|require\\(['"]axios['"]\\)`
47
+ },
48
+ {
49
+ name: "uuid",
50
+ size: "30 KB",
51
+ replacement: "crypto.randomUUID() (native)",
52
+ confidence: "high",
53
+ autoPrReady: true,
54
+ reason: "crypto.randomUUID() is available in all modern Node.js and browsers",
55
+ detectionPattern: `from ['"]uuid['"]|require\\(['"]uuid['"]\\)`
56
+ },
57
+ {
58
+ name: "deepmerge",
59
+ size: "15 KB",
60
+ replacement: "jscore-core",
61
+ confidence: "high",
62
+ autoPrReady: true,
63
+ reason: "jscore-core provides deepMerge out of the box",
64
+ detectionPattern: `from ['"]deepmerge['"]|require\\(['"]deepmerge['"]\\)`
65
+ },
66
+ {
67
+ name: "lodash.merge",
68
+ size: "25 KB",
69
+ replacement: "jscore-core",
70
+ confidence: "high",
71
+ autoPrReady: true,
72
+ reason: "jscore-core provides deepMerge out of the box",
73
+ detectionPattern: `from ['"]lodash\\.(merge|clone|pick|omit|get|set)['"]`
74
+ },
75
+ {
76
+ name: "chalk",
77
+ size: "45 KB",
78
+ replacement: "picocolors",
79
+ confidence: "medium",
80
+ autoPrReady: false,
81
+ reason: "picocolors is 3KB vs chalk's 45KB with same API",
82
+ detectionPattern: `from ['"]chalk['"]|require\\(['"]chalk['"]\\)`
83
+ },
84
+ {
85
+ name: "nanoid",
86
+ size: "8 KB",
87
+ replacement: "jscore-core/string (nanoid)",
88
+ confidence: "high",
89
+ autoPrReady: true,
90
+ reason: "jscore-core provides nanoid with same API",
91
+ detectionPattern: `from ['"]nanoid['"]|require\\(['"]nanoid['"]\\)`
92
+ },
93
+ {
94
+ name: "dayjs",
95
+ size: "50 KB",
96
+ replacement: "jscore-core/date",
97
+ confidence: "medium",
98
+ autoPrReady: false,
99
+ reason: "Partially overlapping \u2014 covers basics but not all plugins",
100
+ detectionPattern: `from ['"]dayjs['"]|require\\(['"]dayjs['"]\\)`
101
+ },
102
+ {
103
+ name: "clsx",
104
+ size: "5 KB",
105
+ replacement: "native template literals",
106
+ confidence: "high",
107
+ autoPrReady: true,
108
+ reason: "Can be replaced with simple template literal conditional pattern",
109
+ detectionPattern: `from ['"]clsx['"]|require\\(['"]clsx['"]\\)`
110
+ }
111
+ ];
112
+ var KNOWN_CVES = {
113
+ "ansi-regex": [
114
+ { cve: "CVE-2021-3807", severity: "high", fix: "Update to ansi-regex@6.0.1 or later" }
115
+ ],
116
+ "semver": [
117
+ { cve: "CVE-2022-25883", severity: "medium", fix: "Update to semver@7.5.2 or later" }
118
+ ],
119
+ "json5": [
120
+ { cve: "CVE-2022-46175", severity: "high", fix: "Update to json5@2.2.3 or later" }
121
+ ],
122
+ "lodash": [
123
+ { cve: "CVE-2020-28502", severity: "high", fix: "Update to lodash@4.17.21 or later" },
124
+ { cve: "CVE-2020-8203", severity: "medium", fix: "Update to lodash@4.17.21 or later" }
125
+ ]
126
+ };
127
+
128
+ // src/dep-exray/scanner/index.ts
129
+ function parsePackageJson(path) {
130
+ const raw = readFileSync(path, "utf-8");
131
+ const json = JSON.parse(raw);
132
+ return {
133
+ name: json.name ?? basename(join(path, "..")),
134
+ dependencies: json.dependencies ?? {},
135
+ devDependencies: json.devDependencies ?? {}
136
+ };
137
+ }
138
+ function parseLockfile(projectPath) {
139
+ const lockPath = join(projectPath, "package-lock.json");
140
+ if (!existsSync(lockPath)) return null;
141
+ try {
142
+ const raw = readFileSync(lockPath, "utf-8");
143
+ const json = JSON.parse(raw);
144
+ const packages = {};
145
+ if (json.packages) {
146
+ for (const [key, val] of Object.entries(json.packages)) {
147
+ if (key) {
148
+ packages[key] = val;
149
+ }
150
+ }
151
+ }
152
+ if (json.dependencies && Object.keys(packages).length === 0) {
153
+ for (const [key, val] of Object.entries(json.dependencies)) {
154
+ packages[key] = { version: val.version, dependencies: val.requires };
155
+ }
156
+ }
157
+ return { packages };
158
+ } catch {
159
+ return null;
160
+ }
161
+ }
162
+ function detectImportInFile(filePath, regex) {
163
+ try {
164
+ const content = readFileSync(filePath, "utf-8");
165
+ return regex.test(content);
166
+ } catch {
167
+ return false;
168
+ }
169
+ }
170
+ function detectImportsInSrc(projectPath, mapping) {
171
+ const regex = new RegExp(mapping.detectionPattern);
172
+ const srcDir = join(projectPath, "src");
173
+ if (!existsSync(srcDir)) return false;
174
+ try {
175
+ const files = collectSourceFiles(srcDir);
176
+ for (const file of files) {
177
+ if (detectImportInFile(file, regex)) return true;
178
+ }
179
+ } catch {
180
+ return false;
181
+ }
182
+ return false;
183
+ }
184
+ function collectSourceFiles(dir) {
185
+ const results = [];
186
+ try {
187
+ const entries = readdirSync(dir, { withFileTypes: true });
188
+ for (const entry of entries) {
189
+ if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git" || entry.name === "coverage" || entry.name === ".tsup") {
190
+ continue;
191
+ }
192
+ const full = join(dir, entry.name);
193
+ if (entry.isDirectory()) {
194
+ results.push(...collectSourceFiles(full));
195
+ } else if (entry.isFile()) {
196
+ const ext = entry.name.split(".").pop();
197
+ if (ext === "ts" || ext === "tsx" || ext === "js" || ext === "jsx" || ext === "mjs" || ext === "cjs") {
198
+ results.push(full);
199
+ }
200
+ }
201
+ }
202
+ } catch {
203
+ }
204
+ return results;
205
+ }
206
+ function estimateTransitiveCount(lockfile, directNames) {
207
+ if (!lockfile) return 0;
208
+ let count = 0;
209
+ for (const key of Object.keys(lockfile.packages)) {
210
+ if (!key || key === "") continue;
211
+ const name = key.startsWith("node_modules/") ? key.slice("node_modules/".length) : key;
212
+ const rootName = name.startsWith("@") ? `${name.split("/")[0]}/${name.split("/")[1]}` : name.split("/")[0];
213
+ if (rootName && !directNames.has(rootName)) {
214
+ count++;
215
+ }
216
+ }
217
+ return count;
218
+ }
219
+ function parseSize(value) {
220
+ const cleaned = value.replace(/\(.*?\)/g, "").trim();
221
+ const match = cleaned.match(/^([\d.]+)\s*(KB|MB)/i);
222
+ if (!match) return 0;
223
+ const num = Number.parseFloat(match[1]);
224
+ if (!match[2]) return 0;
225
+ if (match[2].toUpperCase() === "MB") return num * 1024;
226
+ return num;
227
+ }
228
+ async function scanProject(config) {
229
+ const projectPath = config.path ?? ".";
230
+ const pkgPath = join(projectPath, "package.json");
231
+ if (!existsSync(pkgPath)) {
232
+ throw new Error(`No package.json found at ${projectPath}. Run dep-exray in a JavaScript/TypeScript project directory.`);
233
+ }
234
+ const pkg = parsePackageJson(pkgPath);
235
+ const lockfile = parseLockfile(projectPath);
236
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
237
+ const directNames = new Set(Object.keys(allDeps));
238
+ const transitiveCount = estimateTransitiveCount(lockfile, directNames);
239
+ const highImpactReplacements = [];
240
+ const mediumImpactReplacements = [];
241
+ const securityIssues = [];
242
+ const sizeMap = {};
243
+ for (const m of KNOWN_MAPPINGS) {
244
+ sizeMap[m.name] = m.size;
245
+ }
246
+ for (const mapping of KNOWN_MAPPINGS) {
247
+ const isDirect = directNames.has(mapping.name);
248
+ if (!isDirect) continue;
249
+ const isUsed = detectImportsInSrc(projectPath, mapping);
250
+ if (!isUsed && !config.verbose) continue;
251
+ const mappingSize = parseSize(sizeMap[mapping.name] ?? "0 KB");
252
+ const replacementSize = mapping.replacement.startsWith("native") ? 0 : 5;
253
+ const reductionStr = mappingSize > 1024 ? `${(mappingSize / 1024).toFixed(1)} MB \u2192 ${replacementSize} KB` : `${mappingSize.toFixed(0)} KB \u2192 ${replacementSize} KB`;
254
+ const suggestion = {
255
+ packageName: mapping.name,
256
+ reason: mapping.reason,
257
+ replacement: mapping.replacement,
258
+ estimatedSizeReduction: reductionStr,
259
+ confidence: mapping.confidence,
260
+ autoPrReady: mapping.autoPrReady
261
+ };
262
+ if (mapping.confidence === "high") {
263
+ highImpactReplacements.push(suggestion);
264
+ } else {
265
+ mediumImpactReplacements.push(suggestion);
266
+ }
267
+ }
268
+ for (const [name, cves] of Object.entries(KNOWN_CVES)) {
269
+ if (directNames.has(name)) {
270
+ for (const cveItem of cves) {
271
+ securityIssues.push({
272
+ packageName: name,
273
+ cveId: cveItem.cve,
274
+ severity: cveItem.severity,
275
+ fix: cveItem.fix
276
+ });
277
+ }
278
+ }
279
+ }
280
+ let totalSizeKB = 0;
281
+ for (const depName of directNames) {
282
+ const sizeStr = sizeMap[depName];
283
+ if (sizeStr) {
284
+ totalSizeKB += parseSize(sizeStr);
285
+ } else {
286
+ totalSizeKB += 50;
287
+ }
288
+ }
289
+ totalSizeKB += transitiveCount * 30;
290
+ const totalSizeStr = totalSizeKB > 1024 ? `${(totalSizeKB / 1024).toFixed(1)} MB` : `${totalSizeKB.toFixed(0)} KB`;
291
+ return {
292
+ projectName: pkg.name,
293
+ directDeps: directNames.size,
294
+ transitiveDeps: transitiveCount,
295
+ totalEstimatedSize: totalSizeStr,
296
+ highImpactReplacements,
297
+ mediumImpactReplacements,
298
+ securityIssues
299
+ };
300
+ }
301
+
302
+ // src/dep-exray/reporter/index.ts
303
+ import pc from "picocolors";
304
+ function severityColor(severity) {
305
+ switch (severity) {
306
+ case "critical":
307
+ return pc.bold(pc.red(severity.toUpperCase()));
308
+ case "high":
309
+ return pc.red(severity.toUpperCase());
310
+ case "medium":
311
+ return pc.yellow(severity.toUpperCase());
312
+ case "low":
313
+ return pc.dim(severity.toUpperCase());
314
+ }
315
+ }
316
+ function confidenceIcon(confidence) {
317
+ switch (confidence) {
318
+ case "high":
319
+ return pc.green("\u25CF");
320
+ case "medium":
321
+ return pc.yellow("\u25CF");
322
+ case "low":
323
+ return pc.red("\u25CF");
324
+ }
325
+ }
326
+ function generateReport(result, jsonOutput) {
327
+ if (jsonOutput) {
328
+ return JSON.stringify(result, null, 2);
329
+ }
330
+ const lines = [];
331
+ lines.push(pc.bold(pc.cyan(`\u250C${"\u2500".repeat(58)}\u2510`)));
332
+ lines.push(pc.bold(pc.cyan(`\u2502${" ".repeat(18)}dep-exray Report${" ".repeat(21)}\u2502`)));
333
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
334
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.white("\u{1F4E6} PROJECT:")} ${pc.bold(result.projectName)}${" ".repeat(Math.max(1, 47 - result.projectName.length))}\u2502`)));
335
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.white("\u{1F4CA} DEPENDENCIES:")} ${pc.bold(String(result.directDeps))} direct + ${pc.bold(String(result.transitiveDeps))} transitive${" ".repeat(Math.max(1, 27 - String(result.transitiveDeps).length))}\u2502`)));
336
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.white("\u{1F4BE} TOTAL SIZE:")} ${pc.bold(result.totalEstimatedSize)}${" ".repeat(Math.max(1, 42 - result.totalEstimatedSize.length))}\u2502`)));
337
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
338
+ if (result.highImpactReplacements.length > 0) {
339
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.green("\u{1F7E2}")} ${pc.bold(pc.green("HIGH IMPACT REPLACEMENTS"))}${" ".repeat(23)}\u2502`)));
340
+ for (const item of result.highImpactReplacements) {
341
+ const autoPr = item.autoPrReady ? pc.green("\u2713 Auto-PR ready") : pc.dim("Manual review needed");
342
+ const confIcon = confidenceIcon(item.confidence);
343
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
344
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.red("\u2717")} ${pc.bold(item.packageName)} (${item.estimatedSizeReduction})${" ".repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}\u2502`)));
345
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.dim("\u2192")} ${pc.cyan(item.replacement)}${" ".repeat(Math.max(1, 51 - item.replacement.length))}\u2502`)));
346
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.dim("\u2514\u2500")} ${autoPr} ${confIcon} ${item.confidence}${" ".repeat(Math.max(1, 35))}\u2502`)));
347
+ }
348
+ }
349
+ if (result.mediumImpactReplacements.length > 0) {
350
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
351
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.yellow("\u{1F7E1}")} ${pc.bold(pc.yellow("MEDIUM IMPACT REPLACEMENTS"))}${" ".repeat(20)}\u2502`)));
352
+ for (const item of result.mediumImpactReplacements) {
353
+ const autoPr = item.autoPrReady ? pc.green("\u2713 Auto-PR ready") : pc.dim("Manual review needed");
354
+ const confIcon = confidenceIcon(item.confidence);
355
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
356
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.red("\u2717")} ${pc.bold(item.packageName)} (${item.estimatedSizeReduction})${" ".repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}\u2502`)));
357
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.dim("\u2192")} ${pc.cyan(item.replacement)}${" ".repeat(Math.max(1, 51 - item.replacement.length))}\u2502`)));
358
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.dim("\u2514\u2500")} ${autoPr} ${confIcon} ${item.confidence}${" ".repeat(Math.max(1, 35))}\u2502`)));
359
+ }
360
+ }
361
+ if (result.securityIssues.length > 0) {
362
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
363
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.red("\u{1F534}")} ${pc.bold(pc.red("SECURITY ISSUES"))}${" ".repeat(33)}\u2502`)));
364
+ for (const issue of result.securityIssues) {
365
+ lines.push(pc.bold(pc.cyan(`\u251C${"\u2500".repeat(58)}\u2524`)));
366
+ lines.push(pc.bold(pc.cyan(`\u2502 ${severityColor(issue.severity)} ${pc.bold(issue.cveId)} in ${issue.packageName}${" ".repeat(Math.max(1, 40 - issue.packageName.length))}\u2502`)));
367
+ lines.push(pc.bold(pc.cyan(`\u2502 ${pc.dim("\u2192")} ${issue.fix}${" ".repeat(Math.max(1, 52 - issue.fix.length))}\u2502`)));
368
+ }
369
+ }
370
+ lines.push(pc.bold(pc.cyan(`\u2514${"\u2500".repeat(58)}\u2518`)));
371
+ return lines.join("\n");
372
+ }
373
+
374
+ // src/dep-exray/cli.ts
375
+ var program = new Command();
376
+ program.name("dep-exray").description("Dependency health scanner for JavaScript/TypeScript projects").version("0.1.0").argument("[path]", "Project path to scan", ".").option("-j, --json", "Output as JSON").option("-v, --verbose", "Verbose output").option("--fix", "Auto-generate migration PRs").action(async (path, options) => {
377
+ try {
378
+ const result = await scanProject({ path, verbose: options.verbose, jsonOutput: options.json });
379
+ console.log(generateReport(result, options.json));
380
+ } catch (error) {
381
+ const message = error instanceof Error ? error.message : String(error);
382
+ console.error(`
383
+ \u2716 ${message}
384
+ `);
385
+ process.exit(1);
386
+ }
387
+ });
388
+ program.parse();
389
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/dep-exray/cli.ts","../../src/dep-exray/scanner/index.ts","../../src/dep-exray/known-mappings.ts","../../src/dep-exray/reporter/index.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport { Command } from 'commander'\r\nimport { scanProject } from './scanner/index.js'\r\nimport { generateReport } from './reporter/index.js'\r\n\r\nconst program = new Command()\r\n\r\nprogram\r\n .name('dep-exray')\r\n .description('Dependency health scanner for JavaScript/TypeScript projects')\r\n .version('0.1.0')\r\n .argument('[path]', 'Project path to scan', '.')\r\n .option('-j, --json', 'Output as JSON')\r\n .option('-v, --verbose', 'Verbose output')\r\n .option('--fix', 'Auto-generate migration PRs')\r\n .action(async (path: string, options: { json?: boolean; verbose?: boolean; fix?: boolean }) => {\r\n try {\r\n const result = await scanProject({ path, verbose: options.verbose, jsonOutput: options.json })\r\n console.log(generateReport(result, options.json))\r\n } catch (error) {\r\n const message = error instanceof Error ? error.message : String(error)\r\n console.error(`\\n ✖ ${message}\\n`)\r\n process.exit(1)\r\n }\r\n })\r\n\r\nprogram.parse()\r\n","import { readFileSync, readdirSync, existsSync } from 'node:fs'\r\nimport { join, basename } from 'node:path'\r\nimport type { ScanResult, ReplacementSuggestion, SecurityIssue, ScannerConfig } from '../types.js'\r\nimport { KNOWN_MAPPINGS, KNOWN_CVES, type PackageMapping } from '../known-mappings.js'\r\n\r\ninterface LockfilePackages {\r\n [key: string]: { version?: string; dependencies?: Record<string, string> } | undefined\r\n}\r\n\r\ninterface LockfileData {\r\n packages: LockfilePackages\r\n}\r\n\r\nfunction parsePackageJson(path: string): { name: string; dependencies: Record<string, string>; devDependencies: Record<string, string> } {\r\n const raw = readFileSync(path, 'utf-8')\r\n const json = JSON.parse(raw)\r\n return {\r\n name: json.name ?? basename(join(path, '..')),\r\n dependencies: (json.dependencies as Record<string, string>) ?? {},\r\n devDependencies: (json.devDependencies as Record<string, string>) ?? {},\r\n }\r\n}\r\n\r\nfunction parseLockfile(projectPath: string): LockfileData | null {\r\n const lockPath = join(projectPath, 'package-lock.json')\r\n if (!existsSync(lockPath)) return null\r\n try {\r\n const raw = readFileSync(lockPath, 'utf-8')\r\n const json = JSON.parse(raw)\r\n const packages: LockfilePackages = {}\r\n\r\n if (json.packages) {\r\n for (const [key, val] of Object.entries(json.packages as Record<string, { version?: string }>)) {\r\n if (key) {\r\n packages[key] = val\r\n }\r\n }\r\n }\r\n\r\n if (json.dependencies && Object.keys(packages).length === 0) {\r\n for (const [key, val] of Object.entries(json.dependencies as Record<string, { version?: string; requires?: Record<string, string> }>)) {\r\n packages[key] = { version: val.version, dependencies: val.requires }\r\n }\r\n }\r\n\r\n return { packages }\r\n } catch {\r\n return null\r\n }\r\n}\r\n\r\nfunction detectImportInFile(filePath: string, regex: RegExp): boolean {\r\n try {\r\n const content = readFileSync(filePath, 'utf-8')\r\n return regex.test(content)\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\nfunction detectImportsInSrc(projectPath: string, mapping: PackageMapping): boolean {\r\n const regex = new RegExp(mapping.detectionPattern)\r\n const srcDir = join(projectPath, 'src')\r\n if (!existsSync(srcDir)) return false\r\n\r\n try {\r\n const files = collectSourceFiles(srcDir)\r\n for (const file of files) {\r\n if (detectImportInFile(file, regex)) return true\r\n }\r\n } catch {\r\n return false\r\n }\r\n return false\r\n}\r\n\r\nfunction collectSourceFiles(dir: string): string[] {\r\n const results: string[] = []\r\n try {\r\n const entries = readdirSync(dir, { withFileTypes: true })\r\n for (const entry of entries) {\r\n if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name === '.git' || entry.name === 'coverage' || entry.name === '.tsup') {\r\n continue\r\n }\r\n const full = join(dir, entry.name)\r\n if (entry.isDirectory()) {\r\n results.push(...collectSourceFiles(full))\r\n } else if (entry.isFile()) {\r\n const ext = entry.name.split('.').pop()\r\n if (ext === 'ts' || ext === 'tsx' || ext === 'js' || ext === 'jsx' || ext === 'mjs' || ext === 'cjs') {\r\n results.push(full)\r\n }\r\n }\r\n }\r\n } catch {\r\n // skip inaccessible dirs\r\n }\r\n return results\r\n}\r\n\r\nfunction estimateTransitiveCount(lockfile: LockfileData | null, directNames: Set<string>): number {\r\n if (!lockfile) return 0\r\n let count = 0\r\n for (const key of Object.keys(lockfile.packages)) {\r\n if (!key || key === '') continue\r\n const name = key.startsWith('node_modules/') ? key.slice('node_modules/'.length) : key\r\n const rootName = name.startsWith('@') ? `${name.split('/')[0]}/${name.split('/')[1]}` : name.split('/')[0]\r\n if (rootName && !directNames.has(rootName)) {\r\n count++\r\n }\r\n }\r\n return count\r\n}\r\n\r\nfunction parseSize(value: string): number {\r\n const cleaned = value.replace(/\\(.*?\\)/g, '').trim()\r\n const match = cleaned.match(/^([\\d.]+)\\s*(KB|MB)/i)\r\n if (!match) return 0\r\n const num = Number.parseFloat(match[1]!)\r\n if (!match[2]) return 0\r\n if (match[2].toUpperCase() === 'MB') return num * 1024\r\n return num\r\n}\r\n\r\nexport async function scanProject(config: ScannerConfig): Promise<ScanResult> {\r\n const projectPath = config.path ?? '.'\r\n const pkgPath = join(projectPath, 'package.json')\r\n\r\n if (!existsSync(pkgPath)) {\r\n throw new Error(`No package.json found at ${projectPath}. Run dep-exray in a JavaScript/TypeScript project directory.`)\r\n }\r\n\r\n const pkg = parsePackageJson(pkgPath)\r\n const lockfile = parseLockfile(projectPath)\r\n\r\n const allDeps: Record<string, string> = { ...pkg.dependencies, ...pkg.devDependencies }\r\n const directNames = new Set(Object.keys(allDeps))\r\n\r\n const transitiveCount = estimateTransitiveCount(lockfile, directNames)\r\n\r\n const highImpactReplacements: ReplacementSuggestion[] = []\r\n const mediumImpactReplacements: ReplacementSuggestion[] = []\r\n const securityIssues: SecurityIssue[] = []\r\n\r\n const sizeMap: Record<string, string> = {}\r\n for (const m of KNOWN_MAPPINGS) {\r\n sizeMap[m.name] = m.size\r\n }\r\n\r\n for (const mapping of KNOWN_MAPPINGS) {\r\n const isDirect = directNames.has(mapping.name)\r\n if (!isDirect) continue\r\n\r\n const isUsed = detectImportsInSrc(projectPath, mapping)\r\n if (!isUsed && !config.verbose) continue\r\n\r\n const mappingSize = parseSize(sizeMap[mapping.name] ?? '0 KB')\r\n const replacementSize = mapping.replacement.startsWith('native') ? 0 : 5\r\n const reductionStr = mappingSize > 1024\r\n ? `${(mappingSize / 1024).toFixed(1)} MB → ${replacementSize} KB`\r\n : `${mappingSize.toFixed(0)} KB → ${replacementSize} KB`\r\n\r\n const suggestion: ReplacementSuggestion = {\r\n packageName: mapping.name,\r\n reason: mapping.reason,\r\n replacement: mapping.replacement,\r\n estimatedSizeReduction: reductionStr,\r\n confidence: mapping.confidence,\r\n autoPrReady: mapping.autoPrReady,\r\n }\r\n\r\n if (mapping.confidence === 'high') {\r\n highImpactReplacements.push(suggestion)\r\n } else {\r\n mediumImpactReplacements.push(suggestion)\r\n }\r\n }\r\n\r\n for (const [name, cves] of Object.entries(KNOWN_CVES)) {\r\n if (directNames.has(name)) {\r\n for (const cveItem of cves) {\r\n securityIssues.push({\r\n packageName: name,\r\n cveId: cveItem.cve,\r\n severity: cveItem.severity as SecurityIssue['severity'],\r\n fix: cveItem.fix,\r\n })\r\n }\r\n }\r\n }\r\n\r\n let totalSizeKB = 0\r\n for (const depName of directNames) {\r\n const sizeStr = sizeMap[depName]\r\n if (sizeStr) {\r\n totalSizeKB += parseSize(sizeStr)\r\n } else {\r\n totalSizeKB += 50\r\n }\r\n }\r\n totalSizeKB += transitiveCount * 30\r\n\r\n const totalSizeStr = totalSizeKB > 1024\r\n ? `${(totalSizeKB / 1024).toFixed(1)} MB`\r\n : `${totalSizeKB.toFixed(0)} KB`\r\n\r\n return {\r\n projectName: pkg.name,\r\n directDeps: directNames.size,\r\n transitiveDeps: transitiveCount,\r\n totalEstimatedSize: totalSizeStr,\r\n highImpactReplacements,\r\n mediumImpactReplacements,\r\n securityIssues,\r\n }\r\n}\r\n","\r\n\r\nexport interface PackageMapping {\r\n name: string\r\n size: string\r\n replacement: string\r\n confidence: 'high' | 'medium' | 'low'\r\n autoPrReady: boolean\r\n reason: string\r\n detectionPattern: string\r\n}\r\n\r\nexport const KNOWN_MAPPINGS: PackageMapping[] = [\r\n {\r\n name: 'lodash',\r\n size: '4.2 MB',\r\n replacement: 'jscore-core',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'Most lodash functions have direct replacements in jscore-core with 99% API compatibility',\r\n detectionPattern: 'from [\\'\"]lodash[\\'\"]|require\\\\([\\'\"]lodash[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'moment',\r\n size: '2.5 MB',\r\n replacement: 'jscore-core/date',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'date utilities in jscore-core cover 95% of common moment use cases',\r\n detectionPattern: 'from [\\'\"]moment[\\'\"]|require\\\\([\\'\"]moment[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'date-fns',\r\n size: '1.2 MB (tree-shaked ~50KB)',\r\n replacement: 'jscore-core/date',\r\n confidence: 'medium',\r\n autoPrReady: false,\r\n reason: 'Partially overlapping — jscore-core covers basic date ops but not all locale support',\r\n detectionPattern: 'from [\\'\"]date-fns[\\'\"]|require\\\\([\\'\"]date-fns[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'axios',\r\n size: '1.6 MB',\r\n replacement: 'native fetch + jscore-core/async/retry',\r\n confidence: 'medium',\r\n autoPrReady: false,\r\n reason: 'Native fetch covers most use cases; needs manual review for interceptors',\r\n detectionPattern: 'from [\\'\"]axios[\\'\"]|require\\\\([\\'\"]axios[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'uuid',\r\n size: '30 KB',\r\n replacement: 'crypto.randomUUID() (native)',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'crypto.randomUUID() is available in all modern Node.js and browsers',\r\n detectionPattern: 'from [\\'\"]uuid[\\'\"]|require\\\\([\\'\"]uuid[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'deepmerge',\r\n size: '15 KB',\r\n replacement: 'jscore-core',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'jscore-core provides deepMerge out of the box',\r\n detectionPattern: 'from [\\'\"]deepmerge[\\'\"]|require\\\\([\\'\"]deepmerge[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'lodash.merge',\r\n size: '25 KB',\r\n replacement: 'jscore-core',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'jscore-core provides deepMerge out of the box',\r\n detectionPattern: 'from [\\'\"]lodash\\\\.(merge|clone|pick|omit|get|set)[\\'\"]',\r\n },\r\n {\r\n name: 'chalk',\r\n size: '45 KB',\r\n replacement: 'picocolors',\r\n confidence: 'medium',\r\n autoPrReady: false,\r\n reason: \"picocolors is 3KB vs chalk's 45KB with same API\",\r\n detectionPattern: 'from [\\'\"]chalk[\\'\"]|require\\\\([\\'\"]chalk[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'nanoid',\r\n size: '8 KB',\r\n replacement: 'jscore-core/string (nanoid)',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'jscore-core provides nanoid with same API',\r\n detectionPattern: 'from [\\'\"]nanoid[\\'\"]|require\\\\([\\'\"]nanoid[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'dayjs',\r\n size: '50 KB',\r\n replacement: 'jscore-core/date',\r\n confidence: 'medium',\r\n autoPrReady: false,\r\n reason: 'Partially overlapping — covers basics but not all plugins',\r\n detectionPattern: 'from [\\'\"]dayjs[\\'\"]|require\\\\([\\'\"]dayjs[\\'\"]\\\\)',\r\n },\r\n {\r\n name: 'clsx',\r\n size: '5 KB',\r\n replacement: 'native template literals',\r\n confidence: 'high',\r\n autoPrReady: true,\r\n reason: 'Can be replaced with simple template literal conditional pattern',\r\n detectionPattern: 'from [\\'\"]clsx[\\'\"]|require\\\\([\\'\"]clsx[\\'\"]\\\\)',\r\n },\r\n]\r\n\r\nexport const KNOWN_CVES: Record<string, { cve: string; severity: string; fix: string }[]> = {\r\n 'ansi-regex': [\r\n { cve: 'CVE-2021-3807', severity: 'high', fix: 'Update to ansi-regex@6.0.1 or later' },\r\n ],\r\n 'semver': [\r\n { cve: 'CVE-2022-25883', severity: 'medium', fix: 'Update to semver@7.5.2 or later' },\r\n ],\r\n 'json5': [\r\n { cve: 'CVE-2022-46175', severity: 'high', fix: 'Update to json5@2.2.3 or later' },\r\n ],\r\n 'lodash': [\r\n { cve: 'CVE-2020-28502', severity: 'high', fix: 'Update to lodash@4.17.21 or later' },\r\n { cve: 'CVE-2020-8203', severity: 'medium', fix: 'Update to lodash@4.17.21 or later' },\r\n ],\r\n}\r\n","import pc from 'picocolors'\r\nimport type { ScanResult, ReplacementSuggestion, SecurityIssue } from '../types.js'\r\n\r\nfunction severityColor(severity: SecurityIssue['severity']): string {\r\n switch (severity) {\r\n case 'critical': return pc.bold(pc.red(severity.toUpperCase()))\r\n case 'high': return pc.red(severity.toUpperCase())\r\n case 'medium': return pc.yellow(severity.toUpperCase())\r\n case 'low': return pc.dim(severity.toUpperCase())\r\n }\r\n}\r\n\r\nfunction confidenceIcon(confidence: ReplacementSuggestion['confidence']): string {\r\n switch (confidence) {\r\n case 'high': return pc.green('●')\r\n case 'medium': return pc.yellow('●')\r\n case 'low': return pc.red('●')\r\n }\r\n}\r\n\r\nexport function generateReport(result: ScanResult, jsonOutput?: boolean): string {\r\n if (jsonOutput) {\r\n return JSON.stringify(result, null, 2)\r\n }\r\n\r\n const lines: string[] = []\r\n\r\n // ┌─┐│└┘─\r\n lines.push(pc.bold(pc.cyan(`┌${'─'.repeat(58)}┐`)))\r\n lines.push(pc.bold(pc.cyan(`│${' '.repeat(18)}dep-exray Report${' '.repeat(21)}│`)))\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.white('📦 PROJECT:')} ${pc.bold(result.projectName)}${' '.repeat(Math.max(1, 47 - result.projectName.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.white('📊 DEPENDENCIES:')} ${pc.bold(String(result.directDeps))} direct + ${pc.bold(String(result.transitiveDeps))} transitive${' '.repeat(Math.max(1, 27 - String(result.transitiveDeps).length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.white('💾 TOTAL SIZE:')} ${pc.bold(result.totalEstimatedSize)}${' '.repeat(Math.max(1, 42 - result.totalEstimatedSize.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n\r\n if (result.highImpactReplacements.length > 0) {\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.green('🟢')} ${pc.bold(pc.green('HIGH IMPACT REPLACEMENTS'))}${' '.repeat(23)}│`)))\r\n for (const item of result.highImpactReplacements) {\r\n const autoPr = item.autoPrReady ? pc.green('✓ Auto-PR ready') : pc.dim('Manual review needed')\r\n const confIcon = confidenceIcon(item.confidence)\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.red('✗')} ${pc.bold(item.packageName)} (${item.estimatedSizeReduction})${' '.repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.dim('→')} ${pc.cyan(item.replacement)}${' '.repeat(Math.max(1, 51 - item.replacement.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.dim('└─')} ${autoPr} ${confIcon} ${item.confidence}${' '.repeat(Math.max(1, 35))}│`)))\r\n }\r\n }\r\n\r\n if (result.mediumImpactReplacements.length > 0) {\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.yellow('🟡')} ${pc.bold(pc.yellow('MEDIUM IMPACT REPLACEMENTS'))}${' '.repeat(20)}│`)))\r\n for (const item of result.mediumImpactReplacements) {\r\n const autoPr = item.autoPrReady ? pc.green('✓ Auto-PR ready') : pc.dim('Manual review needed')\r\n const confIcon = confidenceIcon(item.confidence)\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.red('✗')} ${pc.bold(item.packageName)} (${item.estimatedSizeReduction})${' '.repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.dim('→')} ${pc.cyan(item.replacement)}${' '.repeat(Math.max(1, 51 - item.replacement.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.dim('└─')} ${autoPr} ${confIcon} ${item.confidence}${' '.repeat(Math.max(1, 35))}│`)))\r\n }\r\n }\r\n\r\n if (result.securityIssues.length > 0) {\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.red('🔴')} ${pc.bold(pc.red('SECURITY ISSUES'))}${' '.repeat(33)}│`)))\r\n for (const issue of result.securityIssues) {\r\n lines.push(pc.bold(pc.cyan(`├${'─'.repeat(58)}┤`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${severityColor(issue.severity)} ${pc.bold(issue.cveId)} in ${issue.packageName}${' '.repeat(Math.max(1, 40 - issue.packageName.length))}│`)))\r\n lines.push(pc.bold(pc.cyan(`│ ${pc.dim('→')} ${issue.fix}${' '.repeat(Math.max(1, 52 - issue.fix.length))}│`)))\r\n }\r\n }\r\n\r\n lines.push(pc.bold(pc.cyan(`└${'─'.repeat(58)}┘`)))\r\n\r\n return lines.join('\\n')\r\n}\r\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACDxB,SAAS,cAAc,aAAa,kBAAkB;AACtD,SAAS,MAAM,gBAAgB;;;ACWxB,IAAM,iBAAm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AM,SAAS,MAAM,YAAY,EAAE,MAAM,SAAS,QAAQ,SAAS,YAAY,QAAQ,KAAK,CAAC;AAC7F,YAAQ,IAAI,eAAe,QAAQ,QAAQ,IAAI,CAAC;AAAA,EAClD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,YAAQ,MAAM;AAAA,WAAS,OAAO;AAAA,CAAI;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QAAQ,MAAM;","names":[]}
@@ -0,0 +1,5 @@
1
+ export { scanProject } from './scanner/index.js';
2
+ export { generateReport } from './reporter/index.js';
3
+ export { analyzeUsage } from './analyzer/index.js';
4
+ export { DependencyInfo, ReplacementSuggestion, ScanResult, ScannerConfig, SecurityIssue } from './types.js';
5
+ export { KNOWN_CVES, KNOWN_MAPPINGS } from './known-mappings.js';