@arcgis/codemod 6.0.0-next.12 → 6.0.0-next.13

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,689 +1,927 @@
1
- var Q = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), V = (n) => {
2
- throw TypeError(n);
1
+ var Z = (s, e) => (e = Symbol[s]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + s), ee = (s) => {
2
+ throw TypeError(s);
3
3
  };
4
- var G = (n, e, o) => {
4
+ var te = (s, e, n) => {
5
5
  if (e != null) {
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() {
6
+ typeof e != "object" && typeof e != "function" && ee("Object expected");
7
+ var t, o;
8
+ n && (t = e[Z("asyncDispose")]), t === void 0 && (t = e[Z("dispose")], n && (o = t)), typeof t != "function" && ee("Object not disposable"), o && (t = function() {
9
9
  try {
10
- i.call(this);
11
- } catch (a) {
12
- return Promise.reject(a);
10
+ o.call(this);
11
+ } catch (r) {
12
+ return Promise.reject(r);
13
13
  }
14
- }), n.push([o, t, e]);
15
- } else o && n.push([o]);
14
+ }), s.push([n, t, e]);
15
+ } else n && s.push([n]);
16
16
  return e;
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(); )
17
+ }, ne = (s, e, n) => {
18
+ var t = typeof SuppressedError == "function" ? SuppressedError : function(i, d, l, p) {
19
+ return p = Error(l), p.name = "SuppressedError", p.error = i, p.suppressed = d, p;
20
+ }, o = (i) => e = n ? new t(i, e, "An error was suppressed during disposal") : (n = !0, i), r = (i) => {
21
+ for (; i = s.pop(); )
22
22
  try {
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);
23
+ var d = i[1] && i[1].call(i[2]);
24
+ if (i[0]) return Promise.resolve(d).then(r, (l) => (o(l), r()));
25
+ } catch (l) {
26
+ o(l);
27
27
  }
28
- if (o) throw e;
28
+ if (n) throw e;
29
29
  };
