@arcgis/codemod 5.2.0-next.98 → 6.0.0-next.0

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.
@@ -29,9 +29,9 @@ var g = (t, e, s) => {
29
29
  };
30
30
  return n();
31
31
  };
32
- import { p } from "./actions-CE74rP-z.js";
33
- import { c as k } from "./useProjectInstance-BAlKm1ad.js";
34
- import { p as C } from "./cli-x1Uhjnb_.js";
32
+ import { p } from "./actions.js";
33
+ import { c as k } from "./useProjectInstance.js";
34
+ import { p as C } from "./cli.js";
35
35
  const j = {
36
36
  meta: {
37
37
  needsTypeInformation: !1
@@ -0,0 +1,255 @@
1
+ import { d as h } from "./cli.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,93 @@
1
+ import { findPath as a } from "@arcgis/node-toolkit/file";
2
+ import { path as s, toPosixPathSeparators as d } from "@arcgis/node-toolkit/path";
3
+ import { collectOutputSync as c } from "@arcgis/node-toolkit/shell";
4
+ import u from "typescript";
5
+ import { retrievePackageJson as g } from "@arcgis/node-toolkit/packageJson";
6
+ function P() {
7
+ const t = a(".git");
8
+ if (t === void 0)
9
+ throw new Error("Unable to find a Git repository for the deprecation audit.");
10
+ const e = s.dirname(t), o = c("git", ["remote", "get-url", "origin"], { cwd: e }), n = c("git", ["rev-parse", "HEAD"], { cwd: e });
11
+ return { repository: l(o), repositoryRoot: e, ref: n };
12
+ }
13
+ function v(t, e) {
14
+ return d(s.relative(e, t));
15
+ }
16
+ function y(t, e, o, n) {
17
+ const i = t === "usages" ? "usage" : "definition";
18
+ process.stderr.write(
19
+ `Deprecations: ${e} ${i}${e === 1 ? "" : "s"} across ${o} file${o === 1 ? "" : "s"} from ${n} package${n === 1 ? "" : "s"}.
20
+ `
21
+ );
22
+ }
23
+ function l(t) {
24
+ const e = t.replace(/\.git$/u, "");
25
+ if (e.startsWith("http://") || e.startsWith("https://"))
26
+ return new URL(e).href.replace(/^https?:\/\//u, "").replace(/\/$/u, "");
27
+ const o = /^(?:ssh:\/\/)?git@([^/:]+)[:/](.+)$/u.exec(e);
28
+ if (o !== null)
29
+ return `${o[1]}/${o[2]}`;
30
+ throw new Error(`Unsupported Git remote URL: ${t}`);
31
+ }
32
+ function w(t) {
33
+ return typeof t == "string" ? t : t.map((e) => e.kind === u.SyntaxKind.JSDocText ? e.text : m(e.getText())).join("");
34
+ }
35
+ function k(t) {
36
+ return t === void 0 ? void 0 : f(u.displayPartsToString([...t]));
37
+ }
38
+ function f(t) {
39
+ return t.replace(
40
+ /\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
41
+ (e, o) => p(o)
42
+ );
43
+ }
44
+ function m(t) {
45
+ const e = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(t)?.[1];
46
+ return e === void 0 ? t : p(e);
47
+ }
48
+ function p(t) {
49
+ const e = t.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"), o = e.indexOf("|");
50
+ if (o !== -1)
51
+ return e.slice(o + 1).trim() || e.slice(0, o).trim();
52
+ const [n, ...i] = e.split(/\s+/u);
53
+ return i.join(" ") || n;
54
+ }
55
+ function R(t, e) {
56
+ const o = a("package.json", t);
57
+ return o === void 0 ? e : g(s.dirname(o)).name ?? e;
58
+ }
59
+ const r = {
60
+ excludedPackageNames: /* @__PURE__ */ new Set([
61
+ "@arcgis/charts-components-react",
62
+ "@arcgis/coding-components-react",
63
+ "@arcgis/components-build-utils",
64
+ "@arcgis/map-components-react",
65
+ "@arcgis/portal-components-react",
66
+ "@arcgis-test/lit-components-react"
67
+ ]),
68
+ excludedDefinitionPathFragments: ["test-package"],
69
+ ignoreDeprecatedApis: ["getReactWrapperOptions"],
70
+ ignoredDeprecationsByIncludes: ["React wrappers are not needed in React 19 or above"]
71
+ };
72
+ function J(t) {
73
+ return t !== void 0 && r.excludedPackageNames.has(t);
74
+ }
75
+ function T(t) {
76
+ return r.excludedDefinitionPathFragments.some(
77
+ (e) => t.includes(e)
78
+ );
79
+ }
80
+ function E(t, e) {
81
+ return r.ignoreDeprecatedApis.some((o) => o === t) || e != null && r.ignoredDeprecationsByIncludes.some((o) => e.includes(o));
82
+ }
83
+ export {
84
+ v as a,
85
+ R as b,
86
+ E as c,
87
+ k as d,
88
+ T as e,
89
+ w as f,
90
+ P as g,
91
+ y as p,
92
+ J as s
93
+ };