@arcgis/codemod 6.0.0-next.15 → 6.0.0-next.17
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/artifact.js +1 -1
- package/dist/chunks/classification.js +75 -70
- package/dist/chunks/cli.js +1 -1
- package/dist/chunks/componentAudit.js +181 -126
- package/dist/chunks/index.js +672 -529
- package/dist/chunks/index2.js +95 -96
- package/dist/chunks/index3.js +146 -146
- package/package.json +6 -5
package/dist/chunks/index3.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { readFile as J } from "node:fs/promises";
|
|
2
|
-
import { b as
|
|
2
|
+
import { b as M, c as C } from "./artifact.js";
|
|
3
3
|
import { c as k, g as z, b as h, i as B, d as A } from "./classification.js";
|
|
4
4
|
import { e as j, b, d as N } from "./cli.js";
|
|
5
5
|
async function F(e = {}) {
|
|
6
|
-
const
|
|
7
|
-
for (const
|
|
8
|
-
|
|
9
|
-
for (const
|
|
10
|
-
e[
|
|
11
|
-
const a = await fetch(
|
|
6
|
+
const n = new URL(e.url ?? j);
|
|
7
|
+
for (const s of e.repositories ?? [])
|
|
8
|
+
n.searchParams.append("repository", s);
|
|
9
|
+
for (const s of ["branch", "since", "until"])
|
|
10
|
+
e[s] !== void 0 && n.searchParams.set(s, e[s]);
|
|
11
|
+
const a = await fetch(n, {
|
|
12
12
|
signal: AbortSignal.timeout(12e4),
|
|
13
13
|
redirect: "error"
|
|
14
14
|
});
|
|
@@ -17,92 +17,92 @@ async function F(e = {}) {
|
|
|
17
17
|
const i = await a.json();
|
|
18
18
|
if (!Array.isArray(i))
|
|
19
19
|
throw new Error("Invalid collector response.");
|
|
20
|
-
return i.map((
|
|
21
|
-
const t =
|
|
20
|
+
return i.map((s) => {
|
|
21
|
+
const t = M(JSON.stringify(s));
|
|
22
22
|
if (t.auditKind !== "usages")
|
|
23
23
|
throw new Error("Expected an audit-usages report from the collector.");
|
|
24
24
|
return { ...t, auditKind: "usages" };
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
async function Y(e,
|
|
28
|
-
const { section: t = "all", ...
|
|
29
|
-
Promise.all(e.map(async (l) => await
|
|
30
|
-
Promise.all(i.map(async (l) => await
|
|
31
|
-
|
|
27
|
+
async function Y(e, n, a = {}, i = [], s) {
|
|
28
|
+
const { section: t = "all", ...r } = a, [o, c, u] = await Promise.all([
|
|
29
|
+
Promise.all(e.map(async (l) => await D(l, "usages"))),
|
|
30
|
+
Promise.all(i.map(async (l) => await D(l, "definitions"))),
|
|
31
|
+
s === void 0 ? [] : F(s)
|
|
32
32
|
]), d = x(
|
|
33
|
-
[...o, ...
|
|
34
|
-
|
|
35
|
-
i.length === 0 ? void 0 :
|
|
36
|
-
), p =
|
|
33
|
+
[...o, ...u],
|
|
34
|
+
r,
|
|
35
|
+
i.length === 0 ? void 0 : c
|
|
36
|
+
), p = n === "json" ? JSON.stringify(d, void 0, 2) : L(
|
|
37
37
|
d,
|
|
38
|
-
|
|
38
|
+
n,
|
|
39
39
|
t,
|
|
40
|
-
[...o, ...
|
|
40
|
+
[...o, ...u].flatMap(({ findings: l }) => l)
|
|
41
41
|
);
|
|
42
42
|
process.stdout.write(`${p}
|
|
43
43
|
`);
|
|
44
44
|
}
|
|
45
|
-
function x(e,
|
|
46
|
-
const i = /* @__PURE__ */ new Set(),
|
|
45
|
+
function x(e, n = {}, a) {
|
|
46
|
+
const i = /* @__PURE__ */ new Set(), s = [], t = e.flatMap((o) => {
|
|
47
47
|
if (i.has(o.repository))
|
|
48
48
|
throw new Error(`Duplicate audit-usages report for ${o.repository}.`);
|
|
49
49
|
i.add(o.repository);
|
|
50
|
-
const
|
|
51
|
-
return
|
|
52
|
-
}),
|
|
50
|
+
const c = o.findings.map((u) => ({ ...u, category: u.category ?? k(u) })).filter((u) => S(u, n));
|
|
51
|
+
return s.push(V(o, c)), c.map((u) => ({ finding: u, source: { repository: o.repository, ref: o.ref } }));
|
|
52
|
+
}), r = O(t);
|
|
53
53
|
return {
|
|
54
54
|
auditKind: "aggregated-usages",
|
|
55
55
|
aggregatedDate: Date.now(),
|
|
56
56
|
count: t.length,
|
|
57
|
-
repositories:
|
|
58
|
-
(o,
|
|
57
|
+
repositories: s.sort(
|
|
58
|
+
(o, c) => c.count - o.count || o.repository.localeCompare(c.repository)
|
|
59
59
|
),
|
|
60
|
-
packages:
|
|
61
|
-
...a === void 0 ? {} : { unused: K(e, a,
|
|
60
|
+
packages: r,
|
|
61
|
+
...a === void 0 ? {} : { unused: K(e, a, n) }
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function V(e,
|
|
64
|
+
function V(e, n) {
|
|
65
65
|
return {
|
|
66
66
|
repository: e.repository,
|
|
67
67
|
ref: e.ref,
|
|
68
68
|
branch: e.branch,
|
|
69
69
|
scanDate: e.scanDate,
|
|
70
70
|
scannerVersion: e.scannerVersion,
|
|
71
|
-
count:
|
|
72
|
-
apiCount: new Set(
|
|
73
|
-
categories: z(
|
|
71
|
+
count: n.length,
|
|
72
|
+
apiCount: new Set(n.map(w)).size,
|
|
73
|
+
categories: z(n, (a) => a).map(({ categoryName: a, count: i, packages: s }) => ({
|
|
74
74
|
category: a,
|
|
75
75
|
label: N[a].label,
|
|
76
76
|
count: i,
|
|
77
|
-
packages:
|
|
77
|
+
packages: s.map(({ packageName: t, displayName: r, count: o }) => ({
|
|
78
78
|
package: t,
|
|
79
|
-
...
|
|
79
|
+
...r === t ? {} : { displayName: r },
|
|
80
80
|
count: o
|
|
81
81
|
}))
|
|
82
82
|
}))
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return (!
|
|
85
|
+
function S(e, n) {
|
|
86
|
+
return (!n.esriOnly || b(e.package)) && (n.category === void 0 || e.category === n.category) && (n.packageName === void 0 || e.package === n.packageName);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
const
|
|
88
|
+
function O(e) {
|
|
89
|
+
const n = [...Map.groupBy(e, ({ finding: a }) => a.package)].map(([a, i]) => {
|
|
90
|
+
const s = [...Map.groupBy(i, ({ finding: t }) => t.module)].map(([t, r]) => {
|
|
91
91
|
const o = [
|
|
92
92
|
...Map.groupBy(
|
|
93
|
-
|
|
94
|
-
({ finding:
|
|
93
|
+
r,
|
|
94
|
+
({ finding: c }) => JSON.stringify([c.category ?? k(c), w(c)])
|
|
95
95
|
)
|
|
96
|
-
].map(([,
|
|
97
|
-
const
|
|
98
|
-
(p, { finding: l }) =>
|
|
99
|
-
|
|
100
|
-
), d =
|
|
96
|
+
].map(([, c]) => {
|
|
97
|
+
const u = c.reduce(
|
|
98
|
+
(p, { finding: l }) => C(l, p) < 0 ? l : p,
|
|
99
|
+
c[0].finding
|
|
100
|
+
), d = c.flatMap(({ source: p }) => p === void 0 ? [] : [p]);
|
|
101
101
|
return {
|
|
102
|
-
name:
|
|
103
|
-
category:
|
|
104
|
-
kind:
|
|
105
|
-
memberOf:
|
|
102
|
+
name: u.name,
|
|
103
|
+
category: u.category ?? k(u),
|
|
104
|
+
kind: u.kind,
|
|
105
|
+
memberOf: u.memberOf,
|
|
106
106
|
count: d.length,
|
|
107
107
|
repositories: [...Map.groupBy(d, ({ repository: p }) => p)].map(([p, l]) => ({
|
|
108
108
|
repository: U(p),
|
|
@@ -114,73 +114,73 @@ function S(e) {
|
|
|
114
114
|
};
|
|
115
115
|
});
|
|
116
116
|
return o.sort(
|
|
117
|
-
(
|
|
117
|
+
(c, u) => u.count - c.count || h(c).localeCompare(h(u)) || c.name.localeCompare(u.name) || (c.memberOf ?? "").localeCompare(u.memberOf ?? "") || (c.kind ?? "").localeCompare(u.kind ?? "") || c.category.localeCompare(u.category)
|
|
118
118
|
), {
|
|
119
119
|
module: t,
|
|
120
|
-
count: o.reduce((
|
|
120
|
+
count: o.reduce((c, u) => c + u.count, 0),
|
|
121
121
|
apis: o
|
|
122
122
|
};
|
|
123
123
|
});
|
|
124
|
-
return
|
|
125
|
-
(t,
|
|
126
|
-
), { package: a, count:
|
|
124
|
+
return s.sort(
|
|
125
|
+
(t, r) => r.count - t.count || +(t.module === void 0) - +(r.module === void 0) || (t.module ?? "").localeCompare(r.module ?? "")
|
|
126
|
+
), { package: a, count: s.reduce((t, r) => t + r.count, 0), modules: s };
|
|
127
127
|
});
|
|
128
|
-
return
|
|
128
|
+
return n.sort(
|
|
129
129
|
(a, i) => Number(b(i.package)) - Number(b(a.package)) || i.count - a.count || a.package.localeCompare(i.package)
|
|
130
|
-
),
|
|
130
|
+
), n;
|
|
131
131
|
}
|
|
132
|
-
function K(e,
|
|
133
|
-
const i = e.flatMap((
|
|
134
|
-
for (const
|
|
135
|
-
for (const o of
|
|
132
|
+
function K(e, n, a) {
|
|
133
|
+
const i = e.flatMap((r) => r.findings), s = new Set(i.map(w)), t = /* @__PURE__ */ new Map();
|
|
134
|
+
for (const r of n)
|
|
135
|
+
for (const o of r.findings) {
|
|
136
136
|
if (o.module === void 0)
|
|
137
137
|
throw new Error(
|
|
138
138
|
`Definition ${o.package}/${o.name} has no module. Regenerate its audit-definitions report.`
|
|
139
139
|
);
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
142
|
-
const p = t.get(
|
|
143
|
-
(p === void 0 ||
|
|
140
|
+
const c = { ...o, category: o.category ?? k(o) }, u = w(c);
|
|
141
|
+
if (!s.has(u) && S(c, a)) {
|
|
142
|
+
const p = t.get(u);
|
|
143
|
+
(p === void 0 || C(c, p.finding) < 0) && t.set(u, { finding: c });
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
return { count: t.size, packages:
|
|
146
|
+
return { count: t.size, packages: O([...t.values()]) };
|
|
147
147
|
}
|
|
148
148
|
function w(e) {
|
|
149
149
|
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
150
|
}
|
|
151
|
-
function U(e,
|
|
151
|
+
function U(e, n = !1) {
|
|
152
152
|
const a = new URL(`https://${e}`);
|
|
153
|
-
return !
|
|
153
|
+
return !n && a.hostname === "github.com" ? e : a.pathname.slice(1);
|
|
154
154
|
}
|
|
155
|
-
function L(e,
|
|
156
|
-
const
|
|
155
|
+
function L(e, n, a, i) {
|
|
156
|
+
const s = new Map(
|
|
157
157
|
[...Map.groupBy(i, (o) => JSON.stringify([o.package, o.module]))].map(
|
|
158
|
-
([o,
|
|
158
|
+
([o, c]) => [o, c.length]
|
|
159
159
|
)
|
|
160
160
|
);
|
|
161
161
|
if (a === "apis")
|
|
162
|
-
return y(e,
|
|
162
|
+
return y(e, n, s);
|
|
163
163
|
if (a === "unused-apis") {
|
|
164
164
|
if (e.unused === void 0)
|
|
165
165
|
throw new Error("The unused-apis section requires --definitions.");
|
|
166
|
-
return y(e.unused,
|
|
166
|
+
return y(e.unused, n, s, "Deprecated APIs with zero detected usages");
|
|
167
167
|
}
|
|
168
|
-
const t =
|
|
168
|
+
const t = n === "md", r = [
|
|
169
169
|
t ? "# Deprecation overview" : "Deprecation overview",
|
|
170
170
|
"",
|
|
171
171
|
`${e.count} usages - ${e.repositories.length} repositories - Aggregated: ${new Date(e.aggregatedDate).toISOString().slice(0, 10)}`,
|
|
172
172
|
""
|
|
173
173
|
];
|
|
174
174
|
for (const o of e.repositories) {
|
|
175
|
-
const
|
|
176
|
-
|
|
175
|
+
const c = o.scanDate === void 0 ? "Unknown" : new Date(o.scanDate).toISOString(), u = o.scanDate !== void 0 && e.aggregatedDate - o.scanDate > 720 * 60 * 60 * 1e3 ? " - ⚠️ Stale" : "";
|
|
176
|
+
r.push(
|
|
177
177
|
"",
|
|
178
178
|
...t ? [
|
|
179
179
|
"<details>",
|
|
180
|
-
`<summary>${o.count} usages - ${P(U(o.repository, !0))} - ${
|
|
180
|
+
`<summary>${o.count} usages - ${P(U(o.repository, !0))} - ${c.slice(0, 10)}${u}</summary>`,
|
|
181
181
|
""
|
|
182
|
-
] : [`${o.repository}: ${o.count} usages; selected scan ${u}`]
|
|
183
|
-
),
|
|
182
|
+
] : [`${o.repository}: ${o.count} usages; selected scan ${c}${u}`]
|
|
183
|
+
), r.push(
|
|
184
184
|
`> ${[
|
|
185
185
|
`Distinct APIs: ${o.apiCount}`,
|
|
186
186
|
`Branch: ${t ? g(o.branch ?? "Unknown") : o.branch ?? "Unknown"}`,
|
|
@@ -188,28 +188,28 @@ function L(e, s, a, i) {
|
|
|
188
188
|
`Scanner version: ${t ? g(o.scannerVersion ?? "Unknown") : o.scannerVersion ?? "Unknown"}`
|
|
189
189
|
].join(" | ")}`,
|
|
190
190
|
""
|
|
191
|
-
), o.categories.length === 0 ?
|
|
192
|
-
for (const
|
|
193
|
-
if (t &&
|
|
194
|
-
|
|
195
|
-
`| **${g(
|
|
191
|
+
), o.categories.length === 0 ? r.push("No matching deprecated usages.") : t && r.push("| Category | Package | Usages |", "| --- | --- | ---: |");
|
|
192
|
+
for (const d of o.categories) {
|
|
193
|
+
if (t && d.packages.length === 1) {
|
|
194
|
+
r.push(
|
|
195
|
+
`| **${g(d.label)}** | ${g(d.packages[0].displayName ?? d.packages[0].package)} | **${d.count}** |`
|
|
196
196
|
);
|
|
197
197
|
continue;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
t ? `| **${g(
|
|
199
|
+
r.push(
|
|
200
|
+
t ? `| **${g(d.label)}** | | **${d.count}** |` : ` ${d.label} (${d.count})`
|
|
201
201
|
);
|
|
202
|
-
for (const
|
|
203
|
-
|
|
204
|
-
t ? `| | ${g(
|
|
202
|
+
for (const p of d.packages)
|
|
203
|
+
r.push(
|
|
204
|
+
t ? `| | ${g(p.displayName ?? p.package)} | ${p.count} |` : ` ${p.displayName ?? p.package} (${p.count})`
|
|
205
205
|
);
|
|
206
206
|
}
|
|
207
|
-
t &&
|
|
207
|
+
t && r.push("", "</details>");
|
|
208
208
|
}
|
|
209
|
-
return a === "all" && (
|
|
209
|
+
return a === "all" && (r.push("", y(e, n, s)), e.unused !== void 0 && r.push(
|
|
210
210
|
"",
|
|
211
|
-
y(e.unused,
|
|
212
|
-
)),
|
|
211
|
+
y(e.unused, n, s, "Deprecated APIs with zero detected usages")
|
|
212
|
+
)), r.join(`
|
|
213
213
|
`);
|
|
214
214
|
}
|
|
215
215
|
function g(e) {
|
|
@@ -218,122 +218,122 @@ function g(e) {
|
|
|
218
218
|
function P(e) {
|
|
219
219
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
220
220
|
}
|
|
221
|
-
function y(e,
|
|
222
|
-
const
|
|
223
|
-
for (const [o, { label:
|
|
224
|
-
const
|
|
221
|
+
function y(e, n, a, i = "Deprecated API usages") {
|
|
222
|
+
const s = n === "md", t = `${i}${m(e.count)}`, r = [s ? `# ${t}` : t];
|
|
223
|
+
for (const [o, { label: c }] of Object.entries(N)) {
|
|
224
|
+
const u = e.packages.flatMap((p) => {
|
|
225
225
|
const l = p.modules.flatMap(($) => {
|
|
226
226
|
const f = $.apis.filter((v) => v.category === o);
|
|
227
227
|
return f.length === 0 ? [] : [{ ...$, apis: f, count: f.reduce((v, E) => v + E.count, 0) }];
|
|
228
228
|
});
|
|
229
229
|
return l.length === 0 ? [] : [{ ...p, modules: l, count: l.reduce(($, f) => $ + f.count, 0) }];
|
|
230
230
|
});
|
|
231
|
-
if (
|
|
231
|
+
if (u.length === 0)
|
|
232
232
|
continue;
|
|
233
|
-
const d =
|
|
234
|
-
|
|
233
|
+
const d = u.reduce((p, l) => p + l.count, 0);
|
|
234
|
+
r.push(
|
|
235
235
|
"",
|
|
236
|
-
`${
|
|
237
|
-
...T(
|
|
236
|
+
`${s ? "## " : ""}${c}${m(d)}`,
|
|
237
|
+
...T(u, s, a)
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
return
|
|
240
|
+
return r.join(`
|
|
241
241
|
`);
|
|
242
242
|
}
|
|
243
243
|
function m(e) {
|
|
244
244
|
return e === 0 ? "" : ` (${e})`;
|
|
245
245
|
}
|
|
246
|
-
function T(e,
|
|
247
|
-
const i = [],
|
|
246
|
+
function T(e, n, a) {
|
|
247
|
+
const i = [], s = e.flatMap(
|
|
248
248
|
(t) => [
|
|
249
|
-
...Map.groupBy(t.modules, (
|
|
250
|
-
].map(([
|
|
249
|
+
...Map.groupBy(t.modules, (r) => B(t.package, r.module))
|
|
250
|
+
].map(([r, o]) => ({
|
|
251
251
|
...t,
|
|
252
|
-
displayName:
|
|
252
|
+
displayName: r,
|
|
253
253
|
modules: o,
|
|
254
|
-
count: o.reduce((
|
|
254
|
+
count: o.reduce((c, u) => c + u.count, 0)
|
|
255
255
|
}))
|
|
256
256
|
);
|
|
257
|
-
for (const t of
|
|
257
|
+
for (const t of s) {
|
|
258
258
|
if (i.push(
|
|
259
259
|
"",
|
|
260
|
-
|
|
261
|
-
),
|
|
260
|
+
n ? `### ${t.displayName === t.package ? `\`${t.package}\`` : t.displayName}${m(t.count)}` : `${t.displayName}${m(t.count)}`
|
|
261
|
+
), n) {
|
|
262
262
|
i.push(...H(t.modules, t.package, a));
|
|
263
263
|
continue;
|
|
264
264
|
}
|
|
265
|
-
for (const
|
|
266
|
-
const o =
|
|
267
|
-
i.push(` ${o}${m(
|
|
268
|
-
for (const
|
|
269
|
-
i.push(...R(
|
|
265
|
+
for (const r of t.modules) {
|
|
266
|
+
const o = r.module ?? "Unknown module";
|
|
267
|
+
i.push(` ${o}${m(r.count)}`);
|
|
268
|
+
for (const c of r.apis)
|
|
269
|
+
i.push(...R(c, !1, " "));
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
return i;
|
|
273
273
|
}
|
|
274
|
-
function R(e,
|
|
275
|
-
const i = `${h(e)}${A(e.kind)}`,
|
|
276
|
-
({ repository: t, count:
|
|
274
|
+
function R(e, n, a = "") {
|
|
275
|
+
const i = `${h(e)}${A(e.kind)}`, s = e.repositories.map(
|
|
276
|
+
({ repository: t, count: r }) => `${a} ${n ? `- \`${t}\`` : t} (${r})`
|
|
277
277
|
);
|
|
278
|
-
return
|
|
278
|
+
return n ? [
|
|
279
279
|
`${a}- \`${h(e)}\`${A(e.kind)}${m(e.count)}`,
|
|
280
|
-
...
|
|
281
|
-
] : [`${a}${i}${m(e.count)}`, ...
|
|
280
|
+
...s
|
|
281
|
+
] : [`${a}${i}${m(e.count)}`, ...s];
|
|
282
282
|
}
|
|
283
|
-
function H(e,
|
|
283
|
+
function H(e, n, a) {
|
|
284
284
|
const i = /* @__PURE__ */ new Map();
|
|
285
|
-
for (const
|
|
285
|
+
for (const s of e) {
|
|
286
286
|
let t = i;
|
|
287
|
-
const
|
|
288
|
-
for (const [o,
|
|
289
|
-
let
|
|
290
|
-
|
|
287
|
+
const r = s.module === void 0 ? [void 0] : s.module.split("/");
|
|
288
|
+
for (const [o, c] of r.entries()) {
|
|
289
|
+
let u = t.get(c);
|
|
290
|
+
u === void 0 && (u = { name: c, count: 0, usedCount: 0, children: /* @__PURE__ */ new Map(), apis: [] }, t.set(c, u)), u.count += s.count, o === r.length - 1 && (u.apis = s.apis, u.usedCount = s.count === 0 && s.module !== void 0 ? a?.get(JSON.stringify([n, s.module])) ?? 0 : 0), t = u.children;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
return [...i.values()].sort((
|
|
293
|
+
return [...i.values()].sort((s, t) => t.count - s.count).flatMap((s) => I(s, 0));
|
|
294
294
|
}
|
|
295
|
-
function I(e,
|
|
295
|
+
function I(e, n) {
|
|
296
296
|
let a = e, i = a.name ?? "Unknown module";
|
|
297
297
|
for (; a.children.size === 1 && a.apis.length === 0; )
|
|
298
298
|
a = [...a.children.values()][0], i += `/${a.name}`;
|
|
299
299
|
a.children.size > 0 && (i += "/");
|
|
300
|
-
const
|
|
300
|
+
const s = " ".repeat(n), t = [
|
|
301
301
|
...[...a.children.values()].map((o) => ({
|
|
302
302
|
count: o.count,
|
|
303
|
-
lines: I(o,
|
|
303
|
+
lines: I(o, n + 1)
|
|
304
304
|
})),
|
|
305
305
|
...a.apis.map((o) => ({
|
|
306
306
|
count: o.count,
|
|
307
|
-
lines: R(o, !0,
|
|
307
|
+
lines: R(o, !0, s)
|
|
308
308
|
}))
|
|
309
309
|
];
|
|
310
|
-
t.sort((o,
|
|
311
|
-
const
|
|
310
|
+
t.sort((o, c) => c.count - o.count);
|
|
311
|
+
const r = [
|
|
312
312
|
...a.usedCount === 0 ? [] : [
|
|
313
|
-
`${
|
|
313
|
+
`${s}> **Warning:** Other deprecated APIs in this file still have detected usages (${a.usedCount}). Do not remove the entire file.`,
|
|
314
314
|
""
|
|
315
315
|
],
|
|
316
316
|
...t.flatMap(({ lines: o }) => o)
|
|
317
317
|
];
|
|
318
|
-
return
|
|
318
|
+
return n === 0 ? [
|
|
319
319
|
"",
|
|
320
320
|
"<details>",
|
|
321
321
|
`<summary><code>${i.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")}</code>${m(e.count)}</summary>`,
|
|
322
322
|
"",
|
|
323
|
-
...
|
|
323
|
+
...r,
|
|
324
324
|
"",
|
|
325
325
|
"</details>"
|
|
326
|
-
] : [`${" ".repeat(
|
|
326
|
+
] : [`${" ".repeat(n - 1)}- \`${i}\`${m(e.count)}`, ...r];
|
|
327
327
|
}
|
|
328
|
-
async function
|
|
328
|
+
async function D(e, n) {
|
|
329
329
|
let a;
|
|
330
330
|
try {
|
|
331
|
-
a =
|
|
331
|
+
a = M(await J(e, "utf8"));
|
|
332
332
|
} catch (i) {
|
|
333
|
-
throw new Error(`Failed to read audit-${
|
|
333
|
+
throw new Error(`Failed to read audit-${n} report: ${e}`, { cause: i });
|
|
334
334
|
}
|
|
335
|
-
if (a.auditKind !==
|
|
336
|
-
throw new Error(`Invalid audit-${
|
|
335
|
+
if (a.auditKind !== n)
|
|
336
|
+
throw new Error(`Invalid audit-${n} report: ${e}`);
|
|
337
337
|
return a;
|
|
338
338
|
}
|
|
339
339
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/codemod",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.17",
|
|
4
4
|
"description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@arcgis/api-extractor": "6.0.0-next.
|
|
15
|
-
"@arcgis/node-toolkit": "6.0.0-next.
|
|
16
|
-
"@arcgis/toolkit": "6.0.0-next.
|
|
14
|
+
"@arcgis/api-extractor": "6.0.0-next.17",
|
|
15
|
+
"@arcgis/node-toolkit": "6.0.0-next.17",
|
|
16
|
+
"@arcgis/toolkit": "6.0.0-next.17",
|
|
17
17
|
"@commander-js/extra-typings": "^15.0.0",
|
|
18
18
|
"commander": "^15.0.0",
|
|
19
19
|
"semver": "^7.7.3",
|
|
20
20
|
"tinyglobby": "~0.2.17",
|
|
21
21
|
"ts-morph": "^28.0.0",
|
|
22
22
|
"tslib": "^2.8.1",
|
|
23
|
-
"typescript": "~6.0.3"
|
|
23
|
+
"typescript": "~6.0.3",
|
|
24
|
+
"yaml": "^2.8.3"
|
|
24
25
|
},
|
|
25
26
|
"bin": {
|
|
26
27
|
"codemod": "./bin/cli.js"
|