@arcgis/codemod 6.0.0-next.3 → 6.0.0-next.30
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 +48 -0
- package/dist/chunks/classification.js +131 -141
- package/dist/chunks/cli.js +388 -223
- package/dist/chunks/codemod5.js +0 -1
- package/dist/chunks/codemod7.js +1214 -1232
- package/dist/chunks/componentAudit.js +258 -0
- package/dist/chunks/format.js +109 -105
- package/dist/chunks/github.js +124 -0
- package/dist/chunks/index.js +919 -308
- package/dist/chunks/index2.js +116 -103
- package/dist/chunks/index3.js +342 -0
- package/dist/chunks/sync.js +44 -142
- package/dist/chunks/syncMarkdown.js +32 -0
- package/dist/chunks/useProjectInstance.js +27 -24
- package/package.json +7 -5
- package/dist/chunks/hardcodedBehavior.js +0 -63
|
@@ -0,0 +1,48 @@
|
|
|
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.30";
|
|
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")
|
|
12
|
+
throw new Error("Invalid deprecation audit JSON.");
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
function h() {
|
|
16
|
+
const o = c(".git");
|
|
17
|
+
if (o === void 0)
|
|
18
|
+
throw new Error("Unable to find a Git repository for the deprecation audit.");
|
|
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 };
|
|
21
|
+
}
|
|
22
|
+
function g(o, e) {
|
|
23
|
+
return p(s.relative(e, o));
|
|
24
|
+
}
|
|
25
|
+
function v(o, e, r, n) {
|
|
26
|
+
const a = o === "usages" ? "usage" : "definition";
|
|
27
|
+
process.stderr.write(
|
|
28
|
+
`Deprecations: ${e} ${a}${e === 1 ? "" : "s"} across ${r} file${r === 1 ? "" : "s"} from ${n} package${n === 1 ? "" : "s"}.
|
|
29
|
+
`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
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}`);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
g as a,
|
|
43
|
+
$ as b,
|
|
44
|
+
w as c,
|
|
45
|
+
h as g,
|
|
46
|
+
v as p,
|
|
47
|
+
f as s
|
|
48
|
+
};
|
|
@@ -1,107 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
function K(e, t, r, i) {
|
|
24
|
-
const n = e === "usages" ? "usage" : "definition";
|
|
25
|
-
process.stderr.write(
|
|
26
|
-
`Deprecations: ${t} ${n}${t === 1 ? "" : "s"} across ${r} file${r === 1 ? "" : "s"} from ${i} package${i === 1 ? "" : "s"}.
|
|
27
|
-
`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
function A(e) {
|
|
31
|
-
const t = e.replace(/\.git$/u, "");
|
|
32
|
-
if (t.startsWith("http://") || t.startsWith("https://"))
|
|
33
|
-
return new URL(t).href.replace(/^https?:\/\//u, "").replace(/\/$/u, "");
|
|
34
|
-
const r = /^(?:ssh:\/\/)?git@([^/:]+)[:/](.+)$/u.exec(t);
|
|
35
|
-
if (r !== null)
|
|
36
|
-
return `${r[1]}/${r[2]}`;
|
|
37
|
-
throw new Error(`Unsupported Git remote URL: ${e}`);
|
|
38
|
-
}
|
|
39
|
-
function _(e) {
|
|
40
|
-
const t = e.memberOf === void 0 ? e.api : `${e.memberOf}.${e.api}`;
|
|
41
|
-
return e.apiKind === "method" || e.apiKind === "function" ? `${t}()` : t;
|
|
1
|
+
import t from "typescript";
|
|
2
|
+
import { findPath as k } from "@arcgis/node-toolkit/file";
|
|
3
|
+
import { toPosixPathSeparators as y, path as h } from "@arcgis/node-toolkit/path";
|
|
4
|
+
import { retrievePackageJson as v } from "@arcgis/node-toolkit/packageJson";
|
|
5
|
+
import { b as C, d as P } from "./cli.js";
|
|
6
|
+
function j(e) {
|
|
7
|
+
if (e.kind === "css-property")
|
|
8
|
+
return e.name;
|
|
9
|
+
if (e.kind === "element")
|
|
10
|
+
return `<${e.name}>`;
|
|
11
|
+
if (e.memberOf !== void 0) {
|
|
12
|
+
if (e.kind === "css-part")
|
|
13
|
+
return `${e.memberOf}::part(${e.name})`;
|
|
14
|
+
if (e.kind === "css-state")
|
|
15
|
+
return `${e.memberOf}:state(${e.name})`;
|
|
16
|
+
if (e.kind === "slot")
|
|
17
|
+
return `${e.memberOf} > [slot="${e.name}"]`;
|
|
18
|
+
if (e.kind === "attribute")
|
|
19
|
+
return `${e.memberOf}[${e.name}]`;
|
|
20
|
+
}
|
|
21
|
+
const r = e.memberOf === void 0 ? e.name : `${e.memberOf}.${e.name}`;
|
|
22
|
+
return e.kind === "method" || e.kind === "function" ? `${r}()` : r;
|
|
42
23
|
}
|
|
43
|
-
function
|
|
44
|
-
return e === void 0 || e === "
|
|
24
|
+
function _(e, r = "dash") {
|
|
25
|
+
return e === void 0 || e === "field" || e === "method" || e === "function" ? "" : r === "parentheses" ? ` (${e})` : ` - ${e}`;
|
|
45
26
|
}
|
|
46
|
-
function
|
|
27
|
+
function G(e) {
|
|
47
28
|
if (e === void 0)
|
|
48
29
|
return {};
|
|
49
|
-
const
|
|
30
|
+
const r = w(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, s = i?.name === void 0 ? void 0 : O(i, i.name.text);
|
|
50
31
|
return {
|
|
51
|
-
...
|
|
52
|
-
...
|
|
32
|
+
...r === void 0 ? {} : { kind: r },
|
|
33
|
+
...s === void 0 ? {} : { memberOf: s }
|
|
53
34
|
};
|
|
54
35
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
36
|
+
function O(e, r) {
|
|
37
|
+
const o = [];
|
|
57
38
|
for (let i = e?.parent; i !== void 0; i = i.parent) {
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
60
|
-
|
|
39
|
+
if (t.isClassLike(i) || t.isInterfaceDeclaration(i) || t.isTypeLiteralNode(i))
|
|
40
|
+
return r;
|
|
41
|
+
t.isModuleDeclaration(i) && t.isIdentifier(i.name) && o.unshift(i.name.text);
|
|
61
42
|
}
|
|
62
|
-
return [...
|
|
63
|
-
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
return "
|
|
67
|
-
if (
|
|
43
|
+
return [...o, r].join(".");
|
|
44
|
+
}
|
|
45
|
+
function w(e) {
|
|
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))
|
|
49
|
+
return "field";
|
|
50
|
+
if (t.isMethodDeclaration(e) || t.isMethodSignature(e))
|
|
68
51
|
return "method";
|
|
69
|
-
if (
|
|
52
|
+
if (t.isClassLike(e))
|
|
70
53
|
return "class";
|
|
71
|
-
if (
|
|
54
|
+
if (t.isInterfaceDeclaration(e))
|
|
72
55
|
return "interface";
|
|
73
|
-
if (
|
|
56
|
+
if (t.isTypeAliasDeclaration(e))
|
|
74
57
|
return "type";
|
|
75
|
-
if (
|
|
58
|
+
if (t.isFunctionDeclaration(e))
|
|
76
59
|
return "function";
|
|
77
|
-
if (
|
|
78
|
-
return "variable";
|
|
79
|
-
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))
|
|
80
63
|
return "namespace";
|
|
81
64
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
definitions: "Remove deprecated APIs in next breaking changes release"
|
|
85
|
-
}, X = {
|
|
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);
|
|
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);
|
|
91
67
|
}
|
|
92
|
-
const
|
|
68
|
+
const J = /* @__PURE__ */ new Map([
|
|
93
69
|
["MapView", "arcgis-map"],
|
|
94
70
|
["SceneView", "arcgis-scene"],
|
|
95
71
|
["LinkChartView", "arcgis-link-chart"],
|
|
96
72
|
["VideoView", "arcgis-video"]
|
|
97
|
-
]),
|
|
73
|
+
]), L = /* @__PURE__ */ new Set([
|
|
98
74
|
"MessageBundleLoader",
|
|
99
75
|
"createJSONLoader",
|
|
100
76
|
"fetchMessageBundle",
|
|
101
77
|
"messageBundle",
|
|
102
78
|
"normalizeMessageBundleLocale",
|
|
103
79
|
"registerMessageBundleLoader"
|
|
104
|
-
]),
|
|
80
|
+
]), A = /* @__PURE__ */ new Set([
|
|
105
81
|
"AreaMeasurement2D",
|
|
106
82
|
"AreaMeasurement3D",
|
|
107
83
|
"BasemapGallery",
|
|
@@ -142,16 +118,18 @@ const $ = /* @__PURE__ */ new Map([
|
|
|
142
118
|
"TableList",
|
|
143
119
|
"useLegacyCreateTools"
|
|
144
120
|
]);
|
|
145
|
-
function
|
|
121
|
+
function $({
|
|
146
122
|
package: e,
|
|
147
|
-
|
|
148
|
-
category:
|
|
123
|
+
name: r,
|
|
124
|
+
category: o,
|
|
149
125
|
memberOf: i,
|
|
150
|
-
module:
|
|
151
|
-
|
|
126
|
+
module: s,
|
|
127
|
+
deprecated: u
|
|
152
128
|
}) {
|
|
153
|
-
|
|
154
|
-
|
|
129
|
+
if (o !== void 0)
|
|
130
|
+
return o;
|
|
131
|
+
const a = e.toLowerCase(), n = typeof u == "string" ? u.toLowerCase() : "";
|
|
132
|
+
return e === "@arcgis/core" && r === "ui" && [
|
|
155
133
|
"DOMContainer",
|
|
156
134
|
"DOMContainerProperties",
|
|
157
135
|
"MapView",
|
|
@@ -162,71 +140,83 @@ function B({
|
|
|
162
140
|
"LinkChartViewProperties",
|
|
163
141
|
"VideoView",
|
|
164
142
|
"VideoViewProperties"
|
|
165
|
-
].includes(i?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && (
|
|
166
|
-
}
|
|
167
|
-
function te(e, t) {
|
|
168
|
-
return x(E(e, t));
|
|
143
|
+
].includes(i?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && (A.has(r) || n.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (/^(?:__esri\.)?(?:geometryEngine(?:Async)?|projection)(?:\.|$)/u.test(r) || r === "extendedSpatialReferenceInfo" || s?.startsWith("geometry/geometryEngine") || s?.startsWith("geometry/projection")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(n) ? "codemod" : e === "@arcgis/core" && (L.has(r) || n.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";
|
|
169
144
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
145
|
+
function H(e, r) {
|
|
146
|
+
const o = `/node_modules/${r}/`, i = e.map(y).sort(
|
|
147
|
+
(s, u) => Number(u.includes(o)) - Number(s.includes(o)) || s.localeCompare(u)
|
|
148
|
+
);
|
|
149
|
+
for (const s of i) {
|
|
150
|
+
const u = s.lastIndexOf(o);
|
|
151
|
+
let a;
|
|
152
|
+
if (u !== -1)
|
|
153
|
+
a = s.slice(u + o.length);
|
|
154
|
+
else {
|
|
155
|
+
const n = [...s.matchAll(/\/(?:src|dist)(?=\/)/gu)];
|
|
156
|
+
if (n.length === 1)
|
|
157
|
+
a = s.slice(n[0].index + 1);
|
|
158
|
+
else {
|
|
159
|
+
const c = k("package.json", h.dirname(s));
|
|
160
|
+
if (c === void 0)
|
|
161
|
+
continue;
|
|
162
|
+
const d = h.dirname(c);
|
|
163
|
+
if (v(d).name !== r)
|
|
164
|
+
continue;
|
|
165
|
+
a = y(h.relative(d, s));
|
|
166
|
+
}
|
|
183
167
|
}
|
|
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, "");
|
|
168
|
+
return a.startsWith("src/") ? V(a) : B(a);
|
|
190
169
|
}
|
|
191
170
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
171
|
+
function V(e) {
|
|
172
|
+
return y(e).replace(/^src\//u, "").replace(D, "");
|
|
173
|
+
}
|
|
174
|
+
function B(e) {
|
|
175
|
+
return y(e).replace(/^dist\//u, "").replace(D, "").replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
|
|
176
|
+
}
|
|
177
|
+
const D = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
|
|
178
|
+
function K(e, r) {
|
|
179
|
+
const o = Map.groupBy(e, (i) => $(r(i)));
|
|
180
|
+
return Object.keys(P).flatMap((i) => {
|
|
181
|
+
const s = o.get(i);
|
|
182
|
+
if (s === void 0)
|
|
198
183
|
return [];
|
|
199
|
-
const a = [...Map.groupBy(
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
return
|
|
184
|
+
const a = [...Map.groupBy(s, (n) => {
|
|
185
|
+
const c = r(n);
|
|
186
|
+
return T(c.package, c.module);
|
|
187
|
+
})].map(([n, c]) => {
|
|
188
|
+
const d = r(c[0]).package, S = [...Map.groupBy(c, (m) => {
|
|
189
|
+
const l = r(m);
|
|
190
|
+
return JSON.stringify([l.name, l.memberOf, l.kind]);
|
|
191
|
+
}).values()].map((m) => {
|
|
192
|
+
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, b) => p.localeCompare(b));
|
|
193
|
+
return { name: l, reasons: g, items: m };
|
|
206
194
|
});
|
|
207
|
-
return
|
|
195
|
+
return S.sort((m, l) => {
|
|
196
|
+
const f = r(m.items[0]), g = r(l.items[0]);
|
|
197
|
+
return l.items.length - m.items.length || m.name.localeCompare(l.name) || (f.memberOf ?? "").localeCompare(g.memberOf ?? "") || (f.kind ?? "").localeCompare(g.kind ?? "");
|
|
198
|
+
}), { packageName: d, displayName: n, count: c.length, apis: S };
|
|
208
199
|
});
|
|
209
|
-
return a.sort(
|
|
200
|
+
return a.sort(
|
|
201
|
+
(n, c) => c.count - n.count || n.packageName.localeCompare(c.packageName) || n.displayName.localeCompare(c.displayName)
|
|
202
|
+
), [{ categoryName: i, count: s.length, packages: a }];
|
|
210
203
|
});
|
|
211
204
|
}
|
|
205
|
+
function T(e, r) {
|
|
206
|
+
return x(e, r) ? "DOM / Web platform" : e;
|
|
207
|
+
}
|
|
208
|
+
function x(e, r) {
|
|
209
|
+
return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
|
|
210
|
+
}
|
|
212
211
|
export {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
$ as k,
|
|
224
|
-
Z as l,
|
|
225
|
-
F as m,
|
|
226
|
-
ee as n,
|
|
227
|
-
Q as o,
|
|
228
|
-
K as p,
|
|
229
|
-
q,
|
|
230
|
-
X as r,
|
|
231
|
-
Y as s
|
|
212
|
+
H as a,
|
|
213
|
+
j as b,
|
|
214
|
+
$ as c,
|
|
215
|
+
_ as d,
|
|
216
|
+
G as e,
|
|
217
|
+
O as f,
|
|
218
|
+
K as g,
|
|
219
|
+
J as h,
|
|
220
|
+
T as i,
|
|
221
|
+
V as s
|
|
232
222
|
};
|