30
- return a();
30
+ return r();
31
31
  };
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";
32
+ import { c as Se } from "./useProjectInstance.js";
33
+ import { d as F, r as be, i as Ne, a as ke, b as Ae } from "./cli.js";
34
+ import { f as M } from "./log.js";
35
+ import { path as D, toPosixPathSeparators as Pe } from "@arcgis/node-toolkit/path";
36
+ import { log as U } from "@arcgis/toolkit/log";
37
+ import { forEachWithConcurrency as pe } from "@arcgis/toolkit/promise";
38
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) {
39
+ import { s as De, g as I, a as $e, c as Ce, p as Oe } from "./artifact.js";
40
+ import { loadCodeowners as de } from "@arcgis/node-toolkit/codeowners";
41
+ import { c as se, s as J, g as Ee, a as ie, l as Te, b as me, d as ue, e as Le, f as Ie, h as Me } from "./componentAudit.js";
42
+ import { g as Je, a as W, c as ge, b as Re, d as je, e as z, f as oe, h as Fe } from "./classification.js";
43
+ import { styleText as V } from "node:util";
44
+ import { f as fe } from "./format.js";
45
+ import { realpath as R, readFile as B } from "node:fs/promises";
46
+ import O from "semver";
47
+ import { asyncFindPath as ze } from "@arcgis/node-toolkit/file";
48
+ import { asyncRetrievePackageJson as Ue } from "@arcgis/node-toolkit/packageJson";
49
+ function We(s, e, n) {
47
50
  if (e === "json") {
48
- if (o !== void 0) {
49
- process.stdout.write(`${JSON.stringify(o, void 0, 2)}
51
+ if (n !== void 0) {
52
+ process.stdout.write(`${JSON.stringify(n, void 0, 2)}
50
53
  `);
51
54
  return;
52
55
  }
53
- const t = C();
54
- process.stdout.write(`${Fe(n, te(), t)}
56
+ const t = I();
57
+ process.stdout.write(`${qe(s, de(), t)}
55
58
  `);
56
59
  return;
57
60
  }
58
61
  if (e === "md") {
59
- process.stdout.write(`${Ue(n)}
60
- `);
62
+ process.stdout.write(
63
+ `${n === void 0 ? Ge(s) : fe(n)}
64
+ `
65
+ );
61
66
  return;
62
67
  }
63
- process.stdout.write(`${Ie(n)}
68
+ process.stdout.write(`${Ve(s)}
64
69
  `);
65
70
  }
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})`);
71
+ function Ve(s) {
72
+ const e = he(s), n = e.reduce((o, r) => o + r.count, 0), t = [ae("Deprecation summary", n)];
73
+ for (const { categoryName: o, count: r, packages: i } of e) {
74
+ t.push(`${F[o].label} (${r})`);
75
+ for (const { displayName: d, count: l } of i)
76
+ t.push(` ${re(d)} (${l})`);
72
77
  }
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
+ t.push("", "", ae("Deprecation details", n));
79
+ for (const { categoryName: o, count: r, packages: i } of e) {
80
+ const d = F[o];
81
+ t.push("", `${d.label} (${r})`), "description" in d && t.push(` ${d.description}`);
82
+ for (const { displayName: l, count: p, apis: f } of i) {
83
+ t.push("", ` ${re(l)} (${p})`);
84
+ for (const { name: a, reasons: m, items: h } of f) {
85
+ const x = h[0].usage, g = Re({ name: a, memberOf: x.memberOf, kind: x.kind });
86
+ t.push(` ${Be(g)}${je(x.kind)} (${h.length})`);
87
+ for (const w of m)
88
+ t.push(Ke(w, 6));
89
+ for (const { sourceFileName: w, usage: N } of Qe(h))
90
+ t.push(` ${M(w)}:${N.line}:${N.column}`);
86
91
  }
87
92
  }
88
93
  }
89
94
  return t.join(`
90
95
  `);
91
96
  }
92
- function ie(n) {
93
- const e = [...n].flatMap(
94
- ([o, t]) => t.map((i) => ({ ...i, packageName: o }))
97
+ function he(s) {
98
+ const e = [...s].flatMap(
99
+ ([n, t]) => t.map((o) => ({ ...o, packageName: n }))
95
100
  );
96
- return Pe(e, ({ packageName: o, usage: t }) => ({
97
- package: o,
101
+ return Je(e, ({ packageName: n, usage: t }) => ({
102
+ package: n,
98
103
  name: t.name,
99
104
  kind: t.kind,
100
105
  category: t.category,
101
106
  memberOf: t.memberOf,
102
- module: t.module ?? J(t.originFileNames, o),
107
+ module: t.module ?? W(t.originFileNames, n),
103
108
  deprecated: t.reason ?? !0
104
109
  }));
105
110
  }
106
- function X(n, e) {
107
- return M(["bold", "yellow"], `${n} (${e})`);
111
+ function ae(s, e) {
112
+ return V(["bold", "yellow"], `${s} (${e})`);
108
113
  }
109
- function Y(n) {
110
- return M("blue", n);
114
+ function re(s) {
115
+ return V("blue", s);
111
116
  }
112
- function Le(n) {
113
- return M(["bold", "white"], n);
117
+ function Be(s) {
118
+ return V(["bold", "white"], s);
114
119
  }
115
- function Je(n, e) {
116
- const o = " ".repeat(e);
117
- return n.split(/\r?\n/u).map((t) => `${o}${t}`).join(`
120
+ function Ke(s, e) {
121
+ const n = " ".repeat(e);
122
+ return s.split(/\r?\n/u).map((t) => `${n}${t}`).join(`
118
123
  `);
119
124
  }
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
125
+ function Qe(s) {
126
+ return s.toSorted(
127
+ (e, n) => e.sourceFileName.localeCompare(n.sourceFileName) || e.usage.line - n.usage.line || e.usage.column - n.usage.column
123
128
  );
124
129
  }
125
- function Re(n) {
126
- return [...n].sort(([e], [o]) => e.localeCompare(o));
130
+ function qe(s, e, n = I()) {
131
+ return JSON.stringify(K(s, e, n), void 0, 2);
127
132
  }
128
- function Fe(n, e, o = C()) {
129
- return JSON.stringify(R(n, e, o), void 0, 2);
133
+ function Ge(s, e = I()) {
134
+ return fe(K(s, void 0, e));
130
135
  }
131
- function Ue(n, e = C()) {
132
- return $e(R(n, void 0, e));
133
- }
134
- function R(n, e, o, t) {
135
- const i = ie(n);
136
+ function K(s, e, n, t) {
137
+ const o = he(s);
136
138
  return {
137
139
  auditKind: "usages",
138
- repository: o.repository,
139
- ref: o.ref,
140
- branch: o.branch,
141
- scannerVersion: he,
140
+ repository: n.repository,
141
+ ref: n.ref,
142
+ branch: n.branch,
143
+ scannerVersion: De,
142
144
  scanDate: Date.now(),
143
145
  ...t === void 0 ? {} : { complete: t },
144
146
  summary: {
145
- total: i.reduce((s, { count: l }) => s + l, 0),
146
- categories: i.map(({ categoryName: s, count: l, packages: d }) => ({
147
- category: s,
148
- label: I[s].label,
149
- count: l,
150
- packages: d.map(({ packageName: m, displayName: f, count: r }) => ({
151
- package: m,
152
- ...f === m ? {} : { displayName: f },
153
- count: r
147
+ total: o.reduce((i, { count: d }) => i + d, 0),
148
+ categories: o.map(({ categoryName: i, count: d, packages: l }) => ({
149
+ category: i,
150
+ label: F[i].label,
151
+ count: d,
152
+ packages: l.map(({ packageName: p, displayName: f, count: a }) => ({
153
+ package: p,
154
+ ...f === p ? {} : { displayName: f },
155
+ count: a
154
156
  }))
155
157
  }))
156
158
  },
157
- findings: ze(n, e, o)
159
+ findings: _e(s, e, n)
158
160
  };
159
161
  }
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 = {
162
+ function _e(s, e, n) {
163
+ return [...s].flatMap(
164
+ ([t, o]) => o.map((r) => {
165
+ const i = r.usage.module ?? W(r.usage.originFileNames, t), d = {
164
166
  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
167
+ name: r.usage.name,
168
+ category: r.usage.category,
169
+ memberOf: r.usage.memberOf,
170
+ module: i,
171
+ deprecated: r.usage.reason ?? !0
170
172
  };
171
173
  return {
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) ?? []
174
+ ...d,
175
+ category: ge(d),
176
+ kind: r.usage.kind,
177
+ memberOf: r.usage.memberOf,
178
+ file: $e(r.sourceFileName, n.repositoryRoot),
179
+ line: r.usage.line,
180
+ column: r.usage.column,
181
+ codeowners: e?.getOwners(r.sourceFileName) ?? []
180
182
  };
181
183
  })
182
- );
184
+ ).sort(Ce);
183
185
  }
184
- function Z(n, e, o) {
186
+ function ce(s, e, n) {
185
187
  if (!e.hasDeprecatedApis)
186
188
  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 }))
189
+ const t = "getLineAndCharacterOfPosition" in s ? (a) => s.getLineAndCharacterOfPosition(a) : He(s.text), o = /* @__PURE__ */ new Map();
190
+ for (const [a, m] of e.cssVariables)
191
+ for (let h = s.text.indexOf(a); h !== -1; h = s.text.indexOf(a, h + a.length))
192
+ i(m, h, a.length);
193
+ const r = D.extname(s.fileName).slice(1).toLowerCase();
194
+ return r === "html" ? Ze(
195
+ s.text,
196
+ (a, m, h) => {
197
+ l(
198
+ a,
199
+ m,
200
+ h.map(({ name: x, start: g }) => ({ name: x, start: g }))
199
201
  );
200
202
  },
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,
203
+ (a, m) => le(a, m, p)
204
+ ) : r === "css" || r === "scss" || r === "sass" ? le(s.text, 0, p, r !== "css") : "kind" in s && f(s, s), [...o.values()].sort((a, m) => a.usage.start - m.usage.start);
205
+ function i(a, m, h) {
206
+ const { line: x, character: g } = t(m);
207
+ o.set(JSON.stringify([a.package, a.kind, a.memberOf, a.name, m]), {
208
+ packageName: a.package,
209
+ sourceFileName: s.fileName,
208
210
  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
211
+ name: a.name,
212
+ kind: a.kind,
213
+ memberOf: a.kind === "css-property" ? void 0 : a.memberOf,
214
+ module: a.module,
215
+ reason: a.reason,
216
+ originFileNames: [a.sourceFileName],
217
+ start: m,
218
+ length: h,
219
+ line: x + 1,
220
+ column: g + 1
219
221
  }
220
222
  });
221
223
  }
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)
224
+ function d(a, m, h) {
225
+ const x = e.components.get(a);
226
+ return x?.length === 1 ? x[0].definitions.find(
227
+ (g) => g.kind === m && g.name === h && (m === "element" || g.memberOf === a)
226
228
  ) : void 0;
227
229
  }
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);
230
+ function l(a, m, h) {
231
+ const x = d(a, "element", a);
232
+ x !== void 0 && i(x, m, a.length);
233
+ for (const g of h) {
234
+ const w = d(a, "attribute", g.name);
235
+ w !== void 0 && i(w, g.start, g.name.length);
234
236
  }
235
237
  }
236
- function m(r, p, x, h) {
237
- const u = l(r, p, x);
238
- u !== void 0 && s(u, h, x.length);
238
+ function p(a, m, h, x) {
239
+ const g = d(a, m, h);
240
+ g !== void 0 && i(g, x, h.length);
239
241
  }
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)
242
+ function f(a, m) {
243
+ if (c.isJsxOpeningElement(a) || c.isJsxSelfClosingElement(a)) {
244
+ const h = a.tagName.getText(m), x = a.attributes.properties.filter(c.isJsxAttribute);
245
+ if (l(
246
+ h,
247
+ a.tagName.getStart(m),
248
+ x.map((g) => ({
249
+ name: g.name.getText(m),
250
+ start: g.name.getStart(m)
249
251
  }))
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);
252
+ ), /^[a-z][\w-]*$/u.test(h)) {
253
+ const g = x.find((S) => S.name.getText(m) === "slot"), w = g?.initializer, N = w !== void 0 && c.isJsxExpression(w) ? w.expression : w, b = g === void 0 ? -1 : a.attributes.properties.indexOf(g), A = a.attributes.properties.slice(b + 1).some(c.isJsxSpreadAttribute);
254
+ if (N !== void 0 && (c.isStringLiteral(N) || c.isNoSubstitutionTemplateLiteral(N)) && !A) {
255
+ const S = Xe(c.isJsxOpeningElement(a) ? a.parent : a, n), u = S === void 0 ? void 0 : d(S, "slot", N.text);
256
+ u !== void 0 && i(u, N.getStart(m) + 1, N.getWidth(m) - 2);
255
257
  }
256
258
  }
257
259
  }
258
- c.forEachChild(r, (x) => f(x, p));
260
+ c.forEachChild(a, (h) => f(h, m));
259
261
  }
260
262
  }
261
- function We(n) {
263
+ function He(s) {
262
264
  const e = [
263
265
  0,
264
- ...Array.from(n.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (o) => o.index + o[0].length)
266
+ ...Array.from(s.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (n) => n.index + n[0].length)
265
267
  ];
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;
268
+ return (n) => {
269
+ let t = 0, o = e.length;
270
+ for (; t + 1 < o; ) {
271
+ const r = Math.floor((t + o) / 2);
272
+ e[r] <= n ? t = r : o = r;
271
273
  }
272
- return { line: t, character: o - e[t] };
274
+ return { line: t, character: n - e[t] };
273
275
  };
274
276
  }
275
- function je(n, e) {
276
- let o = n;
277
- for (let t = o.parent; t !== void 0; o = t, t = t.parent) {
277
+ function Xe(s, e) {
278
+ let n = s;
279
+ for (let t = n.parent; t !== void 0; n = t, t = t.parent) {
278
280
  if (c.isJsxElement(t))
279
281
  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))) {
282
+ if (!(c.isJsxFragment(t) || c.isJsxExpression(t) || c.isParenthesizedExpression(t)) && !(c.isConditionalExpression(t) && n !== t.condition) && !(c.isBinaryExpression(t) && (t.operatorToken.kind === c.SyntaxKind.AmpersandAmpersandToken && n === t.right || t.operatorToken.kind === c.SyntaxKind.BarBarToken || t.operatorToken.kind === c.SyntaxKind.QuestionQuestionToken))) {
281
283
  if (c.isReturnStatement(t)) {
282
- const i = c.findAncestor(t, c.isFunctionLike);
283
- if (i === void 0 || !c.isArrowFunction(i) && !c.isFunctionExpression(i))
284
+ const o = c.findAncestor(t, c.isFunctionLike);
285
+ if (o === void 0 || !c.isArrowFunction(o) && !c.isFunctionExpression(o))
284
286
  return;
285
- o = i.body, t = i;
287
+ n = o.body, t = o;
286
288
  }
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")
289
+ if ((c.isArrowFunction(t) || c.isFunctionExpression(t)) && n === t.body) {
290
+ const o = t.parent;
291
+ if (!c.isCallExpression(o) || o.arguments[0] !== t || !c.isPropertyAccessExpression(o.expression) || o.expression.name.text !== "map")
290
292
  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
+ const r = o.expression.expression, i = e?.getTypeAtLocation(r);
294
+ if (!c.isArrayLiteralExpression(r) && (i === void 0 || !e.isArrayType(i) && !e.isTupleType(i)))
293
295
  return;
294
- o = t, t = i;
296
+ n = t, t = o;
295
297
  continue;
296
298
  }
297
299
  return;
298
300
  }
299
301
  }
300
302
  }
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;
303
+ function le(s, e, n, t = !1) {
304
+ const o = t ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, r = s.replace(o, (p) => p.replace(/[^\r\n]/gu, " ")), i = [];
305
+ let d = 0, l = 0;
306
+ for (const p of r.matchAll(/[{};]/gu)) {
307
+ const f = p.index;
308
+ if (l > 0) {
309
+ l += p[0] === "{" ? 1 : p[0] === "}" ? -1 : 0, d = f + 1;
308
310
  continue;
309
311
  }
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);
312
+ if (p[0] === "}")
313
+ i.pop();
314
+ else if (p[0] === "{") {
315
+ const a = r.slice(d, f), m = i.at(-1) ?? [];
316
+ if (/^\s*--[\w-]+\s*:/u.test(a))
317
+ l = 1;
318
+ else if (a.trimStart().startsWith("@"))
319
+ i.push(m);
318
320
  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}`
321
+ const x = a.split(",").map((g) => g.trim()).flatMap(
322
+ (g) => m.length === 0 ? [g] : m.map(
323
+ (w) => g.includes("&") ? g.replaceAll("&", w) : `${w} ${g}`
322
324
  )
323
325
  );
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)
326
+ for (const g of a.matchAll(/::part\(\s*([\w\s-]+?)\s*\)|:state\(\s*([\w-]+)\s*\)/gu)) {
327
+ const w = a.lastIndexOf(",", g.index) + 1, N = a.slice(w, g.index), A = (m.length === 0 ? [N] : m.map(
328
+ (y) => N.includes("&") ? N.replaceAll("&", y) : `${y} ${N}`
329
+ )).map(Ye);
330
+ if (A.includes(void 0) || new Set(A).size !== 1)
329
331
  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);
332
+ const S = g[1] === void 0 ? "css-state" : "css-part", u = g[1] ?? g[2], v = g.index + g[0].indexOf(u);
333
+ for (const y of u.matchAll(/[\w-]+/gu))
334
+ n(A[0], S, y[0], e + d + v + y.index);
333
335
  }
334
- s.push(h);
336
+ i.push(x);
335
337
  }
336
338
  }
337
- l = f + 1;
339
+ d = f + 1;
338
340
  }
339
341
  }
340
- function Be(n) {
341
- const e = n.replace(/:state\([\w-]+\)/gu, "").trimStart();
342
+ function Ye(s) {
343
+ const e = s.replace(/:state\([\w-]+\)/gu, "").trimStart();
342
344
  return /(?:^|[\s>+~])([a-z][\w-]*)(?:[.#:][\w-]+|\[[^\]]*\])*$/iu.exec(e)?.[1]?.toLowerCase();
343
345
  }
344
- function Ke(n, e, o) {
346
+ function Ze(s, e, n) {
345
347
  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
+ for (let o = t.exec(s); o !== null; o = t.exec(s)) {
349
+ if (o[1] === void 0 || o[0].startsWith("</"))
348
350
  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
+ const r = o[1].toLowerCase(), i = o.index + 1 + o[1].length, d = [...o[2].matchAll(/([^\s"'<>/=]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/gu)].map(
352
+ (l) => ({ name: l[1].toLowerCase(), start: i + l.index })
351
353
  );
352
- if (e(a, i.index + 1, l), a === "plaintext")
354
+ if (e(r, o.index + 1, d), r === "plaintext")
353
355
  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;
356
+ if (["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes"].includes(r)) {
357
+ const l = new RegExp(`</${r}\\s*>`, "giu");
358
+ l.lastIndex = t.lastIndex;
359
+ const p = l.exec(s);
360
+ r === "style" && n(s.slice(t.lastIndex, p?.index ?? s.length), t.lastIndex), t.lastIndex = p === null ? s.length : l.lastIndex;
361
+ }
362
+ }
363
+ }
364
+ const et = /[:/@\\]|^\.{1,2}$|\.(?:tgz|tar(?:\.gz)?)$/iu;
365
+ async function tt(s, e, n) {
366
+ const t = JSON.parse('["@arcgis/ai-components","@arcgis/api-extractor","@arcgis/arcade-parser","@arcgis/arcade-languageservice","@arcgis/charts-components","@arcgis/charts-components-react","@arcgis/codemod","@arcgis/coding-components","@arcgis/coding-components-react","@arcgis/common-components","@arcgis/components-build-utils","@arcgis/core","@arcgis/lumina-toolkit","@arcgis/create","@arcgis/eslint-config","@arcgis/languages-api-utils","@arcgis/languages-sdk-spec","@arcgis/lumina","@arcgis/lumina-compiler","@arcgis/map-components","@arcgis/map-components-react","@arcgis/node-toolkit","@arcgis/portal-components","@arcgis/portal-components-react","@arcgis/toolkit"]'), o = new Set(t), r = /* @__PURE__ */ new Set([...t, "@esri/calcite-components"]), i = [...new Map(s.map((a) => [a.filePath, a])).values()], d = new Set(
367
+ (await Promise.all(
368
+ i.map(async ({ filePath: a, contents: m }) => {
369
+ const h = [await R(a)], x = m.publishConfig?.directory;
370
+ if (typeof x == "string") {
371
+ const g = D.resolve(D.dirname(a), x, "package.json");
372
+ c.sys.fileExists(g) && h.push(await R(g));
373
+ }
374
+ return h;
375
+ })
376
+ )).flat()
377
+ ), l = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), f = [];
378
+ await pe(i, 4, async (a) => {
379
+ let m;
380
+ const h = [], x = {
381
+ ...a.contents.peerDependencies,
382
+ ...a.contents.optionalDependencies,
383
+ ...a.contents.devDependencies,
384
+ ...a.contents.dependencies
385
+ };
386
+ for (const [b, A] of Object.entries(x)) {
387
+ const S = A.replace(/^npm:/u, "");
388
+ if (!r.has(b) || !A.startsWith("catalog:") && et.test(S))
389
+ continue;
390
+ const u = await ze(
391
+ D.join("node_modules", b, "package.json"),
392
+ D.dirname(a.filePath)
393
+ );
394
+ if (u === void 0) {
395
+ (e === void 0 || b === e) && f.push(`${b} (${a.contents.name ?? a.filePath})`);
396
+ continue;
397
+ }
398
+ if (d.has(await R(u)))
399
+ continue;
400
+ const v = await Ue(D.dirname(u));
401
+ !v.name || !v.version || !r.has(v.name) || h.push({ declared: A, location: u, name: v.name, version: v.version });
402
+ }
403
+ const g = Map.groupBy(
404
+ h.filter(({ name: b }) => o.has(b)),
405
+ ({ version: b }) => b
406
+ ), w = O.maxSatisfying([...g.keys()], "*", {
407
+ includePrerelease: !0
408
+ }), N = [...g].sort(([b], [A]) => b.localeCompare(A)).map(
409
+ ([b, A]) => `${b}: ${A.map(({ name: S }) => `\`${S}\``).sort().join(", ")}`
410
+ ).join("; ");
411
+ for (const { declared: b, location: A, name: S, version: u } of h) {
412
+ if (e !== void 0 && S !== e)
413
+ continue;
414
+ let v = l.get(S);
415
+ v === void 0 && (v = nt(S), l.set(S, v));
416
+ const y = await v;
417
+ y === void 0 && n?.();
418
+ const P = y === void 0 ? void 0 : it(u, y), $ = [];
419
+ P !== void 0 && $.push({
420
+ category: "outdatedDependencies",
421
+ targetVersion: P.expected,
422
+ reason: `Update to ${P.expected} (declared ${b}). ${P.reason}`
423
+ }), o.has(S) && w !== null && O.lt(u, w) && $.push({
424
+ category: "mismatchedDependencies",
425
+ targetVersion: w,
426
+ reason: `Web GIS SDK packages within the same package.json must use the same exact version (found ${N}).`
427
+ });
428
+ for (const { category: E, targetVersion: T, reason: k } of $) {
429
+ m ??= c.parseJsonText(a.filePath, await B(a.filePath, "utf8"));
430
+ const C = p.get(S) ?? [];
431
+ C.push({
432
+ sourceFileName: a.filePath,
433
+ usage: {
434
+ name: `${u} => ${T}`,
435
+ category: E,
436
+ module: "package.json",
437
+ originFileNames: [A],
438
+ reason: k,
439
+ ...st(m, S, b)
440
+ }
441
+ }), p.set(S, C);
442
+ }
359
443
  }
444
+ });
445
+ for (const a of p.values())
446
+ a.sort(
447
+ (m, h) => m.sourceFileName.localeCompare(h.sourceFileName) || m.usage.start - h.usage.start
448
+ );
449
+ return f.length > 0 && (n?.(), f.sort(), U(
450
+ "warn",
451
+ "dependency-versions",
452
+ `Failed to find installed locations for ${f.length} dependencies: ${f.slice(0, 15).join(", ")}${f.length > 15 ? `, and ${f.length - 15} more` : ""}.`
453
+ )), p;
454
+ }
455
+ async function nt(s) {
456
+ try {
457
+ const e = await fetch(`https://registry.npmjs.org/-/package/${encodeURIComponent(s)}/dist-tags`, {
458
+ signal: AbortSignal.timeout(5e3),
459
+ redirect: "error"
460
+ });
461
+ if (!e.ok)
462
+ throw new Error(`Registry returned HTTP ${e.status}`);
463
+ const n = await e.json();
464
+ if (typeof n != "object" || n === null || Array.isArray(n))
465
+ throw new Error("Invalid registry dist-tags response");
466
+ const t = {};
467
+ for (const [o, r] of Object.entries(n))
468
+ ["latest", "rc", "next"].includes(o) && typeof r == "string" && O.valid(r) !== null && (t[o] = r);
469
+ if (Object.keys(t).length === 0)
470
+ throw new Error("Registry returned no supported release tags");
471
+ return t;
472
+ } catch (e) {
473
+ U("warn", s, `Dependency freshness unavailable: ${String(e)}`);
474
+ return;
360
475
  }
361
476
  }
362
- async function xt(n, e) {
363
- if (e.reportingUrl && (n || e.esriOnly || e.category || e.packageName))
477
+ function st(s, e, n) {
478
+ const t = c.forEachChild(s, d), o = t.getStart(s), { line: r, character: i } = s.getLineAndCharacterOfPosition(o);
479
+ return { start: o, length: t.getWidth(s), line: r + 1, column: i + 1 };
480
+ function d(l) {
481
+ return c.isPropertyAssignment(l) && c.isStringLiteral(l.name) && ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"].includes(l.name.text) && c.isObjectLiteralExpression(l.initializer) ? l.initializer.properties.find(
482
+ (p) => c.isPropertyAssignment(p) && c.isStringLiteral(p.name) && p.name.text === e && c.isStringLiteral(p.initializer) && p.initializer.text === n
483
+ )?.name : c.forEachChild(l, d);
484
+ }
485
+ }
486
+ function it(s, e) {
487
+ const n = O.parse(s), t = O.parse(e.latest ?? "");
488
+ if (n === null)
489
+ return;
490
+ if (
491
+ // Permit packages without latest dist-tag
492
+ t !== null && // Permit installed to be newer than latest
493
+ O.lt(n, t) && // Require using stable over prerelease
494
+ (n.prerelease.length > 0 || // Forbid major being behind stable
495
+ n.major !== t.major || // Forbid minor being behind stable
496
+ n.minor !== t.minor)
497
+ )
498
+ return {
499
+ expected: t.version,
500
+ reason: "A newer stable release is available. Prerelease versions are deprecated."
501
+ };
502
+ if (
503
+ // Enforce policy only for next.N prereleases
504
+ n.prerelease.length !== 2 || // Only enforce policy for -next
505
+ n.prerelease[0] !== "next"
506
+ )
507
+ return;
508
+ const o = n.prerelease[1];
509
+ if (typeof o != "number")
510
+ return;
511
+ const i = [e.next, e.rc].flatMap((d) => {
512
+ const l = O.parse(d ?? "");
513
+ return l !== null && // Support packages without latest dist-tag
514
+ (t === null || // Ignore rc dist-tag if it is behind latest
515
+ O.gt(l, t)) && // Require same major.minor.patch for -next version comparison
516
+ l.major === n.major && l.minor === n.minor && l.patch === n.patch && // Require next.N format for comparison
517
+ l.prerelease.length === 2 && l.prerelease[0] === "next" && typeof l.prerelease[1] == "number" ? [l] : [];
518
+ }).sort(O.rcompare).at(0);
519
+ if (i !== void 0 && Number(i.prerelease[1]) - o >= 30)
520
+ return {
521
+ expected: i.version,
522
+ reason: "Installed -next is significantly behind the most recent -next build."
523
+ };
524
+ }
525
+ const ot = /* @__PURE__ */ new Set(["none", "amd", "umd", "system", "systemjs", "node", "node10", "legacy"]), at = /* @__PURE__ */ new Set(["node", "node10", "classic"]);
526
+ async function rt(s) {
527
+ const e = "es2024", n = [];
528
+ for (const t of [...new Set(s)].sort()) {
529
+ const o = c.parseJsonText(t, await B(t, "utf8"));
530
+ n.push(...ct(o, e));
531
+ }
532
+ return n;
533
+ }
534
+ function ct(s, e) {
535
+ const n = s.statements[0];
536
+ if (n === void 0 || !c.isExpressionStatement(n) || !c.isObjectLiteralExpression(n.expression))
537
+ return [];
538
+ const t = n.expression.properties.find(
539
+ (i) => c.isPropertyAssignment(i) && c.isStringLiteral(i.name) && i.name.text === "compilerOptions"
540
+ );
541
+ if (t === void 0 || !c.isObjectLiteralExpression(t.initializer))
542
+ return [];
543
+ const o = c.convertCompilerOptionsFromJson({ target: e }, ".").options.target, r = [];
544
+ for (const i of t.initializer.properties) {
545
+ if (!c.isPropertyAssignment(i) || !c.isStringLiteral(i.name))
546
+ continue;
547
+ const d = i.name.text, l = c.isStringLiteral(i.initializer) ? i.initializer.text.toLowerCase() : void 0;
548
+ let p;
549
+ if (d === "module" && l !== void 0 && ot.has(l))
550
+ p = `The ${l} module setting is legacy or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
551
+ else if (d === "moduleResolution" && l !== void 0 && at.has(l))
552
+ p = `The ${l} module resolution setting is deprecated or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
553
+ else if (d === "target" && l !== void 0) {
554
+ const h = c.convertCompilerOptionsFromJson({ target: l }, ".").options.target;
555
+ h !== void 0 && h < o && (p = `Targets below ${e} are older than Maps SDK's for JavaScript supported targets. See https://next.gha.afd.arcgis.com/javascript/latest/system-requirements/.`);
556
+ } else d === "ignoreDeprecations" && (p = "Address deprecations that were suppressed by ignoreDeprecations.");
557
+ if (p === void 0)
558
+ continue;
559
+ const f = i.name.getStart(s), { line: a, character: m } = s.getLineAndCharacterOfPosition(f);
560
+ r.push({
561
+ sourceFileName: s.fileName,
562
+ usage: {
563
+ name: `compilerOptions.${d}${l === void 0 ? "" : `: ${l}`}`,
564
+ category: "outdatedTypeScriptConfig",
565
+ module: "tsconfig.json",
566
+ originFileNames: [],
567
+ reason: p,
568
+ start: f,
569
+ length: i.name.getWidth(s),
570
+ line: a + 1,
571
+ column: m + 1
572
+ }
573
+ });
574
+ }
575
+ return r;
576
+ }
577
+ async function Rt(s, e) {
578
+ if (e.reportingUrl && (s || e.esriOnly || e.category || e.packageName))
364
579
  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)
580
+ const n = e.outputFormat === "json" || e.reportingUrl ? process.cwd() === I().repositoryRoot : !1;
581
+ if (e.reportingUrl && !n)
367
582
  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(
583
+ let t = !s && !e.esriOnly && !e.category && !e.packageName;
584
+ (e.outputFormat === "json" || e.reportingUrl) && (t &&= n), await be(
370
585
  {
371
586
  meta: {
372
587
  needsTypeInformation: !0,
373
588
  needsFooter: !1,
374
- includeComponentFiles: !0
589
+ includeComponentFiles: !0,
590
+ includeTsConfigFiles: !0
375
591
  },
376
- async run(i) {
377
- await Qe(i, e, t);
592
+ async run(o) {
593
+ await lt(o, e, t, s);
378
594
  }
379
595
  },
380
596
  "deprecations audit-usages",
381
- n
597
+ s
382
598
  );
383
599
  }
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 = [
600
+ async function lt(s, e, n, t) {
601
+ const o = /* @__PURE__ */ new Map(), r = Le("warn", () => {
602
+ n = !1;
603
+ }), i = /* @__PURE__ */ new Map(), d = se([]), l = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), f = [
388
604
  ...new Map(
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 }]] : [];
605
+ s.flatMap(({ packageJson: u }) => {
606
+ const v = u === void 0 ? void 0 : D.dirname(u.filePath), y = u?.contents.name;
607
+ return v !== void 0 && y !== void 0 && L(v, process.cwd()) ? [[v, { root: v, name: y }]] : [];
392
608
  })
393
609
  ).values()
394
- ].toSorted((g, v) => v.root.length - g.root.length);
395
- for (const g of n) {
396
- var u = [];
610
+ ].toSorted((u, v) => v.root.length - u.root.length);
611
+ for (const u of s) {
612
+ var N = [];
397
613
  try {
398
- if (Ne(g.packageJson?.contents.name)) {
399
- const b = g.packageJson?.filePath;
400
- b !== void 0 && !d.has(b) && (d.add(b), xe(
614
+ if (J(u.packageJson?.contents.name)) {
615
+ const k = u.packageJson?.filePath;
616
+ k !== void 0 && !p.has(k) && (p.add(k), U(
401
617
  "warn",
402
- $(b),
403
- `Skipping excluded package \`${g.packageJson?.contents.name ?? g.cwd}\`.`
618
+ M(k),
619
+ `Skipping excluded package \`${u.packageJson?.contents.name ?? u.cwd}\`.`
404
620
  ));
405
621
  continue;
406
622
  }
407
- if (g.filePaths.length === 0)
623
+ if (u.filePaths.length === 0)
408
624
  continue;
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);
625
+ const v = Ee(u.packageJson);
626
+ const y = await g(u.packageJson, v.packages);
627
+ const P = u.packageJson === void 0 ? void 0 : D.dirname(u.packageJson.filePath);
628
+ const $ = te(N, u.filePaths.some(Ne) ? Se(u, !1, {
629
+ paths: { ...u.typeScriptConfig?.compilerOptions.paths, ...v.paths }
630
+ }) : void 0);
631
+ const E = $?.tsMorph.getLanguageService().compilerObject;
632
+ const T = E?.getProgram()?.getTypeChecker();
633
+ for (const k of $?.getCodemodFiles() ?? []) {
634
+ const C = k.compilerNode;
635
+ if (!ie(C.fileName)) {
636
+ if (E !== void 0 && T !== void 0) {
637
+ const we = dt(
638
+ C,
639
+ E,
640
+ T,
641
+ P,
642
+ e.esriOnly
643
+ );
644
+ for (const H of we) {
645
+ const X = yt(H.originFileNames, f, P), Y = o.get(X) ?? [];
646
+ Y.push({ sourceFileName: C.fileName, usage: H }), o.set(X, Y);
647
+ }
427
648
  }
649
+ w(ce(C, y, T)), l.add(C.fileName);
428
650
  }
429
- h(Z(k, v, D)), l.add(k.fileName);
430
651
  }
431
- v.hasDeprecatedApis && await ve(g.filePaths, 8, async (b) => {
432
- if (l.has(b))
652
+ y.hasDeprecatedApis && await pe(u.filePaths, 8, async (k) => {
653
+ if (l.has(k) || ie(k))
433
654
  return;
434
- const k = await Oe(b, "utf8");
435
- h(Z({ fileName: b, text: k }, v)), l.add(b);
655
+ const C = await B(k, "utf8");
656
+ w(ce({ fileName: k, text: C }, y)), l.add(k);
436
657
  });
437
- } catch (y) {
438
- var w = y, E = !0;
658
+ } catch (b) {
659
+ var A = b, S = !0;
439
660
  } finally {
440
- _(u, w, E);
661
+ ne(N, A, S);
441
662
  }
442
663
  }
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(
664
+ const a = await tt(
665
+ s.flatMap(
666
+ ({ packageJson: u }) => u === void 0 || J(u.contents.name) ? [] : [u]
667
+ ),
668
+ e.packageName,
669
+ () => {
670
+ n = !1;
671
+ }
672
+ );
673
+ for (const [u, v] of a)
674
+ o.set(u, [...o.get(u) ?? [], ...v]);
675
+ if (!e.esriOnly && (e.packageName === void 0 || e.packageName === "typescript") && (e.category === void 0 || e.category === "outdatedTypeScriptConfig")) {
676
+ const u = s.flatMap(
677
+ ({ typeScriptConfig: y, packageJson: P }) => y !== void 0 && !J(P?.contents.name) && L(y.filePath, process.cwd()) && (t === void 0 || t === y.filePath) ? [y.filePath] : []
678
+ ), v = await rt(u);
679
+ v.length > 0 && o.set("typescript", [...o.get("typescript") ?? [], ...v]);
680
+ }
681
+ const m = pt(o, e), h = e.reportingUrl || e.outputFormat === "json" ? K(m, de(), I(), n) : void 0;
682
+ We(m, e.outputFormat, h);
683
+ const x = [...m.values()].flat();
684
+ Oe(
447
685
  "usages",
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;
686
+ x.length,
687
+ new Set(x.map(({ sourceFileName: u }) => u)).size,
688
+ m.size
689
+ ), e.reportingUrl && h !== void 0 && await ke(h, e.reportingUrl);
690
+ async function g(u, v) {
691
+ if (u === void 0)
692
+ return d;
693
+ let y = i.get(u.filePath);
694
+ return y === void 0 && (y = se(
695
+ await Te(u, r, e.esriOnly, v)
696
+ ), i.set(u.filePath, y)), y;
459
697
  }
460
- function h(g) {
461
- for (const { packageName: v, sourceFileName: N, usage: A } of g) {
462
- if (ne(A.name, A.reason))
698
+ function w(u) {
699
+ for (const { packageName: v, sourceFileName: y, usage: P } of u) {
700
+ if (me(P.name, P.reason))
463
701
  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);
702
+ const $ = o.get(v) ?? [], E = $.findIndex(
703
+ (k) => k.sourceFileName === y && k.usage.start === P.start && k.usage.length === P.length
704
+ ), T = { sourceFileName: y, usage: P };
705
+ E === -1 ? $.push(T) : $[E] = T, o.set(v, $);
468
706
  }
469
707
  }
470
708
  }
471
- function Ve(n, e) {
472
- const o = /* @__PURE__ */ new Map();
473
- for (const [t, i] of n) {
709
+ function pt(s, e) {
710
+ const n = /* @__PURE__ */ new Map();
711
+ for (const [t, o] of s) {
474
712
  if (e.packageName !== void 0 && t !== e.packageName)
475
713
  continue;
476
- const a = i.filter(
477
- ({ usage: s }) => e.category === void 0 || se({
714
+ const r = o.filter(
715
+ ({ usage: i }) => e.category === void 0 || ge({
478
716
  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
717
+ name: i.name,
718
+ category: i.category,
719
+ memberOf: i.memberOf,
720
+ module: i.module ?? W(i.originFileNames, t),
721
+ deprecated: i.reason ?? !0
484
722
  }) === e.category
485
723
  );
486
- a.length > 0 && o.set(t, a);
724
+ r.length > 0 && n.set(t, r);
487
725
  }
488
- return o;
726
+ return n;
489
727
  }
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)
728
+ function dt(s, e, n, t, o = !1) {
729
+ const r = /* @__PURE__ */ new Map();
730
+ for (const i of e.getSuggestionDiagnostics(s.fileName)) {
731
+ if (i.reportsDeprecated === void 0)
494
732
  continue;
495
- const l = ae(n, s.start, s.start + s.length);
733
+ const d = ve(s, i.start, i.start + i.length);
496
734
  if (
497
735
  // Don't report for imports, only for usages
498
- c.findAncestor(l, c.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
499
- c.findAncestor(l, c.isJsxClosingElement) !== void 0
736
+ c.findAncestor(d, c.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
737
+ c.findAncestor(d, c.isJsxClosingElement) !== void 0
500
738
  )
501
739
  continue;
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
740
+ const l = gt(d, n), p = l.reason === void 0 ? [] : Q(l.symbol), f = p.length > 0 ? void 0 : e.getDefinitionAtPosition(s.fileName, i.start), a = p.length > 0 ? p : [...new Set(f?.map(({ fileName: m }) => m))];
741
+ G(a, o, t) && q(r, s, {
742
+ start: i.start,
743
+ length: i.length,
744
+ ...ft(d, l, n, e, f?.[0]),
745
+ originFileNames: a,
746
+ reason: vt(e, s.fileName, i.start) ?? l.reason
509
747
  });
510
748
  }
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;
749
+ return mt(s, n, r, t, o), [...r.values()].toSorted((i, d) => i.start - d.start);
750
+ }
751
+ function mt(s, e, n, t, o) {
752
+ function r(i) {
753
+ c.isNewExpression(i) && ut(i, e, n, t, o);
754
+ let d, l;
755
+ if (c.isJsxAttribute(i) && c.isIdentifier(i.name)) {
756
+ const p = i.parent.parent;
757
+ (c.isJsxOpeningElement(p) || c.isJsxSelfClosingElement(p)) && (l = e.getContextualType(p.tagName)?.getProperty(i.name.text), d = i.name);
758
+ } else if ((c.isPropertyAssignment(i) || c.isShorthandPropertyAssignment(i) || c.isMethodDeclaration(i)) && c.isObjectLiteralExpression(i.parent)) {
759
+ const p = c.isComputedPropertyName(i.name) ? j(i.name.expression, e) : i.name.text, f = e.getContextualType(i.parent);
760
+ l = p === void 0 || f === void 0 ? void 0 : e.getNonNullableType(f).getProperty(p), d = i.name;
761
+ } else if (c.isPropertyAccessExpression(i))
762
+ l = e.getSymbolAtLocation(i.name), d = i.name;
763
+ else if (c.isElementAccessExpression(i)) {
764
+ const p = j(i.argumentExpression, e);
765
+ l = p === void 0 ? void 0 : e.getTypeAtLocation(i.expression).getProperty(p), d = i.argumentExpression;
766
+ } else if (c.isBindingElement(i) && c.isObjectBindingPattern(i.parent) && i.dotDotDotToken === void 0) {
767
+ const p = i.propertyName ?? (c.isIdentifier(i.name) ? i.name : void 0), f = p === void 0 ? void 0 : c.isComputedPropertyName(p) ? j(p.expression, e) : p.text;
768
+ l = f === void 0 ? void 0 : e.getTypeAtLocation(i.parent).getProperty(f), d = p;
531
769
  }
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]),
770
+ if ((c.isPropertyAccessExpression(i) || c.isElementAccessExpression(i) || c.isBindingElement(i)) && !l?.declarations?.some(
771
+ (p) => c.isGetAccessorDeclaration(p) || c.isSetAccessorDeclaration(p)
772
+ ) && (l = void 0), l !== void 0 && d !== void 0) {
773
+ const p = xe(l, e), f = Q(l);
774
+ p !== void 0 && G(f, o, t) && q(n, s, {
775
+ start: d.getStart(s),
776
+ length: d.getWidth(s),
777
+ name: l.getName(),
778
+ ...z(l.declarations?.[0]),
541
779
  originFileNames: f,
542
- reason: m
780
+ reason: p
543
781
  });
544
782
  }
545
- c.forEachChild(s, a);
783
+ c.forEachChild(i, r);
546
784
  }
547
- a(n);
785
+ r(s);
548
786
  }
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)
787
+ function ut(s, e, n, t, o) {
788
+ const r = e.getTypeAtLocation(s).getSymbol(), i = r?.declarations?.[0], d = i !== void 0 && (c.isClassDeclaration(i) || c.isInterfaceDeclaration(i)) ? i.name?.text : void 0, l = d === void 0 ? void 0 : Fe.get(d);
789
+ if (l === void 0 || d === void 0)
552
790
  return;
553
- const m = F(a);
554
- if (!m.some(
555
- (p) => (W(p) ?? oe(P.dirname(p), "")) === "@arcgis/core"
556
- ) || !z(m, i, t))
791
+ const p = Q(r);
792
+ if (!p.some(
793
+ (m) => (_(m) ?? ue(D.dirname(m), "")) === "@arcgis/core"
794
+ ) || !G(p, o, t))
557
795
  return;
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,
796
+ const f = c.isPropertyAccessExpression(s.expression) ? s.expression.name : s.expression, a = s.getSourceFile();
797
+ q(n, a, {
798
+ start: f.getStart(a),
799
+ length: f.getWidth(a),
800
+ name: d,
563
801
  kind: "class",
564
802
  category: "coreViews",
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.`
803
+ originFileNames: p,
804
+ reason: `Direct construction with new ${d}() is discouraged. Use \`<${l}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
567
805
  });
568
806
  }
569
- function T(n, e) {
570
- const o = e.getTypeAtLocation(n);
571
- return o.isStringLiteral() || o.isNumberLiteral() ? String(o.value) : void 0;
807
+ function j(s, e) {
808
+ const n = e.getTypeAtLocation(s);
809
+ return n.isStringLiteral() || n.isNumberLiteral() ? String(n.value) : void 0;
572
810
  }
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);
811
+ function gt(s, e) {
812
+ let n = e.getSymbolAtLocation(s);
813
+ for (; n !== void 0 && (n.flags & c.SymbolFlags.Alias) !== 0; ) {
814
+ const t = xe(n, e);
577
815
  if (t !== void 0)
578
- return { symbol: o, reason: t };
579
- o = o.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(o);
816
+ return { symbol: n, reason: t };
817
+ n = n.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(n);
580
818
  }
581
- return { symbol: o, reason: void 0 };
819
+ return { symbol: n, reason: void 0 };
582
820
  }
583
- function F(n) {
584
- return [...new Set(n?.declarations?.map((e) => e.getSourceFile().fileName))];
821
+ function Q(s) {
822
+ return [...new Set(s?.declarations?.map((e) => e.getSourceFile().fileName))];
585
823
  }
586
- function Xe(n, e, o, t, i) {
824
+ function ft(s, e, n, t, o) {
587
825
  if (e.reason !== void 0)
588
826
  return {
589
- name: H(e.symbol.declarations?.[0], e.symbol.getName()),
590
- ...L(e.symbol.declarations?.[0])
827
+ name: oe(e.symbol.declarations?.[0], e.symbol.getName()),
828
+ ...z(e.symbol.declarations?.[0])
591
829
  };
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,
594
- i.textSpan.start,
595
- i.textSpan.start + i.textSpan.length
596
- ), l = (s === void 0 ? void 0 : o.getSymbolAtLocation(s)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], d = i?.name;
830
+ const r = o === void 0 ? void 0 : t.getProgram()?.getSourceFile(o.fileName), i = o === void 0 || r === void 0 ? void 0 : ve(
831
+ r,
832
+ o.textSpan.start,
833
+ o.textSpan.start + o.textSpan.length
834
+ ), d = (i === void 0 ? void 0 : n.getSymbolAtLocation(i)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], l = o?.name;
597
835
  return {
598
- name: d === void 0 ? Ye(n) : H(l, d),
599
- ...L(l)
836
+ name: l === void 0 ? ht(s) : oe(d, l),
837
+ ...z(d)
600
838
  };
601
839
  }
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/");
840
+ function L(s, e) {
841
+ const n = D.relative(e, s);
842
+ return n !== "" && !n.startsWith("../") && !D.isAbsolute(n) && n !== "node_modules" && !n.startsWith("node_modules/");
605
843
  }
606
- function ae(n, e, o) {
607
- let t = n;
844
+ function ve(s, e, n) {
845
+ let t = s;
608
846
  for (; ; ) {
609
- let i;
610
- if (c.forEachChild(t, (a) => {
611
- i === void 0 && a.getStart(n) <= e && a.getEnd() >= o && (i = a);
612
- }), i === void 0)
847
+ let o;
848
+ if (c.forEachChild(t, (r) => {
849
+ o === void 0 && r.getStart(s) <= e && r.getEnd() >= n && (o = r);
850
+ }), o === void 0)
613
851
  return t;
614
- t = i;
852
+ t = o;
615
853
  }
616
854
  }
617
- function Ye(n) {
618
- return c.isIdentifier(n) || c.isPrivateIdentifier(n) || c.isStringLiteralLike(n) || c.isNumericLiteral(n) ? n.text : n.getText();
855
+ function ht(s) {
856
+ return c.isIdentifier(s) || c.isPrivateIdentifier(s) || c.isStringLiteralLike(s) || c.isNumericLiteral(s) ? s.text : s.getText();
619
857
  }
620
- function re(n) {
621
- const e = n?.find(({ name: o }) => o === "deprecated");
622
- return e === void 0 ? void 0 : ke(e.text) ?? "";
858
+ function ye(s) {
859
+ const e = s?.find(({ name: n }) => n === "deprecated");
860
+ return e === void 0 ? void 0 : Me(e.text) ?? "";
623
861
  }
624
- function Ze(n, e, o) {
862
+ function vt(s, e, n) {
625
863
  try {
626
- return re(n.getQuickInfoAtPosition(e, o)?.tags);
864
+ return ye(s.getQuickInfoAtPosition(e, n)?.tags);
627
865
  } catch {
628
866
  return;
629
867
  }
630
868
  }
631
- function ce(n, e) {
869
+ function xe(s, e) {
632
870
  try {
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);
871
+ const n = ye(s?.getJsDocTags(e));
872
+ if (n !== void 0)
873
+ return n;
874
+ const t = s?.declarations?.filter((o) => c.isGetAccessorDeclaration(o) || c.isSetAccessorDeclaration(o)).map((o) => c.getJSDocDeprecatedTag(o)).find((o) => o !== void 0);
875
+ return t === void 0 ? void 0 : t.comment === void 0 ? "" : Ie(t.comment);
638
876
  } catch {
639
877
  return;
640
878
  }
641
879
  }
642
- function U(n, e, o) {
643
- if (ne(o.name, o.reason))
880
+ function q(s, e, n) {
881
+ if (me(n.name, n.reason))
644
882
  return;
645
- const { line: t, character: i } = e.getLineAndCharacterOfPosition(o.start);
646
- n.set(`${o.start}:${o.length}`, {
647
- ...o,
883
+ const { line: t, character: o } = e.getLineAndCharacterOfPosition(n.start);
884
+ s.set(`${n.start}:${n.length}`, {
885
+ ...n,
648
886
  line: t + 1,
649
- column: i + 1
887
+ column: o + 1
650
888
  });
651
889
  }
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);
890
+ function G(s, e, n) {
891
+ return s.some((t) => n !== void 0 && L(t, n)) ? !1 : !e || s.some((t) => {
892
+ const o = _(t);
893
+ return o === void 0 ? n === void 0 || !L(t, n) : Ae(o);
656
894
  });
657
895
  }
658
- function W(n) {
659
- const e = ge(n), o = "/node_modules/", t = e.lastIndexOf(o);
896
+ function _(s) {
897
+ const e = Pe(s), n = "/node_modules/", t = e.lastIndexOf(n);
660
898
  if (t === -1)
661
899
  return;
662
- const [i, a] = e.slice(t + o.length).split("/");
663
- return i.startsWith("@") ? `${i}/${a}` : i;
900
+ const [o, r] = e.slice(t + n.length).split("/");
901
+ return o.startsWith("@") ? `${o}/${r}` : o;
664
902
  }
665
- function et(n, e = [], o) {
666
- const t = n[0];
903
+ function yt(s, e = [], n) {
904
+ const t = s[0];
667
905
  if (t === void 0)
668
906
  return "unknown package";
669
- const i = W(t);
670
- if (i !== void 0)
907
+ const o = _(t);
908
+ if (o !== void 0)
909
+ return o;
910
+ const r = e.find(({ root: a }) => L(t, a));
911
+ if (r !== void 0)
912
+ return r.name;
913
+ const i = D.dirname(M(t)), d = ue(D.dirname(t), i);
914
+ if (d !== i)
915
+ return d;
916
+ if (n === void 0)
671
917
  return i;
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("/");
918
+ const p = D.relative(n, t).split("/"), f = p.findIndex((a) => a !== "..");
919
+ return f < 1 ? D.dirname(M(t)) : p.slice(0, f * 2).join("/");
682
920
  }
683
921
  export {
684
- xt as auditDeprecatedUsages,
685
- Ge as collectDeprecatedApiUsages,
686
- et as getDeprecationOriginLabel,
687
- W as getNodeModulesPackageName,
688
- z as shouldIncludeDeprecation
922
+ Rt as auditDeprecatedUsages,
923
+ dt as collectDeprecatedApiUsages,
924
+ yt as getDeprecationOriginLabel,
925
+ _ as getNodeModulesPackageName,
926
+ G as shouldIncludeDeprecation
689
927
  };