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

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,1234 @@
1
- var M = (o, e) => (e = Symbol[o]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + o), O = (o) => {
2
- throw TypeError(o);
1
+ var ne = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), se = (n) => {
2
+ throw TypeError(n);
3
3
  };
4
- var J = (o, e, t) => {
4
+ var ie = (n, e, t) => {
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" && se("Object expected");
7
+ var s, i;
8
+ t && (s = e[ne("asyncDispose")]), s === void 0 && (s = e[ne("dispose")], t && (i = s)), typeof s != "function" && se("Object not disposable"), i && (s = function() {
9
9
  try {
10
10
  i.call(this);
11
- } catch (s) {
12
- return Promise.reject(s);
11
+ } catch (c) {
12
+ return Promise.reject(c);
13
13
  }
14
- }), o.push([t, a, e]);
15
- } else t && o.push([t]);
14
+ }), n.push([t, s, e]);
15
+ } else t && n.push([t]);
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
+ }, re = (n, e, t) => {
18
+ var s = typeof SuppressedError == "function" ? SuppressedError : function(r, p, l, a) {
19
+ return a = Error(l), a.name = "SuppressedError", a.error = r, a.suppressed = p, a;
20
+ }, i = (r) => e = t ? new s(r, e, "An error was suppressed during disposal") : (t = !0, r), c = (r) => {
21
+ for (; r = 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 p = r[1] && r[1].call(r[2]);
24
+ if (r[0]) return Promise.resolve(p).then(c, (l) => (i(l), c()));
25
+ } catch (l) {
26
+ i(l);
27
27
  }
28
28
  if (t) throw e;
29
29
  };
30
- return s();
30
+ return c();
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 De } from "./useProjectInstance.js";
33
+ import { d as z, r as Ee, s as oe, i as Le, a as Te, b as Oe } from "./cli.js";
34
+ import { f as R } from "./log.js";
35
+ import { path as P, toPosixPathSeparators as Fe } from "@arcgis/node-toolkit/path";
36
+ import { forEachWithConcurrency as ve } from "@arcgis/toolkit/promise";
37
+ import o from "typescript";
38
+ import { g as ye, s as Ie, a as M, b as We, c as B, d as xe, e as Me, f as je, h as Re, i as we, p as Je, j as V, k as ae, l as Ue } from "./classification.js";
39
+ import { loadCodeowners as Se } from "@arcgis/node-toolkit/codeowners";
40
+ import { s as ze, c as ce, g as Ve, l as Ge, a as ke, b as qe, d as Be, e as Ke } from "./componentAudit.js";
41
+ import { styleText as K } from "node:util";
42
+ import { f as Ne } from "./format.js";
43
+ import { realpath as j, readFile as J } from "node:fs/promises";
44
+ import O from "semver";
45
+ import { asyncFindPath as G } from "@arcgis/node-toolkit/file";
46
+ import { asyncRetrievePackageJson as He } from "@arcgis/node-toolkit/packageJson";
47
+ import { log as q } from "@arcgis/toolkit/log";
48
+ import { LineCounter as Qe, parseDocument as _e, isMap as Xe, isScalar as le } from "yaml";
49
+ function Ye(n, e, t) {
44
50
  if (e === "json") {
45
- const t = A();
46
- process.stdout.write(`${Ne(o, le(), t)}
51
+ if (t !== void 0) {
52
+ process.stdout.write(`${JSON.stringify(t, void 0, 2)}
53
+ `);
54
+ return;
55
+ }
56
+ const s = M();
57
+ process.stdout.write(`${st(n, Se(), s)}
47
58
  `);
48
59
  return;
49
60
  }
50
61
  if (e === "md") {
51
- process.stdout.write(`${he(o)}
52
- `);
62
+ process.stdout.write(
63
+ `${t === void 0 ? it(n) : Ne(t)}
64
+ `
65
+ );
53
66
  return;
54
67
  }
55
- process.stdout.write(`${ge(o)}
68
+ process.stdout.write(`${Ze(n)}
56
69
  `);
57
70
  }
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})`);
64
- }
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}`);
71
+ function Ze(n) {
72
+ const e = be(n), t = e.reduce((i, c) => i + c.count, 0), s = [pe("Deprecation summary", t)];
73
+ for (const { categoryName: i, count: c, packages: r } of e) {
74
+ s.push(`${z[i].label} (${c})`);
75
+ for (const { displayName: p, count: l } of r)
76
+ s.push(` ${de(p)} (${l})`);
77
+ }
78
+ s.push("", "", pe("Deprecation details", t));
79
+ for (const { categoryName: i, count: c, packages: r } of e) {
80
+ const p = z[i];
81
+ s.push("", `${p.label} (${c})`), "description" in p && s.push(` ${p.description}`);
82
+ for (const { displayName: l, count: a, apis: m } of r) {
83
+ s.push("", ` ${de(l)} (${a})`);
84
+ for (const { name: g, reasons: y, items: v } of m) {
85
+ const d = v[0].usage, u = je({ name: g, memberOf: d.memberOf, kind: d.kind });
86
+ s.push(` ${et(u)}${Re(d.kind)} (${v.length})`);
87
+ for (const x of y)
88
+ s.push(tt(x, 6));
89
+ for (const { sourceFileName: x, usage: w } of nt(v))
90
+ s.push(` ${R(x)}:${w.line}:${w.column}`);
78
91
  }
79
92
  }
80
93
  }
81
- return a.join(`
94
+ return s.join(`
82
95
  `);
83
96
  }
84
- function Q(o) {
85
- const e = [...o].flatMap(
86
- ([t, a]) => a.map((i) => ({ ...i, packageName: t }))
97
+ function be(n) {
98
+ const e = [...n].flatMap(
99
+ ([t, s]) => s.map((i) => ({ ...i, packageName: t }))
87
100
  );
88
- return te(e, ({ packageName: t, usage: a }) => ({
101
+ return We(e, ({ packageName: t, usage: s }) => ({
89
102
  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
103
+ name: s.name,
104
+ kind: s.kind,
105
+ category: s.category,
106
+ memberOf: s.memberOf,
107
+ module: s.module ?? B(s.originFileNames, t),
108
+ deprecated: s.reason ?? !0
95
109
  }));
96
110
  }
97
- function U(o, e) {
98
- return k(["bold", "yellow"], `${o} (${e})`);
111
+ function pe(n, e) {
112
+ return K(["bold", "yellow"], `${n} (${e})`);
99
113
  }
100
- function K(o) {
101
- return k("blue", o);
114
+ function de(n) {
115
+ return K("blue", n);
102
116
  }
103
- function fe(o) {
104
- return k(["bold", "white"], o);
117
+ function et(n) {
118
+ return K(["bold", "white"], n);
105
119
  }
106
- function de(o, e) {
120
+ function tt(n, e) {
107
121
  const t = " ".repeat(e);
108
- return o.split(/\r?\n/u).map((a) => `${t}${a}`).join(`
122
+ return n.split(/\r?\n/u).map((s) => `${t}${s}`).join(`
109
123
  `);
110
124
  }
111
- function ve(o) {
112
- return o.toSorted(
125
+ function nt(n) {
126
+ return n.toSorted(
113
127
  (e, t) => e.sourceFileName.localeCompare(t.sourceFileName) || e.usage.line - t.usage.line || e.usage.column - t.usage.column
114
128
  );
115
129
  }
116
- function ye(o) {
117
- return [...o].sort(([e], [t]) => e.localeCompare(t));
130
+ function st(n, e, t = M()) {
131
+ return JSON.stringify(H(n, e, t), void 0, 2);
118
132
  }
119
- function Ne(o, e, t = A()) {
120
- return JSON.stringify(V(o, e, t), void 0, 2);
133
+ function it(n, e = M()) {
134
+ return Ne(H(n, void 0, e));
121
135
  }
122
- function he(o, e = A()) {
123
- return pe(V(o, void 0, e));
124
- }
125
- function V(o, e, t) {
126
- const a = Q(o);
136
+ function H(n, e, t, s, i = []) {
137
+ const c = be(n), r = ye(process.cwd(), t.repositoryRoot);
127
138
  return {
128
- kind: "usages",
139
+ auditKind: "usages",
129
140
  repository: t.repository,
130
141
  ref: t.ref,
142
+ branch: t.branch,
143
+ scannerVersion: Ie,
144
+ scanDate: Date.now(),
145
+ ...s === void 0 ? {} : { complete: s },
146
+ ...r === "" ? {} : { cwd: r },
147
+ ...i.length === 0 ? {} : { excludedPaths: i },
131
148
  summary: {
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
149
+ total: c.reduce((l, { count: a }) => l + a, 0),
150
+ categories: c.map(({ categoryName: l, count: a, packages: m }) => ({
151
+ category: l,
152
+ label: z[l].label,
153
+ count: a,
154
+ packages: m.map(({ packageName: g, displayName: y, count: v }) => ({
155
+ package: g,
156
+ ...y === g ? {} : { displayName: y },
157
+ count: v
140
158
  }))
141
159
  }))
142
160
  },
143
- findings: xe(o, e, t)
161
+ findings: rt(n, e, t)
144
162
  };
145
163
  }
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
164
+ function rt(n, e, t) {
165
+ return [...n].flatMap(
166
+ ([s, i]) => i.map((c) => {
167
+ const r = c.usage.module ?? B(c.usage.originFileNames, s), p = {
168
+ package: s,
169
+ name: c.usage.name,
170
+ category: c.usage.category,
171
+ memberOf: c.usage.memberOf,
172
+ module: r,
173
+ deprecated: c.usage.reason ?? !0
156
174
  };
157
175
  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) ?? []
176
+ ...p,
177
+ category: xe(p),
178
+ kind: c.usage.kind,
179
+ memberOf: c.usage.memberOf,
180
+ file: ye(c.sourceFileName, t.repositoryRoot),
181
+ line: c.usage.line,
182
+ column: c.usage.column,
183
+ codeowners: e?.getOwners(c.sourceFileName) ?? []
166
184
  };
167
185
  })
186
+ ).sort(Me);
187
+ }
188
+ function ot(n, e, t) {
189
+ return { scanNode: s, scanCss: i, scanHtmlAttributes: c };
190
+ function s(p, l, a) {
191
+ if (!o.isStringLiteralLike(p))
192
+ return;
193
+ const m = p.getStart(l) + 1, g = l.text.slice(m, p.end - 1);
194
+ /(?:^|,)\s*(["']?)CalciteWebCoreIcons\1\s*(?=,|$)/iu.test(g) && me(g, a + m, r), U(g, a + m, r), i(g, a + m);
195
+ }
196
+ function i(p, l, a = !1) {
197
+ const m = a ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, g = p.replace(
198
+ m,
199
+ (v) => v.startsWith("/") ? v.replace(/[^\r\n]/gu, " ") : v
200
+ ), y = g.replace(m, (v) => v.replace(/[^\r\n]/gu, " "));
201
+ U(y, l, r);
202
+ for (const v of y.matchAll(
203
+ /(?:^|[;{}\r\n])\s*(?:font(?:-family)?|--[-\w]+|\$[-\w]+)\s*:([^;{}]*?)(?=;|\}|$|[\r\n][\t ]*[-\w$]+\s*:)/giu
204
+ )) {
205
+ const d = v.index + v[0].length - v[1].length;
206
+ me(g.slice(d, d + v[1].length), l + d, r);
207
+ }
208
+ }
209
+ function c(p) {
210
+ for (const { name: l, value: a, valueStart: m } of p)
211
+ a !== void 0 && (l === "class" ? U(a, m, r) : l === "style" && i(a, m));
212
+ }
213
+ function r(p, l) {
214
+ const { line: a, character: m } = e(p);
215
+ t({
216
+ packageName: "@arcgis/core",
217
+ sourceFileName: n,
218
+ usage: {
219
+ name: "CalciteWebCoreIcons",
220
+ module: "symbols/Font",
221
+ reason: "The Esri Icon Font is deprecated. Use supported fonts or symbols for map graphics and labels, and Calcite UI Icons for UI icons. See https://developers.arcgis.com/javascript/latest/esri-icon-font/",
222
+ originFileNames: [],
223
+ start: p,
224
+ length: l,
225
+ line: a + 1,
226
+ column: m + 1
227
+ }
228
+ });
229
+ }
230
+ }
231
+ function me(n, e, t) {
232
+ for (const s of n.matchAll(/"[^"\r\n]*"|'[^'\r\n]*'|[-\w]+/gu)) {
233
+ const i = s[0].startsWith('"') || s[0].startsWith("'"), c = i ? s[0].slice(1, -1) : s[0];
234
+ c.toLowerCase() === "calcitewebcoreicons" && t(e + s.index + (i ? 1 : 0), c.length);
235
+ }
236
+ }
237
+ function U(n, e, t) {
238
+ for (const s of n.matchAll(/(?<![-\w])esri-icon-[a-z][\w-]*/gu))
239
+ s[0] !== "esri-icon-font-fallback-text" && t(e + s.index, s[0].length);
240
+ }
241
+ function at(n, e, t) {
242
+ return { scanNode: s };
243
+ function s(i, c, r, p) {
244
+ if (r === void 0 || !o.isCallExpression(i) || i.arguments.some(o.isSpreadElement) || !ct(i.expression, r))
245
+ return;
246
+ const l = i.arguments[0];
247
+ if (l === void 0 || !o.isStringLiteralLike(l))
248
+ return;
249
+ const a = i.arguments[1], m = ge(a, "strategy");
250
+ if (m !== "missing" && m !== "unknown" && o.isStringLiteralLike(m) && m.text === "local" && y(
251
+ "strategy",
252
+ m,
253
+ 'The workers.open() strategy "local" is deprecated since 5.2. Use "distributed" or "dedicated" to run the module in a worker instead of on the main thread.'
254
+ ), lt.has(l.text))
255
+ return;
256
+ const g = ge(a, "isESM");
257
+ if (g === "missing" || g !== "unknown" && g.kind === o.SyntaxKind.FalseKeyword) {
258
+ const v = i.expression;
259
+ y(
260
+ "isESM",
261
+ o.isPropertyAccessExpression(v) ? v.name : v,
262
+ "Loading custom workers with isESM: false (the default) is deprecated since 5.2. Author the worker as an ES module and pass isESM: true. See https://developers.arcgis.com/javascript/latest/references/core/core/workers/#open"
263
+ );
264
+ }
265
+ function y(v, d, u) {
266
+ const x = p + d.getStart(c), { line: w, character: f } = e(x);
267
+ t({
268
+ packageName: "@arcgis/core",
269
+ sourceFileName: n,
270
+ usage: {
271
+ name: `open.${v}`,
272
+ kind: "function",
273
+ module: "core/workers",
274
+ reason: u,
275
+ originFileNames: [],
276
+ start: x,
277
+ length: d.getWidth(c),
278
+ line: w + 1,
279
+ column: f + 1
280
+ }
281
+ });
282
+ }
283
+ }
284
+ }
285
+ function ct(n, e) {
286
+ const t = o.isPropertyAccessExpression(n) && n.name.text === "open", s = t ? n.expression : n;
287
+ if (!o.isIdentifier(s))
288
+ return !1;
289
+ const i = e.getSymbolAtLocation(s)?.declarations?.[0];
290
+ return i === void 0 ? !1 : t ? o.isNamespaceImport(i) && !i.parent.isTypeOnly && ue(i.parent.parent.moduleSpecifier) : o.isImportSpecifier(i) && !i.isTypeOnly && !i.parent.parent.isTypeOnly && (i.propertyName ?? i.name).text === "open" && ue(i.parent.parent.parent.moduleSpecifier);
291
+ }
292
+ function ue(n) {
293
+ return o.isStringLiteralLike(n) && /^(?:@arcgis\/core|esri)\/core\/workers(?:\.js)?$/u.test(n.text);
294
+ }
295
+ function ge(n, e) {
296
+ if (n === void 0)
297
+ return "missing";
298
+ if (!o.isObjectLiteralExpression(n) || n.properties.some(
299
+ (t) => !o.isPropertyAssignment(t) || o.isComputedPropertyName(t.name)
300
+ ))
301
+ return "unknown";
302
+ for (const t of n.properties.toReversed())
303
+ if (o.isPropertyAssignment(t) && !o.isComputedPropertyName(t.name) && t.name.text === e)
304
+ return t.initializer;
305
+ return "missing";
306
+ }
307
+ const lt = /* @__PURE__ */ new Set([
308
+ "CSVSourceWorker",
309
+ "EdgeProcessingWorker",
310
+ "ElevationSamplerWorker",
311
+ "FeaturePipelineWorker",
312
+ "FeatureServiceSnappingSourceWorker",
313
+ "FlowWorker",
314
+ "GaussianSplatSortWorker",
315
+ "GeospatialPDFLayerWorker",
316
+ "GeometryWorker",
317
+ "GeoJSONSourceWorker",
318
+ "GeoJSONVectorTileSourceWorker",
319
+ "GlyphWorker",
320
+ "IntegratedMesh3DTilesLayerWorker",
321
+ "LercWorker",
322
+ "Lyr3DWorker",
323
+ "MemorySourceWorker",
324
+ "PBFDecoderWorker",
325
+ "PanoramicMeshWorker",
326
+ "ParquetSourceWorker",
327
+ "PointCloudWorker",
328
+ "RasterWorker",
329
+ "SceneLayerSnappingSourceWorker",
330
+ "SceneLayerWorker",
331
+ "TextureCompressionWorker",
332
+ "WFSSourceWorker",
333
+ "WorkerTileHandler",
334
+ "arcadeGeometryOperatorsWorker",
335
+ "statsWorker",
336
+ "ImageMeasurementWorker"
337
+ ]);
338
+ function fe(n, e, t) {
339
+ const s = P.extname(n.fileName).slice(1).toLowerCase(), i = "getLineAndCharacterOfPosition" in n ? (d) => n.getLineAndCharacterOfPosition(d) : mt(n.text), c = /* @__PURE__ */ new Map(), r = ot(n.fileName, i, (d) => {
340
+ c.set(`iconFont:${d.usage.start}`, d);
341
+ }), p = at(n.fileName, i, (d) => {
342
+ c.set(`workers:${d.usage.name}:${d.usage.start}`, d);
343
+ }), l = /\bdefine\s*(?:\.\s*amd\b|\[\s*(?:"amd"|'amd')\s*\])/u.test(n.text);
344
+ for (const d of n.text.matchAll(/(?<![-\w\u0080-\uFFFF])--[-\w\u0080-\uFFFF]+/gu)) {
345
+ const u = e.cssVariables.get(d[0]);
346
+ u !== void 0 && a(u, d.index, d[0].length);
347
+ }
348
+ if (s === "html") {
349
+ const d = /* @__PURE__ */ new Map();
350
+ if (ft({
351
+ contents: n.text,
352
+ scanElement: (u, x, w) => {
353
+ g(
354
+ u,
355
+ x,
356
+ w.map(({ name: f, start: k }) => ({ name: f, start: k }))
357
+ ), r.scanHtmlAttributes(w);
358
+ },
359
+ scanStyle: (u, x) => {
360
+ he(u, x, y), r.scanCss(u, x);
361
+ },
362
+ scanScript: (u, x, w) => {
363
+ const f = w.find(({ name: N }) => N === "type")?.value?.trim().toLowerCase() ?? "";
364
+ if (w.some(({ name: N }) => N === "src") || ![
365
+ "",
366
+ "module",
367
+ "text/javascript",
368
+ "application/javascript",
369
+ "text/ecmascript",
370
+ "application/ecmascript"
371
+ ].includes(f.split(";")[0]))
372
+ return;
373
+ const k = `${n.fileName}.script-${d.size}.js`;
374
+ d.set(k, {
375
+ source: o.createSourceFile(
376
+ k,
377
+ f === "module" ? `${u}
378
+ export {};` : u,
379
+ o.ScriptTarget.Latest,
380
+ !0,
381
+ o.ScriptKind.JS
382
+ ),
383
+ offset: x
384
+ });
385
+ }
386
+ }), d.size > 0) {
387
+ const u = {
388
+ allowJs: !0,
389
+ noLib: !0,
390
+ noResolve: !0,
391
+ types: [],
392
+ target: o.ScriptTarget.Latest
393
+ }, w = o.createProgram([...d.keys()], u, {
394
+ ...o.createCompilerHost(u),
395
+ getSourceFile: (f) => d.get(f)?.source
396
+ }).getTypeChecker();
397
+ for (const { source: f, offset: k } of d.values())
398
+ v({ node: f, jsxSourceFile: f, typeChecker: w, offset: k });
399
+ }
400
+ } else s === "css" || s === "scss" || s === "sass" ? (he(n.text, 0, y, s !== "css"), r.scanCss(n.text, 0, s !== "css")) : "kind" in n && v({ node: n, jsxSourceFile: n, typeChecker: t });
401
+ return [...c.values()].sort((d, u) => d.usage.start - u.usage.start);
402
+ function a(d, u, x) {
403
+ const { line: w, character: f } = i(u);
404
+ c.set(JSON.stringify([d.package, d.kind, d.memberOf, d.name, u]), {
405
+ packageName: d.package,
406
+ sourceFileName: n.fileName,
407
+ usage: {
408
+ name: d.name,
409
+ kind: d.kind,
410
+ memberOf: d.kind === "css-property" ? void 0 : d.memberOf,
411
+ module: d.module,
412
+ reason: d.reason,
413
+ originFileNames: [d.sourceFileName],
414
+ start: u,
415
+ length: x,
416
+ line: w + 1,
417
+ column: f + 1
418
+ }
419
+ });
420
+ }
421
+ function m(d, u, x) {
422
+ const w = e.components.get(d);
423
+ if (w?.length === 1)
424
+ return w[0].definitions.find((f) => pt({ entry: f, tag: d, kind: u, name: x }));
425
+ }
426
+ function g(d, u, x) {
427
+ const w = m(d, "element", d);
428
+ w !== void 0 && a(w, u, d.length);
429
+ for (const f of x) {
430
+ const k = m(d, "attribute", f.name);
431
+ k !== void 0 && a(k, f.start, f.name.length);
432
+ }
433
+ }
434
+ function y(d, u, x, w) {
435
+ const f = m(d, u, x);
436
+ f !== void 0 && a(f, w, x.length);
437
+ }
438
+ function v({
439
+ node: d,
440
+ jsxSourceFile: u,
441
+ typeChecker: x,
442
+ offset: w = 0
443
+ }) {
444
+ r.scanNode(d, u, w), p.scanNode(d, u, x, w);
445
+ const f = dt({ node: d, checker: x });
446
+ if (f !== void 0 && (f.text !== "define" || !l)) {
447
+ const k = w + f.getStart(u), { line: N, character: A } = i(k);
448
+ c.set(`amd:${k}`, {
449
+ packageName: "@arcgis/core",
450
+ sourceFileName: n.fileName,
451
+ usage: {
452
+ name: f.text,
453
+ kind: "function",
454
+ module: "amd",
455
+ reason: "require/define is deprecated. Use $arcgis.import() or ESM instead. See https://developers.arcgis.com/javascript/latest/get-started/",
456
+ originFileNames: [],
457
+ start: k,
458
+ length: f.getWidth(u),
459
+ line: N + 1,
460
+ column: A + 1
461
+ }
462
+ });
463
+ }
464
+ if (o.isJsxOpeningElement(d) || o.isJsxSelfClosingElement(d)) {
465
+ const k = d.tagName.getText(u), N = d.attributes.properties.filter(o.isJsxAttribute);
466
+ if (g(
467
+ k,
468
+ d.tagName.getStart(u),
469
+ N.map((A) => ({
470
+ name: A.name.getText(u),
471
+ start: A.name.getStart(u)
472
+ }))
473
+ ), ze(d, u, e, a), /^[a-z][\w-]*$/u.test(k)) {
474
+ const A = N.find(($) => $.name.getText(u) === "slot"), h = A?.initializer, S = h !== void 0 && o.isJsxExpression(h) ? h.expression : h, b = A === void 0 ? -1 : d.attributes.properties.indexOf(A), L = d.attributes.properties.slice(b + 1).some(o.isJsxSpreadAttribute);
475
+ if (S !== void 0 && (o.isStringLiteral(S) || o.isNoSubstitutionTemplateLiteral(S)) && !L) {
476
+ const $ = ut(o.isJsxOpeningElement(d) ? d.parent : d, x), T = $ === void 0 ? void 0 : m($, "slot", S.text);
477
+ T !== void 0 && a(T, S.getStart(u) + 1, S.getWidth(u) - 2);
478
+ }
479
+ }
480
+ }
481
+ o.forEachChild(d, (k) => v({ node: k, jsxSourceFile: u, typeChecker: x, offset: w }));
482
+ }
483
+ }
484
+ function pt({
485
+ entry: n,
486
+ tag: e,
487
+ kind: t,
488
+ name: s
489
+ }) {
490
+ const i = n.attribute;
491
+ if (t === "attribute" && i !== void 0) {
492
+ const c = i.tagName === e, r = i.name === s;
493
+ return c && r;
494
+ }
495
+ return n.kind !== t || n.name !== s ? !1 : t === "element" ? !0 : n.memberOf === e;
496
+ }
497
+ function dt({
498
+ node: n,
499
+ checker: e
500
+ }) {
501
+ if (e === void 0 || !o.isCallExpression(n))
502
+ return;
503
+ const t = n.expression;
504
+ let s, i;
505
+ if (o.isIdentifier(t))
506
+ s = t, i = t;
507
+ else if (o.isPropertyAccessExpression(t) && o.isIdentifier(t.name) && o.isIdentifier(t.expression) && ["window", "opener", "globalThis"].includes(t.expression.text))
508
+ s = t.name, i = t.expression;
509
+ else
510
+ return;
511
+ if (s.text !== "define" && s.text !== "require")
512
+ return;
513
+ if (s.text === "require") {
514
+ const r = n.arguments[0];
515
+ if (!(r !== void 0 && o.isArrayLiteralExpression(r)) && n.getSourceFile().fileName.toLowerCase().endsWith(".cjs") || r !== void 0 && o.isStringLiteralLike(r) && !r.text.startsWith("esri/"))
516
+ return;
517
+ }
518
+ return (e.getSymbolAtLocation(i)?.declarations ?? []).every(
519
+ (r) => o.isPropertyAccessExpression(t) && r.getSourceFile().isDeclarationFile
520
+ ) ? s : void 0;
521
+ }
522
+ function mt(n) {
523
+ const e = [
524
+ 0,
525
+ ...Array.from(n.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (t) => t.index + t[0].length)
526
+ ];
527
+ return (t) => {
528
+ let s = 0, i = e.length;
529
+ for (; s + 1 < i; ) {
530
+ const c = Math.floor((s + i) / 2);
531
+ e[c] <= t ? s = c : i = c;
532
+ }
533
+ return { line: s, character: t - e[s] };
534
+ };
535
+ }
536
+ function ut(n, e) {
537
+ let t = n;
538
+ for (let s = t.parent; s !== void 0; t = s, s = s.parent) {
539
+ if (o.isJsxElement(s))
540
+ return s.openingElement.tagName.getText();
541
+ if (!(o.isJsxFragment(s) || o.isJsxExpression(s) || o.isParenthesizedExpression(s)) && !(o.isConditionalExpression(s) && t !== s.condition) && !(o.isBinaryExpression(s) && (s.operatorToken.kind === o.SyntaxKind.AmpersandAmpersandToken && t === s.right || s.operatorToken.kind === o.SyntaxKind.BarBarToken || s.operatorToken.kind === o.SyntaxKind.QuestionQuestionToken))) {
542
+ if (o.isReturnStatement(s)) {
543
+ const i = o.findAncestor(s, o.isFunctionLike);
544
+ if (i === void 0 || !o.isArrowFunction(i) && !o.isFunctionExpression(i))
545
+ return;
546
+ t = i.body, s = i;
547
+ }
548
+ if ((o.isArrowFunction(s) || o.isFunctionExpression(s)) && t === s.body) {
549
+ const i = s.parent;
550
+ if (!o.isCallExpression(i) || i.arguments[0] !== s || !o.isPropertyAccessExpression(i.expression) || i.expression.name.text !== "map")
551
+ return;
552
+ const c = i.expression.expression, r = e?.getTypeAtLocation(c);
553
+ if (!o.isArrayLiteralExpression(c) && (r === void 0 || !e.isArrayType(r) && !e.isTupleType(r)))
554
+ return;
555
+ t = s, s = i;
556
+ continue;
557
+ }
558
+ return;
559
+ }
560
+ }
561
+ }
562
+ function he(n, e, t, s = !1) {
563
+ const i = s ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, c = n.replace(i, (a) => a.replace(/[^\r\n]/gu, " ")), r = [];
564
+ let p = 0, l = 0;
565
+ for (const a of c.matchAll(/[{};]/gu)) {
566
+ const m = a.index;
567
+ if (l > 0) {
568
+ l += a[0] === "{" ? 1 : a[0] === "}" ? -1 : 0, p = m + 1;
569
+ continue;
570
+ }
571
+ if (a[0] === "}")
572
+ r.pop();
573
+ else if (a[0] === "{") {
574
+ const g = c.slice(p, m), y = r.at(-1) ?? [];
575
+ if (/^\s*--[\w-]+\s*:/u.test(g))
576
+ l = 1;
577
+ else if (g.trimStart().startsWith("@"))
578
+ r.push(y);
579
+ else {
580
+ const d = g.split(",").map((u) => u.trim()).flatMap(
581
+ (u) => y.length === 0 ? [u] : y.map(
582
+ (x) => u.includes("&") ? u.replaceAll("&", x) : `${x} ${u}`
583
+ )
584
+ );
585
+ for (const u of g.matchAll(/::part\(\s*([\w\s-]+?)\s*\)|:state\(\s*([\w-]+)\s*\)/gu)) {
586
+ const x = g.lastIndexOf(",", u.index) + 1, w = g.slice(x, u.index), k = (y.length === 0 ? [w] : y.map(
587
+ (S) => w.includes("&") ? w.replaceAll("&", S) : `${S} ${w}`
588
+ )).map(gt);
589
+ if (k.includes(void 0) || new Set(k).size !== 1)
590
+ continue;
591
+ const N = u[1] === void 0 ? "css-state" : "css-part", A = u[1] ?? u[2], h = u.index + u[0].indexOf(A);
592
+ for (const S of A.matchAll(/[\w-]+/gu))
593
+ t(k[0], N, S[0], e + p + h + S.index);
594
+ }
595
+ r.push(d);
596
+ }
597
+ }
598
+ p = m + 1;
599
+ }
600
+ }
601
+ function gt(n) {
602
+ const e = n.replace(/:state\([\w-]+\)/gu, "").trimStart();
603
+ return /(?:^|[\s>+~])([a-z][\w-]*)(?:[.#:][\w-]+|\[[^\]]*\])*$/iu.exec(e)?.[1]?.toLowerCase();
604
+ }
605
+ function ft({
606
+ contents: n,
607
+ scanElement: e,
608
+ scanStyle: t,
609
+ scanScript: s
610
+ }) {
611
+ const i = /<!--[\s\S]*?(?:-->|$)|<![^>]*>|<\/?([a-z][\w:-]*)\b((?:"[^"]*"|'[^']*'|[^'">])*)>/giu;
612
+ for (let c = i.exec(n); c !== null; c = i.exec(n)) {
613
+ if (c[1] === void 0 || c[0].startsWith("</"))
614
+ continue;
615
+ const r = c[1].toLowerCase(), p = c.index + 1 + c[1].length, l = [...c[2].matchAll(/([^\s"'<>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gu)].map(
616
+ (a) => {
617
+ const m = a[2] ?? a[3] ?? a[4], g = a[2] !== void 0 || a[3] !== void 0;
618
+ return {
619
+ name: a[1].toLowerCase(),
620
+ start: p + a.index,
621
+ value: m,
622
+ valueStart: p + a.index + a[0].length - (m?.length ?? 0) - (g ? 1 : 0)
623
+ };
624
+ }
625
+ );
626
+ if (e(r, c.index + 1, l), r === "plaintext")
627
+ break;
628
+ if (["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes"].includes(r)) {
629
+ const a = new RegExp(`</${r}\\s*>`, "giu");
630
+ a.lastIndex = i.lastIndex;
631
+ const m = a.exec(n);
632
+ r === "style" ? t(n.slice(i.lastIndex, m?.index ?? n.length), i.lastIndex) : r === "script" && s?.(n.slice(i.lastIndex, m?.index ?? n.length), i.lastIndex, l), i.lastIndex = m === null ? n.length : a.lastIndex;
633
+ }
634
+ }
635
+ }
636
+ const ht = /[:/@\\]|^\.{1,2}$|\.(?:tgz|tar(?:\.gz)?)$/iu;
637
+ async function vt(n, e, t) {
638
+ const s = JSON.parse('["@arcgis/ai-components","@arcgis/api-extractor","@arcgis/arcade-parser","@arcgis/arcade-languageservice","@arcgis/charts-components","@arcgis/codemod","@arcgis/coding-components","@arcgis/common-components","@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/node-toolkit","@arcgis/portal-components","@arcgis/toolkit"]'), i = new Set(s), c = /* @__PURE__ */ new Set([...s, "@esri/calcite-components"]), r = [...new Map(n.map((g) => [g.filePath, g])).values()], p = new Set(
639
+ (await Promise.all(
640
+ r.map(async ({ filePath: g, contents: y }) => {
641
+ const v = [await j(g)], d = y.publishConfig?.directory;
642
+ if (typeof d == "string") {
643
+ const u = P.resolve(P.dirname(g), d, "package.json");
644
+ o.sys.fileExists(u) && v.push(await j(u));
645
+ }
646
+ return v;
647
+ })
648
+ )).flat()
649
+ ), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), m = [];
650
+ await ve(r, 4, async (g) => {
651
+ let y;
652
+ const v = [], d = {
653
+ ...g.contents.peerDependencies,
654
+ ...g.contents.optionalDependencies,
655
+ ...g.contents.devDependencies,
656
+ ...g.contents.dependencies
657
+ };
658
+ for (const [f, k] of Object.entries(d)) {
659
+ const N = k.replace(/^npm:/u, "");
660
+ if (!c.has(f) || !k.startsWith("catalog:") && ht.test(N))
661
+ continue;
662
+ const A = await G(
663
+ P.join("node_modules", f, "package.json"),
664
+ P.dirname(g.filePath)
665
+ );
666
+ if (A === void 0) {
667
+ (e === void 0 || f === e) && m.push(`${f} (${g.contents.name ?? g.filePath})`);
668
+ continue;
669
+ }
670
+ if (p.has(await j(A)))
671
+ continue;
672
+ const h = await He(P.dirname(A));
673
+ !h.name || !h.version || !c.has(h.name) || v.push({ declared: k, location: A, name: h.name, version: h.version });
674
+ }
675
+ const u = Map.groupBy(
676
+ v.filter(({ name: f }) => i.has(f)),
677
+ ({ version: f }) => f
678
+ ), x = O.maxSatisfying([...u.keys()], "*", {
679
+ includePrerelease: !0
680
+ }), w = [...u].sort(([f], [k]) => f.localeCompare(k)).map(
681
+ ([f, k]) => `${f}: ${k.map(({ name: N }) => `\`${N}\``).sort().join(", ")}`
682
+ ).join("; ");
683
+ for (const { declared: f, location: k, name: N, version: A } of v) {
684
+ if (e !== void 0 && N !== e)
685
+ continue;
686
+ let h = l.get(N);
687
+ h === void 0 && (h = xt(N), l.set(N, h));
688
+ const S = await h;
689
+ S === void 0 && t?.();
690
+ const b = S === void 0 ? void 0 : St(A, S), L = [];
691
+ b !== void 0 && L.push({
692
+ category: "outdatedDependencies",
693
+ targetVersion: b.expected,
694
+ reason: `Update to ${b.expected} (declared ${f}). ${b.reason}`
695
+ }), i.has(N) && x !== null && O.lt(A, x) && L.push({
696
+ category: "mismatchedDependencies",
697
+ targetVersion: x,
698
+ reason: `Web GIS SDK packages within the same package.json must use the same exact version (found ${w}).`
699
+ });
700
+ for (const { category: $, targetVersion: T, reason: F } of L) {
701
+ let C;
702
+ if ($ === "outdatedDependencies" && f.startsWith("catalog:"))
703
+ try {
704
+ C = await yt(g.filePath, N, f);
705
+ } catch (D) {
706
+ t?.(), q(
707
+ "warn",
708
+ R(g.filePath),
709
+ `Unable to locate dependency catalog: ${String(D)}`
710
+ );
711
+ }
712
+ C === void 0 && (y ??= o.parseJsonText(g.filePath, await J(g.filePath, "utf8")));
713
+ const E = a.get(N) ?? [];
714
+ C !== void 0 && E.some(
715
+ (D) => D.sourceFileName === C.sourceFileName && D.usage.start === C.location.start && D.usage.category === $
716
+ ) || (E.push({
717
+ sourceFileName: C?.sourceFileName ?? g.filePath,
718
+ usage: {
719
+ name: `${A} => ${T}`,
720
+ category: $,
721
+ module: C === void 0 ? "package.json" : P.basename(C.sourceFileName),
722
+ originFileNames: [k],
723
+ reason: F,
724
+ ...C?.location ?? wt(y, N, f)
725
+ }
726
+ }), a.set(N, E));
727
+ }
728
+ }
729
+ });
730
+ for (const g of a.values())
731
+ g.sort(
732
+ (y, v) => y.sourceFileName.localeCompare(v.sourceFileName) || y.usage.start - v.usage.start
733
+ );
734
+ return m.length > 0 && (t?.(), m.sort(), q(
735
+ "warn",
736
+ "dependency-versions",
737
+ `Failed to find installed locations for ${m.length} dependencies: ${m.slice(0, 15).join(", ")}${m.length > 15 ? `, and ${m.length - 15} more` : ""}.`
738
+ )), a;
739
+ }
740
+ async function yt(n, e, t) {
741
+ const s = await G("pnpm-workspace.yaml", P.dirname(n)) ?? await G(".yarnrc.yml", P.dirname(n));
742
+ if (s === void 0)
743
+ throw new Error(`Missing pnpm-workspace.yaml or .yarnrc.yml for ${t}`);
744
+ const i = await j(s), c = new Qe(), r = _e(await J(i, "utf8"), { lineCounter: c });
745
+ if (r.errors.length > 0)
746
+ throw r.errors[0];
747
+ const p = t.slice(8), l = r.getIn(
748
+ p === "" || p === "default" ? ["catalog"] : ["catalogs", p],
749
+ !0
750
+ ), a = Xe(l) ? l.items.find(({ key: d }) => le(d) && d.value === e)?.key : void 0;
751
+ if (!le(a) || a.range === void 0)
752
+ throw new Error(`Missing ${e} in ${t} in ${i}`);
753
+ const [m, g] = a.range, { line: y, col: v } = c.linePos(m);
754
+ return { sourceFileName: i, location: { start: m, length: g - m, line: y, column: v } };
755
+ }
756
+ async function xt(n) {
757
+ try {
758
+ const e = await fetch(`https://registry.npmjs.org/-/package/${encodeURIComponent(n)}/dist-tags`, {
759
+ signal: AbortSignal.timeout(5e3),
760
+ redirect: "error"
761
+ });
762
+ if (!e.ok)
763
+ throw new Error(`Registry returned HTTP ${e.status}`);
764
+ const t = await e.json();
765
+ if (typeof t != "object" || t === null || Array.isArray(t))
766
+ throw new Error("Invalid registry dist-tags response");
767
+ const s = {};
768
+ for (const [i, c] of Object.entries(t))
769
+ ["latest", "rc", "next"].includes(i) && typeof c == "string" && O.valid(c) !== null && (s[i] = c);
770
+ if (Object.keys(s).length === 0)
771
+ throw new Error("Registry returned no supported release tags");
772
+ return s;
773
+ } catch (e) {
774
+ q("warn", n, `Dependency freshness unavailable: ${String(e)}`);
775
+ return;
776
+ }
777
+ }
778
+ function wt(n, e, t) {
779
+ const s = o.forEachChild(n, p), i = s.getStart(n), { line: c, character: r } = n.getLineAndCharacterOfPosition(i);
780
+ return { start: i, length: s.getWidth(n), line: c + 1, column: r + 1 };
781
+ function p(l) {
782
+ return o.isPropertyAssignment(l) && o.isStringLiteral(l.name) && ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"].includes(l.name.text) && o.isObjectLiteralExpression(l.initializer) ? l.initializer.properties.find(
783
+ (a) => o.isPropertyAssignment(a) && o.isStringLiteral(a.name) && a.name.text === e && o.isStringLiteral(a.initializer) && a.initializer.text === t
784
+ )?.name : o.forEachChild(l, p);
785
+ }
786
+ }
787
+ function St(n, e) {
788
+ const t = O.parse(n), s = O.parse(e.latest ?? "");
789
+ if (t === null)
790
+ return;
791
+ if (
792
+ // Permit packages without latest dist-tag
793
+ s !== null && // Permit installed to be newer than latest
794
+ O.lt(t, s) && // Require using stable over prerelease
795
+ (t.prerelease.length > 0 || // Forbid major being behind stable
796
+ t.major !== s.major || // Forbid minor being behind stable
797
+ t.minor !== s.minor)
798
+ )
799
+ return {
800
+ expected: s.version,
801
+ reason: "A newer stable release is available. Prerelease versions are deprecated."
802
+ };
803
+ if (
804
+ // Enforce policy only for next.N prereleases
805
+ t.prerelease.length !== 2 || // Only enforce policy for -next
806
+ t.prerelease[0] !== "next"
807
+ )
808
+ return;
809
+ const i = t.prerelease[1];
810
+ if (typeof i != "number")
811
+ return;
812
+ const r = [e.next, e.rc].flatMap((p) => {
813
+ const l = O.parse(p ?? "");
814
+ return l !== null && // Support packages without latest dist-tag
815
+ (s === null || // Ignore rc dist-tag if it is behind latest
816
+ O.gt(l, s)) && // Require same major.minor.patch for -next version comparison
817
+ l.major === t.major && l.minor === t.minor && l.patch === t.patch && // Require next.N format for comparison
818
+ l.prerelease.length === 2 && l.prerelease[0] === "next" && typeof l.prerelease[1] == "number" ? [l] : [];
819
+ }).sort(O.rcompare).at(0);
820
+ if (r !== void 0 && Number(r.prerelease[1]) - i >= 30)
821
+ return {
822
+ expected: r.version,
823
+ reason: "Installed -next is significantly behind the most recent -next build."
824
+ };
825
+ }
826
+ const kt = /* @__PURE__ */ new Set(["none", "amd", "umd", "system", "systemjs", "node", "node10", "legacy"]), Nt = /* @__PURE__ */ new Set(["node", "node10", "classic"]);
827
+ async function bt(n) {
828
+ const e = "es2024", t = [];
829
+ for (const s of [...new Set(n)].sort()) {
830
+ const i = o.parseJsonText(s, await J(s, "utf8"));
831
+ t.push(...At(i, e));
832
+ }
833
+ return t;
834
+ }
835
+ function At(n, e) {
836
+ const t = n.statements[0];
837
+ if (t === void 0 || !o.isExpressionStatement(t) || !o.isObjectLiteralExpression(t.expression))
838
+ return [];
839
+ const s = t.expression.properties.find(
840
+ (r) => o.isPropertyAssignment(r) && o.isStringLiteral(r.name) && r.name.text === "compilerOptions"
168
841
  );
842
+ if (s === void 0 || !o.isObjectLiteralExpression(s.initializer))
843
+ return [];
844
+ const i = o.convertCompilerOptionsFromJson({ target: e }, ".").options.target, c = [];
845
+ for (const r of s.initializer.properties) {
846
+ if (!o.isPropertyAssignment(r) || !o.isStringLiteral(r.name))
847
+ continue;
848
+ const p = r.name.text, l = o.isStringLiteral(r.initializer) ? r.initializer.text.toLowerCase() : void 0;
849
+ let a;
850
+ if (p === "module" && l !== void 0 && kt.has(l))
851
+ a = `The ${l} module setting is legacy or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
852
+ else if (p === "moduleResolution" && l !== void 0 && Nt.has(l))
853
+ a = `The ${l} module resolution setting is deprecated or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
854
+ else if (p === "target" && l !== void 0) {
855
+ const v = o.convertCompilerOptionsFromJson({ target: l }, ".").options.target;
856
+ v !== void 0 && v < i && (a = `Targets below ${e} are older than Maps SDK's for JavaScript supported targets. See https://next.gha.afd.arcgis.com/javascript/latest/system-requirements/.`);
857
+ } else p === "ignoreDeprecations" && (a = "Address deprecations that were suppressed by ignoreDeprecations.");
858
+ if (a === void 0)
859
+ continue;
860
+ const m = r.name.getStart(n), { line: g, character: y } = n.getLineAndCharacterOfPosition(m);
861
+ c.push({
862
+ sourceFileName: n.fileName,
863
+ usage: {
864
+ name: `compilerOptions.${p}${l === void 0 ? "" : `: ${l}`}`,
865
+ category: "outdatedTypeScriptConfig",
866
+ module: "tsconfig.json",
867
+ originFileNames: [],
868
+ reason: a,
869
+ start: m,
870
+ length: r.name.getWidth(n),
871
+ line: g + 1,
872
+ column: y + 1
873
+ }
874
+ });
875
+ }
876
+ return c;
169
877
  }
170
- async function We(o, e) {
171
- await q(
878
+ async function tn(n, e) {
879
+ if (e.reportingUrl && (n || e.esriOnly || e.category || e.packageName))
880
+ throw new Error(
881
+ "Reporting requires complete, unfiltered repository scan. The only supported filter is the --exclude flag."
882
+ );
883
+ const t = e.outputFormat === "json" || e.reportingUrl ? process.cwd() === M().repositoryRoot : !1;
884
+ if (e.reportingUrl && !t)
885
+ throw new Error(
886
+ "Reporting requires scanning from the Git repository root. If some folders must be excluded, use the --exclude flag."
887
+ );
888
+ let s = !n && !e.esriOnly && !e.category && !e.packageName && !e.exclude?.length;
889
+ (e.outputFormat === "json" || e.reportingUrl) && (s &&= t), await Ee(
172
890
  {
173
891
  meta: {
174
892
  needsTypeInformation: !0,
175
- needsFooter: !1
893
+ needsFooter: !1,
894
+ includeComponentFiles: !0,
895
+ includeTsConfigFiles: !0
176
896
  },
177
- run(t) {
178
- Se(t, e);
897
+ async run(i) {
898
+ await Pt(i, e, s, n);
179
899
  }
180
900
  },
181
901
  "deprecations audit-usages",
182
- o
902
+ n
183
903
  );
184
904
  }
185
- function Se(o, e) {
186
- const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = [
905
+ async function Pt(n, e, t, s) {
906
+ const i = /* @__PURE__ */ new Map(), c = we(e.exclude ?? []), r = qe("warn", () => {
907
+ t = !1;
908
+ }), p = /* @__PURE__ */ new Map(), l = ce([]), a = /* @__PURE__ */ new Set(), m = [
187
909
  ...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 }]] : [];
910
+ n.flatMap(({ packageJson: h }) => {
911
+ const S = h === void 0 ? void 0 : P.dirname(h.filePath), b = h?.contents.name;
912
+ return S !== void 0 && b !== void 0 && W(S, process.cwd()) ? [[S, { root: S, name: b }]] : [];
191
913
  })
192
914
  ).values()
193
- ].toSorted((p, g) => g.root.length - p.root.length);
194
- for (const p of o) {
195
- var r = [];
915
+ ].toSorted((h, S) => S.root.length - h.root.length);
916
+ for (const h of n) {
917
+ var f = [];
196
918
  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(
200
- "warn",
201
- x(f),
202
- `Skipping excluded package \`${p.packageJson?.contents.name ?? p.cwd}\`.`
203
- ));
204
- continue;
205
- }
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)
919
+ const S = h.filePaths.filter((E) => c(E) && !oe(E));
920
+ if (S.length === 0)
210
921
  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);
922
+ const b = Ve(h.packageJson);
923
+ const L = await x(h.packageJson, b.packages);
924
+ const $ = h.packageJson === void 0 ? void 0 : P.dirname(h.packageJson.filePath);
925
+ const T = ie(f, S.some(Le) ? De(h, !1, {
926
+ paths: { ...h.typeScriptConfig?.compilerOptions.paths, ...b.paths }
927
+ }) : void 0);
928
+ const F = T?.tsMorph.getLanguageService().compilerObject;
929
+ const C = F?.getProgram()?.getTypeChecker();
930
+ for (const E of T?.getCodemodFiles() ?? []) {
931
+ const D = E.compilerNode;
932
+ if (!(!c(D.fileName) || oe(D.fileName))) {
933
+ if (F !== void 0 && C !== void 0) {
934
+ const $e = $t(
935
+ D,
936
+ F,
937
+ C,
938
+ $,
939
+ e.esriOnly
940
+ );
941
+ for (const Z of $e) {
942
+ const ee = Wt(Z.originFileNames, m, $), te = i.get(ee) ?? [];
943
+ te.push({ sourceFileName: D.fileName, usage: Z }), i.set(ee, te);
944
+ }
945
+ }
946
+ w(fe(D, L, C)), a.add(D.fileName);
223
947
  }
224
948
  }
225
- } catch (m) {
226
- var c = m, u = !0;
949
+ await ve(S, 8, async (E) => {
950
+ if (a.has(E))
951
+ return;
952
+ const D = await J(E, "utf8");
953
+ w(fe({ fileName: E, text: D }, L)), a.add(E);
954
+ });
955
+ } catch (k) {
956
+ var N = k, A = !0;
227
957
  } finally {
228
- R(r, c, u);
958
+ re(f, N, A);
229
959
  }
230
960
  }
231
- const s = Pe(t, e);
232
- ue(s, e.outputFormat);
233
- const n = [...s.values()].flat();
234
- ne(
235
- "usages",
236
- n.length,
237
- new Set(n.map(({ sourceFileName: p }) => p)).size,
238
- s.size
961
+ const g = await vt(
962
+ n.flatMap(({ packageJson: h }) => h === void 0 ? [] : [h]),
963
+ e.packageName,
964
+ () => {
965
+ t = !1;
966
+ }
239
967
  );
968
+ for (const [h, S] of g)
969
+ i.set(h, [...i.get(h) ?? [], ...S]);
970
+ if (!e.esriOnly && (e.packageName === void 0 || e.packageName === "typescript") && (e.category === void 0 || e.category === "outdatedTypeScriptConfig")) {
971
+ const h = n.flatMap(
972
+ ({ typeScriptConfig: b }) => b !== void 0 && W(b.filePath, process.cwd()) && c(b.filePath) && (s === void 0 || s === b.filePath) ? [b.filePath] : []
973
+ ), S = await bt(h);
974
+ S.length > 0 && i.set("typescript", [...i.get("typescript") ?? [], ...S]);
975
+ }
976
+ const y = e.reportingUrl || e.outputFormat === "json" ? M() : void 0, v = Ct(i, e), d = y !== void 0 && (e.reportingUrl || e.outputFormat === "json") ? H(v, Se(), y, t, e.exclude) : void 0;
977
+ Ye(v, e.outputFormat, d);
978
+ const u = [...v.values()].flat();
979
+ Je(
980
+ "usages",
981
+ u.length,
982
+ new Set(u.map(({ sourceFileName: h }) => h)).size,
983
+ v.size
984
+ ), e.reportingUrl && d !== void 0 && await Te(d, e.reportingUrl);
985
+ async function x(h, S) {
986
+ if (h === void 0)
987
+ return l;
988
+ let b = p.get(h.filePath);
989
+ return b === void 0 && (b = ce(
990
+ await Ge(h, r, e.esriOnly, S)
991
+ ), p.set(h.filePath, b)), b;
992
+ }
993
+ function w(h) {
994
+ for (const { packageName: S, sourceFileName: b, usage: L } of h) {
995
+ const $ = i.get(S) ?? [], T = $.findIndex(
996
+ (C) => C.sourceFileName === b && C.usage.start === L.start && C.usage.length === L.length
997
+ ), F = { sourceFileName: b, usage: L };
998
+ T === -1 ? $.push(F) : $[T] = F, i.set(S, $);
999
+ }
1000
+ }
240
1001
  }
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)
1002
+ function Ct(n, e, t) {
1003
+ const s = we(e.exclude ?? [], t), i = /* @__PURE__ */ new Map();
1004
+ for (const [c, r] of n) {
1005
+ if (e.packageName !== void 0 && c !== e.packageName)
245
1006
  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
254
- }) === e.category
1007
+ const p = r.filter(
1008
+ ({ usage: l, sourceFileName: a }) => s(a) && (e.category === void 0 || xe({
1009
+ package: c,
1010
+ name: l.name,
1011
+ category: l.category,
1012
+ memberOf: l.memberOf,
1013
+ module: l.module ?? B(l.originFileNames, c),
1014
+ deprecated: l.reason ?? !0
1015
+ }) === e.category)
255
1016
  );
