@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.
@@ -1,156 +1,156 @@
1
- var y = (o, a) => (a = Symbol[o]) ? a : /* @__PURE__ */ Symbol.for("Symbol." + o), P = (o) => {
2
- throw TypeError(o);
1
+ var P = (a, o) => (o = Symbol[a]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + a), S = (a) => {
2
+ throw TypeError(a);
3
3
  };
4
- var S = (o, a, s) => {
5
- if (a != null) {
6
- typeof a != "object" && typeof a != "function" && P("Object expected");
7
- var t, r;
8
- s && (t = a[y("asyncDispose")]), t === void 0 && (t = a[y("dispose")], s && (r = t)), typeof t != "function" && P("Object not disposable"), r && (t = function() {
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
- r.call(this);
11
- } catch (e) {
12
- return Promise.reject(e);
10
+ i.call(this);
11
+ } catch (p) {
12
+ return Promise.reject(p);
13
13
  }
14
- }), o.push([s, t, a]);
15
- } else s && o.push([s]);
16
- return a;
17
- }, b = (o, a, s) => {
18
- var t = typeof SuppressedError == "function" ? SuppressedError : function(c, m, i, p) {
19
- return p = Error(i), p.name = "SuppressedError", p.error = c, p.suppressed = m, p;
20
- }, r = (c) => a = s ? new t(c, a, "An error was suppressed during disposal") : (s = !0, c), e = (c) => {
21
- for (; c = o.pop(); )
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 m = c[1] && c[1].call(c[2]);
24
- if (c[0]) return Promise.resolve(m).then(e, (i) => (r(i), e()));
25
- } catch (i) {
26
- r(i);
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 a;
28
+ if (s) throw o;
29
29
  };
30
- return e();
30
+ return p();
31
31
  };
32
32
  import { log as J } from "@arcgis/toolkit/log";
33
- import { path as M } from "@arcgis/node-toolkit/path";
34
- import { styleText as R } from "node:util";
35
- import $ from "typescript";
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 T, i as A } from "./cli.js";
38
- import { c as j } from "./useProjectInstance.js";
39
- import { g as C, a as D, p as E, s as F } from "./artifact.js";
40
- import { loadCodeowners as I } from "@arcgis/node-toolkit/codeowners";
41
- import { b as L, d as z, a as K, c as Q, e as V, f as W } from "./classification.js";
42
- import { s as q, i as x, d as B, e as G, f as H } from "./componentAudit.js";
43
- async function de(o, a) {
44
- const s = !o && process.cwd() === C().repositoryRoot;
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(t) {
49
- await U(t, a, s);
47
+ async run(i) {
48
+ await _(i, o, n, s);
50
49
  }
51
50
  },
52
51
  "deprecations audit-definitions",
53
- o
52
+ a
54
53
  );
55
54
  }
