@arcgis/codemod 6.0.0-next.37 → 6.0.0-next.39
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile as E } from "node:fs/promises";
|
|
2
|
-
import { n as M, d as h, b as j, e as C, f as k, o as J, h as
|
|
3
|
-
import {
|
|
2
|
+
import { n as M, d as h, b as j, e as C, f as k, o as J, h as b } from "./classification.js";
|
|
3
|
+
import { a as z, e as A, d as N } from "./cli.js";
|
|
4
4
|
async function B(e = {}) {
|
|
5
5
|
const n = new URL(e.url ?? z);
|
|
6
6
|
for (const s of e.repositories ?? [])
|
|
@@ -85,7 +85,7 @@ function V(e, n) {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
function P(e, n) {
|
|
88
|
-
return (!n.esriOnly ||
|
|
88
|
+
return (!n.esriOnly || A(e.package)) && (n.category === void 0 || e.category === n.category) && (n.packageName === void 0 || e.package === n.packageName);
|
|
89
89
|
}
|
|
90
90
|
function S(e) {
|
|
91
91
|
const n = [...Map.groupBy(e, ({ finding: a }) => a.package)].map(([a, i]) => {
|
|
@@ -128,7 +128,7 @@ function S(e) {
|
|
|
128
128
|
), { package: a, count: s.reduce((t, r) => t + r.count, 0), modules: s };
|
|
129
129
|
});
|
|
130
130
|
return n.sort(
|
|
131
|
-
(a, i) => Number(
|
|
131
|
+
(a, i) => Number(A(i.package)) - Number(A(a.package)) || i.count - a.count || a.package.localeCompare(i.package)
|
|
132
132
|
), n;
|
|
133
133
|
}
|
|
134
134
|
function K(e, n, a) {
|
|
@@ -281,11 +281,11 @@ function H(e, n, a) {
|
|
|
281
281
|
return i;
|
|
282
282
|
}
|
|
283
283
|
function x(e, n, a = "") {
|
|
284
|
-
const i = `${k(e)}${
|
|
284
|
+
const i = `${k(e)}${b(e.kind)}`, s = e.repositories.map(
|
|
285
285
|
({ repository: t, count: r }) => `${a} ${n ? `- \`${t}\`` : t} (${r})`
|
|
286
286
|
);
|
|
287
287
|
return n ? [
|
|
288
|
-
`${a}- \`${k(e)}\`${
|
|
288
|
+
`${a}- \`${k(e)}\`${b(e.kind)}${m(e.count)}`,
|
|
289
289
|
...s
|
|
290
290
|
] : [`${a}${i}${m(e.count)}`, ...s];
|
|
291
291
|
}
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y = (a, o) => (o = Symbol[a]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + a), S = (a) => {
|
|
2
2
|
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var b = (a, o,
|
|
4
|
+
var b = (a, o, i) => {
|
|
5
5
|
if (o != null) {
|
|
6
6
|
typeof o != "object" && typeof o != "function" && S("Object expected");
|
|
7
|
-
var n,
|
|
8
|
-
|
|
7
|
+
var n, s;
|
|
8
|
+
i && (n = o[y("asyncDispose")]), n === void 0 && (n = o[y("dispose")], i && (s = n)), typeof n != "function" && S("Object not disposable"), s && (n = function() {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
10
|
+
s.call(this);
|
|
11
|
+
} catch (r) {
|
|
12
|
+
return Promise.reject(r);
|
|
13
13
|
}
|
|
14
|
-
}), a.push([
|
|
15
|
-
} else
|
|
14
|
+
}), a.push([i, n, o]);
|
|
15
|
+
} else i && a.push([i]);
|
|
16
16
|
return o;
|
|
17
|
-
}, $ = (a, o,
|
|
18
|
-
var n = typeof SuppressedError == "function" ? SuppressedError : function(c, e,
|
|
19
|
-
return
|
|
20
|
-
},
|
|
17
|
+
}, $ = (a, o, i) => {
|
|
18
|
+
var n = typeof SuppressedError == "function" ? SuppressedError : function(c, e, m, p) {
|
|
19
|
+
return p = Error(m), p.name = "SuppressedError", p.error = c, p.suppressed = e, p;
|
|
20
|
+
}, s = (c) => o = i ? new n(c, o, "An error was suppressed during disposal") : (i = !0, c), r = (c) => {
|
|
21
21
|
for (; c = a.pop(); )
|
|
22
22
|
try {
|
|
23
23
|
var e = c[1] && c[1].call(c[2]);
|
|
24
|
-
if (c[0]) return Promise.resolve(e).then(
|
|
25
|
-
} catch (
|
|
26
|
-
|
|
24
|
+
if (c[0]) return Promise.resolve(e).then(r, (m) => (s(m), r()));
|
|
25
|
+
} catch (m) {
|
|
26
|
+
s(m);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (i) throw o;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return r();
|
|
31
31
|
};
|
|
32
|
-
import { log as
|
|
32
|
+
import { log as C } from "@arcgis/toolkit/log";
|
|
33
33
|
import { path as x } from "@arcgis/node-toolkit/path";
|
|
34
34
|
import { styleText as j } from "node:util";
|
|
35
|
-
import
|
|
36
|
-
import { f as
|
|
37
|
-
import { r as
|
|
38
|
-
import { c as
|
|
39
|
-
import { a as
|
|
40
|
-
import { loadCodeowners as
|
|
41
|
-
import { f as
|
|
42
|
-
async function
|
|
43
|
-
const n =
|
|
44
|
-
await
|
|
35
|
+
import J from "typescript";
|
|
36
|
+
import { r as I, f as v } from "./log.js";
|
|
37
|
+
import { r as L, b as z, i as E } from "./cli.js";
|
|
38
|
+
import { c as K } from "./useProjectInstance.js";
|
|
39
|
+
import { a as F, i as Q, g as h, f as V, h as W, p as q, c as B, d as G, s as H, j as U, k as X } from "./classification.js";
|
|
40
|
+
import { loadCodeowners as Y } from "@arcgis/node-toolkit/codeowners";
|
|
41
|
+
import { f as O, a as Z, e as _, b as ee } from "./componentAudit.js";
|
|
42
|
+
async function he(a, { json: o, exclude: i }) {
|
|
43
|
+
const n = await L(a), s = !n && i.length === 0 && process.cwd() === F().repositoryRoot;
|
|
44
|
+
await z(
|
|
45
45
|
{
|
|
46
46
|
meta: { needsTypeInformation: !0, needsFooter: !1, includeComponentFiles: !0 },
|
|
47
|
-
async run(
|
|
48
|
-
await
|
|
47
|
+
async run(r) {
|
|
48
|
+
await oe(r, o, s, i);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"deprecations audit-definitions",
|
|
52
|
-
|
|
53
|
-
);
|
|
52
|
+
n
|
|
53
|
+
), I(s);
|
|
54
54
|
}
|
|
55
|
-
async function
|
|
56
|
-
const
|
|
55
|
+
async function oe(a, o, i, n) {
|
|
56
|
+
const s = [], r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set(), m = _("throw"), p = F(), f = Q(n), u = (t) => E(t) && f(t) && !O(h(t, p.repositoryRoot));
|
|
57
57
|
for (const t of a) {
|
|
58
|
-
var
|
|
58
|
+
var N = [];
|
|
59
59
|
try {
|
|
60
60
|
const d = t.packageJson?.filePath;
|
|
61
|
-
if (d !== void 0 &&
|
|
62
|
-
d !== void 0 && !c.has(d) && (c.add(d),
|
|
61
|
+
if (d !== void 0 && O(h(d, p.repositoryRoot))) {
|
|
62
|
+
d !== void 0 && !c.has(d) && (c.add(d), C(
|
|
63
63
|
"warn",
|
|
64
|
-
|
|
64
|
+
v(d),
|
|
65
65
|
`Skipping excluded package \`${t.packageJson?.contents.name ?? t.cwd}\`.`
|
|
66
66
|
));
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
d !== void 0 && !e.has(d) && (e.add(d),
|
|
71
|
-
if (!t.filePaths.some(
|
|
69
|
+
const g = d === void 0 ? void 0 : await m(d);
|
|
70
|
+
d !== void 0 && !e.has(d) && (e.add(d), g !== void 0 && s.push(...g.definitions));
|
|
71
|
+
if (!t.filePaths.some(u))
|
|
72
72
|
continue;
|
|
73
|
-
const k = b(
|
|
74
|
-
const
|
|
73
|
+
const k = b(N, K(t, !1));
|
|
74
|
+
const M = t.packageJson?.contents.name ?? v(t.cwd);
|
|
75
75
|
for (const w of k.getCodemodFiles()) {
|
|
76
|
-
if (!
|
|
76
|
+
if (!u(w.compilerNode.fileName))
|
|
77
77
|
continue;
|
|
78
|
-
const D = x.dirname(w.compilerNode.fileName),
|
|
79
|
-
|
|
80
|
-
...
|
|
78
|
+
const D = x.dirname(w.compilerNode.fileName), P = r.get(D) ?? Z(D, M);
|
|
79
|
+
r.set(D, P), s.push(
|
|
80
|
+
...te(w.compilerNode, P, g?.modulePaths)
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
} catch (A) {
|
|
84
|
-
var
|
|
84
|
+
var R = A, T = !0;
|
|
85
85
|
} finally {
|
|
86
|
-
$(
|
|
86
|
+
$(N, R, T);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const l = s.filter(({ sourceFileName: t }) => f(t));
|
|
90
90
|
if (o)
|
|
91
|
-
|
|
91
|
+
ne(l, p, i, n);
|
|
92
92
|
else
|
|
93
|
-
for (const t of
|
|
93
|
+
for (const t of l) {
|
|
94
94
|
const d = j(
|
|
95
95
|
"blue",
|
|
96
|
-
`${
|
|
97
|
-
),
|
|
96
|
+
`${v(t.sourceFileName)}:${t.line}:${t.column}`
|
|
97
|
+
), g = V({
|
|
98
98
|
name: t.name,
|
|
99
99
|
memberOf: t.memberOf,
|
|
100
100
|
kind: t.kind
|
|
101
|
-
}), k =
|
|
102
|
-
|
|
101
|
+
}), k = W(t.kind, "parentheses");
|
|
102
|
+
C("warn", d, `\`${g}\`${k} is deprecated.${t.reason ? ` ${t.reason}` : ""}`);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
q(
|
|
105
105
|
"definitions",
|
|
106
|
-
|
|
107
|
-
new Set(
|
|
108
|
-
new Set(
|
|
106
|
+
l.length,
|
|
107
|
+
new Set(l.map(({ sourceFileName: t }) => t)).size,
|
|
108
|
+
new Set(l.map(({ package: t }) => t)).size
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const n = /* @__PURE__ */ new Map(),
|
|
111
|
+
function te(a, o, i) {
|
|
112
|
+
const n = /* @__PURE__ */ new Map(), s = B([a.fileName], o), r = s === void 0 ? void 0 : i?.get(s) ?? s;
|
|
113
113
|
function c(e) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
n.set(`${
|
|
114
|
+
const m = J.getJSDocDeprecatedTag(e), p = ae(e);
|
|
115
|
+
if (m !== void 0 && p !== void 0) {
|
|
116
|
+
const f = p.getStart(a), { line: u, character: l } = a.getLineAndCharacterOfPosition(f);
|
|
117
|
+
n.set(`${f}:${p.getWidth(a)}`, {
|
|
118
118
|
package: o,
|
|
119
|
-
module:
|
|
120
|
-
name:
|
|
121
|
-
...
|
|
122
|
-
reason:
|
|
119
|
+
module: r,
|
|
120
|
+
name: X(e, p.getText(a)),
|
|
121
|
+
...U(e),
|
|
122
|
+
reason: m.comment === void 0 ? void 0 : ee(m.comment),
|
|
123
123
|
sourceFileName: a.fileName,
|
|
124
|
-
line:
|
|
125
|
-
column:
|
|
124
|
+
line: u + 1,
|
|
125
|
+
column: l + 1
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
J.forEachChild(e, c);
|
|
129
129
|
}
|
|
130
|
-
return c(a), [...n.values()].sort((e,
|
|
130
|
+
return c(a), [...n.values()].sort((e, m) => e.line - m.line || e.column - m.column);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ae(a) {
|
|
133
133
|
return a.name;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
135
|
+
function ne(a, o, i, n) {
|
|
136
|
+
const s = Y(), r = h(process.cwd(), o.repositoryRoot), c = {
|
|
137
137
|
auditKind: "definitions",
|
|
138
138
|
repository: o.repository,
|
|
139
139
|
ref: o.ref,
|
|
140
140
|
branch: o.branch,
|
|
141
|
-
scannerVersion:
|
|
141
|
+
scannerVersion: H,
|
|
142
142
|
scanDate: Date.now(),
|
|
143
|
-
complete:
|
|
144
|
-
...
|
|
143
|
+
complete: i,
|
|
144
|
+
...r === "" ? {} : { cwd: r },
|
|
145
145
|
...n.length === 0 ? {} : { excludedPaths: n },
|
|
146
146
|
findings: a.map((e) => ({
|
|
147
147
|
package: e.package,
|
|
@@ -150,7 +150,7 @@ function te(a, o, s, n) {
|
|
|
150
150
|
kind: e.kind,
|
|
151
151
|
memberOf: e.memberOf,
|
|
152
152
|
provenance: e.provenance,
|
|
153
|
-
category:
|
|
153
|
+
category: G({
|
|
154
154
|
package: e.package,
|
|
155
155
|
name: e.name,
|
|
156
156
|
memberOf: e.memberOf,
|
|
@@ -161,13 +161,13 @@ function te(a, o, s, n) {
|
|
|
161
161
|
file: h(e.sourceFileName, o.repositoryRoot),
|
|
162
162
|
line: e.line,
|
|
163
163
|
column: e.column,
|
|
164
|
-
codeowners:
|
|
164
|
+
codeowners: s?.getOwners(e.sourceFileName) ?? []
|
|
165
165
|
}))
|
|
166
166
|
};
|
|
167
167
|
process.stdout.write(`${JSON.stringify(c, void 0, 2)}
|
|
168
168
|
`);
|
|
169
169
|
}
|
|
170
170
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
he as auditDeprecatedDefinitions,
|
|
172
|
+
te as collectDeprecatedApiDefinitions
|
|
173
173
|
};
|