@aiready/deps 0.14.9 → 0.14.12

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.
@@ -1,89 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/analyzer.ts
9
- import { calculateDependencyHealth } from "@aiready/core";
10
- import { readFileSync, existsSync } from "fs";
11
- import { join } from "path";
12
- async function analyzeDeps(options) {
13
- const rootDir = options.rootDir;
14
- const packageJsonPath = join(rootDir, "package.json");
15
- let totalPackages = 0;
16
- let outdatedPackages = 0;
17
- let deprecatedPackages = 0;
18
- let trainingCutoffSkew = 0;
19
- const issues = [];
20
- if (existsSync(packageJsonPath)) {
21
- try {
22
- const content = readFileSync(packageJsonPath, "utf-8");
23
- const pkg = JSON.parse(content);
24
- const allDeps = {
25
- ...pkg.dependencies || {},
26
- ...pkg.devDependencies || {},
27
- ...pkg.peerDependencies || {}
28
- };
29
- const depNames = Object.keys(allDeps);
30
- totalPackages = depNames.length;
31
- for (const [name, version] of Object.entries(allDeps)) {
32
- const vStr = String(version).replace(/[^0-9.]/g, "");
33
- const major = parseInt(vStr.split(".")[0] || "0", 10);
34
- if (["request", "moment", "tslint", "mkdirp", "uuid", "node-uuid"].includes(name) && major < 4) {
35
- deprecatedPackages++;
36
- issues.push({
37
- type: "dependency-health",
38
- severity: "major",
39
- message: `Dependency '${name}' is known to be deprecated. AI assistants may use outdated APIs.`,
40
- location: { file: packageJsonPath, line: 1 }
41
- });
42
- }
43
- if (major === 0) {
44
- outdatedPackages++;
45
- issues.push({
46
- type: "dependency-health",
47
- severity: "minor",
48
- message: `Dependency '${name}' (${version}) is pre-v1. APIs often unstable and hard for AI to predict.`,
49
- location: { file: packageJsonPath, line: 1 }
50
- });
51
- }
52
- }
53
- let skewSignals = 0;
54
- if (allDeps["next"] && allDeps["next"].includes("15")) skewSignals++;
55
- if (allDeps["react"] && allDeps["react"].includes("19")) skewSignals++;
56
- if (allDeps["typescript"] && allDeps["typescript"].includes("5.6")) skewSignals++;
57
- trainingCutoffSkew = totalPackages > 0 ? skewSignals / totalPackages * 5 : 0;
58
- trainingCutoffSkew = Math.min(1, trainingCutoffSkew);
59
- } catch {
60
- }
61
- }
62
- const riskResult = calculateDependencyHealth({
63
- totalPackages,
64
- outdatedPackages,
65
- deprecatedPackages,
66
- trainingCutoffSkew
67
- });
68
- return {
69
- summary: {
70
- filesAnalyzed: existsSync(packageJsonPath) ? 1 : 0,
71
- packagesAnalyzed: totalPackages,
72
- score: riskResult.score,
73
- rating: riskResult.rating
74
- },
75
- issues,
76
- rawData: {
77
- totalPackages,
78
- outdatedPackages,
79
- deprecatedPackages,
80
- trainingCutoffSkew
81
- },
82
- recommendations: riskResult.recommendations
83
- };
84
- }
85
-
86
- export {
87
- __require,
88
- analyzeDeps
89
- };