@arcgis/codemod 6.0.0-next.30 → 6.0.0-next.32
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/dist/chunks/classification.js +146 -94
- package/dist/chunks/cli.js +181 -180
- package/dist/chunks/componentAudit.js +115 -101
- package/dist/chunks/format.js +94 -70
- package/dist/chunks/index.js +857 -693
- package/dist/chunks/index2.js +109 -109
- package/dist/chunks/index3.js +48 -39
- package/dist/chunks/legacyCompatibility.js +210 -0
- package/dist/chunks/sync.js +143 -41
- package/dist/chunks/syncMarkdown.js +28 -18
- package/package.json +5 -4
- package/dist/chunks/artifact.js +0 -48
- package/dist/chunks/github.js +0 -124
package/dist/chunks/index2.js
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var P = (a, o) => (o = Symbol[a]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + a), S = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
if (
|
|
6
|
-
typeof
|
|
7
|
-
var
|
|
8
|
-
s && (
|
|
4
|
+
var b = (a, o, s) => {
|
|
5
|
+
if (o != null) {
|
|
6
|
+
typeof o != "object" && typeof o != "function" && S("Object expected");
|
|
7
|
+
var n, i;
|
|
8
|
+
s && (n = o[P("asyncDispose")]), n === void 0 && (n = o[P("dispose")], s && (i = n)), typeof n != "function" && S("Object not disposable"), i && (n = function() {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
10
|
+
i.call(this);
|
|
11
|
+
} catch (p) {
|
|
12
|
+
return Promise.reject(p);
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
} else s &&
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
for (; c =
|
|
14
|
+
}), a.push([s, n, o]);
|
|
15
|
+
} else s && a.push([s]);
|
|
16
|
+
return o;
|
|
17
|
+
}, $ = (a, o, s) => {
|
|
18
|
+
var n = typeof SuppressedError == "function" ? SuppressedError : function(c, e, r, m) {
|
|
19
|
+
return m = Error(r), m.name = "SuppressedError", m.error = c, m.suppressed = e, m;
|
|
20
|
+
}, i = (c) => o = s ? new n(c, o, "An error was suppressed during disposal") : (s = !0, c), p = (c) => {
|
|
21
|
+
for (; c = a.pop(); )
|
|
22
22
|
try {
|
|
23
|
-
var
|
|
24
|
-
if (c[0]) return Promise.resolve(
|
|
25
|
-
} catch (
|
|
26
|
-
r
|
|
23
|
+
var e = c[1] && c[1].call(c[2]);
|
|
24
|
+
if (c[0]) return Promise.resolve(e).then(p, (r) => (i(r), p()));
|
|
25
|
+
} catch (r) {
|
|
26
|
+
i(r);
|
|
27
27
|
}
|
|
28
|
-
if (s) throw
|
|
28
|
+
if (s) throw o;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return p();
|
|
31
31
|
};
|
|
32
32
|
import { log as J } from "@arcgis/toolkit/log";
|
|
33
|
-
import { path as
|
|
34
|
-
import { styleText as
|
|
35
|
-
import
|
|
33
|
+
import { path as x } from "@arcgis/node-toolkit/path";
|
|
34
|
+
import { styleText as j } from "node:util";
|
|
35
|
+
import O from "typescript";
|
|
36
36
|
import { f as N } from "./log.js";
|
|
37
|
-
import { r as
|
|
38
|
-
import { c as
|
|
39
|
-
import { g as
|
|
40
|
-
import { loadCodeowners as
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
await T(
|
|
37
|
+
import { r as I, i as L } from "./cli.js";
|
|
38
|
+
import { c as z } from "./useProjectInstance.js";
|
|
39
|
+
import { a as R, i as E, g as h, f as K, h as Q, p as V, c as W, d as q, s as B, j as G, k as H } from "./classification.js";
|
|
40
|
+
import { loadCodeowners as U } from "@arcgis/node-toolkit/codeowners";
|
|
41
|
+
import { f as C, a as X, b as Y, d as Z } from "./componentAudit.js";
|
|
42
|
+
async function ue(a, o, s = []) {
|
|
43
|
+
const n = !a && s.length === 0 && process.cwd() === R().repositoryRoot;
|
|
44
|
+
await I(
|
|
46
45
|
{
|
|
47
46
|
meta: { needsTypeInformation: !0, needsFooter: !1, includeComponentFiles: !0 },
|
|
48
|
-
async run(
|
|
49
|
-
await
|
|
47
|
+
async run(i) {
|
|
48
|
+
await _(i, o, n, s);
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
"deprecations audit-definitions",
|
|
53
|
-
|
|
52
|
+
a
|
|
54
53
|
);
|
|
55
54
|
}
|
|
56
|
-
async function
|
|
57
|
-
const
|
|
58
|
-
for (const
|
|
59
|
-
var
|
|
55
|
+
async function _(a, o, s, n) {
|
|
56
|
+
const i = [], p = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set(), r = Y("throw"), m = R(), l = E(n), g = (t) => L(t) && l(t) && !C(h(t, m.repositoryRoot));
|
|
57
|
+
for (const t of a) {
|
|
58
|
+
var v = [];
|
|
60
59
|
try {
|
|
61
|
-
const d =
|
|
62
|
-
if (
|
|
63
|
-
d !== void 0 && !
|
|
60
|
+
const d = t.packageJson?.filePath;
|
|
61
|
+
if (d !== void 0 && C(h(d, m.repositoryRoot))) {
|
|
62
|
+
d !== void 0 && !c.has(d) && (c.add(d), J(
|
|
64
63
|
"warn",
|
|
65
64
|
N(d),
|
|
66
|
-
`Skipping excluded package \`${
|
|
65
|
+
`Skipping excluded package \`${t.packageJson?.contents.name ?? t.cwd}\`.`
|
|
67
66
|
));
|
|
68
67
|
continue;
|
|
69
68
|
}
|
|
70
|
-
const
|
|
71
|
-
d !== void 0 && !
|
|
72
|
-
if (!
|
|
69
|
+
const u = d === void 0 ? void 0 : await r(d);
|
|
70
|
+
d !== void 0 && !e.has(d) && (e.add(d), u !== void 0 && i.push(...u.definitions));
|
|
71
|
+
if (!t.filePaths.some(g))
|
|
73
72
|
continue;
|
|
74
|
-
const k =
|
|
75
|
-
const
|
|
76
|
-
for (const
|
|
77
|
-
if (
|
|
78
|
-
D(h.compilerNode.fileName, i.repositoryRoot)
|
|
79
|
-
))
|
|
73
|
+
const k = b(v, z(t, !1));
|
|
74
|
+
const T = t.packageJson?.contents.name ?? N(t.cwd);
|
|
75
|
+
for (const w of k.getCodemodFiles()) {
|
|
76
|
+
if (!g(w.compilerNode.fileName))
|
|
80
77
|
continue;
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
...
|
|
78
|
+
const D = x.dirname(w.compilerNode.fileName), y = p.get(D) ?? X(D, T);
|
|
79
|
+
p.set(D, y), i.push(
|
|
80
|
+
...ee(w.compilerNode, y, u?.modulePaths)
|
|
84
81
|
);
|
|
85
82
|
}
|
|
86
|
-
} catch (
|
|
87
|
-
var
|
|
83
|
+
} catch (A) {
|
|
84
|
+
var F = A, M = !0;
|
|
88
85
|
} finally {
|
|
89
|
-
|
|
86
|
+
$(v, F, M);
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const f = i.filter(({ sourceFileName: t }) => l(t));
|
|
90
|
+
if (o)
|
|
91
|
+
te(f, m, s, n);
|
|
94
92
|
else
|
|
95
|
-
for (const
|
|
96
|
-
const d =
|
|
93
|
+
for (const t of f) {
|
|
94
|
+
const d = j(
|
|
97
95
|
"blue",
|
|
98
|
-
`${N(
|
|
99
|
-
),
|
|
100
|
-
name:
|
|
101
|
-
memberOf:
|
|
102
|
-
kind:
|
|
103
|
-
}), k =
|
|
104
|
-
J("warn", d, `\`${
|
|
96
|
+
`${N(t.sourceFileName)}:${t.line}:${t.column}`
|
|
97
|
+
), u = K({
|
|
98
|
+
name: t.name,
|
|
99
|
+
memberOf: t.memberOf,
|
|
100
|
+
kind: t.kind
|
|
101
|
+
}), k = Q(t.kind, "parentheses");
|
|
102
|
+
J("warn", d, `\`${u}\`${k} is deprecated.${t.reason ? ` ${t.reason}` : ""}`);
|
|
105
103
|
}
|
|
106
|
-
|
|
104
|
+
V(
|
|
107
105
|
"definitions",
|
|
108
|
-
|
|
109
|
-
new Set(
|
|
110
|
-
new Set(
|
|
106
|
+
f.length,
|
|
107
|
+
new Set(f.map(({ sourceFileName: t }) => t)).size,
|
|
108
|
+
new Set(f.map(({ package: t }) => t)).size
|
|
111
109
|
);
|
|
112
110
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
function c(
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
const l =
|
|
119
|
-
|
|
120
|
-
package:
|
|
121
|
-
module:
|
|
122
|
-
name:
|
|
123
|
-
...
|
|
124
|
-
reason:
|
|
125
|
-
sourceFileName:
|
|
126
|
-
line:
|
|
127
|
-
column:
|
|
111
|
+
function ee(a, o, s) {
|
|
112
|
+
const n = /* @__PURE__ */ new Map(), i = W([a.fileName], o), p = i === void 0 ? void 0 : s?.get(i) ?? i;
|
|
113
|
+
function c(e) {
|
|
114
|
+
const r = O.getJSDocDeprecatedTag(e), m = oe(e);
|
|
115
|
+
if (r !== void 0 && m !== void 0) {
|
|
116
|
+
const l = m.getStart(a), { line: g, character: f } = a.getLineAndCharacterOfPosition(l);
|
|
117
|
+
n.set(`${l}:${m.getWidth(a)}`, {
|
|
118
|
+
package: o,
|
|
119
|
+
module: p,
|
|
120
|
+
name: H(e, m.getText(a)),
|
|
121
|
+
...G(e),
|
|
122
|
+
reason: r.comment === void 0 ? void 0 : Z(r.comment),
|
|
123
|
+
sourceFileName: a.fileName,
|
|
124
|
+
line: g + 1,
|
|
125
|
+
column: f + 1
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
|
-
|
|
128
|
+
O.forEachChild(e, c);
|
|
131
129
|
}
|
|
132
|
-
return c(
|
|
130
|
+
return c(a), [...n.values()].sort((e, r) => e.line - r.line || e.column - r.column);
|
|
133
131
|
}
|
|
134
|
-
function
|
|
135
|
-
return
|
|
132
|
+
function oe(a) {
|
|
133
|
+
return a.name;
|
|
136
134
|
}
|
|
137
|
-
function
|
|
138
|
-
const
|
|
135
|
+
function te(a, o, s, n) {
|
|
136
|
+
const i = U(), p = h(process.cwd(), o.repositoryRoot), c = {
|
|
139
137
|
auditKind: "definitions",
|
|
140
|
-
repository:
|
|
141
|
-
ref:
|
|
142
|
-
branch:
|
|
143
|
-
scannerVersion:
|
|
138
|
+
repository: o.repository,
|
|
139
|
+
ref: o.ref,
|
|
140
|
+
branch: o.branch,
|
|
141
|
+
scannerVersion: B,
|
|
144
142
|
scanDate: Date.now(),
|
|
145
143
|
complete: s,
|
|
146
|
-
|
|
144
|
+
...p === "" ? {} : { cwd: p },
|
|
145
|
+
...n.length === 0 ? {} : { excludedPaths: n },
|
|
146
|
+
findings: a.map((e) => ({
|
|
147
147
|
package: e.package,
|
|
148
148
|
name: e.name,
|
|
149
149
|
module: e.module,
|
|
150
150
|
kind: e.kind,
|
|
151
151
|
memberOf: e.memberOf,
|
|
152
152
|
provenance: e.provenance,
|
|
153
|
-
category:
|
|
153
|
+
category: q({
|
|
154
154
|
package: e.package,
|
|
155
155
|
name: e.name,
|
|
156
156
|
memberOf: e.memberOf,
|
|
@@ -158,16 +158,16 @@ function Z(o, a, s) {
|
|
|
158
158
|
deprecated: e.reason ?? !0
|
|
159
159
|
}),
|
|
160
160
|
deprecated: e.reason ?? !0,
|
|
161
|
-
file:
|
|
161
|
+
file: h(e.sourceFileName, o.repositoryRoot),
|
|
162
162
|
line: e.line,
|
|
163
163
|
column: e.column,
|
|
164
|
-
codeowners:
|
|
164
|
+
codeowners: i?.getOwners(e.sourceFileName) ?? []
|
|
165
165
|
}))
|
|
166
166
|
};
|
|
167
|
-
process.stdout.write(`${JSON.stringify(
|
|
167
|
+
process.stdout.write(`${JSON.stringify(c, void 0, 2)}
|
|
168
168
|
`);
|
|
169
169
|
}
|
|
170
170
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
ue as auditDeprecatedDefinitions,
|
|
172
|
+
ee as collectDeprecatedApiDefinitions
|
|
173
173
|
};
|
package/dist/chunks/index3.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { readFile as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const n = new URL(e.url ?? j);
|
|
1
|
+
import { readFile as E } from "node:fs/promises";
|
|
2
|
+
import { n as M, d as h, b as j, e as C, f as k, o as J, h as A } from "./classification.js";
|
|
3
|
+
import { e as z, b, d as N } from "./cli.js";
|
|
4
|
+
async function B(e = {}) {
|
|
5
|
+
const n = new URL(e.url ?? z);
|
|
7
6
|
for (const s of e.repositories ?? [])
|
|
8
7
|
n.searchParams.append("repository", s);
|
|
9
8
|
for (const s of ["branch", "since", "until"])
|
|
@@ -28,8 +27,8 @@ async function Y(e, n, a = {}, i = [], s) {
|
|
|
28
27
|
const { section: t = "all", ...r } = a, [o, c, u] = await Promise.all([
|
|
29
28
|
Promise.all(e.map(async (l) => await D(l, "usages"))),
|
|
30
29
|
Promise.all(i.map(async (l) => await D(l, "definitions"))),
|
|
31
|
-
s === void 0 ? [] :
|
|
32
|
-
]), d =
|
|
30
|
+
s === void 0 ? [] : B(s)
|
|
31
|
+
]), d = F(
|
|
33
32
|
[...o, ...u],
|
|
34
33
|
r,
|
|
35
34
|
i.length === 0 ? void 0 : c
|
|
@@ -42,14 +41,14 @@ async function Y(e, n, a = {}, i = [], s) {
|
|
|
42
41
|
process.stdout.write(`${p}
|
|
43
42
|
`);
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function F(e, n = {}, a) {
|
|
46
45
|
const i = /* @__PURE__ */ new Set(), s = [], t = e.flatMap((o) => {
|
|
47
46
|
if (i.has(o.repository))
|
|
48
47
|
throw new Error(`Duplicate audit-usages report for ${o.repository}.`);
|
|
49
48
|
i.add(o.repository);
|
|
50
|
-
const c = o.findings.map((u) => ({ ...u, category: u.category ??
|
|
49
|
+
const c = o.findings.map((u) => ({ ...u, category: u.category ?? h(u) })).filter((u) => P(u, n));
|
|
51
50
|
return s.push(V(o, c)), c.map((u) => ({ finding: u, source: { repository: o.repository, ref: o.ref } }));
|
|
52
|
-
}), r =
|
|
51
|
+
}), r = S(t);
|
|
53
52
|
return {
|
|
54
53
|
auditKind: "aggregated-usages",
|
|
55
54
|
aggregatedDate: Date.now(),
|
|
@@ -68,9 +67,12 @@ function V(e, n) {
|
|
|
68
67
|
branch: e.branch,
|
|
69
68
|
scanDate: e.scanDate,
|
|
70
69
|
scannerVersion: e.scannerVersion,
|
|
70
|
+
complete: e.complete,
|
|
71
|
+
cwd: e.cwd,
|
|
72
|
+
excludedPaths: e.excludedPaths,
|
|
71
73
|
count: n.length,
|
|
72
74
|
apiCount: new Set(n.map(w)).size,
|
|
73
|
-
categories:
|
|
75
|
+
categories: j(n, (a) => a).map(({ categoryName: a, count: i, packages: s }) => ({
|
|
74
76
|
category: a,
|
|
75
77
|
label: N[a].label,
|
|
76
78
|
count: i,
|
|
@@ -82,16 +84,16 @@ function V(e, n) {
|
|
|
82
84
|
}))
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
|
-
function
|
|
87
|
+
function P(e, n) {
|
|
86
88
|
return (!n.esriOnly || b(e.package)) && (n.category === void 0 || e.category === n.category) && (n.packageName === void 0 || e.package === n.packageName);
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function S(e) {
|
|
89
91
|
const n = [...Map.groupBy(e, ({ finding: a }) => a.package)].map(([a, i]) => {
|
|
90
92
|
const s = [...Map.groupBy(i, ({ finding: t }) => t.module)].map(([t, r]) => {
|
|
91
93
|
const o = [
|
|
92
94
|
...Map.groupBy(
|
|
93
95
|
r,
|
|
94
|
-
({ finding: c }) => JSON.stringify([c.category ??
|
|
96
|
+
({ finding: c }) => JSON.stringify([c.category ?? h(c), w(c)])
|
|
95
97
|
)
|
|
96
98
|
].map(([, c]) => {
|
|
97
99
|
const u = c.reduce(
|
|
@@ -100,12 +102,12 @@ function O(e) {
|
|
|
100
102
|
), d = c.flatMap(({ source: p }) => p === void 0 ? [] : [p]);
|
|
101
103
|
return {
|
|
102
104
|
name: u.name,
|
|
103
|
-
category: u.category ??
|
|
105
|
+
category: u.category ?? h(u),
|
|
104
106
|
kind: u.kind,
|
|
105
107
|
memberOf: u.memberOf,
|
|
106
108
|
count: d.length,
|
|
107
109
|
repositories: [...Map.groupBy(d, ({ repository: p }) => p)].map(([p, l]) => ({
|
|
108
|
-
repository:
|
|
110
|
+
repository: O(p),
|
|
109
111
|
ref: l[0].ref,
|
|
110
112
|
count: l.length
|
|
111
113
|
})).sort(
|
|
@@ -114,7 +116,7 @@ function O(e) {
|
|
|
114
116
|
};
|
|
115
117
|
});
|
|
116
118
|
return o.sort(
|
|
117
|
-
(c, u) => u.count - c.count ||
|
|
119
|
+
(c, u) => u.count - c.count || k(c).localeCompare(k(u)) || c.name.localeCompare(u.name) || (c.memberOf ?? "").localeCompare(u.memberOf ?? "") || (c.kind ?? "").localeCompare(u.kind ?? "") || c.category.localeCompare(u.category)
|
|
118
120
|
), {
|
|
119
121
|
module: t,
|
|
120
122
|
count: o.reduce((c, u) => c + u.count, 0),
|
|
@@ -137,18 +139,18 @@ function K(e, n, a) {
|
|
|
137
139
|
throw new Error(
|
|
138
140
|
`Definition ${o.package}/${o.name} has no module. Regenerate its audit-definitions report.`
|
|
139
141
|
);
|
|
140
|
-
const c = { ...o, category: o.category ??
|
|
141
|
-
if (!s.has(u) &&
|
|
142
|
+
const c = { ...o, category: o.category ?? h(o) }, u = w(c);
|
|
143
|
+
if (!s.has(u) && P(c, a)) {
|
|
142
144
|
const p = t.get(u);
|
|
143
145
|
(p === void 0 || C(c, p.finding) < 0) && t.set(u, { finding: c });
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
return { count: t.size, packages:
|
|
148
|
+
return { count: t.size, packages: S([...t.values()]) };
|
|
147
149
|
}
|
|
148
150
|
function w(e) {
|
|
149
151
|
return e.kind === "css-property" ? JSON.stringify([e.package, e.kind, e.name]) : e.kind === "css-part" || e.kind === "css-state" || e.kind === "slot" || e.kind === "attribute" || e.kind === "element" ? JSON.stringify([e.package, e.kind, e.memberOf, e.name]) : JSON.stringify([e.package, e.module, e.name, e.memberOf]);
|
|
150
152
|
}
|
|
151
|
-
function
|
|
153
|
+
function O(e, n = !1) {
|
|
152
154
|
const a = new URL(`https://${e}`);
|
|
153
155
|
return !n && a.hostname === "github.com" ? e : a.pathname.slice(1);
|
|
154
156
|
}
|
|
@@ -177,7 +179,7 @@ function L(e, n, a, i) {
|
|
|
177
179
|
"",
|
|
178
180
|
...t ? [
|
|
179
181
|
"<details>",
|
|
180
|
-
`<summary>${o.count} usages - ${
|
|
182
|
+
`<summary>${o.count} usages - ${U(O(o.repository, !0))} - ${c.slice(0, 10)}${u}</summary>`,
|
|
181
183
|
""
|
|
182
184
|
] : [`${o.repository}: ${o.count} usages; selected scan ${c}${u}`]
|
|
183
185
|
), r.push(
|
|
@@ -185,7 +187,10 @@ function L(e, n, a, i) {
|
|
|
185
187
|
`Distinct APIs: ${o.apiCount}`,
|
|
186
188
|
`Branch: ${t ? g(o.branch ?? "Unknown") : o.branch ?? "Unknown"}`,
|
|
187
189
|
`Commit: ${t ? `[\`${o.ref.slice(0, 6)}\`](https://${o.repository}/tree/${encodeURIComponent(o.ref)})` : o.ref}`,
|
|
188
|
-
`Scanner version: ${t ? g(o.scannerVersion ?? "Unknown") : o.scannerVersion ?? "Unknown"}
|
|
190
|
+
`Scanner version: ${t ? g(o.scannerVersion ?? "Unknown") : o.scannerVersion ?? "Unknown"}`,
|
|
191
|
+
...o.excludedPaths?.length ? [
|
|
192
|
+
`Excluded paths: ${t ? o.excludedPaths.map(T).join(", ") : o.excludedPaths.join(", ")}`
|
|
193
|
+
] : []
|
|
189
194
|
].join(" | ")}`,
|
|
190
195
|
""
|
|
191
196
|
), o.categories.length === 0 ? r.push("No matching deprecated usages.") : t && r.push("| Category | Package | Usages |", "| --- | --- | ---: |");
|
|
@@ -212,10 +217,14 @@ function L(e, n, a, i) {
|
|
|
212
217
|
)), r.join(`
|
|
213
218
|
`);
|
|
214
219
|
}
|
|
220
|
+
function T(e) {
|
|
221
|
+
const n = "`".repeat(Math.max(0, ...(e.match(/`+/gu) ?? []).map((a) => a.length)) + 1);
|
|
222
|
+
return `${n} ${e.replaceAll(/\r?\n/gu, " ")} ${n}`;
|
|
223
|
+
}
|
|
215
224
|
function g(e) {
|
|
216
|
-
return
|
|
225
|
+
return U(e).replaceAll("|", "|").replaceAll(/\r?\n/gu, " ");
|
|
217
226
|
}
|
|
218
|
-
function
|
|
227
|
+
function U(e) {
|
|
219
228
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
220
229
|
}
|
|
221
230
|
function y(e, n, a, i = "Deprecated API usages") {
|
|
@@ -224,7 +233,7 @@ function y(e, n, a, i = "Deprecated API usages") {
|
|
|
224
233
|
const u = e.packages.flatMap((p) => {
|
|
225
234
|
const l = p.modules.flatMap(($) => {
|
|
226
235
|
const f = $.apis.filter((v) => v.category === o);
|
|
227
|
-
return f.length === 0 ? [] : [{ ...$, apis: f, count: f.reduce((v,
|
|
236
|
+
return f.length === 0 ? [] : [{ ...$, apis: f, count: f.reduce((v, R) => v + R.count, 0) }];
|
|
228
237
|
});
|
|
229
238
|
return l.length === 0 ? [] : [{ ...p, modules: l, count: l.reduce(($, f) => $ + f.count, 0) }];
|
|
230
239
|
});
|
|
@@ -234,7 +243,7 @@ function y(e, n, a, i = "Deprecated API usages") {
|
|
|
234
243
|
r.push(
|
|
235
244
|
"",
|
|
236
245
|
`${s ? "## " : ""}${c}${m(d)}`,
|
|
237
|
-
...
|
|
246
|
+
...H(u, s, a)
|
|
238
247
|
);
|
|
239
248
|
}
|
|
240
249
|
return r.join(`
|
|
@@ -243,10 +252,10 @@ function y(e, n, a, i = "Deprecated API usages") {
|
|
|
243
252
|
function m(e) {
|
|
244
253
|
return e === 0 ? "" : ` (${e})`;
|
|
245
254
|
}
|
|
246
|
-
function
|
|
255
|
+
function H(e, n, a) {
|
|
247
256
|
const i = [], s = e.flatMap(
|
|
248
257
|
(t) => [
|
|
249
|
-
...Map.groupBy(t.modules, (r) =>
|
|
258
|
+
...Map.groupBy(t.modules, (r) => J(t.package, r.module))
|
|
250
259
|
].map(([r, o]) => ({
|
|
251
260
|
...t,
|
|
252
261
|
displayName: r,
|
|
@@ -259,28 +268,28 @@ function T(e, n, a) {
|
|
|
259
268
|
"",
|
|
260
269
|
n ? `### ${t.displayName === t.package ? `\`${t.package}\`` : t.displayName}${m(t.count)}` : `${t.displayName}${m(t.count)}`
|
|
261
270
|
), n) {
|
|
262
|
-
i.push(...
|
|
271
|
+
i.push(...W(t.modules, t.package, a));
|
|
263
272
|
continue;
|
|
264
273
|
}
|
|
265
274
|
for (const r of t.modules) {
|
|
266
275
|
const o = r.module ?? "Unknown module";
|
|
267
276
|
i.push(` ${o}${m(r.count)}`);
|
|
268
277
|
for (const c of r.apis)
|
|
269
|
-
i.push(...
|
|
278
|
+
i.push(...x(c, !1, " "));
|
|
270
279
|
}
|
|
271
280
|
}
|
|
272
281
|
return i;
|
|
273
282
|
}
|
|
274
|
-
function
|
|
275
|
-
const i = `${
|
|
283
|
+
function x(e, n, a = "") {
|
|
284
|
+
const i = `${k(e)}${A(e.kind)}`, s = e.repositories.map(
|
|
276
285
|
({ repository: t, count: r }) => `${a} ${n ? `- \`${t}\`` : t} (${r})`
|
|
277
286
|
);
|
|
278
287
|
return n ? [
|
|
279
|
-
`${a}- \`${
|
|
288
|
+
`${a}- \`${k(e)}\`${A(e.kind)}${m(e.count)}`,
|
|
280
289
|
...s
|
|
281
290
|
] : [`${a}${i}${m(e.count)}`, ...s];
|
|
282
291
|
}
|
|
283
|
-
function
|
|
292
|
+
function W(e, n, a) {
|
|
284
293
|
const i = /* @__PURE__ */ new Map();
|
|
285
294
|
for (const s of e) {
|
|
286
295
|
let t = i;
|
|
@@ -304,7 +313,7 @@ function I(e, n) {
|
|
|
304
313
|
})),
|
|
305
314
|
...a.apis.map((o) => ({
|
|
306
315
|
count: o.count,
|
|
307
|
-
lines:
|
|
316
|
+
lines: x(o, !0, s)
|
|
308
317
|
}))
|
|
309
318
|
];
|
|
310
319
|
t.sort((o, c) => c.count - o.count);
|
|
@@ -328,7 +337,7 @@ function I(e, n) {
|
|
|
328
337
|
async function D(e, n) {
|
|
329
338
|
let a;
|
|
330
339
|
try {
|
|
331
|
-
a = M(await
|
|
340
|
+
a = M(await E(e, "utf8"));
|
|
332
341
|
} catch (i) {
|
|
333
342
|
throw new Error(`Failed to read audit-${n} report: ${e}`, { cause: i });
|
|
334
343
|
}
|
|
@@ -337,6 +346,6 @@ async function D(e, n) {
|
|
|
337
346
|
return a;
|
|
338
347
|
}
|
|
339
348
|
export {
|
|
340
|
-
|
|
349
|
+
F as aggregateUsages,
|
|
341
350
|
Y as aggregateUsagesFromFiles
|
|
342
351
|
};
|