@arcgis/codemod 6.0.0-next.5 → 6.0.0-next.7

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,459 +1,689 @@
1
- var M = (o, e) => (e = Symbol[o]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + o), O = (o) => {
2
- throw TypeError(o);
1
+ var Q = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), V = (n) => {
2
+ throw TypeError(n);
3
3
  };
4
- var J = (o, e, t) => {
4
+ var G = (n, e, o) => {
5
5
  if (e != null) {
6
- typeof e != "object" && typeof e != "function" && O("Object expected");
7
- var a, i;
8
- t && (a = e[M("asyncDispose")]), a === void 0 && (a = e[M("dispose")], t && (i = a)), typeof a != "function" && O("Object not disposable"), i && (a = function() {
6
+ typeof e != "object" && typeof e != "function" && V("Object expected");
7
+ var t, i;
8
+ o && (t = e[Q("asyncDispose")]), t === void 0 && (t = e[Q("dispose")], o && (i = t)), typeof t != "function" && V("Object not disposable"), i && (t = function() {
9
9
  try {
10
10
  i.call(this);
11
- } catch (s) {
12
- return Promise.reject(s);
11
+ } catch (a) {
12
+ return Promise.reject(a);
13
13
  }
14
- }), o.push([t, a, e]);
15
- } else t && o.push([t]);
14
+ }), n.push([o, t, e]);
15
+ } else o && n.push([o]);
16
16
  return e;
17
- }, R = (o, e, t) => {
18
- var a = typeof SuppressedError == "function" ? SuppressedError : function(n, r, m, c) {
19
- return c = Error(m), c.name = "SuppressedError", c.error = n, c.suppressed = r, c;
20
- }, i = (n) => e = t ? new a(n, e, "An error was suppressed during disposal") : (t = !0, n), s = (n) => {
21
- for (; n = o.pop(); )
17
+ }, _ = (n, e, o) => {
18
+ var t = typeof SuppressedError == "function" ? SuppressedError : function(s, l, d, m) {
19
+ return m = Error(d), m.name = "SuppressedError", m.error = s, m.suppressed = l, m;
20
+ }, i = (s) => e = o ? new t(s, e, "An error was suppressed during disposal") : (o = !0, s), a = (s) => {
21
+ for (; s = n.pop(); )
22
22
  try {
23
- var r = n[1] && n[1].call(n[2]);
24
- if (n[0]) return Promise.resolve(r).then(s, (m) => (i(m), s()));
25
- } catch (m) {
26
- i(m);
23
+ var l = s[1] && s[1].call(s[2]);
24
+ if (s[0]) return Promise.resolve(l).then(a, (d) => (i(d), a()));
25
+ } catch (d) {
26
+ i(d);
27
27
  }
28
- if (t) throw e;
28
+ if (o) throw e;
29
29
  };
30
- return s();
30
+ return a();
31
31
  };
32
- import { c as H } from "./useProjectInstance.js";
33
- import { d as b, r as q } from "./cli.js";
34
- import { f as x } from "./log.js";
35
- import { path as v, toPosixPathSeparators as X } from "@arcgis/node-toolkit/path";
36
- import { log as Y } from "@arcgis/toolkit/log";
37
- import l from "typescript";
38
- import { g as A, a as Z, b as ee, c as te, d as w, e as oe, f as z, p as ne, i as ae, h as D, j, k as ie } from "./classification.js";
39
- import { s as se, g as W, a as re, b as ce, c as me } from "./hardcodedBehavior.js";
40
- import { styleText as k } from "node:util";
41
- import { loadCodeowners as le } from "@arcgis/node-toolkit/codeowners";
42
- import { f as pe } from "./format.js";
43
- function ue(o, e) {
32
+ import { c as me } from "./useProjectInstance.js";
33
+ import { d as I, r as de, i as pe, a as ue, b as fe } from "./cli.js";
34
+ import { f as $ } from "./log.js";
35
+ import { path as P, toPosixPathSeparators as ge } from "@arcgis/node-toolkit/path";
36
+ import { log as xe } from "@arcgis/toolkit/log";
37
+ import { forEachWithConcurrency as ve } from "@arcgis/toolkit/promise";
38
+ import c from "typescript";
39
+ import { s as he, g as C, a as ye, p as we } from "./artifact.js";
40
+ import { loadCodeowners as te } from "@arcgis/node-toolkit/codeowners";
41
+ import { c as q, s as Ne, l as Se, a as ne, g as oe, b as be, d as Ae, e as ke } from "./componentAudit.js";
42
+ import { g as Pe, a as J, c as se, b as De, d as Ce, e as L, f as H, h as Ee } from "./classification.js";
43
+ import { styleText as M } from "node:util";
44
+ import { f as $e } from "./format.js";
45
+ import { readFile as Oe } from "node:fs/promises";
46
+ function Te(n, e, o) {
44
47
  if (e === "json") {
45
- const t = A();
46
- process.stdout.write(`${Ne(o, le(), t)}
48
+ if (o !== void 0) {
49
+ process.stdout.write(`${JSON.stringify(o, void 0, 2)}
50
+ `);
51
+ return;
52
+ }
53
+ const t = C();
54
+ process.stdout.write(`${Fe(n, te(), t)}
47
55
  `);
48
56
  return;
49
57
  }
50
58
  if (e === "md") {
51
- process.stdout.write(`${he(o)}
59
+ process.stdout.write(`${Ue(n)}
52
60
  `);
53
61
  return;
54
62
  }
55
- process.stdout.write(`${ge(o)}
63
+ process.stdout.write(`${Ie(n)}
56
64
  `);
57
65
  }
58
- function ge(o) {
59
- const e = Q(o), t = e.reduce((i, s) => i + s.count, 0), a = [U("Deprecation summary", t)];
60
- for (const { categoryName: i, count: s, packages: n } of e) {
61
- a.push(`${b[i].label} (${s})`);
62
- for (const { packageName: r, count: m } of n)
63
- a.push(` ${K(r)} (${m})`);
66
+ function Ie(n) {
67
+ const e = ie(n), o = e.reduce((i, a) => i + a.count, 0), t = [X("Deprecation summary", o)];
68
+ for (const { categoryName: i, count: a, packages: s } of e) {
69
+ t.push(`${I[i].label} (${a})`);
70
+ for (const { displayName: l, count: d } of s)
71
+ t.push(` ${Y(l)} (${d})`);
64
72
  }
65
- a.push("", "", U("Deprecation details", t));
66
- for (const { categoryName: i, count: s, packages: n } of e) {
67
- const r = b[i];
68
- a.push("", `${r.label} (${s})`), "description" in r && a.push(` ${r.description}`);
69
- for (const { packageName: m, count: c, apis: u } of n) {
70
- a.push("", ` ${K(m)} (${c})`);
71
- for (const { api: p, reasons: g, items: d } of u) {
72
- const y = d[0].usage, h = Z({ api: p, memberOf: y.memberOf, apiKind: y.apiKind });
73
- a.push(` ${fe(h)}${ee(y.apiKind)} (${d.length})`);
74
- for (const f of g)
75
- a.push(de(f, 6));
76
- for (const { sourceFileName: f, usage: N } of ve(d))
77
- a.push(` ${x(f)}:${N.line}:${N.column}`);
73
+ t.push("", "", X("Deprecation details", o));
74
+ for (const { categoryName: i, count: a, packages: s } of e) {
75
+ const l = I[i];
76
+ t.push("", `${l.label} (${a})`), "description" in l && t.push(` ${l.description}`);
77
+ for (const { displayName: d, count: m, apis: f } of s) {
78
+ t.push("", ` ${Y(d)} (${m})`);
79
+ for (const { name: r, reasons: p, items: x } of f) {
80
+ const h = x[0].usage, u = De({ name: r, memberOf: h.memberOf, kind: h.kind });
81
+ t.push(` ${Le(u)}${Ce(h.kind)} (${x.length})`);
82
+ for (const y of p)
83
+ t.push(Je(y, 6));
84
+ for (const { sourceFileName: y, usage: w } of Me(x))
85
+ t.push(` ${$(y)}:${w.line}:${w.column}`);
78
86
  }
79
87
  }
80
88
  }
81
- return a.join(`
89
+ return t.join(`
82
90
  `);
83
91
  }
84
- function Q(o) {
85
- const e = [...o].flatMap(
86
- ([t, a]) => a.map((i) => ({ ...i, packageName: t }))
92
+ function ie(n) {
93
+ const e = [...n].flatMap(
94
+ ([o, t]) => t.map((i) => ({ ...i, packageName: o }))
87
95
  );
88
- return te(e, ({ packageName: t, usage: a }) => ({
89
- package: t,
90
- api: a.name,
91
- category: a.category,
92
- memberOf: a.memberOf,
93
- module: w(a.originFileNames, t),
94
- reason: a.reason ?? null
96
+ return Pe(e, ({ packageName: o, usage: t }) => ({
97
+ package: o,
98
+ name: t.name,
99
+ kind: t.kind,
100
+ category: t.category,
101
+ memberOf: t.memberOf,
102
+ module: t.module ?? J(t.originFileNames, o),
103
+ deprecated: t.reason ?? !0
95
104
  }));
96
105
  }
97
- function U(o, e) {
98
- return k(["bold", "yellow"], `${o} (${e})`);
106
+ function X(n, e) {
107
+ return M(["bold", "yellow"], `${n} (${e})`);
99
108
  }
100
- function K(o) {
101
- return k("blue", o);
109
+ function Y(n) {
110
+ return M("blue", n);
102
111
  }
103
- function fe(o) {
104
- return k(["bold", "white"], o);
112
+ function Le(n) {
113
+ return M(["bold", "white"], n);
105
114
  }
106
- function de(o, e) {
107
- const t = " ".repeat(e);
108
- return o.split(/\r?\n/u).map((a) => `${t}${a}`).join(`
115
+ function Je(n, e) {
116
+ const o = " ".repeat(e);
117
+ return n.split(/\r?\n/u).map((t) => `${o}${t}`).join(`
109
118
  `);
110
119
  }
111
- function ve(o) {
112
- return o.toSorted(
113
- (e, t) => e.sourceFileName.localeCompare(t.sourceFileName) || e.usage.line - t.usage.line || e.usage.column - t.usage.column
120
+ function Me(n) {
121
+ return n.toSorted(
122
+ (e, o) => e.sourceFileName.localeCompare(o.sourceFileName) || e.usage.line - o.usage.line || e.usage.column - o.usage.column
114
123
  );
115
124
  }
116
- function ye(o) {
117
- return [...o].sort(([e], [t]) => e.localeCompare(t));
125
+ function Re(n) {
126
+ return [...n].sort(([e], [o]) => e.localeCompare(o));
118
127
  }
119
- function Ne(o, e, t = A()) {
120
- return JSON.stringify(V(o, e, t), void 0, 2);
128
+ function Fe(n, e, o = C()) {
129
+ return JSON.stringify(R(n, e, o), void 0, 2);
121
130
  }
122
- function he(o, e = A()) {
123
- return pe(V(o, void 0, e));
131
+ function Ue(n, e = C()) {
132
+ return $e(R(n, void 0, e));
124
133
  }
125
- function V(o, e, t) {
126
- const a = Q(o);
134
+ function R(n, e, o, t) {
135
+ const i = ie(n);
127
136
  return {
128
- kind: "usages",
129
- repository: t.repository,
130
- ref: t.ref,
137
+ auditKind: "usages",
138
+ repository: o.repository,
139
+ ref: o.ref,
140
+ branch: o.branch,
141
+ scannerVersion: he,
142
+ scanDate: Date.now(),
143
+ ...t === void 0 ? {} : { complete: t },
131
144
  summary: {
132
- total: a.reduce((s, { count: n }) => s + n, 0),
133
- categories: a.map(({ categoryName: s, count: n, packages: r }) => ({
145
+ total: i.reduce((s, { count: l }) => s + l, 0),
146
+ categories: i.map(({ categoryName: s, count: l, packages: d }) => ({
134
147
  category: s,
135
- label: b[s].label,
136
- count: n,
137
- packages: r.map(({ packageName: m, count: c }) => ({
148
+ label: I[s].label,
149
+ count: l,
150
+ packages: d.map(({ packageName: m, displayName: f, count: r }) => ({
138
151
  package: m,
139
- count: c
152
+ ...f === m ? {} : { displayName: f },
153
+ count: r
140
154
  }))
141
155
  }))
142
156
  },
143
- findings: xe(o, e, t)
157
+ findings: ze(n, e, o)
144
158
  };
145
159
  }
146
- function xe(o, e, t) {
147
- return ye(o).flatMap(
148
- ([a, i]) => i.map((s) => {
149
- const n = w(s.usage.originFileNames, a), r = {
150
- package: a,
151
- api: s.usage.name,
152
- category: s.usage.category,
153
- memberOf: s.usage.memberOf,
154
- module: n,
155
- reason: s.usage.reason ?? null
160
+ function ze(n, e, o) {
161
+ return Re(n).flatMap(
162
+ ([t, i]) => i.map((a) => {
163
+ const s = a.usage.module ?? J(a.usage.originFileNames, t), l = {
164
+ package: t,
165
+ name: a.usage.name,
166
+ category: a.usage.category,
167
+ memberOf: a.usage.memberOf,
168
+ module: s,
169
+ deprecated: a.usage.reason ?? !0
156
170
  };
157
171
  return {
158
- ...r,
159
- category: z(r),
160
- apiKind: s.usage.apiKind,
161
- memberOf: s.usage.memberOf,
162
- file: oe(s.sourceFileName, t.repositoryRoot),
163
- line: s.usage.line,
164
- column: s.usage.column,
165
- codeowners: e?.getOwners(s.sourceFileName) ?? []
172
+ ...l,
173
+ category: se(l),
174
+ kind: a.usage.kind,
175
+ memberOf: a.usage.memberOf,
176
+ file: ye(a.sourceFileName, o.repositoryRoot),
177
+ line: a.usage.line,
178
+ column: a.usage.column,
179
+ codeowners: e?.getOwners(a.sourceFileName) ?? []
166
180
  };
167
181
  })
168
182
  );
169
183
  }
170
- async function We(o, e) {
171
- await q(
184
+ function Z(n, e, o) {
185
+ if (!e.hasDeprecatedApis)
186
+ return [];
187
+ const t = "getLineAndCharacterOfPosition" in n ? (r) => n.getLineAndCharacterOfPosition(r) : We(n.text), i = /* @__PURE__ */ new Map();
188
+ for (const [r, p] of e.cssVariables)
189
+ for (let x = n.text.indexOf(r); x !== -1; x = n.text.indexOf(r, x + r.length))
190
+ s(p, x, r.length);
191
+ const a = P.extname(n.fileName).slice(1).toLowerCase();
192
+ return a === "html" ? Ke(
193
+ n.text,
194
+ (r, p, x) => {
195
+ d(
196
+ r,
197
+ p,
198
+ x.map(({ name: h, start: u }) => ({ name: h, start: u }))
199
+ );
200
+ },
201
+ (r, p) => ee(r, p, m)
202
+ ) : a === "css" || a === "scss" || a === "sass" ? ee(n.text, 0, m, a !== "css") : "kind" in n && f(n, n), [...i.values()].sort((r, p) => r.usage.start - p.usage.start);
203
+ function s(r, p, x) {
204
+ const { line: h, character: u } = t(p);
205
+ i.set(JSON.stringify([r.package, r.kind, r.memberOf, r.name, p]), {
206
+ packageName: r.package,
207
+ sourceFileName: n.fileName,
208
+ usage: {
209
+ name: r.name,
210
+ kind: r.kind,
211
+ memberOf: r.kind === "css-property" ? void 0 : r.memberOf,
212
+ module: r.module,
213
+ reason: r.reason,
214
+ originFileNames: [r.sourceFileName],
215
+ start: p,
216
+ length: x,
217
+ line: h + 1,
218
+ column: u + 1
219
+ }
220
+ });
221
+ }
222
+ function l(r, p, x) {
223
+ const h = e.components.get(r);
224
+ return h?.length === 1 ? h[0].definitions.find(
225
+ (u) => u.kind === p && u.name === x && (p === "element" || u.memberOf === r)
226
+ ) : void 0;
227
+ }
228
+ function d(r, p, x) {
229
+ const h = l(r, "element", r);
230
+ h !== void 0 && s(h, p, r.length);
231
+ for (const u of x) {
232
+ const y = l(r, "attribute", u.name);
233
+ y !== void 0 && s(y, u.start, u.name.length);
234
+ }
235
+ }
236
+ function m(r, p, x, h) {
237
+ const u = l(r, p, x);
238
+ u !== void 0 && s(u, h, x.length);
239
+ }
240
+ function f(r, p) {
241
+ if (c.isJsxOpeningElement(r) || c.isJsxSelfClosingElement(r)) {
242
+ const x = r.tagName.getText(p), h = r.attributes.properties.filter(c.isJsxAttribute);
243
+ if (d(
244
+ x,
245
+ r.tagName.getStart(p),
246
+ h.map((u) => ({
247
+ name: u.name.getText(p),
248
+ start: u.name.getStart(p)
249
+ }))
250
+ ), /^[a-z][\w-]*$/u.test(x)) {
251
+ const u = h.find((v) => v.name.getText(p) === "slot"), y = u?.initializer, w = y !== void 0 && c.isJsxExpression(y) ? y.expression : y, E = u === void 0 ? -1 : r.attributes.properties.indexOf(u), g = r.attributes.properties.slice(E + 1).some(c.isJsxSpreadAttribute);
252
+ if (w !== void 0 && (c.isStringLiteral(w) || c.isNoSubstitutionTemplateLiteral(w)) && !g) {
253
+ const v = je(c.isJsxOpeningElement(r) ? r.parent : r, o), N = v === void 0 ? void 0 : l(v, "slot", w.text);
254
+ N !== void 0 && s(N, w.getStart(p) + 1, w.getWidth(p) - 2);
255
+ }
256
+ }
257
+ }
258
+ c.forEachChild(r, (x) => f(x, p));
259
+ }
260
+ }
261
+ function We(n) {
262
+ const e = [
263
+ 0,
264
+ ...Array.from(n.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (o) => o.index + o[0].length)
265
+ ];
266
+ return (o) => {
267
+ let t = 0, i = e.length;
268
+ for (; t + 1 < i; ) {
269
+ const a = Math.floor((t + i) / 2);
270
+ e[a] <= o ? t = a : i = a;
271
+ }
272
+ return { line: t, character: o - e[t] };
273
+ };
274
+ }
275
+ function je(n, e) {
276
+ let o = n;
277
+ for (let t = o.parent; t !== void 0; o = t, t = t.parent) {
278
+ if (c.isJsxElement(t))
279
+ return t.openingElement.tagName.getText();
280
+ if (!(c.isJsxFragment(t) || c.isJsxExpression(t) || c.isParenthesizedExpression(t)) && !(c.isConditionalExpression(t) && o !== t.condition) && !(c.isBinaryExpression(t) && (t.operatorToken.kind === c.SyntaxKind.AmpersandAmpersandToken && o === t.right || t.operatorToken.kind === c.SyntaxKind.BarBarToken || t.operatorToken.kind === c.SyntaxKind.QuestionQuestionToken))) {
281
+ if (c.isReturnStatement(t)) {
282
+ const i = c.findAncestor(t, c.isFunctionLike);
283
+ if (i === void 0 || !c.isArrowFunction(i) && !c.isFunctionExpression(i))
284
+ return;
285
+ o = i.body, t = i;
286
+ }
287
+ if ((c.isArrowFunction(t) || c.isFunctionExpression(t)) && o === t.body) {
288
+ const i = t.parent;
289
+ if (!c.isCallExpression(i) || i.arguments[0] !== t || !c.isPropertyAccessExpression(i.expression) || i.expression.name.text !== "map")
290
+ return;
291
+ const a = i.expression.expression, s = e?.getTypeAtLocation(a);
292
+ if (!c.isArrayLiteralExpression(a) && (s === void 0 || !e.isArrayType(s) && !e.isTupleType(s)))
293
+ return;
294
+ o = t, t = i;
295
+ continue;
296
+ }
297
+ return;
298
+ }
299
+ }
300
+ }
301
+ function ee(n, e, o, t = !1) {
302
+ const i = t ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, a = n.replace(i, (m) => m.replace(/[^\r\n]/gu, " ")), s = [];
303
+ let l = 0, d = 0;
304
+ for (const m of a.matchAll(/[{};]/gu)) {
305
+ const f = m.index;
306
+ if (d > 0) {
307
+ d += m[0] === "{" ? 1 : m[0] === "}" ? -1 : 0, l = f + 1;
308
+ continue;
309
+ }
310
+ if (m[0] === "}")
311
+ s.pop();
312
+ else if (m[0] === "{") {
313
+ const r = a.slice(l, f), p = s.at(-1) ?? [];
314
+ if (/^\s*--[\w-]+\s*:/u.test(r))
315
+ d = 1;
316
+ else if (r.trimStart().startsWith("@"))
317
+ s.push(p);
318
+ else {
319
+ const h = r.split(",").map((u) => u.trim()).flatMap(
320
+ (u) => p.length === 0 ? [u] : p.map(
321
+ (y) => u.includes("&") ? u.replaceAll("&", y) : `${y} ${u}`
322
+ )
323
+ );
324
+ for (const u of r.matchAll(/::part\(\s*([\w\s-]+?)\s*\)|:state\(\s*([\w-]+)\s*\)/gu)) {
325
+ const y = r.lastIndexOf(",", u.index) + 1, w = r.slice(y, u.index), g = (p.length === 0 ? [w] : p.map(
326
+ (S) => w.includes("&") ? w.replaceAll("&", S) : `${S} ${w}`
327
+ )).map(Be);
328
+ if (g.includes(void 0) || new Set(g).size !== 1)
329
+ continue;
330
+ const v = u[1] === void 0 ? "css-state" : "css-part", N = u[1] ?? u[2], A = u.index + u[0].indexOf(N);
331
+ for (const S of N.matchAll(/[\w-]+/gu))
332
+ o(g[0], v, S[0], e + l + A + S.index);
333
+ }
334
+ s.push(h);
335
+ }
336
+ }
337
+ l = f + 1;
338
+ }
339
+ }
340
+ function Be(n) {
341
+ const e = n.replace(/:state\([\w-]+\)/gu, "").trimStart();
342
+ return /(?:^|[\s>+~])([a-z][\w-]*)(?:[.#:][\w-]+|\[[^\]]*\])*$/iu.exec(e)?.[1]?.toLowerCase();
343
+ }
344
+ function Ke(n, e, o) {
345
+ const t = /<!--[\s\S]*?(?:-->|$)|<![^>]*>|<\/?([a-z][\w:-]*)\b((?:"[^"]*"|'[^']*'|[^'">])*)>/giu;
346
+ for (let i = t.exec(n); i !== null; i = t.exec(n)) {
347
+ if (i[1] === void 0 || i[0].startsWith("</"))
348
+ continue;
349
+ const a = i[1].toLowerCase(), s = i.index + 1 + i[1].length, l = [...i[2].matchAll(/([^\s"'<>/=]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/gu)].map(
350
+ (d) => ({ name: d[1].toLowerCase(), start: s + d.index })
351
+ );
352
+ if (e(a, i.index + 1, l), a === "plaintext")
353
+ break;
354
+ if (["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes"].includes(a)) {
355
+ const d = new RegExp(`</${a}\\s*>`, "giu");
356
+ d.lastIndex = t.lastIndex;
357
+ const m = d.exec(n);
358
+ a === "style" && o(n.slice(t.lastIndex, m?.index ?? n.length), t.lastIndex), t.lastIndex = m === null ? n.length : d.lastIndex;
359
+ }
360
+ }
361
+ }
362
+ async function xt(n, e) {
363
+ if (e.reportingUrl && (n || e.esriOnly || e.category || e.packageName))
364
+ throw new Error("Reporting requires a complete, unfiltered repository scan.");
365
+ const o = e.outputFormat === "json" || e.reportingUrl ? process.cwd() === C().repositoryRoot : !1;
366
+ if (e.reportingUrl && !o)
367
+ throw new Error("Reporting requires scanning from the Git repository root.");
368
+ let t = !n && !e.esriOnly && !e.category && !e.packageName;
369
+ (e.outputFormat === "json" || e.reportingUrl) && (t &&= o), await de(
172
370
  {
173
371
  meta: {
174
372
  needsTypeInformation: !0,
175
- needsFooter: !1
373
+ needsFooter: !1,
374
+ includeComponentFiles: !0
176
375
  },
177
- run(t) {
178
- Se(t, e);
376
+ async run(i) {
377
+ await Qe(i, e, t);
179
378
  }
180
379
  },
181
380
  "deprecations audit-usages",
182
- o
381
+ n
183
382
  );
184
383
  }
185
- function Se(o, e) {
186
- const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = [
384
+ async function Qe(n, e, o) {
385
+ const t = /* @__PURE__ */ new Map(), i = be("warn", () => {
386
+ o = !1;
387
+ }), a = /* @__PURE__ */ new Map(), s = q([]), l = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), m = [
187
388
  ...new Map(
188
- o.flatMap(({ packageJson: p }) => {
189
- const g = p === void 0 ? void 0 : v.dirname(p.filePath), d = p?.contents.name;
190
- return g !== void 0 && d !== void 0 && S(g, process.cwd()) ? [[g, { root: g, name: d }]] : [];
389
+ n.flatMap(({ packageJson: g }) => {
390
+ const v = g === void 0 ? void 0 : P.dirname(g.filePath), N = g?.contents.name;
391
+ return v !== void 0 && N !== void 0 && O(v, process.cwd()) ? [[v, { root: v, name: N }]] : [];
191
392
  })
192
393
  ).values()
193
- ].toSorted((p, g) => g.root.length - p.root.length);
194
- for (const p of o) {
195
- var r = [];
394
+ ].toSorted((g, v) => v.root.length - g.root.length);
395
+ for (const g of n) {
396
+ var u = [];
196
397
  try {
197
- if (se(p.packageJson?.contents.name)) {
198
- const f = p.packageJson?.filePath;
199
- f !== void 0 && !a.has(f) && (a.add(f), Y(
398
+ if (Ne(g.packageJson?.contents.name)) {
399
+ const b = g.packageJson?.filePath;
400
+ b !== void 0 && !d.has(b) && (d.add(b), xe(
200
401
  "warn",
201
- x(f),
202
- `Skipping excluded package \`${p.packageJson?.contents.name ?? p.cwd}\`.`
402
+ $(b),
403
+ `Skipping excluded package \`${g.packageJson?.contents.name ?? g.cwd}\`.`
203
404
  ));
204
405
  continue;
205
406
  }
206
- const g = J(r, H(p, !1));
207
- const d = g.tsMorph.getLanguageService().compilerObject;
208
- const y = d.getProgram()?.getTypeChecker();
209
- if (y === void 0)
407
+ if (g.filePaths.length === 0)
210
408
  continue;
211
- const h = p.packageJson === void 0 ? void 0 : v.dirname(p.packageJson.filePath);
212
- for (const f of g.getCodemodFiles()) {
213
- const N = f.compilerNode;
214
- for (const I of be(
215
- N,
216
- d,
217
- y,
218
- h,
219
- e.esriOnly
220
- )) {
221
- const T = Ee(I.originFileNames, i, h), L = t.get(T) ?? [];
222
- L.push({ sourceFileName: N.fileName, usage: I }), t.set(T, L);
409
+ const v = await x(g.packageJson);
410
+ const N = g.packageJson === void 0 ? void 0 : P.dirname(g.packageJson.filePath);
411
+ const A = G(u, g.filePaths.some(pe) ? me(g, !1) : void 0);
412
+ const S = A?.tsMorph.getLanguageService().compilerObject;
413
+ const D = S?.getProgram()?.getTypeChecker();
414
+ for (const b of A?.getCodemodFiles() ?? []) {
415
+ const k = b.compilerNode;
416
+ if (S !== void 0 && D !== void 0) {
417
+ const le = Ge(
418
+ k,
419
+ S,
420
+ D,
421
+ N,
422
+ e.esriOnly
423
+ );
424
+ for (const j of le) {
425
+ const B = et(j.originFileNames, m, N), K = t.get(B) ?? [];
426
+ K.push({ sourceFileName: k.fileName, usage: j }), t.set(B, K);
427
+ }
223
428
  }
429
+ h(Z(k, v, D)), l.add(k.fileName);
224
430
  }
225
- } catch (m) {
226
- var c = m, u = !0;
431
+ v.hasDeprecatedApis && await ve(g.filePaths, 8, async (b) => {
432
+ if (l.has(b))
433
+ return;
434
+ const k = await Oe(b, "utf8");
435
+ h(Z({ fileName: b, text: k }, v)), l.add(b);
436
+ });
437
+ } catch (y) {
438
+ var w = y, E = !0;
227
439
  } finally {
228
- R(r, c, u);
440
+ _(u, w, E);
229
441
  }
230
442
  }
231
- const s = Pe(t, e);
232
- ue(s, e.outputFormat);
233
- const n = [...s.values()].flat();
234
- ne(
443
+ const f = Ve(t, e), r = e.reportingUrl || e.outputFormat === "json" ? R(f, te(), C(), o) : void 0;
444
+ Te(f, e.outputFormat, r);
445
+ const p = [...f.values()].flat();
446
+ we(
235
447
  "usages",
236
- n.length,
237
- new Set(n.map(({ sourceFileName: p }) => p)).size,
238
- s.size
239
- );
448
+ p.length,
449
+ new Set(p.map(({ sourceFileName: g }) => g)).size,
450
+ f.size
451
+ ), e.reportingUrl && r !== void 0 && await ue(r, e.reportingUrl);
452
+ async function x(g) {
453
+ if (g === void 0)
454
+ return s;
455
+ let v = a.get(g.filePath);
456
+ return v === void 0 && (v = q(
457
+ await Se(g, i, e.esriOnly)
458
+ ), a.set(g.filePath, v)), v;
459
+ }
460
+ function h(g) {
461
+ for (const { packageName: v, sourceFileName: N, usage: A } of g) {
462
+ if (ne(A.name, A.reason))
463
+ continue;
464
+ const S = t.get(v) ?? [], D = S.findIndex(
465
+ (k) => k.sourceFileName === N && k.usage.start === A.start && k.usage.length === A.length
466
+ ), b = { sourceFileName: N, usage: A };
467
+ D === -1 ? S.push(b) : S[D] = b, t.set(v, S);
468
+ }
469
+ }
240
470
  }
241
- function Pe(o, e) {
242
- const t = /* @__PURE__ */ new Map();
243
- for (const [a, i] of o) {
244
- if (e.packageName !== void 0 && a !== e.packageName)
471
+ function Ve(n, e) {
472
+ const o = /* @__PURE__ */ new Map();
473
+ for (const [t, i] of n) {
474
+ if (e.packageName !== void 0 && t !== e.packageName)
245
475
  continue;
246
- const s = i.filter(
247
- ({ usage: n }) => e.category === void 0 || z({
248
- package: a,
249
- api: n.name,
250
- category: n.category,
251
- memberOf: n.memberOf,
252
- module: w(n.originFileNames, a),
253
- reason: n.reason ?? null
476
+ const a = i.filter(
477
+ ({ usage: s }) => e.category === void 0 || se({
478
+ package: t,
479
+ name: s.name,
480
+ category: s.category,
481
+ memberOf: s.memberOf,
482
+ module: s.module ?? J(s.originFileNames, t),
483
+ deprecated: s.reason ?? !0
254
484
  }) === e.category
255
485
  );
256
- s.length > 0 && t.set(a, s);
486
+ a.length > 0 && o.set(t, a);
257
487
  }
258
- return t;
488
+ return o;
259
489
  }
260
- function be(o, e, t, a, i = !1) {
261
- const s = /* @__PURE__ */ new Map();
262
- for (const n of e.getSuggestionDiagnostics(o.fileName)) {
263
- if (n.reportsDeprecated === void 0)
490
+ function Ge(n, e, o, t, i = !1) {
491
+ const a = /* @__PURE__ */ new Map();
492
+ for (const s of e.getSuggestionDiagnostics(n.fileName)) {
493
+ if (s.reportsDeprecated === void 0)
264
494
  continue;
265
- const r = _(o, n.start, n.start + n.length);
495
+ const l = ae(n, s.start, s.start + s.length);
266
496
  if (
267
497
  // Don't report for imports, only for usages
268
- l.findAncestor(r, l.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
269
- l.findAncestor(r, l.isJsxClosingElement) !== void 0
498
+ c.findAncestor(l, c.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
499
+ c.findAncestor(l, c.isJsxClosingElement) !== void 0
270
500
  )
271
501
  continue;
272
- const m = we(r, t), c = m.reason === void 0 ? [] : $(m.symbol), u = c.length > 0 ? void 0 : e.getDefinitionAtPosition(o.fileName, n.start), p = c.length > 0 ? c : [...new Set(u?.map(({ fileName: g }) => g))];
273
- E(p, i, a) && C(s, o, {
274
- start: n.start,
275
- length: n.length,
276
- ...ke(r, m, t, e, u?.[0]),
277
- originFileNames: p,
278
- reason: Ce(e, o.fileName, n.start) ?? m.reason
502
+ const d = He(l, o), m = d.reason === void 0 ? [] : F(d.symbol), f = m.length > 0 ? void 0 : e.getDefinitionAtPosition(n.fileName, s.start), r = m.length > 0 ? m : [...new Set(f?.map(({ fileName: p }) => p))];
503
+ z(r, i, t) && U(a, n, {
504
+ start: s.start,
505
+ length: s.length,
506
+ ...Xe(l, d, o, e, f?.[0]),
507
+ originFileNames: r,
508
+ reason: Ze(e, n.fileName, s.start) ?? d.reason
279
509
  });
280
510
  }
281
- return De(o, t, s, a, i), [...s.values()].toSorted((n, r) => n.start - r.start);
282
- }
283
- function De(o, e, t, a, i) {
284
- function s(n) {
285
- l.isNewExpression(n) && Ae(n, e, t, a, i);
286
- let r, m;
287
- if (l.isJsxAttribute(n) && l.isIdentifier(n.name)) {
288
- const c = n.parent.parent;
289
- (l.isJsxOpeningElement(c) || l.isJsxSelfClosingElement(c)) && (m = e.getContextualType(c.tagName)?.getProperty(n.name.text), r = n.name);
290
- } else if ((l.isPropertyAssignment(n) || l.isShorthandPropertyAssignment(n) || l.isMethodDeclaration(n)) && l.isObjectLiteralExpression(n.parent)) {
291
- const c = l.isComputedPropertyName(n.name) ? P(n.name.expression, e) : n.name.text, u = e.getContextualType(n.parent);
292
- m = c === void 0 || u === void 0 ? void 0 : e.getNonNullableType(u).getProperty(c), r = n.name;
293
- } else if (l.isPropertyAccessExpression(n))
294
- m = e.getSymbolAtLocation(n.name), r = n.name;
295
- else if (l.isElementAccessExpression(n)) {
296
- const c = P(n.argumentExpression, e);
297
- m = c === void 0 ? void 0 : e.getTypeAtLocation(n.expression).getProperty(c), r = n.argumentExpression;
298
- } else if (l.isBindingElement(n) && l.isObjectBindingPattern(n.parent) && n.dotDotDotToken === void 0) {
299
- const c = n.propertyName ?? (l.isIdentifier(n.name) ? n.name : void 0), u = c === void 0 ? void 0 : l.isComputedPropertyName(c) ? P(c.expression, e) : c.text;
300
- m = u === void 0 ? void 0 : e.getTypeAtLocation(n.parent).getProperty(u), r = c;
511
+ return _e(n, o, a, t, i), [...a.values()].toSorted((s, l) => s.start - l.start);
512
+ }
513
+ function _e(n, e, o, t, i) {
514
+ function a(s) {
515
+ c.isNewExpression(s) && qe(s, e, o, t, i);
516
+ let l, d;
517
+ if (c.isJsxAttribute(s) && c.isIdentifier(s.name)) {
518
+ const m = s.parent.parent;
519
+ (c.isJsxOpeningElement(m) || c.isJsxSelfClosingElement(m)) && (d = e.getContextualType(m.tagName)?.getProperty(s.name.text), l = s.name);
520
+ } else if ((c.isPropertyAssignment(s) || c.isShorthandPropertyAssignment(s) || c.isMethodDeclaration(s)) && c.isObjectLiteralExpression(s.parent)) {
521
+ const m = c.isComputedPropertyName(s.name) ? T(s.name.expression, e) : s.name.text, f = e.getContextualType(s.parent);
522
+ d = m === void 0 || f === void 0 ? void 0 : e.getNonNullableType(f).getProperty(m), l = s.name;
523
+ } else if (c.isPropertyAccessExpression(s))
524
+ d = e.getSymbolAtLocation(s.name), l = s.name;
525
+ else if (c.isElementAccessExpression(s)) {
526
+ const m = T(s.argumentExpression, e);
527
+ d = m === void 0 ? void 0 : e.getTypeAtLocation(s.expression).getProperty(m), l = s.argumentExpression;
528
+ } else if (c.isBindingElement(s) && c.isObjectBindingPattern(s.parent) && s.dotDotDotToken === void 0) {
529
+ const m = s.propertyName ?? (c.isIdentifier(s.name) ? s.name : void 0), f = m === void 0 ? void 0 : c.isComputedPropertyName(m) ? T(m.expression, e) : m.text;
530
+ d = f === void 0 ? void 0 : e.getTypeAtLocation(s.parent).getProperty(f), l = m;
301
531
  }
302
- if ((l.isPropertyAccessExpression(n) || l.isElementAccessExpression(n) || l.isBindingElement(n)) && !m?.declarations?.some(
303
- (c) => l.isGetAccessorDeclaration(c) || l.isSetAccessorDeclaration(c)
304
- ) && (m = void 0), m !== void 0 && r !== void 0) {
305
- const c = B(m, e), u = $(m);
306
- c !== void 0 && E(u, i, a) && C(t, o, {
307
- start: r.getStart(o),
308
- length: r.getWidth(o),
309
- name: m.getName(),
310
- ...D(m.declarations?.[0]),
311
- originFileNames: u,
312
- reason: c
532
+ if ((c.isPropertyAccessExpression(s) || c.isElementAccessExpression(s) || c.isBindingElement(s)) && !d?.declarations?.some(
533
+ (m) => c.isGetAccessorDeclaration(m) || c.isSetAccessorDeclaration(m)
534
+ ) && (d = void 0), d !== void 0 && l !== void 0) {
535
+ const m = ce(d, e), f = F(d);
536
+ m !== void 0 && z(f, i, t) && U(o, n, {
537
+ start: l.getStart(n),
538
+ length: l.getWidth(n),
539
+ name: d.getName(),
540
+ ...L(d.declarations?.[0]),
541
+ originFileNames: f,
542
+ reason: m
313
543
  });
314
544
  }
315
- l.forEachChild(n, s);
545
+ c.forEachChild(s, a);
316
546
  }
317
- s(o);
547
+ a(n);
318
548
  }
319
- function Ae(o, e, t, a, i) {
320
- const s = e.getTypeAtLocation(o).getSymbol(), n = s?.declarations?.[0], r = n !== void 0 && (l.isClassDeclaration(n) || l.isInterfaceDeclaration(n)) ? n.name?.text : void 0, m = r === void 0 ? void 0 : ie.get(r);
321
- if (m === void 0 || r === void 0)
549
+ function qe(n, e, o, t, i) {
550
+ const a = e.getTypeAtLocation(n).getSymbol(), s = a?.declarations?.[0], l = s !== void 0 && (c.isClassDeclaration(s) || c.isInterfaceDeclaration(s)) ? s.name?.text : void 0, d = l === void 0 ? void 0 : Ee.get(l);
551
+ if (d === void 0 || l === void 0)
322
552
  return;
323
- const c = $(s);
324
- if (!c.some(
325
- (g) => (F(g) ?? W(v.dirname(g), "")) === "@arcgis/core"
326
- ) || !E(c, i, a))
553
+ const m = F(a);
554
+ if (!m.some(
555
+ (p) => (W(p) ?? oe(P.dirname(p), "")) === "@arcgis/core"
556
+ ) || !z(m, i, t))
327
557
  return;
328
- const u = l.isPropertyAccessExpression(o.expression) ? o.expression.name : o.expression, p = o.getSourceFile();
329
- C(t, p, {
330
- start: u.getStart(p),
331
- length: u.getWidth(p),
332
- name: r,
333
- apiKind: "class",
558
+ const f = c.isPropertyAccessExpression(n.expression) ? n.expression.name : n.expression, r = n.getSourceFile();
559
+ U(o, r, {
560
+ start: f.getStart(r),
561
+ length: f.getWidth(r),
562
+ name: l,
563
+ kind: "class",
334
564
  category: "coreViews",
335
- originFileNames: c,
336
- reason: `Direct construction with new ${r}() is discouraged. Use \`<${m}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
565
+ originFileNames: m,
566
+ reason: `Direct construction with new ${l}() is discouraged. Use \`<${d}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
337
567
  });
338
568
  }
339
- function P(o, e) {
340
- const t = e.getTypeAtLocation(o);
341
- return t.isStringLiteral() || t.isNumberLiteral() ? String(t.value) : void 0;
342
- }
343
- function we(o, e) {
344
- let t = e.getSymbolAtLocation(o);
345
- for (; t !== void 0 && (t.flags & l.SymbolFlags.Alias) !== 0; ) {
346
- const a = B(t, e);
347
- if (a !== void 0)
348
- return { symbol: t, reason: a };
349
- t = t.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(t);
569
+ function T(n, e) {
570
+ const o = e.getTypeAtLocation(n);
571
+ return o.isStringLiteral() || o.isNumberLiteral() ? String(o.value) : void 0;
572
+ }
573
+ function He(n, e) {
574
+ let o = e.getSymbolAtLocation(n);
575
+ for (; o !== void 0 && (o.flags & c.SymbolFlags.Alias) !== 0; ) {
576
+ const t = ce(o, e);
577
+ if (t !== void 0)
578
+ return { symbol: o, reason: t };
579
+ o = o.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(o);
350
580
  }
351
- return { symbol: t, reason: void 0 };
581
+ return { symbol: o, reason: void 0 };
352
582
  }
353
- function $(o) {
354
- return [...new Set(o?.declarations?.map((e) => e.getSourceFile().fileName))];
583
+ function F(n) {
584
+ return [...new Set(n?.declarations?.map((e) => e.getSourceFile().fileName))];
355
585
  }
356
- function ke(o, e, t, a, i) {
586
+ function Xe(n, e, o, t, i) {
357
587
  if (e.reason !== void 0)
358
588
  return {
359
- name: j(e.symbol.declarations?.[0], e.symbol.getName()),
360
- ...D(e.symbol.declarations?.[0])
589
+ name: H(e.symbol.declarations?.[0], e.symbol.getName()),
590
+ ...L(e.symbol.declarations?.[0])
361
591
  };
362
- const s = i === void 0 ? void 0 : a.getProgram()?.getSourceFile(i.fileName), n = i === void 0 || s === void 0 ? void 0 : _(
363
- s,
592
+ const a = i === void 0 ? void 0 : t.getProgram()?.getSourceFile(i.fileName), s = i === void 0 || a === void 0 ? void 0 : ae(
593
+ a,
364
594
  i.textSpan.start,
365
595
  i.textSpan.start + i.textSpan.length
366
- ), r = (n === void 0 ? void 0 : t.getSymbolAtLocation(n)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], m = i?.name;
596
+ ), l = (s === void 0 ? void 0 : o.getSymbolAtLocation(s)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], d = i?.name;
367
597
  return {
368
- name: m === void 0 ? $e(o) : j(r, m),
369
- ...D(r)
598
+ name: d === void 0 ? Ye(n) : H(l, d),
599
+ ...L(l)
370
600
  };
371
601
  }
372
- function S(o, e) {
373
- const t = v.relative(e, o);
374
- return t !== "" && !t.startsWith("../") && !v.isAbsolute(t) && t !== "node_modules" && !t.startsWith("node_modules/");
602
+ function O(n, e) {
603
+ const o = P.relative(e, n);
604
+ return o !== "" && !o.startsWith("../") && !P.isAbsolute(o) && o !== "node_modules" && !o.startsWith("node_modules/");
375
605
  }
376
- function _(o, e, t) {
377
- let a = o;
606
+ function ae(n, e, o) {
607
+ let t = n;
378
608
  for (; ; ) {
379
609
  let i;
380
- if (l.forEachChild(a, (s) => {
381
- i === void 0 && s.getStart(o) <= e && s.getEnd() >= t && (i = s);
610
+ if (c.forEachChild(t, (a) => {
611
+ i === void 0 && a.getStart(n) <= e && a.getEnd() >= o && (i = a);
382
612
  }), i === void 0)
383
- return a;
384
- a = i;
613
+ return t;
614
+ t = i;
385
615
  }
386
616
  }
387
- function $e(o) {
388
- return l.isIdentifier(o) || l.isPrivateIdentifier(o) || l.isStringLiteralLike(o) || l.isNumericLiteral(o) ? o.text : o.getText();
617
+ function Ye(n) {
618
+ return c.isIdentifier(n) || c.isPrivateIdentifier(n) || c.isStringLiteralLike(n) || c.isNumericLiteral(n) ? n.text : n.getText();
389
619
  }
390
- function G(o) {
391
- const e = o?.find(({ name: t }) => t === "deprecated");
392
- return e === void 0 ? void 0 : me(e.text) ?? "";
620
+ function re(n) {
621
+ const e = n?.find(({ name: o }) => o === "deprecated");
622
+ return e === void 0 ? void 0 : ke(e.text) ?? "";
393
623
  }
394
- function Ce(o, e, t) {
624
+ function Ze(n, e, o) {
395
625
  try {
396
- return G(o.getQuickInfoAtPosition(e, t)?.tags);
626
+ return re(n.getQuickInfoAtPosition(e, o)?.tags);
397
627
  } catch {
398
628
  return;
399
629
  }
400
630
  }
401
- function B(o, e) {
631
+ function ce(n, e) {
402
632
  try {
403
- const t = G(o?.getJsDocTags(e));
404
- if (t !== void 0)
405
- return t;
406
- const a = o?.declarations?.filter((i) => l.isGetAccessorDeclaration(i) || l.isSetAccessorDeclaration(i)).map((i) => l.getJSDocDeprecatedTag(i)).find((i) => i !== void 0);
407
- return a === void 0 ? void 0 : a.comment === void 0 ? "" : ce(a.comment);
633
+ const o = re(n?.getJsDocTags(e));
634
+ if (o !== void 0)
635
+ return o;
636
+ const t = n?.declarations?.filter((i) => c.isGetAccessorDeclaration(i) || c.isSetAccessorDeclaration(i)).map((i) => c.getJSDocDeprecatedTag(i)).find((i) => i !== void 0);
637
+ return t === void 0 ? void 0 : t.comment === void 0 ? "" : Ae(t.comment);
408
638
  } catch {
409
639
  return;
410
640
  }
411
641
  }
412
- function C(o, e, t) {
413
- if (re(t.name, t.reason))
642
+ function U(n, e, o) {
643
+ if (ne(o.name, o.reason))
414
644
  return;
415
- const { line: a, character: i } = e.getLineAndCharacterOfPosition(t.start);
416
- o.set(`${t.start}:${t.length}`, {
417
- ...t,
418
- line: a + 1,
645
+ const { line: t, character: i } = e.getLineAndCharacterOfPosition(o.start);
646
+ n.set(`${o.start}:${o.length}`, {
647
+ ...o,
648
+ line: t + 1,
419
649
  column: i + 1
420
650
  });
421
651
  }
422
- function E(o, e, t) {
423
- return o.some((a) => t !== void 0 && S(a, t)) ? !1 : !e || o.some((a) => {
424
- const i = F(a);
425
- return i === void 0 ? t === void 0 || !S(a, t) : ae(i);
652
+ function z(n, e, o) {
653
+ return n.some((t) => o !== void 0 && O(t, o)) ? !1 : !e || n.some((t) => {
654
+ const i = W(t);
655
+ return i === void 0 ? o === void 0 || !O(t, o) : fe(i);
426
656
  });
427
657
  }
428
- function F(o) {
429
- const e = X(o), t = "/node_modules/", a = e.lastIndexOf(t);
430
- if (a === -1)
658
+ function W(n) {
659
+ const e = ge(n), o = "/node_modules/", t = e.lastIndexOf(o);
660
+ if (t === -1)
431
661
  return;
432
- const [i, s] = e.slice(a + t.length).split("/");
433
- return i.startsWith("@") ? `${i}/${s}` : i;
662
+ const [i, a] = e.slice(t + o.length).split("/");
663
+ return i.startsWith("@") ? `${i}/${a}` : i;
434
664
  }
435
- function Ee(o, e = [], t) {
436
- const a = o[0];
437
- if (a === void 0)
665
+ function et(n, e = [], o) {
666
+ const t = n[0];
667
+ if (t === void 0)
438
668
  return "unknown package";
439
- const i = F(a);
669
+ const i = W(t);
440
670
  if (i !== void 0)
441
671
  return i;
442
- const s = e.find(({ root: p }) => S(a, p));
443
- if (s !== void 0)
444
- return s.name;
445
- const n = v.dirname(x(a)), r = W(v.dirname(a), n);
446
- if (r !== n)
447
- return r;
448
- if (t === void 0)
449
- return n;
450
- const c = v.relative(t, a).split("/"), u = c.findIndex((p) => p !== "..");
451
- return u < 1 ? v.dirname(x(a)) : c.slice(0, u * 2).join("/");
672
+ const a = e.find(({ root: r }) => O(t, r));
673
+ if (a !== void 0)
674
+ return a.name;
675
+ const s = P.dirname($(t)), l = oe(P.dirname(t), s);
676
+ if (l !== s)
677
+ return l;
678
+ if (o === void 0)
679
+ return s;
680
+ const m = P.relative(o, t).split("/"), f = m.findIndex((r) => r !== "..");
681
+ return f < 1 ? P.dirname($(t)) : m.slice(0, f * 2).join("/");
452
682
  }
453
683
  export {
454
- We as auditDeprecatedUsages,
455
- be as collectDeprecatedApiUsages,
456
- Ee as getDeprecationOriginLabel,
457
- F as getNodeModulesPackageName,
458
- E as shouldIncludeDeprecation
684
+ xt as auditDeprecatedUsages,
685
+ Ge as collectDeprecatedApiUsages,
686
+ et as getDeprecationOriginLabel,
687
+ W as getNodeModulesPackageName,
688
+ z as shouldIncludeDeprecation
459
689
  };