256
- s.length > 0 && t.set(a, s);
1017
+ p.length > 0 && i.set(c, p);
257
1018
  }
258
- return t;
1019
+ return i;
259
1020
  }
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)
1021
+ function $t(n, e, t, s, i = !1) {
1022
+ const c = /* @__PURE__ */ new Map();
1023
+ for (const r of e.getSuggestionDiagnostics(n.fileName)) {
1024
+ if (r.reportsDeprecated === void 0)
264
1025
  continue;
265
- const r = _(o, n.start, n.start + n.length);
1026
+ const p = Ae(n, r.start, r.start + r.length);
266
1027
  if (
267
1028
  // 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
1029
+ o.findAncestor(p, o.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
1030
+ o.findAncestor(p, o.isJsxClosingElement) !== void 0
270
1031
  )
271
1032
  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
1033
+ const l = Tt(p, t), a = l.reason === void 0 ? [] : Q(l.symbol), m = a.length > 0 ? void 0 : e.getDefinitionAtPosition(n.fileName, r.start), g = a.length > 0 ? a : [...new Set(m?.map(({ fileName: y }) => y))];
1034
+ X(g, i, s) && _(c, n, {
1035
+ start: r.start,
1036
+ length: r.length,
1037
+ ...Ot(p, l, t, e, m?.[0]),
1038
+ originFileNames: g,
1039
+ reason: It(e, n.fileName, r.start) ?? l.reason
279
1040
  });
280
1041
  }
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;
1042
+ return Dt(n, t, c, s, i), [...c.values()].toSorted((r, p) => r.start - p.start);
1043
+ }
1044
+ function Dt(n, e, t, s, i) {
1045
+ function c(r) {
1046
+ o.isNewExpression(r) && Et(r, e, t, s, i);
1047
+ let p, l;
1048
+ if (o.isCallExpression(r))
1049
+ l = Lt(r, e), p = r.arguments[0];
1050
+ else if (o.isJsxAttribute(r) && o.isIdentifier(r.name)) {
1051
+ const a = r.parent.parent;
1052
+ (o.isJsxOpeningElement(a) || o.isJsxSelfClosingElement(a)) && (l = e.getContextualType(a.tagName)?.getProperty(r.name.text), p = r.name);
1053
+ } else if ((o.isPropertyAssignment(r) || o.isShorthandPropertyAssignment(r) || o.isMethodDeclaration(r)) && o.isObjectLiteralExpression(r.parent)) {
1054
+ const a = o.isComputedPropertyName(r.name) ? I(r.name.expression, e) : r.name.text, m = e.getContextualType(r.parent);
1055
+ l = a === void 0 || m === void 0 ? void 0 : e.getNonNullableType(m).getProperty(a), p = r.name;
1056
+ } else if (o.isPropertyAccessExpression(r))
1057
+ l = e.getSymbolAtLocation(r.name), p = r.name;
1058
+ else if (o.isElementAccessExpression(r)) {
1059
+ const a = I(r.argumentExpression, e);
1060
+ l = a === void 0 ? void 0 : e.getTypeAtLocation(r.expression).getProperty(a), p = r.argumentExpression;
1061
+ } else if (o.isBindingElement(r) && o.isObjectBindingPattern(r.parent) && r.dotDotDotToken === void 0) {
1062
+ const a = r.propertyName ?? (o.isIdentifier(r.name) ? r.name : void 0), m = a === void 0 ? void 0 : o.isComputedPropertyName(a) ? I(a.expression, e) : a.text;
1063
+ l = m === void 0 ? void 0 : e.getTypeAtLocation(r.parent).getProperty(m), p = a;
301
1064
  }
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
1065
+ if ((o.isPropertyAccessExpression(r) || o.isElementAccessExpression(r) || o.isBindingElement(r)) && !l?.declarations?.some(
1066
+ (a) => o.isGetAccessorDeclaration(a) || o.isSetAccessorDeclaration(a)
1067
+ ) && (l = void 0), l !== void 0 && p !== void 0) {
1068
+ const a = Ce(l, e), m = Q(l);
1069
+ a !== void 0 && X(m, i, s) && _(t, n, {
1070
+ start: p.getStart(n),
1071
+ length: p.getWidth(n),
1072
+ name: l.getName(),
1073
+ ...V(l.declarations?.[0]),
1074
+ originFileNames: m,
1075
+ reason: a
313
1076
  });
314
1077
  }
315
- l.forEachChild(n, s);
1078
+ o.forEachChild(r, c);
316
1079
  }
317
- s(o);
1080
+ c(n);
318
1081
  }
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)
1082
+ function Et(n, e, t, s, i) {
1083
+ const c = e.getTypeAtLocation(n).getSymbol(), r = c?.declarations?.[0], p = r !== void 0 && (o.isClassDeclaration(r) || o.isInterfaceDeclaration(r)) ? r.name?.text : void 0, l = p === void 0 ? void 0 : Ue.get(p);
1084
+ if (l === void 0 || p === void 0)
322
1085
  return;
323
- const c = $(s);
324
- if (!c.some(
325
- (g) => (F(g) ?? W(v.dirname(g), "")) === "@arcgis/core"
326
- ) || !E(c, i, a))
1086
+ const a = Q(c);
1087
+ if (!a.some(
1088
+ (y) => (Y(y) ?? ke(P.dirname(y), "")) === "@arcgis/core"
1089
+ ) || !X(a, i, s))
327
1090
  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",
1091
+ const m = o.isPropertyAccessExpression(n.expression) ? n.expression.name : n.expression, g = n.getSourceFile();
1092
+ _(t, g, {
1093
+ start: m.getStart(g),
1094
+ length: m.getWidth(g),
1095
+ name: p,
1096
+ kind: "class",
334
1097
  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.`
1098
+ originFileNames: a,
1099
+ reason: `Direct construction with new ${p}() is discouraged. Use \`<${l}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
337
1100
  });
338
1101
  }
339
- function P(o, e) {
340
- const t = e.getTypeAtLocation(o);
1102
+ function Lt(n, e) {
1103
+ const t = n.expression;
1104
+ if (!o.isPropertyAccessExpression(t) && !o.isElementAccessExpression(t) || n.arguments[0] === void 0)
1105
+ return;
1106
+ const s = o.isPropertyAccessExpression(t) ? t.name.text : I(t.argumentExpression, e);
1107
+ if (s !== "addEventListener" && s !== "removeEventListener")
1108
+ return;
1109
+ const i = I(n.arguments[0], e);
1110
+ if (i === void 0)
1111
+ return;
1112
+ const c = e.getNonNullableType(e.getTypeAtLocation(t.expression)), r = c.getProperty("@eventTypes");
1113
+ if (!(r === void 0 || e.getTypeOfSymbolAtLocation(r, n).getProperty(i) === void 0))
1114
+ return c.getProperty(i);
1115
+ }
1116
+ function I(n, e) {
1117
+ const t = e.getTypeAtLocation(n);
341
1118
  return t.isStringLiteral() || t.isNumberLiteral() ? String(t.value) : void 0;
342
1119
  }
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 };
1120
+ function Tt(n, e) {
1121
+ let t = e.getSymbolAtLocation(n);
1122
+ for (; t !== void 0 && (t.flags & o.SymbolFlags.Alias) !== 0; ) {
1123
+ const s = Ce(t, e);
1124
+ if (s !== void 0)
1125
+ return { symbol: t, reason: s };
349
1126
  t = t.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(t);
350
1127
  }
351
1128
  return { symbol: t, reason: void 0 };
352
1129
  }
353
- function $(o) {
354
- return [...new Set(o?.declarations?.map((e) => e.getSourceFile().fileName))];
1130
+ function Q(n) {
1131
+ return [...new Set(n?.declarations?.map((e) => e.getSourceFile().fileName))];
355
1132
  }
356
- function ke(o, e, t, a, i) {
1133
+ function Ot(n, e, t, s, i) {
357
1134
  if (e.reason !== void 0)
358
1135
  return {
359
- name: j(e.symbol.declarations?.[0], e.symbol.getName()),
360
- ...D(e.symbol.declarations?.[0])
1136
+ name: ae(e.symbol.declarations?.[0], e.symbol.getName()),
1137
+ ...V(e.symbol.declarations?.[0])
361
1138
  };
362
- const s = i === void 0 ? void 0 : a.getProgram()?.getSourceFile(i.fileName), n = i === void 0 || s === void 0 ? void 0 : _(
363
- s,
1139
+ const c = i === void 0 ? void 0 : s.getProgram()?.getSourceFile(i.fileName), r = i === void 0 || c === void 0 ? void 0 : Ae(
1140
+ c,
364
1141
  i.textSpan.start,
365
1142
  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;
1143
+ ), p = (r === void 0 ? void 0 : t.getSymbolAtLocation(r)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], l = i?.name;
367
1144
  return {
368
- name: m === void 0 ? $e(o) : j(r, m),
369
- ...D(r)
1145
+ name: l === void 0 ? Ft(n) : ae(p, l),
1146
+ ...V(p)
370
1147
  };
371
1148
  }
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/");
1149
+ function W(n, e) {
1150
+ const t = P.relative(e, n);
1151
+ return t !== "" && !t.startsWith("../") && !P.isAbsolute(t) && t !== "node_modules" && !t.startsWith("node_modules/");
375
1152
  }
376
- function _(o, e, t) {
377
- let a = o;
1153
+ function Ae(n, e, t) {
1154
+ let s = n;
378
1155
  for (; ; ) {
379
1156
  let i;
380
- if (l.forEachChild(a, (s) => {
381
- i === void 0 && s.getStart(o) <= e && s.getEnd() >= t && (i = s);
1157
+ if (o.forEachChild(s, (c) => {
1158
+ i === void 0 && c.getStart(n) <= e && c.getEnd() >= t && (i = c);
382
1159
  }), i === void 0)
383
- return a;
384
- a = i;
1160
+ return s;
1161
+ s = i;
385
1162
  }
386
1163
  }
387
- function $e(o) {
388
- return l.isIdentifier(o) || l.isPrivateIdentifier(o) || l.isStringLiteralLike(o) || l.isNumericLiteral(o) ? o.text : o.getText();
1164
+ function Ft(n) {
1165
+ return o.isIdentifier(n) || o.isPrivateIdentifier(n) || o.isStringLiteralLike(n) || o.isNumericLiteral(n) ? n.text : n.getText();
389
1166
  }
390
- function G(o) {
391
- const e = o?.find(({ name: t }) => t === "deprecated");
392
- return e === void 0 ? void 0 : me(e.text) ?? "";
1167
+ function Pe(n) {
1168
+ const e = n?.find(({ name: t }) => t === "deprecated");
1169
+ return e === void 0 ? void 0 : Ke(e.text) ?? "";
393
1170
  }
394
- function Ce(o, e, t) {
1171
+ function It(n, e, t) {
395
1172
  try {
396
- return G(o.getQuickInfoAtPosition(e, t)?.tags);
1173
+ return Pe(n.getQuickInfoAtPosition(e, t)?.tags);
397
1174
  } catch {
398
1175
  return;
399
1176
  }
400
1177
  }
401
- function B(o, e) {
1178
+ function Ce(n, e) {
402
1179
  try {
403
- const t = G(o?.getJsDocTags(e));
1180
+ const t = Pe(n?.getJsDocTags(e));
404
1181
  if (t !== void 0)
405
1182
  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);
1183
+ const s = n?.declarations?.filter((i) => o.isGetAccessorDeclaration(i) || o.isSetAccessorDeclaration(i)).map((i) => o.getJSDocDeprecatedTag(i)).find((i) => i !== void 0);
1184
+ return s === void 0 ? void 0 : s.comment === void 0 ? "" : Be(s.comment);
408
1185
  } catch {
409
1186
  return;
410
1187
  }
411
1188
  }
412
- function C(o, e, t) {
413
- if (re(t.name, t.reason))
414
- return;
415
- const { line: a, character: i } = e.getLineAndCharacterOfPosition(t.start);
416
- o.set(`${t.start}:${t.length}`, {
1189
+ function _(n, e, t) {
1190
+ const { line: s, character: i } = e.getLineAndCharacterOfPosition(t.start);
1191
+ n.set(`${t.start}:${t.length}`, {
417
1192
  ...t,
418
- line: a + 1,
1193
+ line: s + 1,
419
1194
  column: i + 1
420
1195
  });
421
1196
  }
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);
1197
+ function X(n, e, t) {
1198
+ return n.some((s) => t !== void 0 && W(s, t)) ? !1 : !e || n.some((s) => {
1199
+ const i = Y(s);
1200
+ return i === void 0 ? t === void 0 || !W(s, t) : Oe(i);
426
1201
  });
427
1202
  }
428
- function F(o) {
429
- const e = X(o), t = "/node_modules/", a = e.lastIndexOf(t);
430
- if (a === -1)
1203
+ function Y(n) {
1204
+ const e = Fe(n), t = "/node_modules/", s = e.lastIndexOf(t);
1205
+ if (s === -1)
431
1206
  return;
432
- const [i, s] = e.slice(a + t.length).split("/");
433
- return i.startsWith("@") ? `${i}/${s}` : i;
1207
+ const [i, c] = e.slice(s + t.length).split("/");
1208
+ return i.startsWith("@") ? `${i}/${c}` : i;
434
1209
  }
435
- function Ee(o, e = [], t) {
436
- const a = o[0];
437
- if (a === void 0)
1210
+ function Wt(n, e = [], t) {
1211
+ const s = n[0];
1212
+ if (s === void 0)
438
1213
  return "unknown package";
439
- const i = F(a);
1214
+ const i = Y(s);
440
1215
  if (i !== void 0)
441
1216
  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;
1217
+ const c = e.find(({ root: g }) => W(s, g));
1218
+ if (c !== void 0)
1219
+ return c.name;
1220
+ const r = P.dirname(R(s)), p = ke(P.dirname(s), r);
1221
+ if (p !== r)
1222
+ return p;
448
1223
  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("/");
1224
+ return r;
1225
+ const a = P.relative(t, s).split("/"), m = a.findIndex((g) => g !== "..");
1226
+ return m < 1 ? P.dirname(R(s)) : a.slice(0, m * 2).join("/");
452
1227
  }
453
1228
  export {
454
- We as auditDeprecatedUsages,
455
- be as collectDeprecatedApiUsages,
456
- Ee as getDeprecationOriginLabel,
457
- F as getNodeModulesPackageName,
458
- E as shouldIncludeDeprecation
1229
+ tn as auditDeprecatedUsages,
1230
+ $t as collectDeprecatedApiUsages,
1231
+ Wt as getDeprecationOriginLabel,
1232
+ Y as getNodeModulesPackageName,
1233
+ X as shouldIncludeDeprecation
459
1234
  };