@arcgis/codemod 6.0.0-next.1 → 6.0.0-next.3

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,404 +1,459 @@
1
- var C = (t, o) => (o = Symbol[t]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + t), I = (t) => {
2
- throw TypeError(t);
1
+ var M = (o, e) => (e = Symbol[o]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + o), O = (o) => {
2
+ throw TypeError(o);
3
3
  };
4
- var F = (t, o, e) => {
5
- if (o != null) {
6
- typeof o != "object" && typeof o != "function" && I("Object expected");
7
- var n, r;
8
- e && (n = o[C("asyncDispose")]), n === void 0 && (n = o[C("dispose")], e && (r = n)), typeof n != "function" && I("Object not disposable"), r && (n = function() {
4
+ var J = (o, e, t) => {
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() {
9
9
  try {
10
- r.call(this);
11
- } catch (a) {
12
- return Promise.reject(a);
10
+ i.call(this);
11
+ } catch (s) {
12
+ return Promise.reject(s);
13
13
  }
14
- }), t.push([e, n, o]);
15
- } else e && t.push([e]);
16
- return o;
17
- }, R = (t, o, e) => {
18
- var n = typeof SuppressedError == "function" ? SuppressedError : function(i, s, l, u) {
19
- return u = Error(l), u.name = "SuppressedError", u.error = i, u.suppressed = s, u;
20
- }, r = (i) => o = e ? new n(i, o, "An error was suppressed during disposal") : (e = !0, i), a = (i) => {
21
- for (; i = t.pop(); )
14
+ }), o.push([t, a, e]);
15
+ } else t && o.push([t]);
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(); )
22
22
  try {
23
- var s = i[1] && i[1].call(i[2]);
24
- if (i[0]) return Promise.resolve(s).then(a, (l) => (r(l), a()));
25
- } catch (l) {
26
- r(l);
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);
27
27
  }
28
- if (e) throw o;
28
+ if (t) throw e;
29
29
  };
30
- return a();
30
+ return s();
31
31
  };
