@arcgis/codemod 6.0.0-next.43 → 6.0.0-next.45
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/README.md +158 -7
- package/dist/chunks/actions.js +261 -249
- package/dist/chunks/aggregateUsages.js +11 -10
- package/dist/chunks/apiName.js +123 -0
- package/dist/chunks/auditDefinitions.js +49 -47
- package/dist/chunks/auditUsages.js +649 -647
- package/dist/chunks/classification.js +73 -192
- package/dist/chunks/cli.js +79 -79
- package/dist/chunks/codemod.js +46 -46
- package/dist/chunks/codemod10.js +6059 -0
- package/dist/chunks/codemod11.js +83 -0
- package/dist/chunks/codemod12.js +74 -0
- package/dist/chunks/codemod2.js +180 -400
- package/dist/chunks/codemod3.js +77 -292
- package/dist/chunks/codemod4.js +398 -69
- package/dist/chunks/codemod5.js +292 -88
- package/dist/chunks/codemod6.js +71 -223
- package/dist/chunks/codemod7.js +89 -6041
- package/dist/chunks/codemod8.js +215 -49
- package/dist/chunks/codemod9.js +260 -0
- package/dist/chunks/componentAudit.js +141 -216
- package/dist/chunks/format.js +8 -7
- package/dist/chunks/hardcodedBehavior.js +96 -0
- package/dist/chunks/sync.js +1 -1
- package/package.json +4 -4
|
@@ -1,128 +1,20 @@
|
|
|
1
|
-
import { findPath as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { retrievePackageJson as O } from "@arcgis/node-toolkit/packageJson";
|
|
7
|
-
import { e as C, d as P } from "./cli.js";
|
|
8
|
-
const K = "6.0.0-next.43";
|
|
9
|
-
function I(e, r) {
|
|
10
|
-
return e.package.localeCompare(r.package) || e.file.localeCompare(r.file) || e.line - r.line || e.column - r.column || g(e.module, r.module) || g(e.memberOf, r.memberOf) || e.name.localeCompare(r.name) || g(e.kind, r.kind) || g(e.category, r.category) || g(e.provenance, r.provenance) || String(e.deprecated).localeCompare(String(r.deprecated));
|
|
11
|
-
}
|
|
12
|
-
const g = (e, r) => (e ?? "").localeCompare(r ?? "");
|
|
13
|
-
function q(e) {
|
|
14
|
-
const r = JSON.parse(e);
|
|
15
|
-
if (typeof r != "object" || r === null || !("auditKind" in r) || r.auditKind !== "usages" && r.auditKind !== "definitions")
|
|
16
|
-
throw new Error("Invalid deprecation audit JSON.");
|
|
17
|
-
return r;
|
|
18
|
-
}
|
|
19
|
-
function Q() {
|
|
20
|
-
const e = b(".git");
|
|
21
|
-
if (e === void 0)
|
|
22
|
-
throw new Error("Unable to find a Git repository for the deprecation audit.");
|
|
23
|
-
const r = d.dirname(e), t = v("git", ["remote", "get-url", "origin"], { cwd: r }), o = v("git", ["rev-parse", "HEAD"], { cwd: r }), n = process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || v("git", ["branch", "--show-current"], { cwd: r });
|
|
24
|
-
return { repository: A(t), repositoryRoot: r, ref: o, branch: n };
|
|
25
|
-
}
|
|
26
|
-
function X(e, r) {
|
|
27
|
-
return f(d.relative(r, e));
|
|
28
|
-
}
|
|
29
|
-
function Y(e, r = process.cwd()) {
|
|
30
|
-
if (e.length === 0)
|
|
31
|
-
return () => !0;
|
|
32
|
-
const t = $([...e], { dot: !0 });
|
|
33
|
-
return (o) => !t(f(d.relative(r, o)));
|
|
34
|
-
}
|
|
35
|
-
function Z(e, r, t, o) {
|
|
36
|
-
const n = e === "usages" ? "usage" : "definition";
|
|
37
|
-
process.stderr.write(
|
|
38
|
-
`Deprecations: ${r} ${n}${r === 1 ? "" : "s"} across ${t} file${t === 1 ? "" : "s"} from ${o} package${o === 1 ? "" : "s"}.
|
|
39
|
-
`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
function A(e) {
|
|
43
|
-
const r = e.replace(/\.git$/u, "");
|
|
44
|
-
if (r.startsWith("http://") || r.startsWith("https://"))
|
|
45
|
-
return new URL(r).href.replace(/^https?:\/\//u, "").replace(/\/$/u, "");
|
|
46
|
-
const t = /^(?:ssh:\/\/)?git@([^/:]+)[:/](.+)$/u.exec(r);
|
|
47
|
-
if (t !== null)
|
|
48
|
-
return `${t[1]}/${t[2]}`;
|
|
49
|
-
throw new Error(`Unsupported Git remote URL: ${e}`);
|
|
50
|
-
}
|
|
51
|
-
function ee(e) {
|
|
52
|
-
if (e.kind === "css-property")
|
|
53
|
-
return e.name;
|
|
54
|
-
if (e.kind === "element")
|
|
55
|
-
return `<${e.name}>`;
|
|
56
|
-
if (e.memberOf !== void 0) {
|
|
57
|
-
if (e.kind === "css-part")
|
|
58
|
-
return `${e.memberOf}::part(${e.name})`;
|
|
59
|
-
if (e.kind === "css-state")
|
|
60
|
-
return `${e.memberOf}:state(${e.name})`;
|
|
61
|
-
if (e.kind === "slot")
|
|
62
|
-
return `${e.memberOf} > [slot="${e.name}"]`;
|
|
63
|
-
if (e.kind === "attribute")
|
|
64
|
-
return `${e.memberOf}[${e.name}]`;
|
|
65
|
-
}
|
|
66
|
-
const r = e.memberOf === void 0 ? e.name : `${e.memberOf}.${e.name}`;
|
|
67
|
-
return e.kind === "method" || e.kind === "function" ? `${r}()` : r;
|
|
68
|
-
}
|
|
69
|
-
function re(e, r = "dash") {
|
|
70
|
-
return e === void 0 || e === "field" || e === "method" || e === "function" ? "" : r === "parentheses" ? ` (${e})` : ` - ${e}`;
|
|
71
|
-
}
|
|
72
|
-
function te(e) {
|
|
73
|
-
if (e === void 0)
|
|
74
|
-
return {};
|
|
75
|
-
const r = B(e), t = e.parent, o = t !== void 0 && (i.isClassLike(t) || i.isInterfaceDeclaration(t)) ? t : t !== void 0 && i.isTypeLiteralNode(t) && i.isTypeAliasDeclaration(t.parent) ? t.parent : void 0, n = o?.name === void 0 ? void 0 : L(o, o.name.text);
|
|
76
|
-
return {
|
|
77
|
-
...r === void 0 ? {} : { kind: r },
|
|
78
|
-
...n === void 0 ? {} : { memberOf: n }
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function L(e, r) {
|
|
82
|
-
const t = [];
|
|
83
|
-
for (let o = e?.parent; o !== void 0; o = o.parent) {
|
|
84
|
-
if (i.isClassLike(o) || i.isInterfaceDeclaration(o) || i.isTypeLiteralNode(o))
|
|
85
|
-
return r;
|
|
86
|
-
i.isModuleDeclaration(o) && i.isIdentifier(o.name) && t.unshift(o.name.text);
|
|
87
|
-
}
|
|
88
|
-
return [...t, r].join(".");
|
|
89
|
-
}
|
|
90
|
-
function B(e) {
|
|
91
|
-
if (i.isPropertyDeclaration(e) || i.isPropertySignature(e))
|
|
92
|
-
return (i.getCombinedModifierFlags(e) & i.ModifierFlags.Readonly) !== 0 && D(e) ? "method" : "field";
|
|
93
|
-
if (i.isGetAccessorDeclaration(e) || i.isSetAccessorDeclaration(e))
|
|
94
|
-
return "field";
|
|
95
|
-
if (i.isMethodDeclaration(e) || i.isMethodSignature(e))
|
|
96
|
-
return "method";
|
|
97
|
-
if (i.isClassLike(e))
|
|
98
|
-
return "class";
|
|
99
|
-
if (i.isInterfaceDeclaration(e))
|
|
100
|
-
return "interface";
|
|
101
|
-
if (i.isTypeAliasDeclaration(e))
|
|
102
|
-
return "type";
|
|
103
|
-
if (i.isFunctionDeclaration(e))
|
|
104
|
-
return "function";
|
|
105
|
-
if (i.isVariableDeclaration(e))
|
|
106
|
-
return D(e) && (e.type !== void 0 || (e.parent.flags & i.NodeFlags.Const) !== 0) ? "function" : "variable";
|
|
107
|
-
if (i.isModuleDeclaration(e))
|
|
108
|
-
return "namespace";
|
|
109
|
-
}
|
|
110
|
-
function D(e) {
|
|
111
|
-
return e.type !== void 0 ? i.isFunctionTypeNode(e.type) : !i.isPropertySignature(e) && e.initializer !== void 0 && i.isArrowFunction(e.initializer);
|
|
112
|
-
}
|
|
113
|
-
const oe = /* @__PURE__ */ new Map([
|
|
1
|
+
import { findPath as P } from "@arcgis/node-toolkit/file";
|
|
2
|
+
import { toPosixPathSeparators as f, path as h } from "@arcgis/node-toolkit/path";
|
|
3
|
+
import { retrievePackageJson as w } from "@arcgis/node-toolkit/packageJson";
|
|
4
|
+
import { e as k, d as C } from "./cli.js";
|
|
5
|
+
const z = /* @__PURE__ */ new Map([
|
|
114
6
|
["MapView", "arcgis-map"],
|
|
115
7
|
["SceneView", "arcgis-scene"],
|
|
116
8
|
["LinkChartView", "arcgis-link-chart"],
|
|
117
9
|
["VideoView", "arcgis-video"]
|
|
118
|
-
]),
|
|
10
|
+
]), B = /* @__PURE__ */ new Set([
|
|
119
11
|
"MessageBundleLoader",
|
|
120
12
|
"createJSONLoader",
|
|
121
13
|
"fetchMessageBundle",
|
|
122
14
|
"messageBundle",
|
|
123
15
|
"normalizeMessageBundleLocale",
|
|
124
16
|
"registerMessageBundleLoader"
|
|
125
|
-
]),
|
|
17
|
+
]), L = /* @__PURE__ */ new Set([
|
|
126
18
|
"AreaMeasurement2D",
|
|
127
19
|
"AreaMeasurement3D",
|
|
128
20
|
"BasemapGallery",
|
|
@@ -163,18 +55,18 @@ const oe = /* @__PURE__ */ new Map([
|
|
|
163
55
|
"TableList",
|
|
164
56
|
"useLegacyCreateTools"
|
|
165
57
|
]);
|
|
166
|
-
function
|
|
167
|
-
package:
|
|
168
|
-
name:
|
|
169
|
-
category:
|
|
170
|
-
memberOf:
|
|
171
|
-
module:
|
|
172
|
-
deprecated:
|
|
58
|
+
function V({
|
|
59
|
+
package: r,
|
|
60
|
+
name: e,
|
|
61
|
+
category: s,
|
|
62
|
+
memberOf: u,
|
|
63
|
+
module: t,
|
|
64
|
+
deprecated: a
|
|
173
65
|
}) {
|
|
174
|
-
if (
|
|
175
|
-
return
|
|
176
|
-
const
|
|
177
|
-
return
|
|
66
|
+
if (s !== void 0)
|
|
67
|
+
return s;
|
|
68
|
+
const i = r.toLowerCase(), o = typeof a == "string" ? a.toLowerCase() : "";
|
|
69
|
+
return r === "@arcgis/core" && e === "ui" && [
|
|
178
70
|
"DOMContainer",
|
|
179
71
|
"DOMContainerProperties",
|
|
180
72
|
"MapView",
|
|
@@ -185,90 +77,79 @@ function F({
|
|
|
185
77
|
"LinkChartViewProperties",
|
|
186
78
|
"VideoView",
|
|
187
79
|
"VideoViewProperties"
|
|
188
|
-
].includes(
|
|
80
|
+
].includes(u?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : r === "@arcgis/core" && (L.has(e) || o.includes("components-transition-plan")) ? "coreWidgets" : r === "@arcgis/core" && (/^(?:__esri\.)?(?:geometryEngine(?:Async)?|projection)(?:\.|$)/u.test(e) || e === "extendedSpatialReferenceInfo" || t?.startsWith("geometry/geometryEngine") || t?.startsWith("geometry/projection")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(o) ? "codemod" : r === "@arcgis/core" && (B.has(e) || o.includes("widget translations")) ? "coreIntl" : i.includes("calcite") ? "calcite" : /^@arcgis\/.+components/u.test(i) ? "arcgisComponents" : r === "@arcgis/core" ? "arcgisCore" : i.startsWith("@arcgis/") ? "arcgisSupport" : k(r) ? "otherEsri" : "nonEsri";
|
|
189
81
|
}
|
|
190
|
-
function
|
|
191
|
-
const
|
|
192
|
-
(
|
|
82
|
+
function $(r, e) {
|
|
83
|
+
const s = `/node_modules/${e}/`, u = r.map(f).sort(
|
|
84
|
+
(t, a) => Number(a.includes(s)) - Number(t.includes(s)) || t.localeCompare(a)
|
|
193
85
|
);
|
|
194
|
-
for (const
|
|
195
|
-
const
|
|
196
|
-
let
|
|
197
|
-
if (
|
|
198
|
-
|
|
86
|
+
for (const t of u) {
|
|
87
|
+
const a = t.lastIndexOf(s);
|
|
88
|
+
let i;
|
|
89
|
+
if (a !== -1)
|
|
90
|
+
i = t.slice(a + s.length);
|
|
199
91
|
else {
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
|
|
92
|
+
const o = [...t.matchAll(/\/(?:src|dist)(?=\/)/gu)];
|
|
93
|
+
if (o.length === 1)
|
|
94
|
+
i = t.slice(o[0].index + 1);
|
|
203
95
|
else {
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
96
|
+
const n = P("package.json", h.dirname(t));
|
|
97
|
+
if (n === void 0)
|
|
206
98
|
continue;
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
99
|
+
const m = h.dirname(n);
|
|
100
|
+
if (w(m).name !== e)
|
|
209
101
|
continue;
|
|
210
|
-
|
|
102
|
+
i = f(h.relative(m, t));
|
|
211
103
|
}
|
|
212
104
|
}
|
|
213
|
-
return
|
|
105
|
+
return i.startsWith("src/") ? O(i) : b(i);
|
|
214
106
|
}
|
|
215
107
|
}
|
|
216
|
-
function
|
|
217
|
-
return f(
|
|
108
|
+
function O(r) {
|
|
109
|
+
return f(r).replace(/^src\//u, "").replace(S, "");
|
|
218
110
|
}
|
|
219
|
-
function
|
|
220
|
-
return f(
|
|
111
|
+
function b(r) {
|
|
112
|
+
return f(r).replace(/^dist\//u, "").replace(S, "").replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
|
|
221
113
|
}
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
return Object.keys(
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
114
|
+
const S = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
|
|
115
|
+
function R(r, e) {
|
|
116
|
+
const s = Map.groupBy(r, (u) => V(e(u)));
|
|
117
|
+
return Object.keys(C).flatMap((u) => {
|
|
118
|
+
const t = s.get(u);
|
|
119
|
+
if (t === void 0)
|
|
228
120
|
return [];
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
return
|
|
232
|
-
})].map(([
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
return JSON.stringify([
|
|
236
|
-
}).values()].map((
|
|
237
|
-
const
|
|
238
|
-
return { name:
|
|
121
|
+
const i = [...Map.groupBy(t, (o) => {
|
|
122
|
+
const n = e(o);
|
|
123
|
+
return D(n.package, n.module);
|
|
124
|
+
})].map(([o, n]) => {
|
|
125
|
+
const m = e(n[0]).package, y = [...Map.groupBy(n, (c) => {
|
|
126
|
+
const l = e(c);
|
|
127
|
+
return JSON.stringify([l.name, l.memberOf, l.kind]);
|
|
128
|
+
}).values()].map((c) => {
|
|
129
|
+
const l = e(c[0]).name, d = c.map((p) => e(p).deprecated).filter((p) => typeof p == "string" && p !== ""), g = [...new Set(d)].sort((p, M) => p.localeCompare(M));
|
|
130
|
+
return { name: l, reasons: g, items: c };
|
|
239
131
|
});
|
|
240
|
-
return
|
|
241
|
-
const
|
|
242
|
-
return
|
|
243
|
-
}), { packageName:
|
|
132
|
+
return y.sort((c, l) => {
|
|
133
|
+
const d = e(c.items[0]), g = e(l.items[0]);
|
|
134
|
+
return l.items.length - c.items.length || c.name.localeCompare(l.name) || (d.memberOf ?? "").localeCompare(g.memberOf ?? "") || (d.kind ?? "").localeCompare(g.kind ?? "");
|
|
135
|
+
}), { packageName: m, displayName: o, count: n.length, apis: y };
|
|
244
136
|
});
|
|
245
|
-
return
|
|
246
|
-
(
|
|
247
|
-
), [{ categoryName:
|
|
137
|
+
return i.sort(
|
|
138
|
+
(o, n) => n.count - o.count || o.packageName.localeCompare(n.packageName) || o.displayName.localeCompare(n.displayName)
|
|
139
|
+
), [{ categoryName: u, count: t.length, packages: i }];
|
|
248
140
|
});
|
|
249
141
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
142
|
+
function D(r, e) {
|
|
143
|
+
return A(r, e) ? "DOM / Web platform" : r;
|
|
252
144
|
}
|
|
253
|
-
function
|
|
254
|
-
return
|
|
145
|
+
function A(r, e) {
|
|
146
|
+
return r === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(e ?? "");
|
|
255
147
|
}
|
|
256
148
|
export {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
X as g,
|
|
264
|
-
re as h,
|
|
265
|
-
Y as i,
|
|
266
|
-
te as j,
|
|
267
|
-
L as k,
|
|
268
|
-
oe as l,
|
|
269
|
-
T as m,
|
|
270
|
-
q as n,
|
|
271
|
-
x as o,
|
|
272
|
-
Z as p,
|
|
273
|
-
K as s
|
|
149
|
+
$ as a,
|
|
150
|
+
z as b,
|
|
151
|
+
V as c,
|
|
152
|
+
D as d,
|
|
153
|
+
R as g,
|
|
154
|
+
O as s
|
|
274
155
|
};
|