@arcgis/codemod 5.2.0-next.122 → 5.2.0-next.123
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.
- package/dist/{actions-LEFiI8Xk.js → actions-C2O2Yihz.js} +1 -1
- package/dist/cli-BKh8oci8.js +380 -0
- package/dist/cli.js +1 -1
- package/dist/{codemod-YgioOfc7.js → codemod-B77zhGUg.js} +3 -3
- package/dist/{codemod-DTsG5_YU.js → codemod-BIUlczaa.js} +3 -3
- package/dist/{codemod-lZGspJIz.js → codemod-CV8s2kNe.js} +3 -3
- package/dist/{codemod-HRcnKq-i.js → codemod-CZfrjoI-.js} +3 -3
- package/dist/{codemod-BpcMVaZX.js → codemod-ChBRJ-aq.js} +2 -2
- package/dist/{codemod-DryX37eS.js → codemod-CwSdzblS.js} +3 -3
- package/dist/{codemod-DHO2ieDH.js → codemod-GSxZDuDJ.js} +1 -1
- package/dist/{codemod-eprC1jEo.js → codemod-eFToTK3L.js} +2 -2
- package/dist/format-D_FrLFG7.js +255 -0
- package/dist/index-By51mdF7.js +403 -0
- package/dist/{index-DomCHjnu.js → index-i6wMrws7.js} +2 -2
- package/dist/sync-Bm7WIvtr.js +165 -0
- package/dist/{useProjectInstance-DtWpxhlT.js → useProjectInstance-1xXeoSCI.js} +11 -8
- package/package.json +4 -4
- package/dist/cli-DfAgo-jb.js +0 -326
- package/dist/config-BP6HDIQa.js +0 -19
- package/dist/index-2_o7gSlk.js +0 -313
- package/dist/sync-e0pgnEOM.js +0 -240
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { d as h } from "./cli-BKh8oci8.js";
|
|
2
|
+
const I = /(?:esri|arcgis)/iu, y = "@arcgis/codemod", x = {
|
|
3
|
+
usages: "Refactor-out deprecated API usages",
|
|
4
|
+
definitions: "Remove deprecated APIs in next breaking changes release"
|
|
5
|
+
}, P = {
|
|
6
|
+
usages: "The following deprecated APIs are used in files owned by assigned CODEOWNERS. Refactor them before the APIs are removed.",
|
|
7
|
+
definitions: "The following deprecated APIs are owned by assigned CODEOWNERS. Remove them in the next breaking changes release."
|
|
8
|
+
}, R = "This issue is autogenerated and updated regularly based on remaining items. Feel free to add comments and labels, update assignees, set milestone, or create sub-issues. Close it once completed. A new issue will be created if new findings are detected.", J = "Task", K = "deprecations sync-issues";
|
|
9
|
+
function A(e) {
|
|
10
|
+
return I.test(e);
|
|
11
|
+
}
|
|
12
|
+
const L = /* @__PURE__ */ new Set([
|
|
13
|
+
"MessageBundleLoader",
|
|
14
|
+
"createJSONLoader",
|
|
15
|
+
"fetchMessageBundle",
|
|
16
|
+
"messageBundle",
|
|
17
|
+
"normalizeMessageBundleLocale",
|
|
18
|
+
"registerMessageBundleLoader"
|
|
19
|
+
]), O = /* @__PURE__ */ new Set([
|
|
20
|
+
"AreaMeasurement2D",
|
|
21
|
+
"AreaMeasurement3D",
|
|
22
|
+
"BasemapGallery",
|
|
23
|
+
"BasemapToggle",
|
|
24
|
+
"BatchAttributeForm",
|
|
25
|
+
"BinaryColorSizeSlider",
|
|
26
|
+
"ClassedColorSlider",
|
|
27
|
+
"ColorSlider",
|
|
28
|
+
"ColorSizeSlider",
|
|
29
|
+
"CoordinateConversion",
|
|
30
|
+
"Daylight",
|
|
31
|
+
"DirectLineMeasurement3D",
|
|
32
|
+
"DistanceMeasurement2D",
|
|
33
|
+
"Editor",
|
|
34
|
+
"FeatureForm",
|
|
35
|
+
"FeatureTable",
|
|
36
|
+
"GridControls",
|
|
37
|
+
"HeatmapSlider",
|
|
38
|
+
"Home",
|
|
39
|
+
"HistogramRangeSlider",
|
|
40
|
+
"LayerList",
|
|
41
|
+
"Legend",
|
|
42
|
+
"LineOfSight",
|
|
43
|
+
"Locate",
|
|
44
|
+
"NavigationToggle",
|
|
45
|
+
"OpacitySlider",
|
|
46
|
+
"OrientedImageryViewer",
|
|
47
|
+
"Print",
|
|
48
|
+
"ScaleBar",
|
|
49
|
+
"Search",
|
|
50
|
+
"Sketch",
|
|
51
|
+
"SketchLabelOptions",
|
|
52
|
+
"SketchTooltipOptions",
|
|
53
|
+
"Slice",
|
|
54
|
+
"SizeSlider",
|
|
55
|
+
"Slider",
|
|
56
|
+
"SnappingOptions",
|
|
57
|
+
"TableList",
|
|
58
|
+
"useLegacyCreateTools"
|
|
59
|
+
]);
|
|
60
|
+
function D({
|
|
61
|
+
packageName: e,
|
|
62
|
+
api: n,
|
|
63
|
+
reason: s
|
|
64
|
+
}) {
|
|
65
|
+
const r = e.toLowerCase(), t = s?.toLowerCase() ?? "";
|
|
66
|
+
return e === "@arcgis/core" && (O.has(n) || t.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (n === "geometryEngine" || n === "extendedSpatialReferenceInfo" || t.includes("geometry/operators")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(t) ? "codemod" : e === "@arcgis/core" && (L.has(n) || t.includes("widget translations")) ? "coreIntl" : r.includes("calcite") ? "calcite" : e === "@arcgis/core" || r.startsWith("@arcgis/") && r.includes("components") ? "arcgisCoreComponents" : A(e) ? "otherEsri" : "nonEsri";
|
|
67
|
+
}
|
|
68
|
+
function j(e, n) {
|
|
69
|
+
const s = Map.groupBy(e, (r) => D(n(r)));
|
|
70
|
+
return Object.keys(h).flatMap((r) => {
|
|
71
|
+
const t = s.get(r);
|
|
72
|
+
if (t === void 0)
|
|
73
|
+
return [];
|
|
74
|
+
const i = [...Map.groupBy(t, (a) => n(a).packageName)].map(([a, c]) => {
|
|
75
|
+
const p = [...Map.groupBy(c, (d) => n(d).api)].map(([d, m]) => {
|
|
76
|
+
const g = m.map((u) => n(u).reason).filter((u) => u != null && u !== ""), f = [...new Set(g)].sort((u, $) => u.localeCompare($));
|
|
77
|
+
return { api: d, reasons: f, items: m };
|
|
78
|
+
});
|
|
79
|
+
return p.sort((d, m) => m.items.length - d.items.length || d.api.localeCompare(m.api)), { packageName: a, count: c.length, apis: p };
|
|
80
|
+
});
|
|
81
|
+
return i.sort((a, c) => c.count - a.count || a.packageName.localeCompare(c.packageName)), [{ categoryName: r, count: t.length, packages: i }];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const S = `<!-- ${y} -->`, V = `<!-- ${y}`, M = 65536;
|
|
85
|
+
function Q(e) {
|
|
86
|
+
const n = C(e, e.findings);
|
|
87
|
+
return `${n.summary.trim().replace(/^### /u, "## ")}
|
|
88
|
+
|
|
89
|
+
${n.details}`;
|
|
90
|
+
}
|
|
91
|
+
function X(e) {
|
|
92
|
+
const n = /* @__PURE__ */ new Map();
|
|
93
|
+
for (const s of e.findings) {
|
|
94
|
+
const r = k(s.codeowners), t = r.join(","), o = n.get(t) ?? [];
|
|
95
|
+
o.push({ ...s, codeowners: r }), n.set(t, o);
|
|
96
|
+
}
|
|
97
|
+
return [...n.entries()].map(([s, r]) => {
|
|
98
|
+
const t = s === "" ? [] : s.split(","), o = T(e, r);
|
|
99
|
+
return {
|
|
100
|
+
changes: [],
|
|
101
|
+
title: x[e.kind],
|
|
102
|
+
owners: t,
|
|
103
|
+
assignees: t.filter((i) => /^@[^/@\s]+$/u.test(i)).map((i) => i.slice(1)),
|
|
104
|
+
chunks: F(o, M, G(t))
|
|
105
|
+
};
|
|
106
|
+
}).sort((s, r) => s.title.localeCompare(r.title));
|
|
107
|
+
}
|
|
108
|
+
function T(e, n) {
|
|
109
|
+
const s = k(n.flatMap((t) => t.codeowners)).filter(
|
|
110
|
+
(t) => /^@[^/@\s]+\/[^@\s]+$/u.test(t)
|
|
111
|
+
), r = s.length === 0 ? "" : `
|
|
112
|
+
|
|
113
|
+
CODEOWNERS: ${s.join(", ")}`;
|
|
114
|
+
return E(e, n, r);
|
|
115
|
+
}
|
|
116
|
+
function E(e, n, s) {
|
|
117
|
+
const r = P[e.kind], t = C(e, n);
|
|
118
|
+
return `${r}${s}${t.summary}
|
|
119
|
+
|
|
120
|
+
${R}
|
|
121
|
+
|
|
122
|
+
${t.details}`;
|
|
123
|
+
}
|
|
124
|
+
function C(e, n) {
|
|
125
|
+
return e.kind === "usages" ? v(e, n) : z(e, n);
|
|
126
|
+
}
|
|
127
|
+
function v(e, n) {
|
|
128
|
+
const s = j(n, ({ package: o, api: i, reason: a }) => ({
|
|
129
|
+
packageName: o,
|
|
130
|
+
api: i,
|
|
131
|
+
reason: a
|
|
132
|
+
})), r = s.map(({ categoryName: o, count: i, packages: a }) => {
|
|
133
|
+
const c = a.map(({ packageName: l, count: p }) => ` - \`${l}\`: ${p}`).join(`
|
|
134
|
+
`);
|
|
135
|
+
return `- **${h[o].label}**: ${i}
|
|
136
|
+
${c}`;
|
|
137
|
+
}).join(`
|
|
138
|
+
`), t = s.map(({ categoryName: o, count: i, packages: a }) => {
|
|
139
|
+
const c = a.map(({ packageName: d, count: m, apis: g }) => {
|
|
140
|
+
const f = g.map(
|
|
141
|
+
({ api: u, reasons: $, items: b }) => B(e, u, $, b)
|
|
142
|
+
);
|
|
143
|
+
return `#### ${d} (${m})
|
|
144
|
+
|
|
145
|
+
${f.join(`
|
|
146
|
+
`)}`;
|
|
147
|
+
}).join(`
|
|
148
|
+
|
|
149
|
+
`), l = h[o], p = "description" in l ? `
|
|
150
|
+
|
|
151
|
+
${l.description}` : "";
|
|
152
|
+
return `### ${l.label} (${i})${p}
|
|
153
|
+
|
|
154
|
+
${c}`;
|
|
155
|
+
}).join(`
|
|
156
|
+
|
|
157
|
+
`);
|
|
158
|
+
return {
|
|
159
|
+
summary: `
|
|
160
|
+
|
|
161
|
+
### Deprecation summary
|
|
162
|
+
|
|
163
|
+
${r}`,
|
|
164
|
+
details: `## Deprecation details
|
|
165
|
+
|
|
166
|
+
${t}`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function z(e, n) {
|
|
170
|
+
return { summary: "", details: [...Map.groupBy(n, (t) => t.package).entries()].sort(([t], [o]) => t.localeCompare(o)).map(([t, o]) => {
|
|
171
|
+
const a = [...Map.groupBy(o, (c) => N(e.kind, c)).entries()].sort(([c], [l]) => c.localeCompare(l)).map(([, c]) => B(e, c[0].api, W(c), c));
|
|
172
|
+
return `#### ${t}'s deprecations
|
|
173
|
+
|
|
174
|
+
${a.join(`
|
|
175
|
+
`)}`;
|
|
176
|
+
}).join(`
|
|
177
|
+
|
|
178
|
+
`) };
|
|
179
|
+
}
|
|
180
|
+
function B(e, n, s, r) {
|
|
181
|
+
const t = s.length === 0 ? "" : ` - ${s.map(H).join(" ")}`, o = [
|
|
182
|
+
...new Set(
|
|
183
|
+
r.toSorted((a, c) => a.file.localeCompare(c.file) || a.line - c.line).map((a) => _(e.repository, e.ref, a.file, a.line))
|
|
184
|
+
)
|
|
185
|
+
], i = o.length === 1 ? ` ${o[0]}` : o.map((a) => ` - ${a}`).join(`
|
|
186
|
+
`);
|
|
187
|
+
return `- [ ] \`${n}\`${t}
|
|
188
|
+
${i}`;
|
|
189
|
+
}
|
|
190
|
+
function W(e) {
|
|
191
|
+
return [
|
|
192
|
+
...new Set(
|
|
193
|
+
e.map(({ reason: n }) => n).filter((n) => n !== null && n !== "")
|
|
194
|
+
)
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
function F(e, n = M, s = S) {
|
|
198
|
+
const r = `${s}
|
|
199
|
+
`, t = n - r.length;
|
|
200
|
+
if (t < 1)
|
|
201
|
+
throw new Error("Issue content limit is too small for the managed marker.");
|
|
202
|
+
const o = [];
|
|
203
|
+
let i = e;
|
|
204
|
+
for (; i.length > t; ) {
|
|
205
|
+
const a = i.lastIndexOf(`
|
|
206
|
+
`, t), c = a > 0 ? a : t;
|
|
207
|
+
o.push(r + i.slice(0, c)), i = i.slice(c + (a > 0 ? 1 : 0));
|
|
208
|
+
}
|
|
209
|
+
return o.push(r + i), o;
|
|
210
|
+
}
|
|
211
|
+
function G(e) {
|
|
212
|
+
return e.length === 0 ? S : `<!-- ${y} ${k(e).join(",")} -->`;
|
|
213
|
+
}
|
|
214
|
+
function k(e) {
|
|
215
|
+
return [...new Set(e)].sort((n, s) => n.localeCompare(s));
|
|
216
|
+
}
|
|
217
|
+
function N(e, n) {
|
|
218
|
+
return e === "definitions" ? `${n.api}\0${U(n.file)}` : n.api;
|
|
219
|
+
}
|
|
220
|
+
function U(e) {
|
|
221
|
+
const n = "/src/", s = "/dist/", r = e.lastIndexOf(n), t = e.lastIndexOf(s), o = Math.max(r, t), i = t > r ? s : n;
|
|
222
|
+
return (o === -1 ? e : e.slice(o + i.length)).replace(/\.(?:d\.)?(?:[cm]?ts|tsx)$/u, "");
|
|
223
|
+
}
|
|
224
|
+
function H(e) {
|
|
225
|
+
const n = [], s = (o) => `\0${n.push(o) - 1}\0`, t = e.replaceAll(`\r
|
|
226
|
+
`, `
|
|
227
|
+
`).replaceAll("\r", `
|
|
228
|
+
`).replace(
|
|
229
|
+
/\[([^\]\n]+)\]\((https?:\/\/(?:[^()\s]|\([^()\s]*\))+?)\)/gu,
|
|
230
|
+
(o, i, a) => s(`[${w(i)}](${a})`)
|
|
231
|
+
).replace(/https?:\/\/[^\s<>()]+/gu, (o) => {
|
|
232
|
+
const i = /[.,;:!?]+$/u.exec(o)?.[0] ?? "";
|
|
233
|
+
return `${s(o.slice(0, -i.length || void 0))}${i}`;
|
|
234
|
+
});
|
|
235
|
+
return w(t).replace(/\0(\d+)\0/gu, (o, i) => n[Number(i)]).replaceAll(`
|
|
236
|
+
`, `
|
|
237
|
+
`);
|
|
238
|
+
}
|
|
239
|
+
function w(e) {
|
|
240
|
+
return e.replace(/^(\s*)(#{1,6})(?=\s)/gmu, "$1\\$2").replace(/#(?=\d)/gu, "# ");
|
|
241
|
+
}
|
|
242
|
+
function _(e, n, s, r) {
|
|
243
|
+
const t = n.split("/").map(encodeURIComponent).join("/"), o = s.split("/").map(encodeURIComponent).join("/");
|
|
244
|
+
return `https://${e}/blob/${t}/${o}#L${r}`;
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
J as a,
|
|
248
|
+
X as b,
|
|
249
|
+
D as c,
|
|
250
|
+
K as d,
|
|
251
|
+
V as e,
|
|
252
|
+
Q as f,
|
|
253
|
+
j as g,
|
|
254
|
+
A as i
|
|
255
|
+
};
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
var C = (t, o) => (o = Symbol[t]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + t), I = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
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() {
|
|
9
|
+
try {
|
|
10
|
+
r.call(this);
|
|
11
|
+
} catch (a) {
|
|
12
|
+
return Promise.reject(a);
|
|
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(); )
|
|
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);
|
|
27
|
+
}
|
|
28
|
+
if (e) throw o;
|
|
29
|
+
};
|
|
30
|
+
return a();
|
|
31
|
+
};
|
|
32
|
+
import { c as _ } from "./useProjectInstance-1xXeoSCI.js";
|
|
33
|
+
import { d as P, r as Q } from "./cli-BKh8oci8.js";
|
|
34
|
+
import { f as y } from "./log-B76HBvov.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, l as G, a as K, s as V, p as X, b as Y, c as Z, d as B } from "./codeowners-CarwYwHK.js";
|
|
39
|
+
import { f as ee, c as T, g as te, i as oe } from "./format-D_FrLFG7.js";
|
|
40
|
+
import { styleText as w } from "node:util";
|
|
41
|
+
function ne(t, o) {
|
|
42
|
+
if (o === "json") {
|
|
43
|
+
const e = D();
|
|
44
|
+
process.stdout.write(`${le(t, G(), e)}
|
|
45
|
+
`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (o === "md") {
|
|
49
|
+
process.stdout.write(`${ue(t)}
|
|
50
|
+
`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
process.stdout.write(`${ae(t)}
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
function ae(t) {
|
|
57
|
+
const o = L(t), e = o.reduce((r, a) => r + a.count, 0), n = [J("Deprecation summary", e)];
|
|
58
|
+
for (const { categoryName: r, count: a, packages: i } of o) {
|
|
59
|
+
n.push(`${P[r].label} (${a})`);
|
|
60
|
+
for (const { packageName: s, count: l } of i)
|
|
61
|
+
n.push(` ${M(s)} (${l})`);
|
|
62
|
+
}
|
|
63
|
+
n.push("", "", J("Deprecation details", e));
|
|
64
|
+
for (const { categoryName: r, count: a, packages: i } of o) {
|
|
65
|
+
const s = P[r];
|
|
66
|
+
n.push("", `${s.label} (${a})`), "description" in s && n.push(` ${s.description}`);
|
|
67
|
+
for (const { packageName: l, count: u, apis: p } of i) {
|
|
68
|
+
n.push("", ` ${M(l)} (${u})`);
|
|
69
|
+
for (const { api: c, reasons: m, items: g } of p) {
|
|
70
|
+
n.push(` ${ie(c)} (${g.length})`);
|
|
71
|
+
for (const v of m)
|
|
72
|
+
n.push(re(v, 6));
|
|
73
|
+
for (const { sourceFileName: v, usage: h } of se(g))
|
|
74
|
+
n.push(` ${y(v)}:${h.line}:${h.column}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return n.join(`
|
|
79
|
+
`);
|
|
80
|
+
}
|
|
81
|
+
function L(t) {
|
|
82
|
+
const o = [...t].flatMap(
|
|
83
|
+
([e, n]) => n.map((r) => ({ ...r, packageName: e }))
|
|
84
|
+
);
|
|
85
|
+
return te(o, ({ packageName: e, usage: n }) => ({
|
|
86
|
+
packageName: e,
|
|
87
|
+
api: n.name,
|
|
88
|
+
reason: n.reason
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
function J(t, o) {
|
|
92
|
+
return w(["bold", "yellow"], `${t} (${o})`);
|
|
93
|
+
}
|
|
94
|
+
function M(t) {
|
|
95
|
+
return w("blue", t);
|
|
96
|
+
}
|
|
97
|
+
function ie(t) {
|
|
98
|
+
return w(["bold", "white"], t);
|
|
99
|
+
}
|
|
100
|
+
function re(t, o) {
|
|
101
|
+
const e = " ".repeat(o);
|
|
102
|
+
return t.split(/\r?\n/u).map((n) => `${e}${n}`).join(`
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
function se(t) {
|
|
106
|
+
return t.toSorted(
|
|
107
|
+
(o, e) => o.sourceFileName.localeCompare(e.sourceFileName) || o.usage.line - e.usage.line || o.usage.column - e.usage.column
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function ce(t) {
|
|
111
|
+
return [...t].sort(([o], [e]) => o.localeCompare(e));
|
|
112
|
+
}
|
|
113
|
+
function le(t, o, e = D()) {
|
|
114
|
+
return JSON.stringify(E(t, o, e), void 0, 2);
|
|
115
|
+
}
|
|
116
|
+
function ue(t, o = D()) {
|
|
117
|
+
return ee(E(t, void 0, o));
|
|
118
|
+
}
|
|
119
|
+
function E(t, o, e) {
|
|
120
|
+
const n = L(t);
|
|
121
|
+
return {
|
|
122
|
+
kind: "usages",
|
|
123
|
+
repository: e.repository,
|
|
124
|
+
ref: e.ref,
|
|
125
|
+
summary: {
|
|
126
|
+
total: n.reduce((a, { count: i }) => a + i, 0),
|
|
127
|
+
categories: n.map(({ categoryName: a, count: i, packages: s }) => ({
|
|
128
|
+
category: a,
|
|
129
|
+
label: P[a].label,
|
|
130
|
+
count: i,
|
|
131
|
+
packages: s.map(({ packageName: l, count: u }) => ({
|
|
132
|
+
package: l,
|
|
133
|
+
count: u
|
|
134
|
+
}))
|
|
135
|
+
}))
|
|
136
|
+
},
|
|
137
|
+
findings: ce(t).flatMap(
|
|
138
|
+
([a, i]) => i.map((s) => ({
|
|
139
|
+
category: T({
|
|
140
|
+
packageName: a,
|
|
141
|
+
api: s.usage.name,
|
|
142
|
+
reason: s.usage.reason
|
|
143
|
+
}),
|
|
144
|
+
package: a,
|
|
145
|
+
api: s.usage.name,
|
|
146
|
+
reason: s.usage.reason ?? null,
|
|
147
|
+
file: K(s.sourceFileName, e.repositoryRoot),
|
|
148
|
+
line: s.usage.line,
|
|
149
|
+
column: s.usage.column,
|
|
150
|
+
codeowners: o?.getOwners(s.sourceFileName) ?? []
|
|
151
|
+
}))
|
|
152
|
+
)
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async function Je(t, o) {
|
|
156
|
+
await Q(
|
|
157
|
+
{
|
|
158
|
+
meta: {
|
|
159
|
+
needsTypeInformation: !0,
|
|
160
|
+
needsFooter: !1
|
|
161
|
+
},
|
|
162
|
+
run(e) {
|
|
163
|
+
fe(e, o);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"deprecations audit-usages",
|
|
167
|
+
t
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
function fe(t, o) {
|
|
171
|
+
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [
|
|
172
|
+
...new Map(
|
|
173
|
+
t.flatMap(({ packageJson: c }) => {
|
|
174
|
+
const m = c === void 0 ? void 0 : d.dirname(c.filePath), g = c?.contents.name;
|
|
175
|
+
return m !== void 0 && g !== void 0 && k(m, process.cwd()) ? [[m, { root: m, name: g }]] : [];
|
|
176
|
+
})
|
|
177
|
+
).values()
|
|
178
|
+
].toSorted((c, m) => m.root.length - c.root.length);
|
|
179
|
+
for (const c of t) {
|
|
180
|
+
var s = [];
|
|
181
|
+
try {
|
|
182
|
+
if (V(c.packageJson?.contents.name)) {
|
|
183
|
+
const N = c.packageJson?.filePath;
|
|
184
|
+
N !== void 0 && !n.has(N) && (n.add(N), q(
|
|
185
|
+
"warn",
|
|
186
|
+
y(N),
|
|
187
|
+
`Skipping excluded package \`${c.packageJson?.contents.name ?? c.cwd}\`.`
|
|
188
|
+
));
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const m = F(s, _(c, !1));
|
|
192
|
+
const g = m.tsMorph.getLanguageService().compilerObject;
|
|
193
|
+
const v = g.getProgram()?.getTypeChecker();
|
|
194
|
+
if (v === void 0)
|
|
195
|
+
continue;
|
|
196
|
+
const h = c.packageJson === void 0 ? void 0 : d.dirname(c.packageJson.filePath);
|
|
197
|
+
for (const N of m.getCodemodFiles()) {
|
|
198
|
+
const A = N.compilerNode;
|
|
199
|
+
for (const b of pe(
|
|
200
|
+
A,
|
|
201
|
+
g,
|
|
202
|
+
v,
|
|
203
|
+
h,
|
|
204
|
+
o.esriOnly
|
|
205
|
+
)) {
|
|
206
|
+
const $ = Pe(b.originFileNames, r, h), x = e.get($) ?? [];
|
|
207
|
+
x.push({ sourceFileName: A.fileName, usage: b }), e.set($, x);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} catch (l) {
|
|
211
|
+
var u = l, p = !0;
|
|
212
|
+
} finally {
|
|
213
|
+
R(s, u, p);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const a = me(e, o);
|
|
217
|
+
ne(a, o.outputFormat);
|
|
218
|
+
const i = [...a.values()].flat();
|
|
219
|
+
X(
|
|
220
|
+
"usages",
|
|
221
|
+
i.length,
|
|
222
|
+
new Set(i.map(({ sourceFileName: c }) => c)).size,
|
|
223
|
+
a.size
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function me(t, o) {
|
|
227
|
+
const e = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const [n, r] of t) {
|
|
229
|
+
if (o.packageName !== void 0 && n !== o.packageName)
|
|
230
|
+
continue;
|
|
231
|
+
const a = r.filter(
|
|
232
|
+
({ usage: i }) => o.category === void 0 || T({ packageName: n, api: i.name, reason: i.reason }) === o.category
|
|
233
|
+
);
|
|
234
|
+
a.length > 0 && e.set(n, a);
|
|
235
|
+
}
|
|
236
|
+
return e;
|
|
237
|
+
}
|
|
238
|
+
function pe(t, o, e, n, r = !1) {
|
|
239
|
+
const a = /* @__PURE__ */ new Map();
|
|
240
|
+
for (const i of o.getSuggestionDiagnostics(t.fileName)) {
|
|
241
|
+
if (i.reportsDeprecated === void 0)
|
|
242
|
+
continue;
|
|
243
|
+
const s = he(t, i.start, i.start + i.length);
|
|
244
|
+
if (
|
|
245
|
+
// Don't report for imports, only for usages
|
|
246
|
+
f.findAncestor(s, f.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
|
|
247
|
+
f.findAncestor(s, f.isJsxClosingElement) !== void 0
|
|
248
|
+
)
|
|
249
|
+
continue;
|
|
250
|
+
const l = de(
|
|
251
|
+
s,
|
|
252
|
+
e,
|
|
253
|
+
o,
|
|
254
|
+
t.fileName,
|
|
255
|
+
i.start
|
|
256
|
+
);
|
|
257
|
+
U(l, r, n) && z(a, t, {
|
|
258
|
+
start: i.start,
|
|
259
|
+
length: i.length,
|
|
260
|
+
name: Ne(s, e, o, t.fileName, i.start) ?? ye(s),
|
|
261
|
+
originFileNames: l,
|
|
262
|
+
reason: ke(o, t.fileName, i.start) ?? Se(s, e)
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return ge(t, e, a, n, r), [...a.values()].toSorted((i, s) => i.start - s.start);
|
|
266
|
+
}
|
|
267
|
+
function ge(t, o, e, n, r) {
|
|
268
|
+
function a(i) {
|
|
269
|
+
if (f.isJsxAttribute(i) && f.isIdentifier(i.name)) {
|
|
270
|
+
const s = i.parent.parent;
|
|
271
|
+
if (f.isJsxOpeningElement(s) || f.isJsxSelfClosingElement(s)) {
|
|
272
|
+
const u = o.getContextualType(s.tagName)?.getProperty(i.name.text), p = S(u, o), c = j(u);
|
|
273
|
+
p !== void 0 && U(c, r, n) && z(e, t, {
|
|
274
|
+
start: i.name.getStart(t),
|
|
275
|
+
length: i.name.getWidth(t),
|
|
276
|
+
name: i.name.text,
|
|
277
|
+
originFileNames: c,
|
|
278
|
+
reason: p
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
f.forEachChild(i, a);
|
|
283
|
+
}
|
|
284
|
+
a(t);
|
|
285
|
+
}
|
|
286
|
+
function de(t, o, e, n, r) {
|
|
287
|
+
const a = ve(t, o);
|
|
288
|
+
return a.length > 0 ? a : [...new Set(e.getDefinitionAtPosition(n, r)?.map(({ fileName: i }) => i))];
|
|
289
|
+
}
|
|
290
|
+
function j(t) {
|
|
291
|
+
return [...new Set(t?.declarations?.map((o) => o.getSourceFile().fileName))];
|
|
292
|
+
}
|
|
293
|
+
function ve(t, o) {
|
|
294
|
+
let e = o.getSymbolAtLocation(t);
|
|
295
|
+
for (; e !== void 0 && (e.flags & f.SymbolFlags.Alias) !== 0; ) {
|
|
296
|
+
if (S(e, o) !== void 0)
|
|
297
|
+
return j(e);
|
|
298
|
+
e = e.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(e);
|
|
299
|
+
}
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
function Ne(t, o, e, n, r) {
|
|
303
|
+
let a = o.getSymbolAtLocation(t);
|
|
304
|
+
for (; a !== void 0 && (a.flags & f.SymbolFlags.Alias) !== 0; ) {
|
|
305
|
+
if (S(a, o) !== void 0)
|
|
306
|
+
return a.getName();
|
|
307
|
+
a = a.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(a);
|
|
308
|
+
}
|
|
309
|
+
return e.getDefinitionAtPosition(n, r)?.[0]?.name;
|
|
310
|
+
}
|
|
311
|
+
function k(t, o) {
|
|
312
|
+
const e = d.relative(o, t);
|
|
313
|
+
return e !== "" && !e.startsWith("../") && !d.isAbsolute(e) && e !== "node_modules" && !e.startsWith("node_modules/");
|
|
314
|
+
}
|
|
315
|
+
function he(t, o, e) {
|
|
316
|
+
let n = t;
|
|
317
|
+
for (; ; ) {
|
|
318
|
+
let r;
|
|
319
|
+
if (f.forEachChild(n, (a) => {
|
|
320
|
+
r === void 0 && a.getStart(t) <= o && a.getEnd() >= e && (r = a);
|
|
321
|
+
}), r === void 0)
|
|
322
|
+
return n;
|
|
323
|
+
n = r;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function ye(t) {
|
|
327
|
+
return f.isIdentifier(t) || f.isPrivateIdentifier(t) || f.isStringLiteralLike(t) || f.isNumericLiteral(t) ? t.text : t.getText();
|
|
328
|
+
}
|
|
329
|
+
function O(t) {
|
|
330
|
+
const o = t?.find(({ name: e }) => e === "deprecated");
|
|
331
|
+
return o === void 0 ? void 0 : B(o.text);
|
|
332
|
+
}
|
|
333
|
+
function ke(t, o, e) {
|
|
334
|
+
try {
|
|
335
|
+
return O(t.getQuickInfoAtPosition(o, e)?.tags);
|
|
336
|
+
} catch {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function S(t, o) {
|
|
341
|
+
try {
|
|
342
|
+
return O(t?.getJsDocTags(o));
|
|
343
|
+
} catch {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function Se(t, o) {
|
|
348
|
+
let e = o.getSymbolAtLocation(t);
|
|
349
|
+
for (; e !== void 0 && (e.flags & f.SymbolFlags.Alias) !== 0; ) {
|
|
350
|
+
const n = S(e, o);
|
|
351
|
+
if (n !== void 0)
|
|
352
|
+
return n;
|
|
353
|
+
e = e.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(e);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function z(t, o, e) {
|
|
357
|
+
if (Z(e.name, e.reason))
|
|
358
|
+
return;
|
|
359
|
+
const { line: n, character: r } = o.getLineAndCharacterOfPosition(e.start);
|
|
360
|
+
t.set(`${e.start}:${e.length}`, {
|
|
361
|
+
...e,
|
|
362
|
+
line: n + 1,
|
|
363
|
+
column: r + 1
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function U(t, o, e) {
|
|
367
|
+
return t.some((n) => e !== void 0 && k(n, e)) ? !1 : !o || t.some((n) => {
|
|
368
|
+
const r = W(n);
|
|
369
|
+
return r === void 0 ? e === void 0 || !k(n, e) : oe(r);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
function W(t) {
|
|
373
|
+
const o = H(t), e = "/node_modules/", n = o.lastIndexOf(e);
|
|
374
|
+
if (n === -1)
|
|
375
|
+
return;
|
|
376
|
+
const [r, a] = o.slice(n + e.length).split("/");
|
|
377
|
+
return r.startsWith("@") ? `${r}/${a}` : r;
|
|
378
|
+
}
|
|
379
|
+
function Pe(t, o = [], e) {
|
|
380
|
+
const n = t[0];
|
|
381
|
+
if (n === void 0)
|
|
382
|
+
return "unknown package";
|
|
383
|
+
const r = W(n);
|
|
384
|
+
if (r !== void 0)
|
|
385
|
+
return r;
|
|
386
|
+
const a = o.find(({ root: c }) => k(n, c));
|
|
387
|
+
if (a !== void 0)
|
|
388
|
+
return a.name;
|
|
389
|
+
const i = d.dirname(y(n)), s = Y(d.dirname(n), i);
|
|
390
|
+
if (s !== i)
|
|
391
|
+
return s;
|
|
392
|
+
if (e === void 0)
|
|
393
|
+
return i;
|
|
394
|
+
const u = d.relative(e, n).split("/"), p = u.findIndex((c) => c !== "..");
|
|
395
|
+
return p < 1 ? d.dirname(y(n)) : u.slice(0, p * 2).join("/");
|
|
396
|
+
}
|
|
397
|
+
export {
|
|
398
|
+
Je as auditDeprecatedUsages,
|
|
399
|
+
pe as collectDeprecatedApiUsages,
|
|
400
|
+
Pe as getDeprecationOriginLabel,
|
|
401
|
+
W as getNodeModulesPackageName,
|
|
402
|
+
U as shouldIncludeDeprecation
|
|
403
|
+
};
|
|
@@ -34,8 +34,8 @@ import { path as S } from "@arcgis/node-toolkit/path";
|
|
|
34
34
|
import { styleText as $ } from "node:util";
|
|
35
35
|
import P from "typescript";
|
|
36
36
|
import { f as g } from "./log-B76HBvov.js";
|
|
37
|
-
import { r as v } from "./cli-
|
|
38
|
-
import { c as x } from "./useProjectInstance-
|
|
37
|
+
import { r as v } from "./cli-BKh8oci8.js";
|
|
38
|
+
import { c as x } from "./useProjectInstance-1xXeoSCI.js";
|
|
39
39
|
import { g as C, s as T, e as R, a as y, b, p as j, l as E, f as F } from "./codeowners-CarwYwHK.js";
|
|
40
40
|
async function U(e, o) {
|
|
41
41
|
await v(
|