@arcgis/codemod 6.0.0-next.12 → 6.0.0-next.13
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/artifact.js +36 -32
- package/dist/chunks/classification.js +83 -69
- package/dist/chunks/cli.js +237 -207
- package/dist/chunks/componentAudit.js +156 -104
- package/dist/chunks/format.js +92 -92
- package/dist/chunks/index.js +703 -465
- package/dist/chunks/index2.js +13 -13
- package/dist/chunks/index3.js +240 -205
- package/dist/chunks/useProjectInstance.js +18 -15
- package/package.json +5 -4
package/dist/chunks/artifact.js
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
import { findPath as
|
|
2
|
-
import { path as
|
|
3
|
-
import { collectOutputSync as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { findPath as c } from "@arcgis/node-toolkit/file";
|
|
2
|
+
import { path as s, toPosixPathSeparators as p } from "@arcgis/node-toolkit/path";
|
|
3
|
+
import { collectOutputSync as i } from "@arcgis/node-toolkit/shell";
|
|
4
|
+
const f = "6.0.0-next.13";
|
|
5
|
+
function w(o, e) {
|
|
6
|
+
return o.package.localeCompare(e.package) || o.file.localeCompare(e.file) || o.line - e.line || o.column - e.column || t(o.module, e.module) || t(o.memberOf, e.memberOf) || o.name.localeCompare(e.name) || t(o.kind, e.kind) || t(o.category, e.category) || t(o.provenance, e.provenance) || String(o.deprecated).localeCompare(String(e.deprecated));
|
|
7
|
+
}
|
|
8
|
+
const t = (o, e) => (o ?? "").localeCompare(e ?? "");
|
|
9
|
+
function $(o) {
|
|
10
|
+
const e = JSON.parse(o);
|
|
11
|
+
if (typeof e != "object" || e === null || !("auditKind" in e) || e.auditKind !== "usages" && e.auditKind !== "definitions")
|
|
9
12
|
throw new Error("Invalid deprecation audit JSON.");
|
|
10
|
-
return
|
|
13
|
+
return e;
|
|
11
14
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
+
function h() {
|
|
16
|
+
const o = c(".git");
|
|
17
|
+
if (o === void 0)
|
|
15
18
|
throw new Error("Unable to find a Git repository for the deprecation audit.");
|
|
16
|
-
const
|
|
17
|
-
return { repository:
|
|
19
|
+
const e = s.dirname(o), r = i("git", ["remote", "get-url", "origin"], { cwd: e }), n = i("git", ["rev-parse", "HEAD"], { cwd: e }), a = process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || i("git", ["branch", "--show-current"], { cwd: e });
|
|
20
|
+
return { repository: u(r), repositoryRoot: e, ref: n, branch: a };
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
22
|
+
function g(o, e) {
|
|
23
|
+
return p(s.relative(e, o));
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
25
|
+
function v(o, e, r, n) {
|
|
26
|
+
const a = o === "usages" ? "usage" : "definition";
|
|
24
27
|
process.stderr.write(
|
|
25
|
-
`Deprecations: ${
|
|
28
|
+
`Deprecations: ${e} ${a}${e === 1 ? "" : "s"} across ${r} file${r === 1 ? "" : "s"} from ${n} package${n === 1 ? "" : "s"}.
|
|
26
29
|
`
|
|
27
30
|
);
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
return new URL(
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
return `${
|
|
36
|
-
throw new Error(`Unsupported Git remote URL: ${
|
|
32
|
+
function u(o) {
|
|
33
|
+
const e = o.replace(/\.git$/u, "");
|
|
34
|
+
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
35
|
+
return new URL(e).href.replace(/^https?:\/\//u, "").replace(/\/$/u, "");
|
|
36
|
+
const r = /^(?:ssh:\/\/)?git@([^/:]+)[:/](.+)$/u.exec(e);
|
|
37
|
+
if (r !== null)
|
|
38
|
+
return `${r[1]}/${r[2]}`;
|
|
39
|
+
throw new Error(`Unsupported Git remote URL: ${o}`);
|
|
37
40
|
}
|
|
38
41
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
w as
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
g as a,
|
|
43
|
+
$ as b,
|
|
44
|
+
w as c,
|
|
45
|
+
h as g,
|
|
46
|
+
v as p,
|
|
47
|
+
f as s
|
|
44
48
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { findPath as
|
|
3
|
-
import { toPosixPathSeparators as
|
|
4
|
-
import { retrievePackageJson as
|
|
5
|
-
import { b as
|
|
1
|
+
import t from "typescript";
|
|
2
|
+
import { findPath as v } from "@arcgis/node-toolkit/file";
|
|
3
|
+
import { toPosixPathSeparators as D, path as y } from "@arcgis/node-toolkit/path";
|
|
4
|
+
import { retrievePackageJson as O } from "@arcgis/node-toolkit/packageJson";
|
|
5
|
+
import { b as C, d as w } from "./cli.js";
|
|
6
6
|
function _(e) {
|
|
7
7
|
if (e.kind === "css-property")
|
|
8
8
|
return e.name;
|
|
@@ -27,45 +27,50 @@ function G(e, r = "dash") {
|
|
|
27
27
|
function J(e) {
|
|
28
28
|
if (e === void 0)
|
|
29
29
|
return {};
|
|
30
|
-
const r = P(e), o = e.parent,
|
|
30
|
+
const r = P(e), o = e.parent, i = o !== void 0 && (t.isClassLike(o) || t.isInterfaceDeclaration(o)) ? o : o !== void 0 && t.isTypeLiteralNode(o) && t.isTypeAliasDeclaration(o.parent) ? o.parent : void 0, n = i?.name === void 0 ? void 0 : L(i, i.name.text);
|
|
31
31
|
return {
|
|
32
32
|
...r === void 0 ? {} : { kind: r },
|
|
33
|
-
...
|
|
33
|
+
...n === void 0 ? {} : { memberOf: n }
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function L(e, r) {
|
|
37
37
|
const o = [];
|
|
38
|
-
for (let
|
|
39
|
-
if (
|
|
38
|
+
for (let i = e?.parent; i !== void 0; i = i.parent) {
|
|
39
|
+
if (t.isClassLike(i) || t.isInterfaceDeclaration(i) || t.isTypeLiteralNode(i))
|
|
40
40
|
return r;
|
|
41
|
-
|
|
41
|
+
t.isModuleDeclaration(i) && t.isIdentifier(i.name) && o.unshift(i.name.text);
|
|
42
42
|
}
|
|
43
43
|
return [...o, r].join(".");
|
|
44
44
|
}
|
|
45
45
|
function P(e) {
|
|
46
|
-
if (
|
|
46
|
+
if (t.isPropertyDeclaration(e) || t.isPropertySignature(e))
|
|
47
|
+
return (t.getCombinedModifierFlags(e) & t.ModifierFlags.Readonly) !== 0 && M(e) ? "method" : "field";
|
|
48
|
+
if (t.isGetAccessorDeclaration(e) || t.isSetAccessorDeclaration(e))
|
|
47
49
|
return "field";
|
|
48
|
-
if (
|
|
50
|
+
if (t.isMethodDeclaration(e) || t.isMethodSignature(e))
|
|
49
51
|
return "method";
|
|
50
|
-
if (
|
|
52
|
+
if (t.isClassLike(e))
|
|
51
53
|
return "class";
|
|
52
|
-
if (
|
|
54
|
+
if (t.isInterfaceDeclaration(e))
|
|
53
55
|
return "interface";
|
|
54
|
-
if (
|
|
56
|
+
if (t.isTypeAliasDeclaration(e))
|
|
55
57
|
return "type";
|
|
56
|
-
if (
|
|
58
|
+
if (t.isFunctionDeclaration(e))
|
|
57
59
|
return "function";
|
|
58
|
-
if (
|
|
59
|
-
return "variable";
|
|
60
|
-
if (
|
|
60
|
+
if (t.isVariableDeclaration(e))
|
|
61
|
+
return M(e) && (e.type !== void 0 || (e.parent.flags & t.NodeFlags.Const) !== 0) ? "function" : "variable";
|
|
62
|
+
if (t.isModuleDeclaration(e))
|
|
61
63
|
return "namespace";
|
|
62
64
|
}
|
|
63
|
-
|
|
65
|
+
function M(e) {
|
|
66
|
+
return e.type !== void 0 ? t.isFunctionTypeNode(e.type) : !t.isPropertySignature(e) && e.initializer !== void 0 && t.isArrowFunction(e.initializer);
|
|
67
|
+
}
|
|
68
|
+
const H = /* @__PURE__ */ new Map([
|
|
64
69
|
["MapView", "arcgis-map"],
|
|
65
70
|
["SceneView", "arcgis-scene"],
|
|
66
71
|
["LinkChartView", "arcgis-link-chart"],
|
|
67
72
|
["VideoView", "arcgis-video"]
|
|
68
|
-
]),
|
|
73
|
+
]), A = /* @__PURE__ */ new Set([
|
|
69
74
|
"MessageBundleLoader",
|
|
70
75
|
"createJSONLoader",
|
|
71
76
|
"fetchMessageBundle",
|
|
@@ -113,16 +118,18 @@ const C = /* @__PURE__ */ new Map([
|
|
|
113
118
|
"TableList",
|
|
114
119
|
"useLegacyCreateTools"
|
|
115
120
|
]);
|
|
116
|
-
function
|
|
121
|
+
function V({
|
|
117
122
|
package: e,
|
|
118
123
|
name: r,
|
|
119
124
|
category: o,
|
|
120
|
-
memberOf:
|
|
121
|
-
module:
|
|
122
|
-
deprecated:
|
|
125
|
+
memberOf: i,
|
|
126
|
+
module: n,
|
|
127
|
+
deprecated: c
|
|
123
128
|
}) {
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
if (o !== void 0)
|
|
130
|
+
return o;
|
|
131
|
+
const u = e.toLowerCase(), s = typeof c == "string" ? c.toLowerCase() : "";
|
|
132
|
+
return e === "@arcgis/core" && r === "ui" && [
|
|
126
133
|
"DOMContainer",
|
|
127
134
|
"DOMContainerProperties",
|
|
128
135
|
"MapView",
|
|
@@ -133,71 +140,78 @@ function B({
|
|
|
133
140
|
"LinkChartViewProperties",
|
|
134
141
|
"VideoView",
|
|
135
142
|
"VideoViewProperties"
|
|
136
|
-
].includes(
|
|
143
|
+
].includes(i?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && ($.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" && (A.has(r) || s.includes("widget translations")) ? "coreIntl" : u.includes("calcite") ? "calcite" : /^@arcgis\/.+components/u.test(u) ? "arcgisComponents" : e === "@arcgis/core" ? "arcgisCore" : u.startsWith("@arcgis/") ? "arcgisSupport" : C(e) ? "otherEsri" : "nonEsri";
|
|
137
144
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
145
|
+
function K(e, r) {
|
|
146
|
+
return B(x(e, r));
|
|
140
147
|
}
|
|
141
|
-
function
|
|
148
|
+
function B(e) {
|
|
142
149
|
return e?.replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
|
|
143
150
|
}
|
|
144
|
-
const
|
|
151
|
+
const b = /^(?:src|dist)\//u;
|
|
145
152
|
function x(e, r) {
|
|
146
|
-
const o = `/node_modules/${r}/`,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
const o = `/node_modules/${r}/`, i = e.map(D).sort(
|
|
154
|
+
(n, c) => Number(c.includes(o)) - Number(n.includes(o)) || n.localeCompare(c)
|
|
155
|
+
);
|
|
156
|
+
for (const n of i) {
|
|
157
|
+
const c = n.lastIndexOf(o);
|
|
158
|
+
if (c !== -1)
|
|
159
|
+
return n.slice(c + o.length).replace(b, "").replace(h, "");
|
|
160
|
+
const u = [...n.matchAll(/\/(?:src|dist)(?=\/)/gu)];
|
|
161
|
+
if (u.length === 1) {
|
|
162
|
+
const d = u[0];
|
|
163
|
+
return n.slice(d.index + d[0].length + 1).replace(h, "");
|
|
155
164
|
}
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
165
|
+
const s = v("package.json", y.dirname(n));
|
|
166
|
+
if (s === void 0)
|
|
158
167
|
continue;
|
|
159
|
-
const a =
|
|
160
|
-
if (
|
|
161
|
-
return y
|
|
168
|
+
const a = y.dirname(s);
|
|
169
|
+
if (O(a).name === r)
|
|
170
|
+
return D(y.relative(a, n)).replace(b, "").replace(h, "");
|
|
162
171
|
}
|
|
163
172
|
}
|
|
164
|
-
const
|
|
165
|
-
function
|
|
166
|
-
const o = Map.groupBy(e, (
|
|
167
|
-
return Object.keys(
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
173
|
+
const h = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
|
|
174
|
+
function q(e, r) {
|
|
175
|
+
const o = Map.groupBy(e, (i) => V(r(i)));
|
|
176
|
+
return Object.keys(w).flatMap((i) => {
|
|
177
|
+
const n = o.get(i);
|
|
178
|
+
if (n === void 0)
|
|
170
179
|
return [];
|
|
171
|
-
const
|
|
172
|
-
const a = r(
|
|
180
|
+
const u = [...Map.groupBy(n, (s) => {
|
|
181
|
+
const a = r(s);
|
|
173
182
|
return T(a.package, a.module);
|
|
174
|
-
})].map(([
|
|
175
|
-
const d = r(a[0]).package,
|
|
176
|
-
const
|
|
177
|
-
return JSON.stringify([
|
|
178
|
-
}).values()].map((
|
|
179
|
-
const
|
|
180
|
-
return { name:
|
|
183
|
+
})].map(([s, a]) => {
|
|
184
|
+
const d = r(a[0]).package, S = [...Map.groupBy(a, (m) => {
|
|
185
|
+
const l = r(m);
|
|
186
|
+
return JSON.stringify([l.name, l.memberOf, l.kind]);
|
|
187
|
+
}).values()].map((m) => {
|
|
188
|
+
const l = r(m[0]).name, f = m.map((p) => r(p).deprecated).filter((p) => typeof p == "string" && p !== ""), g = [...new Set(f)].sort((p, k) => p.localeCompare(k));
|
|
189
|
+
return { name: l, reasons: g, items: m };
|
|
181
190
|
});
|
|
182
|
-
return
|
|
191
|
+
return S.sort((m, l) => {
|
|
192
|
+
const f = r(m.items[0]), g = r(l.items[0]);
|
|
193
|
+
return l.items.length - m.items.length || m.name.localeCompare(l.name) || (f.memberOf ?? "").localeCompare(g.memberOf ?? "") || (f.kind ?? "").localeCompare(g.kind ?? "");
|
|
194
|
+
}), { packageName: d, displayName: s, count: a.length, apis: S };
|
|
183
195
|
});
|
|
184
|
-
return
|
|
196
|
+
return u.sort(
|
|
197
|
+
(s, a) => a.count - s.count || s.packageName.localeCompare(a.packageName) || s.displayName.localeCompare(a.displayName)
|
|
198
|
+
), [{ categoryName: i, count: n.length, packages: u }];
|
|
185
199
|
});
|
|
186
200
|
}
|
|
187
201
|
function T(e, r) {
|
|
188
|
-
return
|
|
202
|
+
return F(e, r) ? "DOM / Web platform" : e;
|
|
189
203
|
}
|
|
190
|
-
function
|
|
204
|
+
function F(e, r) {
|
|
191
205
|
return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
|
|
192
206
|
}
|
|
193
207
|
export {
|
|
194
|
-
|
|
208
|
+
K as a,
|
|
195
209
|
_ as b,
|
|
196
|
-
|
|
210
|
+
V as c,
|
|
197
211
|
G as d,
|
|
198
212
|
J as e,
|
|
199
213
|
L as f,
|
|
200
|
-
|
|
201
|
-
|
|
214
|
+
q as g,
|
|
215
|
+
H as h,
|
|
202
216
|
T as i
|
|
203
217
|
};
|