@arcgis/codemod 6.0.0-next.37 → 6.0.0-next.38
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/aggregateUsages.js +6 -6
- package/dist/chunks/auditDefinitions.js +85 -85
- package/dist/chunks/auditUsages.js +556 -544
- package/dist/chunks/classification.js +2 -2
- package/dist/chunks/cli.js +149 -159
- package/dist/chunks/componentAudit.js +4 -4
- package/dist/chunks/format.js +1 -1
- package/dist/chunks/legacyCompatibility.js +1 -1
- package/dist/chunks/log.js +21 -7
- package/dist/chunks/sync.js +59 -57
- package/dist/chunks/useProjectInstance.js +1 -1
- package/package.json +4 -4
package/dist/chunks/format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as D, k as P, l as K, d as w } from "./cli.js";
|
|
2
2
|
import { o as h, b as B, f, h as y } from "./classification.js";
|
|
3
3
|
import { markdownTextLimit as M, splitMarkdown as L } from "@arcgis/node-toolkit/markdown";
|
|
4
4
|
const $ = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectOutput as u } from "@arcgis/node-toolkit/shell";
|
|
2
|
-
import {
|
|
2
|
+
import { m, h as l, k as p } from "./cli.js";
|
|
3
3
|
import { log as f } from "@arcgis/toolkit/log";
|
|
4
4
|
const g = /^( (?:- )?https:\/\/[^/\s]+\/[^/\s]+\/[^/\s]+\/blob\/)[a-f0-9]{40}(\/\S+#L\d+)$/gmu;
|
|
5
5
|
class v {
|
package/dist/chunks/log.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import { path as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { path as o } from "@arcgis/node-toolkit/path";
|
|
2
|
+
import { log as a } from "@arcgis/toolkit/log";
|
|
3
|
+
function c(e) {
|
|
4
|
+
if (e)
|
|
5
|
+
return;
|
|
6
|
+
const r = "Review scan warnings above. This may indicate an unsupported pattern or a bug in @arcgis/codemod; report it to the WebGIS SDK team with a reproduction and log output. Stale deprecation issues won't be closed as results may be incomplete.";
|
|
7
|
+
if (a("error", "@arcgis/codemod", r), process.env.GITHUB_ACTIONS === "true") {
|
|
8
|
+
const t = r.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll(`
|
|
9
|
+
`, "%0A");
|
|
10
|
+
process.stderr.write(`::error::${t}
|
|
11
|
+
`);
|
|
12
|
+
}
|
|
13
|
+
process.exitCode = 1;
|
|
4
14
|
}
|
|
5
|
-
function
|
|
6
|
-
return e.
|
|
15
|
+
function p(e) {
|
|
16
|
+
return s(e.getFilePath());
|
|
17
|
+
}
|
|
18
|
+
function s(e) {
|
|
19
|
+
return o.relative(process.cwd(), e);
|
|
7
20
|
}
|
|
8
21
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
p as a,
|
|
23
|
+
s as f,
|
|
24
|
+
c as r
|
|
11
25
|
};
|
package/dist/chunks/sync.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { readFile as
|
|
2
|
-
import { log as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import B from "
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { readFile as j } from "node:fs/promises";
|
|
2
|
+
import { log as l } from "@arcgis/toolkit/log";
|
|
3
|
+
import { r as M } from "./log.js";
|
|
4
|
+
import { n as x } from "./classification.js";
|
|
5
|
+
import { h as d } from "./cli.js";
|
|
6
|
+
import { c as O, a as N, p as C, b as v } from "./format.js";
|
|
7
|
+
import { G as R, l as T, n as I, s as z, p as B, a as D, i as G } from "./legacyCompatibility.js";
|
|
8
|
+
import P from "picomatch";
|
|
9
|
+
import { parse as U } from "yaml";
|
|
10
|
+
function q(s) {
|
|
11
|
+
const e = U(s);
|
|
11
12
|
if (typeof e != "object" || e === null || Array.isArray(e))
|
|
12
13
|
throw new Error("Expected a label-to-rule mapping in the labeler config.");
|
|
13
14
|
const r = [];
|
|
@@ -15,13 +16,13 @@ function G(s) {
|
|
|
15
16
|
try {
|
|
16
17
|
r.push({ label: n, matches: S(t) });
|
|
17
18
|
} catch (o) {
|
|
18
|
-
|
|
19
|
+
l("warn", d, `Skipping labeler rule for ${n}: ${String(o)}`);
|
|
19
20
|
}
|
|
20
21
|
return (n) => r.filter(({ matches: t }) => n.some(t)).map(({ label: t }) => t);
|
|
21
22
|
}
|
|
22
23
|
function S(s, e = !1) {
|
|
23
24
|
if (typeof s == "string") {
|
|
24
|
-
const n =
|
|
25
|
+
const n = P(s, { dot: !0 });
|
|
25
26
|
return (t) => n(t);
|
|
26
27
|
}
|
|
27
28
|
if (Array.isArray(s))
|
|
@@ -51,62 +52,63 @@ function h(s, e) {
|
|
|
51
52
|
const n = r.map((t) => S(t, e));
|
|
52
53
|
return (t) => e ? n.every((o) => o(t)) : n.some((o) => o(t));
|
|
53
54
|
}
|
|
54
|
-
async function
|
|
55
|
-
const { labels: o = [], closeResolved: c = !1 } = t, p =
|
|
56
|
-
e && process.stdout.write(`${[
|
|
55
|
+
async function oe(s, e, r = 0, n, t = {}) {
|
|
56
|
+
const { labels: o = [], closeResolved: c = !1 } = t, p = x(await j(s, "utf8")), g = c && H(p, r, n), m = new R(p.repository, e), y = await F(m, p.ref), b = W(O(p, y), r, n), a = await Y(b, m, o, g ? p.auditKind : void 0);
|
|
57
|
+
e && process.stdout.write(`${[J(b), ...a].filter(Boolean).join(`
|
|
57
58
|
`)}
|
|
58
|
-
`);
|
|
59
|
+
`), c && M(g);
|
|
59
60
|
}
|
|
60
|
-
async function
|
|
61
|
+
async function F(s, e) {
|
|
61
62
|
try {
|
|
62
63
|
const r = await s.readLabelerConfig(e);
|
|
63
|
-
return r === void 0 ? void 0 :
|
|
64
|
+
return r === void 0 ? void 0 : q(r);
|
|
64
65
|
} catch (r) {
|
|
65
|
-
|
|
66
|
+
l("warn", d, `Skipping labeling based on .github/labeler.yml due to an error: ${String(r)}`);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function H(s, e, r) {
|
|
70
71
|
if (e !== 0 || r !== void 0)
|
|
71
72
|
throw new Error("--close-resolved cannot be used with --offset or --limit.");
|
|
72
|
-
return s.complete !== !0 ? (
|
|
73
|
+
return s.complete !== !0 ? (l(
|
|
73
74
|
"warn",
|
|
74
75
|
d,
|
|
75
76
|
"Skipping --close-resolved: the report is not a complete, unfiltered repository-root audit. Issue creation and updates will continue."
|
|
76
77
|
), !1) : !0;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function W(s, e, r) {
|
|
79
80
|
return s.slice(e, r === void 0 ? void 0 : e + r);
|
|
80
81
|
}
|
|
81
|
-
async function
|
|
82
|
-
await
|
|
83
|
-
const t = n ??
|
|
82
|
+
async function Y(s, e, r = [], n) {
|
|
83
|
+
await K(s, e, r);
|
|
84
|
+
const t = n ?? w(s[0]?.chunks[0] ?? null)?.kind, o = t === void 0 ? [] : [...await e.listOpenIssues(N[t]), ...await T(e)], c = [...new Map(o.map((a) => [a.number, a])).values()], p = n === void 0 ? [] : c.filter((a) => w(a.body)?.kind === n), g = s.map((a) => ({ plan: a, issues: Q(c, a) })), m = /* @__PURE__ */ new Set();
|
|
84
85
|
for (const a of g) {
|
|
85
86
|
const { plan: i } = a;
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
await
|
|
90
|
-
const
|
|
91
|
-
return
|
|
87
|
+
let f = a.issues[0];
|
|
88
|
+
f === void 0 ? (f = await e.createIssue(i.title, i.chunks[0], i.assignees, []), e.dryRun || l("info", d, `Created issue #${f.number}: ${i.title}`)) : I(f.body) !== I(i.chunks[0]) && (await e.updateIssueBody(f.number, i.chunks[0]), e.dryRun || l("info", d, `Updated issue #${f.number}: ${i.title}`));
|
|
89
|
+
const k = f.number, A = w(i.chunks[0]);
|
|
90
|
+
await z(e, k, i.chunks.slice(1), (u) => {
|
|
91
|
+
const $ = C(u);
|
|
92
|
+
return $?.kind === A?.kind && $?.owners.join(",") === i.owners.join(",") || G(u, i.owners);
|
|
92
93
|
});
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
94
|
+
const E = new Set(f.labels.map(({ name: u }) => u.toLowerCase())), L = i.labels.filter((u) => !E.has(u.toLowerCase()));
|
|
95
|
+
if (L.length > 0)
|
|
95
96
|
try {
|
|
96
|
-
await e.addLabels(
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
97
|
+
await e.addLabels(k, L);
|
|
98
|
+
} catch (u) {
|
|
99
|
+
l("warn", d, `Unable to add labels to issue #${k}: ${String(u)}`);
|
|
99
100
|
}
|
|
100
|
-
m.add(
|
|
101
|
-
for (const
|
|
102
|
-
m.add(
|
|
101
|
+
m.add(k);
|
|
102
|
+
for (const u of a.issues)
|
|
103
|
+
m.add(u.number);
|
|
103
104
|
i.changes.push(...e.changes.splice(0));
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const y = p.filter((a) => !m.has(a.number)), b = y.length === 0 ? void 0 : (await e.listLabels()).find((a) => a.toLowerCase() === "8-verified");
|
|
107
|
+
for (const a of y)
|
|
108
|
+
b !== void 0 && !a.labels.some(({ name: i }) => i.toLowerCase() === "8-verified") && await e.addLabels(a.number, [b]), await e.closeIssue(a.number), e.dryRun || l("info", d, `Closed stale issue #${a.number}: ${a.title}`);
|
|
107
109
|
return e.changes.splice(0);
|
|
108
110
|
}
|
|
109
|
-
function
|
|
111
|
+
function J(s) {
|
|
110
112
|
return s.map(
|
|
111
113
|
(e) => `ACTIONS: ${e.changes.length === 0 ? "No changes" : e.changes.join("; ")}
|
|
112
114
|
|
|
@@ -123,13 +125,13 @@ ${r}`).join(`
|
|
|
123
125
|
|
|
124
126
|
`);
|
|
125
127
|
}
|
|
126
|
-
async function
|
|
128
|
+
async function K(s, e, r) {
|
|
127
129
|
const n = new Set(s.flatMap((t) => [...r, ...t.labels]));
|
|
128
130
|
if (n.size !== 0)
|
|
129
131
|
try {
|
|
130
132
|
const t = new Map((await e.listLabels()).map((o) => [o.toLowerCase(), o]));
|
|
131
133
|
for (const o of n)
|
|
132
|
-
t.has(o.toLowerCase()) ||
|
|
134
|
+
t.has(o.toLowerCase()) || l(
|
|
133
135
|
"warn",
|
|
134
136
|
d,
|
|
135
137
|
`.github/labeler.yml specifies a label that doesn't exist in the repository. Skipping: ${o}`
|
|
@@ -139,30 +141,30 @@ async function W(s, e, r) {
|
|
|
139
141
|
...new Set([...r, ...o.labels].flatMap((c) => t.get(c.toLowerCase()) ?? []))
|
|
140
142
|
];
|
|
141
143
|
} catch (t) {
|
|
142
|
-
|
|
144
|
+
l("warn", d, `Skipping labels: unable to read repository labels: ${String(t)}`);
|
|
143
145
|
for (const o of s)
|
|
144
146
|
o.labels = [];
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
function
|
|
148
|
-
const r =
|
|
149
|
+
function Q(s, e) {
|
|
150
|
+
const r = w(e.chunks[0]);
|
|
149
151
|
if (r === void 0)
|
|
150
152
|
throw new Error("Expected an audit marker in issue plan.");
|
|
151
|
-
const n =
|
|
153
|
+
const n = v(r.owners, r.kind);
|
|
152
154
|
for (const o of s)
|
|
153
|
-
|
|
155
|
+
D(o, r.owners);
|
|
154
156
|
return s.filter((o) => {
|
|
155
|
-
const c =
|
|
156
|
-
return c !== void 0 &&
|
|
157
|
+
const c = w(o.body);
|
|
158
|
+
return c !== void 0 && v(c.owners, c.kind) === n;
|
|
157
159
|
}).sort((o, c) => o.number - c.number);
|
|
158
160
|
}
|
|
159
|
-
function
|
|
160
|
-
const e =
|
|
161
|
+
function w(s) {
|
|
162
|
+
const e = C(s) ?? B(s);
|
|
161
163
|
return e?.kind === void 0 ? void 0 : { kind: e.kind, owners: e.owners };
|
|
162
164
|
}
|
|
163
165
|
export {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
J as formatDryRun,
|
|
167
|
+
W as sliceIssuePlans,
|
|
168
|
+
oe as syncDeprecationIssues,
|
|
169
|
+
Y as synchronizeIssuePlans
|
|
168
170
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Project as p } from "ts-morph";
|
|
2
|
-
import { g as t,
|
|
2
|
+
import { g as t, f as a, i as m } from "./cli.js";
|
|
3
3
|
import { log as g } from "@arcgis/toolkit/log";
|
|
4
4
|
import { path as u } from "@arcgis/node-toolkit/path";
|
|
5
5
|
import { styleText as n } from "node:util";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/codemod",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.38",
|
|
4
4
|
"description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@arcgis/api-extractor": "6.0.0-next.
|
|
15
|
-
"@arcgis/node-toolkit": "6.0.0-next.
|
|
16
|
-
"@arcgis/toolkit": "6.0.0-next.
|
|
14
|
+
"@arcgis/api-extractor": "6.0.0-next.38",
|
|
15
|
+
"@arcgis/node-toolkit": "6.0.0-next.38",
|
|
16
|
+
"@arcgis/toolkit": "6.0.0-next.38",
|
|
17
17
|
"@commander-js/extra-typings": "^15.1.0",
|
|
18
18
|
"commander": "^15.1.0",
|
|
19
19
|
"picomatch": "^4.0.4",
|