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