@arcgis/codemod 6.0.0-next.3 → 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 +168 -126
- package/dist/chunks/cli.js +394 -228
- package/dist/chunks/codemod5.js +0 -1
- package/dist/chunks/codemod7.js +1214 -1232
- package/dist/chunks/componentAudit.js +272 -0
- package/dist/chunks/format.js +140 -112
- package/dist/chunks/index.js +1087 -312
- package/dist/chunks/index2.js +112 -99
- package/dist/chunks/index3.js +351 -0
- package/dist/chunks/legacyCompatibility.js +210 -0
- package/dist/chunks/sync.js +146 -142
- package/dist/chunks/syncMarkdown.js +42 -0
- package/dist/chunks/useProjectInstance.js +27 -24
- package/package.json +8 -5
- package/dist/chunks/hardcodedBehavior.js +0 -63
|
@@ -1,95 +1,116 @@
|
|
|
1
|
-
import { findPath as
|
|
2
|
-
import { path as
|
|
3
|
-
import { collectOutputSync as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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";
|
|
7
|
+
import { b as C, d as P } from "./cli.js";
|
|
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")
|
|
10
16
|
throw new Error("Invalid deprecation audit JSON.");
|
|
11
|
-
return
|
|
17
|
+
return r;
|
|
12
18
|
}
|
|
13
|
-
function
|
|
14
|
-
const e =
|
|
19
|
+
function Q() {
|
|
20
|
+
const e = b(".git");
|
|
15
21
|
if (e === void 0)
|
|
16
22
|
throw new Error("Unable to find a Git repository for the deprecation audit.");
|
|
17
|
-
const
|
|
18
|
-
return { repository: A(
|
|
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));
|
|
19
28
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
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)));
|
|
22
34
|
}
|
|
23
|
-
function
|
|
35
|
+
function Z(e, r, t, o) {
|
|
24
36
|
const n = e === "usages" ? "usage" : "definition";
|
|
25
37
|
process.stderr.write(
|
|
26
|
-
`Deprecations: ${
|
|
38
|
+
`Deprecations: ${r} ${n}${r === 1 ? "" : "s"} across ${t} file${t === 1 ? "" : "s"} from ${o} package${o === 1 ? "" : "s"}.
|
|
27
39
|
`
|
|
28
40
|
);
|
|
29
41
|
}
|
|
30
42
|
function A(e) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return new URL(
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
return `${
|
|
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]}`;
|
|
37
49
|
throw new Error(`Unsupported Git remote URL: ${e}`);
|
|
38
50
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
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;
|
|
42
68
|
}
|
|
43
|
-
function
|
|
44
|
-
return e === void 0 || e === "
|
|
69
|
+
function re(e, r = "dash") {
|
|
70
|
+
return e === void 0 || e === "field" || e === "method" || e === "function" ? "" : r === "parentheses" ? ` (${e})` : ` - ${e}`;
|
|
45
71
|
}
|
|
46
|
-
function
|
|
72
|
+
function te(e) {
|
|
47
73
|
if (e === void 0)
|
|
48
74
|
return {};
|
|
49
|
-
const
|
|
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);
|
|
50
76
|
return {
|
|
51
|
-
...
|
|
77
|
+
...r === void 0 ? {} : { kind: r },
|
|
52
78
|
...n === void 0 ? {} : { memberOf: n }
|
|
53
79
|
};
|
|
54
80
|
}
|
|
55
|
-
function L(e,
|
|
56
|
-
const
|
|
57
|
-
for (let
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
60
|
-
|
|
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);
|
|
61
87
|
}
|
|
62
|
-
return [...
|
|
88
|
+
return [...t, r].join(".");
|
|
63
89
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
return "
|
|
67
|
-
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))
|
|
94
|
+
return "field";
|
|
95
|
+
if (i.isMethodDeclaration(e) || i.isMethodSignature(e))
|
|
68
96
|
return "method";
|
|
69
|
-
if (
|
|
97
|
+
if (i.isClassLike(e))
|
|
70
98
|
return "class";
|
|
71
|
-
if (
|
|
99
|
+
if (i.isInterfaceDeclaration(e))
|
|
72
100
|
return "interface";
|
|
73
|
-
if (
|
|
101
|
+
if (i.isTypeAliasDeclaration(e))
|
|
74
102
|
return "type";
|
|
75
|
-
if (
|
|
103
|
+
if (i.isFunctionDeclaration(e))
|
|
76
104
|
return "function";
|
|
77
|
-
if (
|
|
78
|
-
return "variable";
|
|
79
|
-
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))
|
|
80
108
|
return "namespace";
|
|
81
109
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
usages: "The following deprecated APIs are used in files owned by assigned CODEOWNERS. Refactor them before the APIs are removed.",
|
|
87
|
-
definitions: "The following deprecated APIs are owned by assigned CODEOWNERS. Remove them in the next breaking changes release."
|
|
88
|
-
}, Y = "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.", Z = "Task", ee = "deprecations sync-issues";
|
|
89
|
-
function k(e) {
|
|
90
|
-
return C.test(e);
|
|
91
|
-
}
|
|
92
|
-
const $ = /* @__PURE__ */ new Map([
|
|
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([
|
|
93
114
|
["MapView", "arcgis-map"],
|
|
94
115
|
["SceneView", "arcgis-scene"],
|
|
95
116
|
["LinkChartView", "arcgis-link-chart"],
|
|
@@ -101,7 +122,7 @@ const $ = /* @__PURE__ */ new Map([
|
|
|
101
122
|
"messageBundle",
|
|
102
123
|
"normalizeMessageBundleLocale",
|
|
103
124
|
"registerMessageBundleLoader"
|
|
104
|
-
]),
|
|
125
|
+
]), E = /* @__PURE__ */ new Set([
|
|
105
126
|
"AreaMeasurement2D",
|
|
106
127
|
"AreaMeasurement3D",
|
|
107
128
|
"BasemapGallery",
|
|
@@ -142,16 +163,18 @@ const $ = /* @__PURE__ */ new Map([
|
|
|
142
163
|
"TableList",
|
|
143
164
|
"useLegacyCreateTools"
|
|
144
165
|
]);
|
|
145
|
-
function
|
|
166
|
+
function F({
|
|
146
167
|
package: e,
|
|
147
|
-
|
|
148
|
-
category:
|
|
149
|
-
memberOf:
|
|
168
|
+
name: r,
|
|
169
|
+
category: t,
|
|
170
|
+
memberOf: o,
|
|
150
171
|
module: n,
|
|
151
|
-
|
|
172
|
+
deprecated: u
|
|
152
173
|
}) {
|
|
153
|
-
|
|
154
|
-
|
|
174
|
+
if (t !== void 0)
|
|
175
|
+
return t;
|
|
176
|
+
const a = e.toLowerCase(), s = typeof u == "string" ? u.toLowerCase() : "";
|
|
177
|
+
return e === "@arcgis/core" && r === "ui" && [
|
|
155
178
|
"DOMContainer",
|
|
156
179
|
"DOMContainerProperties",
|
|
157
180
|
"MapView",
|
|
@@ -162,71 +185,90 @@ function B({
|
|
|
162
185
|
"LinkChartViewProperties",
|
|
163
186
|
"VideoView",
|
|
164
187
|
"VideoViewProperties"
|
|
165
|
-
].includes(
|
|
166
|
-
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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";
|
|
189
|
+
}
|
|
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)
|
|
193
|
+
);
|
|
194
|
+
for (const n of o) {
|
|
195
|
+
const u = n.lastIndexOf(t);
|
|
196
|
+
let a;
|
|
197
|
+
if (u !== -1)
|
|
198
|
+
a = n.slice(u + t.length);
|
|
199
|
+
else {
|
|
200
|
+
const s = [...n.matchAll(/\/(?:src|dist)(?=\/)/gu)];
|
|
201
|
+
if (s.length === 1)
|
|
202
|
+
a = n.slice(s[0].index + 1);
|
|
203
|
+
else {
|
|
204
|
+
const c = b("package.json", d.dirname(n));
|
|
205
|
+
if (c === void 0)
|
|
206
|
+
continue;
|
|
207
|
+
const y = d.dirname(c);
|
|
208
|
+
if (O(y).name !== r)
|
|
209
|
+
continue;
|
|
210
|
+
a = f(d.relative(y, n));
|
|
211
|
+
}
|
|
183
212
|
}
|
|
184
|
-
|
|
185
|
-
if (o === void 0)
|
|
186
|
-
continue;
|
|
187
|
-
const c = g.dirname(o);
|
|
188
|
-
if (P(c).name === t)
|
|
189
|
-
return h(g.relative(c, n)).replace(/^(?:src|dist)\//u, "").replace(f, "");
|
|
213
|
+
return a.startsWith("src/") ? T(a) : R(a);
|
|
190
214
|
}
|
|
191
215
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
216
|
+
function T(e) {
|
|
217
|
+
return f(e).replace(/^src\//u, "").replace(k, "");
|
|
218
|
+
}
|
|
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);
|
|
197
227
|
if (n === void 0)
|
|
198
228
|
return [];
|
|
199
|
-
const a = [...Map.groupBy(n, (
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
return
|
|
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 };
|
|
206
239
|
});
|
|
207
|
-
return
|
|
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 };
|
|
208
244
|
});
|
|
209
|
-
return a.sort(
|
|
245
|
+
return a.sort(
|
|
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 }];
|
|
210
248
|
});
|
|
211
249
|
}
|
|
250
|
+
function x(e, r) {
|
|
251
|
+
return N(e, r) ? "DOM / Web platform" : e;
|
|
252
|
+
}
|
|
253
|
+
function N(e, r) {
|
|
254
|
+
return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
|
|
255
|
+
}
|
|
212
256
|
export {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
X as r,
|
|
231
|
-
Y as s
|
|
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
|
|
232
274
|
};
|