56
- async function U(o, a, s) {
57
- const t = [], r = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), m = G("throw"), i = C();
58
- for (const n of o) {
59
- var p = [];
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 = n.packageJson?.filePath;
62
- if (q(n.packageJson?.contents.name) || d !== void 0 && x(D(d, i.repositoryRoot))) {
63
- d !== void 0 && !e.has(d) && (e.add(d), J(
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 \`${n.packageJson?.contents.name ?? n.cwd}\`.`
65
+ `Skipping excluded package \`${t.packageJson?.contents.name ?? t.cwd}\`.`
67
66
  ));
68
67
  continue;
69
68
  }
70
- const f = d === void 0 ? void 0 : await m(d);
71
- d !== void 0 && !c.has(d) && (c.add(d), f !== void 0 && t.push(...f.definitions));
72
- if (!n.filePaths.some(A))
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 = S(p, j(n, !1));
75
- const O = n.packageJson?.contents.name ?? N(n.cwd);
76
- for (const h of k.getCodemodFiles()) {
77
- if (x(
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 w = M.dirname(h.compilerNode.fileName), v = r.get(w) ?? B(w, O);
82
- r.set(w, v), t.push(
83
- ...X(h.compilerNode, v, f?.modulePaths)
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 (l) {
87
- var u = l, g = !0;
83
+ } catch (A) {
84
+ var F = A, M = !0;
88
85
  } finally {
89
- b(p, u, g);
86
+ $(v, F, M);
90
87
  }
91
88
  }
92
- if (a)
93
- Z(t, i, s);
89
+ const f = i.filter(({ sourceFileName: t }) => l(t));
90
+ if (o)
91
+ te(f, m, s, n);
94
92
  else
95
- for (const n of t) {
96
- const d = R(
93
+ for (const t of f) {
94
+ const d = j(
97
95
  "blue",
98
- `${N(n.sourceFileName)}:${n.line}:${n.column}`
99
- ), f = L({
100
- name: n.name,
101
- memberOf: n.memberOf,
102
- kind: n.kind
103
- }), k = z(n.kind, "parentheses");
104
- J("warn", d, `\`${f}\`${k} is deprecated.${n.reason ? ` ${n.reason}` : ""}`);
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
- E(
104
+ V(
107
105
  "definitions",
108
- t.length,
109
- new Set(t.map(({ sourceFileName: n }) => n)).size,
110
- new Set(t.map(({ package: n }) => n)).size
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 X(o, a, s) {
114
- const t = /* @__PURE__ */ new Map(), r = K([o.fileName], a), e = r === void 0 ? void 0 : s?.get(r) ?? r;
115
- function c(m) {
116
- const i = $.getJSDocDeprecatedTag(m), p = Y(m);
117
- if (i !== void 0 && p !== void 0) {
118
- const l = p.getStart(o), { line: u, character: g } = o.getLineAndCharacterOfPosition(l);
119
- t.set(`${l}:${p.getWidth(o)}`, {
120
- package: a,
121
- module: e,
122
- name: W(m, p.getText(o)),
123
- ...V(m),
124
- reason: i.comment === void 0 ? void 0 : H(i.comment),
125
- sourceFileName: o.fileName,
126
- line: u + 1,
127
- column: g + 1
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
- $.forEachChild(m, c);
128
+ O.forEachChild(e, c);
131
129
  }
132
- return c(o), [...t.values()].sort((m, i) => m.line - i.line || m.column - i.column);
130
+ return c(a), [...n.values()].sort((e, r) => e.line - r.line || e.column - r.column);
133
131
  }
134
- function Y(o) {
135
- return o.name;
132
+ function oe(a) {
133
+ return a.name;
136
134
  }
137
- function Z(o, a, s) {
138
- const t = I(), r = {
135
+ function te(a, o, s, n) {
136
+ const i = U(), p = h(process.cwd(), o.repositoryRoot), c = {
139
137
  auditKind: "definitions",
140
- repository: a.repository,
141
- ref: a.ref,
142
- branch: a.branch,
143
- scannerVersion: F,
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
- findings: o.map((e) => ({
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: Q({
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: D(e.sourceFileName, a.repositoryRoot),
161
+ file: h(e.sourceFileName, o.repositoryRoot),
162
162
  line: e.line,
163
163
  column: e.column,
164
- codeowners: t?.getOwners(e.sourceFileName) ?? []
164
+ codeowners: i?.getOwners(e.sourceFileName) ?? []
165
165
  }))
166
166
  };
167
- process.stdout.write(`${JSON.stringify(r, void 0, 2)}
167
+ process.stdout.write(`${JSON.stringify(c, void 0, 2)}
168
168
  `);
169
169
  }
170
170
  export {
171
- de as auditDeprecatedDefinitions,
172
- X as collectDeprecatedApiDefinitions
171
+ ue as auditDeprecatedDefinitions,
172
+ ee as collectDeprecatedApiDefinitions
173
173
  };
@@ -1,9 +1,8 @@
1
- import { readFile as J } from "node:fs/promises";
2
- import { b as M, c as C } from "./artifact.js";
3
- import { c as k, g as z, b as h, i as B, d as A } from "./classification.js";
4
- import { e as j, b, d as N } from "./cli.js";
5
- async function F(e = {}) {
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 ? [] : F(s)
32
- ]), d = x(
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 x(e, n = {}, a) {
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 ?? k(u) })).filter((u) => S(u, n));
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 = O(t);
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: z(n, (a) => a).map(({ categoryName: a, count: i, packages: s }) => ({
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 S(e, n) {
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 O(e) {
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 ?? k(c), w(c)])
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 ?? k(u),
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: U(p),
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 || 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)
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 ?? k(o) }, u = w(c);
141
- if (!s.has(u) && S(c, a)) {
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: O([...t.values()]) };
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 U(e, n = !1) {
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 - ${P(U(o.repository, !0))} - ${c.slice(0, 10)}${u}</summary>`,
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 P(e).replaceAll("|", "&#124;").replaceAll(/\r?\n/gu, " ");
225
+ return U(e).replaceAll("|", "&#124;").replaceAll(/\r?\n/gu, " ");
217
226
  }
218
- function P(e) {
227
+ function U(e) {
219
228
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
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, E) => v + E.count, 0) }];
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
- ...T(u, s, a)
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 T(e, n, a) {
255
+ function H(e, n, a) {
247
256
  const i = [], s = e.flatMap(
248
257
  (t) => [
249
- ...Map.groupBy(t.modules, (r) => B(t.package, r.module))
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(...H(t.modules, t.package, a));
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(...R(c, !1, " "));
278
+ i.push(...x(c, !1, " "));
270
279
  }
271
280
  }
272
281
  return i;
273
282
  }
274
- function R(e, n, a = "") {
275
- const i = `${h(e)}${A(e.kind)}`, s = e.repositories.map(
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}- \`${h(e)}\`${A(e.kind)}${m(e.count)}`,
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 H(e, n, a) {
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: R(o, !0, s)
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 J(e, "utf8"));
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
- x as aggregateUsages,
349
+ F as aggregateUsages,
341
350
  Y as aggregateUsagesFromFiles
342
351
  };