32
- import { c as _ } from "./useProjectInstance.js";
33
- import { d as P, r as Q } from "./cli.js";
34
- import { f as y } from "./log.js";
35
- import { path as d, toPosixPathSeparators as H } from "@arcgis/node-toolkit/path";
36
- import { log as q } from "@arcgis/toolkit/log";
37
- import f from "typescript";
38
- import { g as D, a as G, s as K, p as V, b as X, c as Y, d as Z } from "./hardcodedBehavior.js";
39
- import { f as B, c as T, g as ee, i as te } from "./format.js";
40
- import { styleText as w } from "node:util";
41
- import { loadCodeowners as oe } from "@arcgis/node-toolkit/codeowners";
42
- function ne(t, o) {
43
- if (o === "json") {
44
- const e = D();
45
- process.stdout.write(`${le(t, oe(), e)}
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) {
44
+ if (e === "json") {
45
+ const t = A();
46
+ process.stdout.write(`${Ne(o, le(), t)}
46
47
  `);
47
48
  return;
48
49
  }
49
- if (o === "md") {
50
- process.stdout.write(`${ue(t)}
50
+ if (e === "md") {
51
+ process.stdout.write(`${he(o)}
51
52
  `);
52
53
  return;
53
54
  }
54
- process.stdout.write(`${ae(t)}
55
+ process.stdout.write(`${ge(o)}
55
56
  `);
56
57
  }
57
- function ae(t) {
58
- const o = L(t), e = o.reduce((r, a) => r + a.count, 0), n = [J("Deprecation summary", e)];
59
- for (const { categoryName: r, count: a, packages: i } of o) {
60
- n.push(`${P[r].label} (${a})`);
61
- for (const { packageName: s, count: l } of i)
62
- n.push(` ${M(s)} (${l})`);
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})`);
63
64
  }
64
- n.push("", "", J("Deprecation details", e));
65
- for (const { categoryName: r, count: a, packages: i } of o) {
66
- const s = P[r];
67
- n.push("", `${s.label} (${a})`), "description" in s && n.push(` ${s.description}`);
68
- for (const { packageName: l, count: u, apis: p } of i) {
69
- n.push("", ` ${M(l)} (${u})`);
70
- for (const { api: c, reasons: m, items: g } of p) {
71
- n.push(` ${ie(c)} (${g.length})`);
72
- for (const v of m)
73
- n.push(re(v, 6));
74
- for (const { sourceFileName: v, usage: h } of se(g))
75
- n.push(` ${y(v)}:${h.line}:${h.column}`);
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}`);
76
78
  }
77
79
  }
78
80
  }
79
- return n.join(`
81
+ return a.join(`
80
82
  `);
81
83
  }
82
- function L(t) {
83
- const o = [...t].flatMap(
84
- ([e, n]) => n.map((r) => ({ ...r, packageName: e }))
84
+ function Q(o) {
85
+ const e = [...o].flatMap(
86
+ ([t, a]) => a.map((i) => ({ ...i, packageName: t }))
85
87
  );
86
- return ee(o, ({ packageName: e, usage: n }) => ({
87
- packageName: e,
88
- api: n.name,
89
- reason: n.reason
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
90
95
  }));
91
96
  }
92
- function J(t, o) {
93
- return w(["bold", "yellow"], `${t} (${o})`);
97
+ function U(o, e) {
98
+ return k(["bold", "yellow"], `${o} (${e})`);
94
99
  }
95
- function M(t) {
96
- return w("blue", t);
100
+ function K(o) {
101
+ return k("blue", o);
97
102
  }
98
- function ie(t) {
99
- return w(["bold", "white"], t);
103
+ function fe(o) {
104
+ return k(["bold", "white"], o);
100
105
  }
101
- function re(t, o) {
102
- const e = " ".repeat(o);
103
- return t.split(/\r?\n/u).map((n) => `${e}${n}`).join(`
106
+ function de(o, e) {
107
+ const t = " ".repeat(e);
108
+ return o.split(/\r?\n/u).map((a) => `${t}${a}`).join(`
104
109
  `);
105
110
  }
106
- function se(t) {
107
- return t.toSorted(
108
- (o, e) => o.sourceFileName.localeCompare(e.sourceFileName) || o.usage.line - e.usage.line || o.usage.column - e.usage.column
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
109
114
  );
110
115
  }
111
- function ce(t) {
112
- return [...t].sort(([o], [e]) => o.localeCompare(e));
116
+ function ye(o) {
117
+ return [...o].sort(([e], [t]) => e.localeCompare(t));
113
118
  }
114
- function le(t, o, e = D()) {
115
- return JSON.stringify(E(t, o, e), void 0, 2);
119
+ function Ne(o, e, t = A()) {
120
+ return JSON.stringify(V(o, e, t), void 0, 2);
116
121
  }
117
- function ue(t, o = D()) {
118
- return B(E(t, void 0, o));
122
+ function he(o, e = A()) {
123
+ return pe(V(o, void 0, e));
119
124
  }
120
- function E(t, o, e) {
121
- const n = L(t);
125
+ function V(o, e, t) {
126
+ const a = Q(o);
122
127
  return {
123
128
  kind: "usages",
124
- repository: e.repository,
125
- ref: e.ref,
129
+ repository: t.repository,
130
+ ref: t.ref,
126
131
  summary: {
127
- total: n.reduce((a, { count: i }) => a + i, 0),
128
- categories: n.map(({ categoryName: a, count: i, packages: s }) => ({
129
- category: a,
130
- label: P[a].label,
131
- count: i,
132
- packages: s.map(({ packageName: l, count: u }) => ({
133
- package: l,
134
- count: u
132
+ total: a.reduce((s, { count: n }) => s + n, 0),
133
+ categories: a.map(({ categoryName: s, count: n, packages: r }) => ({
134
+ category: s,
135
+ label: b[s].label,
136
+ count: n,
137
+ packages: r.map(({ packageName: m, count: c }) => ({
138
+ package: m,
139
+ count: c
135
140
  }))
136
141
  }))
137
142
  },
138
- findings: ce(t).flatMap(
139
- ([a, i]) => i.map((s) => ({
140
- category: T({
141
- packageName: a,
142
- api: s.usage.name,
143
- reason: s.usage.reason
144
- }),
143
+ findings: xe(o, e, t)
144
+ };
145
+ }
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 = {
145
150
  package: a,
146
151
  api: s.usage.name,
147
- reason: s.usage.reason ?? null,
148
- file: G(s.sourceFileName, e.repositoryRoot),
152
+ category: s.usage.category,
153
+ memberOf: s.usage.memberOf,
154
+ module: n,
155
+ reason: s.usage.reason ?? null
156
+ };
157
+ return {
158
+ ...r,
159
+ category: z(r),
160
+ apiKind: s.usage.apiKind,
161
+ memberOf: s.usage.memberOf,
162
+ file: oe(s.sourceFileName, t.repositoryRoot),
149
163
  line: s.usage.line,
150
164
  column: s.usage.column,
151
- codeowners: o?.getOwners(s.sourceFileName) ?? []
152
- }))
153
- )
154
- };
165
+ codeowners: e?.getOwners(s.sourceFileName) ?? []
166
+ };
167
+ })
168
+ );
155
169
  }
156
- async function Me(t, o) {
157
- await Q(
170
+ async function We(o, e) {
171
+ await q(
158
172
  {
159
173
  meta: {
160
174
  needsTypeInformation: !0,
161
175
  needsFooter: !1
162
176
  },
163
- run(e) {
164
- fe(e, o);
177
+ run(t) {
178
+ Se(t, e);
165
179
  }
166
180
  },
167
181
  "deprecations audit-usages",
168
- t
182
+ o
169
183
  );
170
184
  }
171
- function fe(t, o) {
172
- const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [
185
+ function Se(o, e) {
186
+ const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = [
173
187
  ...new Map(
174
- t.flatMap(({ packageJson: c }) => {
175
- const m = c === void 0 ? void 0 : d.dirname(c.filePath), g = c?.contents.name;
176
- return m !== void 0 && g !== void 0 && k(m, process.cwd()) ? [[m, { root: m, name: g }]] : [];
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 }]] : [];
177
191
  })
178
192
  ).values()
179
- ].toSorted((c, m) => m.root.length - c.root.length);
180
- for (const c of t) {
181
- var s = [];
193
+ ].toSorted((p, g) => g.root.length - p.root.length);
194
+ for (const p of o) {
195
+ var r = [];
182
196
  try {
183
- if (K(c.packageJson?.contents.name)) {
184
- const N = c.packageJson?.filePath;
185
- N !== void 0 && !n.has(N) && (n.add(N), q(
197
+ if (se(p.packageJson?.contents.name)) {
198
+ const f = p.packageJson?.filePath;
199
+ f !== void 0 && !a.has(f) && (a.add(f), Y(
186
200
  "warn",
187
- y(N),
188
- `Skipping excluded package \`${c.packageJson?.contents.name ?? c.cwd}\`.`
201
+ x(f),
202
+ `Skipping excluded package \`${p.packageJson?.contents.name ?? p.cwd}\`.`
189
203
  ));
190
204
  continue;
191
205
  }
192
- const m = F(s, _(c, !1));
193
- const g = m.tsMorph.getLanguageService().compilerObject;
194
- const v = g.getProgram()?.getTypeChecker();
195
- if (v === void 0)
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)
196
210
  continue;
197
- const h = c.packageJson === void 0 ? void 0 : d.dirname(c.packageJson.filePath);
198
- for (const N of m.getCodemodFiles()) {
199
- const A = N.compilerNode;
200
- for (const b of pe(
201
- A,
202
- g,
203
- v,
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,
204
218
  h,
205
- o.esriOnly
219
+ e.esriOnly
206
220
  )) {
207
- const $ = Pe(b.originFileNames, r, h), x = e.get($) ?? [];
208
- x.push({ sourceFileName: A.fileName, usage: b }), e.set($, x);
221
+ const T = Ee(I.originFileNames, i, h), L = t.get(T) ?? [];
222
+ L.push({ sourceFileName: N.fileName, usage: I }), t.set(T, L);
209
223
  }
210
224
  }
211
- } catch (l) {
212
- var u = l, p = !0;
225
+ } catch (m) {
226
+ var c = m, u = !0;
213
227
  } finally {
214
- R(s, u, p);
228
+ R(r, c, u);
215
229
  }
216
230
  }
217
- const a = me(e, o);
218
- ne(a, o.outputFormat);
219
- const i = [...a.values()].flat();
220
- V(
231
+ const s = Pe(t, e);
232
+ ue(s, e.outputFormat);
233
+ const n = [...s.values()].flat();
234
+ ne(
221
235
  "usages",
222
- i.length,
223
- new Set(i.map(({ sourceFileName: c }) => c)).size,
224
- a.size
236
+ n.length,
237
+ new Set(n.map(({ sourceFileName: p }) => p)).size,
238
+ s.size
225
239
  );
226
240
  }
227
- function me(t, o) {
228
- const e = /* @__PURE__ */ new Map();
229
- for (const [n, r] of t) {
230
- if (o.packageName !== void 0 && n !== o.packageName)
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)
231
245
  continue;
232
- const a = r.filter(
233
- ({ usage: i }) => o.category === void 0 || T({ packageName: n, api: i.name, reason: i.reason }) === o.category
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
254
+ }) === e.category
234
255
  );
235
- a.length > 0 && e.set(n, a);
256
+ s.length > 0 && t.set(a, s);
236
257
  }
237
- return e;
258
+ return t;
238
259
  }
239
- function pe(t, o, e, n, r = !1) {
240
- const a = /* @__PURE__ */ new Map();
241
- for (const i of o.getSuggestionDiagnostics(t.fileName)) {
242
- if (i.reportsDeprecated === void 0)
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)
243
264
  continue;
244
- const s = he(t, i.start, i.start + i.length);
265
+ const r = _(o, n.start, n.start + n.length);
245
266
  if (
246
267
  // Don't report for imports, only for usages
247
- f.findAncestor(s, f.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
248
- f.findAncestor(s, f.isJsxClosingElement) !== void 0
268
+ l.findAncestor(r, l.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
269
+ l.findAncestor(r, l.isJsxClosingElement) !== void 0
249
270
  )
250
271
  continue;
251
- const l = de(
252
- s,
253
- e,
254
- o,
255
- t.fileName,
256
- i.start
257
- );
258
- U(l, r, n) && z(a, t, {
259
- start: i.start,
260
- length: i.length,
261
- name: Ne(s, e, o, t.fileName, i.start) ?? ye(s),
262
- originFileNames: l,
263
- reason: ke(o, t.fileName, i.start) ?? Se(s, e)
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
264
279
  });
265
280
  }
266
- return ge(t, e, a, n, r), [...a.values()].toSorted((i, s) => i.start - s.start);
267
- }
268
- function ge(t, o, e, n, r) {
269
- function a(i) {
270
- if (f.isJsxAttribute(i) && f.isIdentifier(i.name)) {
271
- const s = i.parent.parent;
272
- if (f.isJsxOpeningElement(s) || f.isJsxSelfClosingElement(s)) {
273
- const u = o.getContextualType(s.tagName)?.getProperty(i.name.text), p = S(u, o), c = j(u);
274
- p !== void 0 && U(c, r, n) && z(e, t, {
275
- start: i.name.getStart(t),
276
- length: i.name.getWidth(t),
277
- name: i.name.text,
278
- originFileNames: c,
279
- reason: p
280
- });
281
- }
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;
301
+ }
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
313
+ });
282
314
  }
283
- f.forEachChild(i, a);
315
+ l.forEachChild(n, s);
284
316
  }
