@arcgis/codemod 6.0.0-next.30 → 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.
- package/dist/chunks/classification.js +146 -94
- package/dist/chunks/cli.js +181 -180
- package/dist/chunks/componentAudit.js +115 -101
- package/dist/chunks/format.js +94 -70
- package/dist/chunks/index.js +857 -693
- package/dist/chunks/index2.js +109 -109
- package/dist/chunks/index3.js +48 -39
- package/dist/chunks/legacyCompatibility.js +210 -0
- package/dist/chunks/sync.js +143 -41
- package/dist/chunks/syncMarkdown.js +28 -18
- package/package.json +5 -4
- package/dist/chunks/artifact.js +0 -48
- package/dist/chunks/github.js +0 -124
|
@@ -1,9 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { findPath as b } from "@arcgis/node-toolkit/file";
|
|
2
|
+
import { path as d, toPosixPathSeparators as f } from "@arcgis/node-toolkit/path";
|
|
3
|
+
import { collectOutputSync as v } from "@arcgis/node-toolkit/shell";
|
|
4
|
+
import $ from "picomatch";
|
|
5
|
+
import i from "typescript";
|
|
6
|
+
import { retrievePackageJson as O } from "@arcgis/node-toolkit/packageJson";
|
|
5
7
|
import { b as C, d as P } from "./cli.js";
|
|
6
|
-
|
|
8
|
+
const K = "6.0.0-next.31";
|
|
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) {
|
|
7
52
|
if (e.kind === "css-property")
|
|
8
53
|
return e.name;
|
|
9
54
|
if (e.kind === "element")
|
|
@@ -21,63 +66,63 @@ function j(e) {
|
|
|
21
66
|
const r = e.memberOf === void 0 ? e.name : `${e.memberOf}.${e.name}`;
|
|
22
67
|
return e.kind === "method" || e.kind === "function" ? `${r}()` : r;
|
|
23
68
|
}
|
|
24
|
-
function
|
|
69
|
+
function re(e, r = "dash") {
|
|
25
70
|
return e === void 0 || e === "field" || e === "method" || e === "function" ? "" : r === "parentheses" ? ` (${e})` : ` - ${e}`;
|
|
26
71
|
}
|
|
27
|
-
function
|
|
72
|
+
function te(e) {
|
|
28
73
|
if (e === void 0)
|
|
29
74
|
return {};
|
|
30
|
-
const r =
|
|
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);
|
|
31
76
|
return {
|
|
32
77
|
...r === void 0 ? {} : { kind: r },
|
|
33
|
-
...
|
|
78
|
+
...n === void 0 ? {} : { memberOf: n }
|
|
34
79
|
};
|
|
35
80
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
for (let
|
|
39
|
-
if (
|
|
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))
|
|
40
85
|
return r;
|
|
41
|
-
|
|
86
|
+
i.isModuleDeclaration(o) && i.isIdentifier(o.name) && t.unshift(o.name.text);
|
|
42
87
|
}
|
|
43
|
-
return [...
|
|
88
|
+
return [...t, r].join(".");
|
|
44
89
|
}
|
|
45
|
-
function
|
|
46
|
-
if (
|
|
47
|
-
return (
|
|
48
|
-
if (
|
|
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))
|
|
49
94
|
return "field";
|
|
50
|
-
if (
|
|
95
|
+
if (i.isMethodDeclaration(e) || i.isMethodSignature(e))
|
|
51
96
|
return "method";
|
|
52
|
-
if (
|
|
97
|
+
if (i.isClassLike(e))
|
|
53
98
|
return "class";
|
|
54
|
-
if (
|
|
99
|
+
if (i.isInterfaceDeclaration(e))
|
|
55
100
|
return "interface";
|
|
56
|
-
if (
|
|
101
|
+
if (i.isTypeAliasDeclaration(e))
|
|
57
102
|
return "type";
|
|
58
|
-
if (
|
|
103
|
+
if (i.isFunctionDeclaration(e))
|
|
59
104
|
return "function";
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
62
|
-
if (
|
|
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))
|
|
63
108
|
return "namespace";
|
|
64
109
|
}
|
|
65
|
-
function
|
|
66
|
-
return e.type !== void 0 ?
|
|
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);
|
|
67
112
|
}
|
|
68
|
-
const
|
|
113
|
+
const oe = /* @__PURE__ */ new Map([
|
|
69
114
|
["MapView", "arcgis-map"],
|
|
70
115
|
["SceneView", "arcgis-scene"],
|
|
71
116
|
["LinkChartView", "arcgis-link-chart"],
|
|
72
117
|
["VideoView", "arcgis-video"]
|
|
73
|
-
]),
|
|
118
|
+
]), V = /* @__PURE__ */ new Set([
|
|
74
119
|
"MessageBundleLoader",
|
|
75
120
|
"createJSONLoader",
|
|
76
121
|
"fetchMessageBundle",
|
|
77
122
|
"messageBundle",
|
|
78
123
|
"normalizeMessageBundleLocale",
|
|
79
124
|
"registerMessageBundleLoader"
|
|
80
|
-
]),
|
|
125
|
+
]), E = /* @__PURE__ */ new Set([
|
|
81
126
|
"AreaMeasurement2D",
|
|
82
127
|
"AreaMeasurement3D",
|
|
83
128
|
"BasemapGallery",
|
|
@@ -118,17 +163,17 @@ const J = /* @__PURE__ */ new Map([
|
|
|
118
163
|
"TableList",
|
|
119
164
|
"useLegacyCreateTools"
|
|
120
165
|
]);
|
|
121
|
-
function
|
|
166
|
+
function F({
|
|
122
167
|
package: e,
|
|
123
168
|
name: r,
|
|
124
|
-
category:
|
|
125
|
-
memberOf:
|
|
126
|
-
module:
|
|
169
|
+
category: t,
|
|
170
|
+
memberOf: o,
|
|
171
|
+
module: n,
|
|
127
172
|
deprecated: u
|
|
128
173
|
}) {
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
131
|
-
const a = e.toLowerCase(),
|
|
174
|
+
if (t !== void 0)
|
|
175
|
+
return t;
|
|
176
|
+
const a = e.toLowerCase(), s = typeof u == "string" ? u.toLowerCase() : "";
|
|
132
177
|
return e === "@arcgis/core" && r === "ui" && [
|
|
133
178
|
"DOMContainer",
|
|
134
179
|
"DOMContainerProperties",
|
|
@@ -140,83 +185,90 @@ function $({
|
|
|
140
185
|
"LinkChartViewProperties",
|
|
141
186
|
"VideoView",
|
|
142
187
|
"VideoViewProperties"
|
|
143
|
-
].includes(
|
|
188
|
+
].includes(o?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && (E.has(r) || s.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (/^(?:__esri\.)?(?:geometryEngine(?:Async)?|projection)(?:\.|$)/u.test(r) || r === "extendedSpatialReferenceInfo" || n?.startsWith("geometry/geometryEngine") || n?.startsWith("geometry/projection")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(s) ? "codemod" : e === "@arcgis/core" && (V.has(r) || s.includes("widget translations")) ? "coreIntl" : a.includes("calcite") ? "calcite" : /^@arcgis\/.+components/u.test(a) ? "arcgisComponents" : e === "@arcgis/core" ? "arcgisCore" : a.startsWith("@arcgis/") ? "arcgisSupport" : C(e) ? "otherEsri" : "nonEsri";
|
|
144
189
|
}
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
(
|
|
190
|
+
function ie(e, r) {
|
|
191
|
+
const t = `/node_modules/${r}/`, o = e.map(f).sort(
|
|
192
|
+
(n, u) => Number(u.includes(t)) - Number(n.includes(t)) || n.localeCompare(u)
|
|
148
193
|
);
|
|
149
|
-
for (const
|
|
150
|
-
const u =
|
|
194
|
+
for (const n of o) {
|
|
195
|
+
const u = n.lastIndexOf(t);
|
|
151
196
|
let a;
|
|
152
197
|
if (u !== -1)
|
|
153
|
-
a =
|
|
198
|
+
a = n.slice(u + t.length);
|
|
154
199
|
else {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
a =
|
|
200
|
+
const s = [...n.matchAll(/\/(?:src|dist)(?=\/)/gu)];
|
|
201
|
+
if (s.length === 1)
|
|
202
|
+
a = n.slice(s[0].index + 1);
|
|
158
203
|
else {
|
|
159
|
-
const c =
|
|
204
|
+
const c = b("package.json", d.dirname(n));
|
|
160
205
|
if (c === void 0)
|
|
161
206
|
continue;
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
207
|
+
const y = d.dirname(c);
|
|
208
|
+
if (O(y).name !== r)
|
|
164
209
|
continue;
|
|
165
|
-
a =
|
|
210
|
+
a = f(d.relative(y, n));
|
|
166
211
|
}
|
|
167
212
|
}
|
|
168
|
-
return a.startsWith("src/") ?
|
|
213
|
+
return a.startsWith("src/") ? T(a) : R(a);
|
|
169
214
|
}
|
|
170
215
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
216
|
+
function T(e) {
|
|
217
|
+
return f(e).replace(/^src\//u, "").replace(k, "");
|
|
173
218
|
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
176
|
-
}
|
|
177
|
-
const
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
return Object.keys(P).flatMap((
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
219
|
+
function R(e) {
|
|
220
|
+
return f(e).replace(/^dist\//u, "").replace(k, "").replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
|
|
221
|
+
}
|
|
222
|
+
const k = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
|
|
223
|
+
function ne(e, r) {
|
|
224
|
+
const t = Map.groupBy(e, (o) => F(r(o)));
|
|
225
|
+
return Object.keys(P).flatMap((o) => {
|
|
226
|
+
const n = t.get(o);
|
|
227
|
+
if (n === void 0)
|
|
183
228
|
return [];
|
|
184
|
-
const a = [...Map.groupBy(
|
|
185
|
-
const c = r(
|
|
186
|
-
return
|
|
187
|
-
})].map(([
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
return JSON.stringify([
|
|
191
|
-
}).values()].map((
|
|
192
|
-
const
|
|
193
|
-
return { name:
|
|
229
|
+
const a = [...Map.groupBy(n, (s) => {
|
|
230
|
+
const c = r(s);
|
|
231
|
+
return x(c.package, c.module);
|
|
232
|
+
})].map(([s, c]) => {
|
|
233
|
+
const y = r(c[0]).package, w = [...Map.groupBy(c, (p) => {
|
|
234
|
+
const m = r(p);
|
|
235
|
+
return JSON.stringify([m.name, m.memberOf, m.kind]);
|
|
236
|
+
}).values()].map((p) => {
|
|
237
|
+
const m = r(p[0]).name, h = p.map((l) => r(l).deprecated).filter((l) => typeof l == "string" && l !== ""), S = [...new Set(h)].sort((l, M) => l.localeCompare(M));
|
|
238
|
+
return { name: m, reasons: S, items: p };
|
|
194
239
|
});
|
|
195
|
-
return
|
|
196
|
-
const
|
|
197
|
-
return
|
|
198
|
-
}), { packageName:
|
|
240
|
+
return w.sort((p, m) => {
|
|
241
|
+
const h = r(p.items[0]), S = r(m.items[0]);
|
|
242
|
+
return m.items.length - p.items.length || p.name.localeCompare(m.name) || (h.memberOf ?? "").localeCompare(S.memberOf ?? "") || (h.kind ?? "").localeCompare(S.kind ?? "");
|
|
243
|
+
}), { packageName: y, displayName: s, count: c.length, apis: w };
|
|
199
244
|
});
|
|
200
245
|
return a.sort(
|
|
201
|
-
(
|
|
202
|
-
), [{ categoryName:
|
|
246
|
+
(s, c) => c.count - s.count || s.packageName.localeCompare(c.packageName) || s.displayName.localeCompare(c.displayName)
|
|
247
|
+
), [{ categoryName: o, count: n.length, packages: a }];
|
|
203
248
|
});
|
|
204
249
|
}
|
|
205
|
-
function T(e, r) {
|
|
206
|
-
return x(e, r) ? "DOM / Web platform" : e;
|
|
207
|
-
}
|
|
208
250
|
function x(e, r) {
|
|
251
|
+
return N(e, r) ? "DOM / Web platform" : e;
|
|
252
|
+
}
|
|
253
|
+
function N(e, r) {
|
|
209
254
|
return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
|
|
210
255
|
}
|
|
211
256
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
257
|
+
Q as a,
|
|
258
|
+
ne as b,
|
|
259
|
+
ie as c,
|
|
260
|
+
F as d,
|
|
261
|
+
I as e,
|
|
262
|
+
ee as f,
|
|
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
|
|
222
274
|
};
|