285
- a(t);
317
+ s(o);
286
318
  }
287
- function de(t, o, e, n, r) {
288
- const a = ve(t, o);
289
- return a.length > 0 ? a : [...new Set(e.getDefinitionAtPosition(n, r)?.map(({ fileName: i }) => i))];
290
- }
291
- function j(t) {
292
- return [...new Set(t?.declarations?.map((o) => o.getSourceFile().fileName))];
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)
322
+ return;
323
+ const c = $(s);
324
+ if (!c.some(
325
+ (g) => (F(g) ?? W(v.dirname(g), "")) === "@arcgis/core"
326
+ ) || !E(c, i, a))
327
+ 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",
334
+ 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.`
337
+ });
293
338
  }
294
- function ve(t, o) {
295
- let e = o.getSymbolAtLocation(t);
296
- for (; e !== void 0 && (e.flags & f.SymbolFlags.Alias) !== 0; ) {
297
- if (S(e, o) !== void 0)
298
- return j(e);
299
- e = e.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(e);
300
- }
301
- return [];
302
- }
303
- function Ne(t, o, e, n, r) {
304
- let a = o.getSymbolAtLocation(t);
305
- for (; a !== void 0 && (a.flags & f.SymbolFlags.Alias) !== 0; ) {
306
- if (S(a, o) !== void 0)
307
- return a.getName();
308
- a = a.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(a);
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);
309
350
  }
310
- return e.getDefinitionAtPosition(n, r)?.[0]?.name;
351
+ return { symbol: t, reason: void 0 };
352
+ }
353
+ function $(o) {
354
+ return [...new Set(o?.declarations?.map((e) => e.getSourceFile().fileName))];
355
+ }
356
+ function ke(o, e, t, a, i) {
357
+ if (e.reason !== void 0)
358
+ return {
359
+ name: j(e.symbol.declarations?.[0], e.symbol.getName()),
360
+ ...D(e.symbol.declarations?.[0])
361
+ };
362
+ const s = i === void 0 ? void 0 : a.getProgram()?.getSourceFile(i.fileName), n = i === void 0 || s === void 0 ? void 0 : _(
363
+ s,
364
+ i.textSpan.start,
365
+ 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;
367
+ return {
368
+ name: m === void 0 ? $e(o) : j(r, m),
369
+ ...D(r)
370
+ };
311
371
  }
312
- function k(t, o) {
313
- const e = d.relative(o, t);
314
- return e !== "" && !e.startsWith("../") && !d.isAbsolute(e) && e !== "node_modules" && !e.startsWith("node_modules/");
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/");
315
375
  }
316
- function he(t, o, e) {
317
- let n = t;
376
+ function _(o, e, t) {
377
+ let a = o;
318
378
  for (; ; ) {
319
- let r;
320
- if (f.forEachChild(n, (a) => {
321
- r === void 0 && a.getStart(t) <= o && a.getEnd() >= e && (r = a);
322
- }), r === void 0)
323
- return n;
324
- n = r;
379
+ let i;
380
+ if (l.forEachChild(a, (s) => {
381
+ i === void 0 && s.getStart(o) <= e && s.getEnd() >= t && (i = s);
382
+ }), i === void 0)
383
+ return a;
384
+ a = i;
325
385
  }
326
386
  }
327
- function ye(t) {
328
- return f.isIdentifier(t) || f.isPrivateIdentifier(t) || f.isStringLiteralLike(t) || f.isNumericLiteral(t) ? t.text : t.getText();
387
+ function $e(o) {
388
+ return l.isIdentifier(o) || l.isPrivateIdentifier(o) || l.isStringLiteralLike(o) || l.isNumericLiteral(o) ? o.text : o.getText();
329
389
  }
330
- function O(t) {
331
- const o = t?.find(({ name: e }) => e === "deprecated");
332
- return o === void 0 ? void 0 : Z(o.text);
390
+ function G(o) {
391
+ const e = o?.find(({ name: t }) => t === "deprecated");
392
+ return e === void 0 ? void 0 : me(e.text) ?? "";
333
393
  }
334
- function ke(t, o, e) {
394
+ function Ce(o, e, t) {
335
395
  try {
336
- return O(t.getQuickInfoAtPosition(o, e)?.tags);
396
+ return G(o.getQuickInfoAtPosition(e, t)?.tags);
337
397
  } catch {
338
398
  return;
339
399
  }
340
400
  }
341
- function S(t, o) {
401
+ function B(o, e) {
342
402
  try {
343
- return O(t?.getJsDocTags(o));
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);
344
408
  } catch {
345
409
  return;
346
410
  }
347
411
  }
348
- function Se(t, o) {
349
- let e = o.getSymbolAtLocation(t);
350
- for (; e !== void 0 && (e.flags & f.SymbolFlags.Alias) !== 0; ) {
351
- const n = S(e, o);
352
- if (n !== void 0)
353
- return n;
354
- e = e.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(e);
355
- }
356
- }
357
- function z(t, o, e) {
358
- if (Y(e.name, e.reason))
412
+ function C(o, e, t) {
413
+ if (re(t.name, t.reason))
359
414
  return;
360
- const { line: n, character: r } = o.getLineAndCharacterOfPosition(e.start);
361
- t.set(`${e.start}:${e.length}`, {
362
- ...e,
363
- line: n + 1,
364
- column: r + 1
415
+ const { line: a, character: i } = e.getLineAndCharacterOfPosition(t.start);
416
+ o.set(`${t.start}:${t.length}`, {
417
+ ...t,
418
+ line: a + 1,
419
+ column: i + 1
365
420
  });
366
421
  }
367
- function U(t, o, e) {
368
- return t.some((n) => e !== void 0 && k(n, e)) ? !1 : !o || t.some((n) => {
369
- const r = W(n);
370
- return r === void 0 ? e === void 0 || !k(n, e) : te(r);
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);
371
426
  });
372
427
  }
373
- function W(t) {
374
- const o = H(t), e = "/node_modules/", n = o.lastIndexOf(e);
375
- if (n === -1)
428
+ function F(o) {
429
+ const e = X(o), t = "/node_modules/", a = e.lastIndexOf(t);
430
+ if (a === -1)
376
431
  return;
377
- const [r, a] = o.slice(n + e.length).split("/");
378
- return r.startsWith("@") ? `${r}/${a}` : r;
432
+ const [i, s] = e.slice(a + t.length).split("/");
433
+ return i.startsWith("@") ? `${i}/${s}` : i;
379
434
  }
380
- function Pe(t, o = [], e) {
381
- const n = t[0];
382
- if (n === void 0)
435
+ function Ee(o, e = [], t) {
436
+ const a = o[0];
437
+ if (a === void 0)
383
438
  return "unknown package";
384
- const r = W(n);
385
- if (r !== void 0)
386
- return r;
387
- const a = o.find(({ root: c }) => k(n, c));
388
- if (a !== void 0)
389
- return a.name;
390
- const i = d.dirname(y(n)), s = X(d.dirname(n), i);
391
- if (s !== i)
392
- return s;
393
- if (e === void 0)
439
+ const i = F(a);
440
+ if (i !== void 0)
394
441
  return i;
395
- const u = d.relative(e, n).split("/"), p = u.findIndex((c) => c !== "..");
396
- return p < 1 ? d.dirname(y(n)) : u.slice(0, p * 2).join("/");
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("/");
397
452
  }
398
453
  export {
399
- Me as auditDeprecatedUsages,
400
- pe as collectDeprecatedApiUsages,
401
- Pe as getDeprecationOriginLabel,
402
- W as getNodeModulesPackageName,
403
- U as shouldIncludeDeprecation
454
+ We as auditDeprecatedUsages,
455
+ be as collectDeprecatedApiUsages,
456
+ Ee as getDeprecationOriginLabel,
457
+ F as getNodeModulesPackageName,
458
+ E as shouldIncludeDeprecation
404
459
  };