@arcgis/codemod 6.0.0-next.2 → 6.0.0-next.3
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 +232 -0
- package/dist/chunks/cli.js +71 -57
- package/dist/chunks/format.js +109 -180
- package/dist/chunks/hardcodedBehavior.js +38 -68
- package/dist/chunks/index.js +340 -285
- package/dist/chunks/index2.js +110 -93
- package/dist/chunks/sync.js +39 -40
- package/package.json +4 -4
package/dist/chunks/index.js
CHANGED
|
@@ -1,404 +1,459 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var M = (o, e) => (e = Symbol[o]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + o), O = (o) => {
|
|
2
|
+
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
if (
|
|
6
|
-
typeof
|
|
7
|
-
var
|
|
8
|
-
|
|
4
|
+
var J = (o, e, t) => {
|
|
5
|
+
if (e != null) {
|
|
6
|
+
typeof e != "object" && typeof e != "function" && O("Object expected");
|
|
7
|
+
var a, i;
|
|
8
|
+
t && (a = e[M("asyncDispose")]), a === void 0 && (a = e[M("dispose")], t && (i = a)), typeof a != "function" && O("Object not disposable"), i && (a = function() {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
10
|
+
i.call(this);
|
|
11
|
+
} catch (s) {
|
|
12
|
+
return Promise.reject(s);
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
17
|
-
}, R = (
|
|
18
|
-
var
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
for (;
|
|
14
|
+
}), o.push([t, a, e]);
|
|
15
|
+
} else t && o.push([t]);
|
|
16
|
+
return e;
|
|
17
|
+
}, R = (o, e, t) => {
|
|
18
|
+
var a = typeof SuppressedError == "function" ? SuppressedError : function(n, r, m, c) {
|
|
19
|
+
return c = Error(m), c.name = "SuppressedError", c.error = n, c.suppressed = r, c;
|
|
20
|
+
}, i = (n) => e = t ? new a(n, e, "An error was suppressed during disposal") : (t = !0, n), s = (n) => {
|
|
21
|
+
for (; n = o.pop(); )
|
|
22
22
|
try {
|
|
23
|
-
var
|
|
24
|
-
if (
|
|
25
|
-
} catch (
|
|
26
|
-
|
|
23
|
+
var r = n[1] && n[1].call(n[2]);
|
|
24
|
+
if (n[0]) return Promise.resolve(r).then(s, (m) => (i(m), s()));
|
|
25
|
+
} catch (m) {
|
|
26
|
+
i(m);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (t) throw e;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return s();
|
|
31
31
|
};
|
|
32
|
-
import { c as
|
|
33
|
-
import { d as
|
|
34
|
-
import { f as
|
|
35
|
-
import { path as
|
|
36
|
-
import { log as
|
|
37
|
-
import
|
|
38
|
-
import { g as
|
|
39
|
-
import {
|
|
40
|
-
import { styleText as
|
|
41
|
-
import { loadCodeowners as
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
import { c as H } from "./useProjectInstance.js";
|
|
33
|
+
import { d as b, r as q } from "./cli.js";
|
|
34
|
+
import { f as x } from "./log.js";
|
|
35
|
+
import { path as v, toPosixPathSeparators as X } from "@arcgis/node-toolkit/path";
|
|
36
|
+
import { log as Y } from "@arcgis/toolkit/log";
|
|
37
|
+
import l from "typescript";
|
|
38
|
+
import { g as A, a as Z, b as ee, c as te, d as w, e as oe, f as z, p as ne, i as ae, h as D, j, k as ie } from "./classification.js";
|
|
39
|
+
import { s as se, g as W, a as re, b as ce, c as me } from "./hardcodedBehavior.js";
|
|
40
|
+
import { styleText as k } from "node:util";
|
|
41
|
+
import { loadCodeowners as le } from "@arcgis/node-toolkit/codeowners";
|
|
42
|
+
import { f as pe } from "./format.js";
|
|
43
|
+
function ue(o, e) {
|
|
44
|
+
if (e === "json") {
|
|
45
|
+
const t = A();
|
|
46
|
+
process.stdout.write(`${Ne(o, le(), t)}
|
|
46
47
|
`);
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
if (
|
|
50
|
-
process.stdout.write(`${
|
|
50
|
+
if (e === "md") {
|
|
51
|
+
process.stdout.write(`${he(o)}
|
|
51
52
|
`);
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
process.stdout.write(`${
|
|
55
|
+
process.stdout.write(`${ge(o)}
|
|
55
56
|
`);
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
for (const { categoryName:
|
|
60
|
-
|
|
61
|
-
for (const { packageName:
|
|
62
|
-
|
|
58
|
+
function ge(o) {
|
|
59
|
+
const e = Q(o), t = e.reduce((i, s) => i + s.count, 0), a = [U("Deprecation summary", t)];
|
|
60
|
+
for (const { categoryName: i, count: s, packages: n } of e) {
|
|
61
|
+
a.push(`${b[i].label} (${s})`);
|
|
62
|
+
for (const { packageName: r, count: m } of n)
|
|
63
|
+
a.push(` ${K(r)} (${m})`);
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
for (const { categoryName:
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
for (const { packageName:
|
|
69
|
-
|
|
70
|
-
for (const { api:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
a.push("", "", U("Deprecation details", t));
|
|
66
|
+
for (const { categoryName: i, count: s, packages: n } of e) {
|
|
67
|
+
const r = b[i];
|
|
68
|
+
a.push("", `${r.label} (${s})`), "description" in r && a.push(` ${r.description}`);
|
|
69
|
+
for (const { packageName: m, count: c, apis: u } of n) {
|
|
70
|
+
a.push("", ` ${K(m)} (${c})`);
|
|
71
|
+
for (const { api: p, reasons: g, items: d } of u) {
|
|
72
|
+
const y = d[0].usage, h = Z({ api: p, memberOf: y.memberOf, apiKind: y.apiKind });
|
|
73
|
+
a.push(` ${fe(h)}${ee(y.apiKind)} (${d.length})`);
|
|
74
|
+
for (const f of g)
|
|
75
|
+
a.push(de(f, 6));
|
|
76
|
+
for (const { sourceFileName: f, usage: N } of ve(d))
|
|
77
|
+
a.push(` ${x(f)}:${N.line}:${N.column}`);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
return
|
|
81
|
+
return a.join(`
|
|
80
82
|
`);
|
|
81
83
|
}
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
([
|
|
84
|
+
function Q(o) {
|
|
85
|
+
const e = [...o].flatMap(
|
|
86
|
+
([t, a]) => a.map((i) => ({ ...i, packageName: t }))
|
|
85
87
|
);
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
api:
|
|
89
|
-
|
|
88
|
+
return te(e, ({ packageName: t, usage: a }) => ({
|
|
89
|
+
package: t,
|
|
90
|
+
api: a.name,
|
|
91
|
+
category: a.category,
|
|
92
|
+
memberOf: a.memberOf,
|
|
93
|
+
module: w(a.originFileNames, t),
|
|
94
|
+
reason: a.reason ?? null
|
|
90
95
|
}));
|
|
91
96
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
97
|
+
function U(o, e) {
|
|
98
|
+
return k(["bold", "yellow"], `${o} (${e})`);
|
|
94
99
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
100
|
+
function K(o) {
|
|
101
|
+
return k("blue", o);
|
|
97
102
|
}
|
|
98
|
-
function
|
|
99
|
-
return
|
|
103
|
+
function fe(o) {
|
|
104
|
+
return k(["bold", "white"], o);
|
|
100
105
|
}
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
return
|
|
106
|
+
function de(o, e) {
|
|
107
|
+
const t = " ".repeat(e);
|
|
108
|
+
return o.split(/\r?\n/u).map((a) => `${t}${a}`).join(`
|
|
104
109
|
`);
|
|
105
110
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
108
|
-
(
|
|
111
|
+
function ve(o) {
|
|
112
|
+
return o.toSorted(
|
|
113
|
+
(e, t) => e.sourceFileName.localeCompare(t.sourceFileName) || e.usage.line - t.usage.line || e.usage.column - t.usage.column
|
|
109
114
|
);
|
|
110
115
|
}
|
|
111
|
-
function
|
|
112
|
-
return [...
|
|
116
|
+
function ye(o) {
|
|
117
|
+
return [...o].sort(([e], [t]) => e.localeCompare(t));
|
|
113
118
|
}
|
|
114
|
-
function
|
|
115
|
-
return JSON.stringify(
|
|
119
|
+
function Ne(o, e, t = A()) {
|
|
120
|
+
return JSON.stringify(V(o, e, t), void 0, 2);
|
|
116
121
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
122
|
+
function he(o, e = A()) {
|
|
123
|
+
return pe(V(o, void 0, e));
|
|
119
124
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
125
|
+
function V(o, e, t) {
|
|
126
|
+
const a = Q(o);
|
|
122
127
|
return {
|
|
123
128
|
kind: "usages",
|
|
124
|
-
repository:
|
|
125
|
-
ref:
|
|
129
|
+
repository: t.repository,
|
|
130
|
+
ref: t.ref,
|
|
126
131
|
summary: {
|
|
127
|
-
total:
|
|
128
|
-
categories:
|
|
129
|
-
category:
|
|
130
|
-
label:
|
|
131
|
-
count:
|
|
132
|
-
packages:
|
|
133
|
-
package:
|
|
134
|
-
count:
|
|
132
|
+
total: a.reduce((s, { count: n }) => s + n, 0),
|
|
133
|
+
categories: a.map(({ categoryName: s, count: n, packages: r }) => ({
|
|
134
|
+
category: s,
|
|
135
|
+
label: b[s].label,
|
|
136
|
+
count: n,
|
|
137
|
+
packages: r.map(({ packageName: m, count: c }) => ({
|
|
138
|
+
package: m,
|
|
139
|
+
count: c
|
|
135
140
|
}))
|
|
136
141
|
}))
|
|
137
142
|
},
|
|
138
|
-
findings:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
findings: xe(o, e, t)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function xe(o, e, t) {
|
|
147
|
+
return ye(o).flatMap(
|
|
148
|
+
([a, i]) => i.map((s) => {
|
|
149
|
+
const n = w(s.usage.originFileNames, a), r = {
|
|
145
150
|
package: a,
|
|
146
151
|
api: s.usage.name,
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
category: s.usage.category,
|
|
153
|
+
memberOf: s.usage.memberOf,
|
|
154
|
+
module: n,
|
|
155
|
+
reason: s.usage.reason ?? null
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
...r,
|
|
159
|
+
category: z(r),
|
|
160
|
+
apiKind: s.usage.apiKind,
|
|
161
|
+
memberOf: s.usage.memberOf,
|
|
162
|
+
file: oe(s.sourceFileName, t.repositoryRoot),
|
|
149
163
|
line: s.usage.line,
|
|
150
164
|
column: s.usage.column,
|
|
151
|
-
codeowners:
|
|
152
|
-
}
|
|
153
|
-
)
|
|
154
|
-
|
|
165
|
+
codeowners: e?.getOwners(s.sourceFileName) ?? []
|
|
166
|
+
};
|
|
167
|
+
})
|
|
168
|
+
);
|
|
155
169
|
}
|
|
156
|
-
async function
|
|
157
|
-
await
|
|
170
|
+
async function We(o, e) {
|
|
171
|
+
await q(
|
|
158
172
|
{
|
|
159
173
|
meta: {
|
|
160
174
|
needsTypeInformation: !0,
|
|
161
175
|
needsFooter: !1
|
|
162
176
|
},
|
|
163
|
-
run(
|
|
164
|
-
|
|
177
|
+
run(t) {
|
|
178
|
+
Se(t, e);
|
|
165
179
|
}
|
|
166
180
|
},
|
|
167
181
|
"deprecations audit-usages",
|
|
168
|
-
|
|
182
|
+
o
|
|
169
183
|
);
|
|
170
184
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
185
|
+
function Se(o, e) {
|
|
186
|
+
const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = [
|
|
173
187
|
...new Map(
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
return
|
|
188
|
+
o.flatMap(({ packageJson: p }) => {
|
|
189
|
+
const g = p === void 0 ? void 0 : v.dirname(p.filePath), d = p?.contents.name;
|
|
190
|
+
return g !== void 0 && d !== void 0 && S(g, process.cwd()) ? [[g, { root: g, name: d }]] : [];
|
|
177
191
|
})
|
|
178
192
|
).values()
|
|
179
|
-
].toSorted((
|
|
180
|
-
for (const
|
|
181
|
-
var
|
|
193
|
+
].toSorted((p, g) => g.root.length - p.root.length);
|
|
194
|
+
for (const p of o) {
|
|
195
|
+
var r = [];
|
|
182
196
|
try {
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
|
|
197
|
+
if (se(p.packageJson?.contents.name)) {
|
|
198
|
+
const f = p.packageJson?.filePath;
|
|
199
|
+
f !== void 0 && !a.has(f) && (a.add(f), Y(
|
|
186
200
|
"warn",
|
|
187
|
-
|
|
188
|
-
`Skipping excluded package \`${
|
|
201
|
+
x(f),
|
|
202
|
+
`Skipping excluded package \`${p.packageJson?.contents.name ?? p.cwd}\`.`
|
|
189
203
|
));
|
|
190
204
|
continue;
|
|
191
205
|
}
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
206
|
+
const g = J(r, H(p, !1));
|
|
207
|
+
const d = g.tsMorph.getLanguageService().compilerObject;
|
|
208
|
+
const y = d.getProgram()?.getTypeChecker();
|
|
209
|
+
if (y === void 0)
|
|
196
210
|
continue;
|
|
197
|
-
const h =
|
|
198
|
-
for (const
|
|
199
|
-
const
|
|
200
|
-
for (const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
const h = p.packageJson === void 0 ? void 0 : v.dirname(p.packageJson.filePath);
|
|
212
|
+
for (const f of g.getCodemodFiles()) {
|
|
213
|
+
const N = f.compilerNode;
|
|
214
|
+
for (const I of be(
|
|
215
|
+
N,
|
|
216
|
+
d,
|
|
217
|
+
y,
|
|
204
218
|
h,
|
|
205
|
-
|
|
219
|
+
e.esriOnly
|
|
206
220
|
)) {
|
|
207
|
-
const
|
|
208
|
-
|
|
221
|
+
const T = Ee(I.originFileNames, i, h), L = t.get(T) ?? [];
|
|
222
|
+
L.push({ sourceFileName: N.fileName, usage: I }), t.set(T, L);
|
|
209
223
|
}
|
|
210
224
|
}
|
|
211
|
-
} catch (
|
|
212
|
-
var
|
|
225
|
+
} catch (m) {
|
|
226
|
+
var c = m, u = !0;
|
|
213
227
|
} finally {
|
|
214
|
-
R(
|
|
228
|
+
R(r, c, u);
|
|
215
229
|
}
|
|
216
230
|
}
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
231
|
+
const s = Pe(t, e);
|
|
232
|
+
ue(s, e.outputFormat);
|
|
233
|
+
const n = [...s.values()].flat();
|
|
234
|
+
ne(
|
|
221
235
|
"usages",
|
|
222
|
-
|
|
223
|
-
new Set(
|
|
224
|
-
|
|
236
|
+
n.length,
|
|
237
|
+
new Set(n.map(({ sourceFileName: p }) => p)).size,
|
|
238
|
+
s.size
|
|
225
239
|
);
|
|
226
240
|
}
|
|
227
|
-
function
|
|
228
|
-
const
|
|
229
|
-
for (const [
|
|
230
|
-
if (
|
|
241
|
+
function Pe(o, e) {
|
|
242
|
+
const t = /* @__PURE__ */ new Map();
|
|
243
|
+
for (const [a, i] of o) {
|
|
244
|
+
if (e.packageName !== void 0 && a !== e.packageName)
|
|
231
245
|
continue;
|
|
232
|
-
const
|
|
233
|
-
({ usage:
|
|
246
|
+
const s = i.filter(
|
|
247
|
+
({ usage: n }) => e.category === void 0 || z({
|
|
248
|
+
package: a,
|
|
249
|
+
api: n.name,
|
|
250
|
+
category: n.category,
|
|
251
|
+
memberOf: n.memberOf,
|
|
252
|
+
module: w(n.originFileNames, a),
|
|
253
|
+
reason: n.reason ?? null
|
|
254
|
+
}) === e.category
|
|
234
255
|
);
|
|
235
|
-
|
|
256
|
+
s.length > 0 && t.set(a, s);
|
|
236
257
|
}
|
|
237
|
-
return
|
|
258
|
+
return t;
|
|
238
259
|
}
|
|
239
|
-
function
|
|
240
|
-
const
|
|
241
|
-
for (const
|
|
242
|
-
if (
|
|
260
|
+
function be(o, e, t, a, i = !1) {
|
|
261
|
+
const s = /* @__PURE__ */ new Map();
|
|
262
|
+
for (const n of e.getSuggestionDiagnostics(o.fileName)) {
|
|
263
|
+
if (n.reportsDeprecated === void 0)
|
|
243
264
|
continue;
|
|
244
|
-
const
|
|
265
|
+
const r = _(o, n.start, n.start + n.length);
|
|
245
266
|
if (
|
|
246
267
|
// Don't report for imports, only for usages
|
|
247
|
-
|
|
248
|
-
|
|
268
|
+
l.findAncestor(r, l.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
|
|
269
|
+
l.findAncestor(r, l.isJsxClosingElement) !== void 0
|
|
249
270
|
)
|
|
250
271
|
continue;
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
t
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
U(l, r, n) && z(a, t, {
|
|
259
|
-
start: i.start,
|
|
260
|
-
length: i.length,
|
|
261
|
-
name: Ne(s, e, o, t.fileName, i.start) ?? ye(s),
|
|
262
|
-
originFileNames: l,
|
|
263
|
-
reason: ke(o, t.fileName, i.start) ?? Se(s, e)
|
|
272
|
+
const m = we(r, t), c = m.reason === void 0 ? [] : $(m.symbol), u = c.length > 0 ? void 0 : e.getDefinitionAtPosition(o.fileName, n.start), p = c.length > 0 ? c : [...new Set(u?.map(({ fileName: g }) => g))];
|
|
273
|
+
E(p, i, a) && C(s, o, {
|
|
274
|
+
start: n.start,
|
|
275
|
+
length: n.length,
|
|
276
|
+
...ke(r, m, t, e, u?.[0]),
|
|
277
|
+
originFileNames: p,
|
|
278
|
+
reason: Ce(e, o.fileName, n.start) ?? m.reason
|
|
264
279
|
});
|
|
265
280
|
}
|
|
266
|
-
return
|
|
267
|
-
}
|
|
268
|
-
function
|
|
269
|
-
function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
return De(o, t, s, a, i), [...s.values()].toSorted((n, r) => n.start - r.start);
|
|
282
|
+
}
|
|
283
|
+
function De(o, e, t, a, i) {
|
|
284
|
+
function s(n) {
|
|
285
|
+
l.isNewExpression(n) && Ae(n, e, t, a, i);
|
|
286
|
+
let r, m;
|
|
287
|
+
if (l.isJsxAttribute(n) && l.isIdentifier(n.name)) {
|
|
288
|
+
const c = n.parent.parent;
|
|
289
|
+
(l.isJsxOpeningElement(c) || l.isJsxSelfClosingElement(c)) && (m = e.getContextualType(c.tagName)?.getProperty(n.name.text), r = n.name);
|
|
290
|
+
} else if ((l.isPropertyAssignment(n) || l.isShorthandPropertyAssignment(n) || l.isMethodDeclaration(n)) && l.isObjectLiteralExpression(n.parent)) {
|
|
291
|
+
const c = l.isComputedPropertyName(n.name) ? P(n.name.expression, e) : n.name.text, u = e.getContextualType(n.parent);
|
|
292
|
+
m = c === void 0 || u === void 0 ? void 0 : e.getNonNullableType(u).getProperty(c), r = n.name;
|
|
293
|
+
} else if (l.isPropertyAccessExpression(n))
|
|
294
|
+
m = e.getSymbolAtLocation(n.name), r = n.name;
|
|
295
|
+
else if (l.isElementAccessExpression(n)) {
|
|
296
|
+
const c = P(n.argumentExpression, e);
|
|
297
|
+
m = c === void 0 ? void 0 : e.getTypeAtLocation(n.expression).getProperty(c), r = n.argumentExpression;
|
|
298
|
+
} else if (l.isBindingElement(n) && l.isObjectBindingPattern(n.parent) && n.dotDotDotToken === void 0) {
|
|
299
|
+
const c = n.propertyName ?? (l.isIdentifier(n.name) ? n.name : void 0), u = c === void 0 ? void 0 : l.isComputedPropertyName(c) ? P(c.expression, e) : c.text;
|
|
300
|
+
m = u === void 0 ? void 0 : e.getTypeAtLocation(n.parent).getProperty(u), r = c;
|
|
301
|
+
}
|
|
302
|
+
if ((l.isPropertyAccessExpression(n) || l.isElementAccessExpression(n) || l.isBindingElement(n)) && !m?.declarations?.some(
|
|
303
|
+
(c) => l.isGetAccessorDeclaration(c) || l.isSetAccessorDeclaration(c)
|
|
304
|
+
) && (m = void 0), m !== void 0 && r !== void 0) {
|
|
305
|
+
const c = B(m, e), u = $(m);
|
|
306
|
+
c !== void 0 && E(u, i, a) && C(t, o, {
|
|
307
|
+
start: r.getStart(o),
|
|
308
|
+
length: r.getWidth(o),
|
|
309
|
+
name: m.getName(),
|
|
310
|
+
...D(m.declarations?.[0]),
|
|
311
|
+
originFileNames: u,
|
|
312
|
+
reason: c
|
|
313
|
+
});
|
|
282
314
|
}
|
|
283
|
-
|
|
315
|
+
l.forEachChild(n, s);
|
|
284
316
|
}
|
|
285
|
-
|
|
317
|
+
s(o);
|
|
286
318
|
}
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
319
|
+
function Ae(o, e, t, a, i) {
|
|
320
|
+
const s = e.getTypeAtLocation(o).getSymbol(), n = s?.declarations?.[0], r = n !== void 0 && (l.isClassDeclaration(n) || l.isInterfaceDeclaration(n)) ? n.name?.text : void 0, m = r === void 0 ? void 0 : ie.get(r);
|
|
321
|
+
if (m === void 0 || r === void 0)
|
|
322
|
+
return;
|
|
323
|
+
const c = $(s);
|
|
324
|
+
if (!c.some(
|
|
325
|
+
(g) => (F(g) ?? W(v.dirname(g), "")) === "@arcgis/core"
|
|
326
|
+
) || !E(c, i, a))
|
|
327
|
+
return;
|
|
328
|
+
const u = l.isPropertyAccessExpression(o.expression) ? o.expression.name : o.expression, p = o.getSourceFile();
|
|
329
|
+
C(t, p, {
|
|
330
|
+
start: u.getStart(p),
|
|
331
|
+
length: u.getWidth(p),
|
|
332
|
+
name: r,
|
|
333
|
+
apiKind: "class",
|
|
334
|
+
category: "coreViews",
|
|
335
|
+
originFileNames: c,
|
|
336
|
+
reason: `Direct construction with new ${r}() is discouraged. Use \`<${m}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
|
|
337
|
+
});
|
|
293
338
|
}
|
|
294
|
-
function
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
for (; a !== void 0 && (a.flags & f.SymbolFlags.Alias) !== 0; ) {
|
|
306
|
-
if (S(a, o) !== void 0)
|
|
307
|
-
return a.getName();
|
|
308
|
-
a = a.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(a);
|
|
339
|
+
function P(o, e) {
|
|
340
|
+
const t = e.getTypeAtLocation(o);
|
|
341
|
+
return t.isStringLiteral() || t.isNumberLiteral() ? String(t.value) : void 0;
|
|
342
|
+
}
|
|
343
|
+
function we(o, e) {
|
|
344
|
+
let t = e.getSymbolAtLocation(o);
|
|
345
|
+
for (; t !== void 0 && (t.flags & l.SymbolFlags.Alias) !== 0; ) {
|
|
346
|
+
const a = B(t, e);
|
|
347
|
+
if (a !== void 0)
|
|
348
|
+
return { symbol: t, reason: a };
|
|
349
|
+
t = t.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(t);
|
|
309
350
|
}
|
|
310
|
-
return
|
|
351
|
+
return { symbol: t, reason: void 0 };
|
|
352
|
+
}
|
|
353
|
+
function $(o) {
|
|
354
|
+
return [...new Set(o?.declarations?.map((e) => e.getSourceFile().fileName))];
|
|
355
|
+
}
|
|
356
|
+
function ke(o, e, t, a, i) {
|
|
357
|
+
if (e.reason !== void 0)
|
|
358
|
+
return {
|
|
359
|
+
name: j(e.symbol.declarations?.[0], e.symbol.getName()),
|
|
360
|
+
...D(e.symbol.declarations?.[0])
|
|
361
|
+
};
|
|
362
|
+
const s = i === void 0 ? void 0 : a.getProgram()?.getSourceFile(i.fileName), n = i === void 0 || s === void 0 ? void 0 : _(
|
|
363
|
+
s,
|
|
364
|
+
i.textSpan.start,
|
|
365
|
+
i.textSpan.start + i.textSpan.length
|
|
366
|
+
), r = (n === void 0 ? void 0 : t.getSymbolAtLocation(n)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], m = i?.name;
|
|
367
|
+
return {
|
|
368
|
+
name: m === void 0 ? $e(o) : j(r, m),
|
|
369
|
+
...D(r)
|
|
370
|
+
};
|
|
311
371
|
}
|
|
312
|
-
function
|
|
313
|
-
const
|
|
314
|
-
return
|
|
372
|
+
function S(o, e) {
|
|
373
|
+
const t = v.relative(e, o);
|
|
374
|
+
return t !== "" && !t.startsWith("../") && !v.isAbsolute(t) && t !== "node_modules" && !t.startsWith("node_modules/");
|
|
315
375
|
}
|
|
316
|
-
function
|
|
317
|
-
let
|
|
376
|
+
function _(o, e, t) {
|
|
377
|
+
let a = o;
|
|
318
378
|
for (; ; ) {
|
|
319
|
-
let
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
}),
|
|
323
|
-
return
|
|
324
|
-
|
|
379
|
+
let i;
|
|
380
|
+
if (l.forEachChild(a, (s) => {
|
|
381
|
+
i === void 0 && s.getStart(o) <= e && s.getEnd() >= t && (i = s);
|
|
382
|
+
}), i === void 0)
|
|
383
|
+
return a;
|
|
384
|
+
a = i;
|
|
325
385
|
}
|
|
326
386
|
}
|
|
327
|
-
function
|
|
328
|
-
return
|
|
387
|
+
function $e(o) {
|
|
388
|
+
return l.isIdentifier(o) || l.isPrivateIdentifier(o) || l.isStringLiteralLike(o) || l.isNumericLiteral(o) ? o.text : o.getText();
|
|
329
389
|
}
|
|
330
|
-
function
|
|
331
|
-
const
|
|
332
|
-
return
|
|
390
|
+
function G(o) {
|
|
391
|
+
const e = o?.find(({ name: t }) => t === "deprecated");
|
|
392
|
+
return e === void 0 ? void 0 : me(e.text) ?? "";
|
|
333
393
|
}
|
|
334
|
-
function
|
|
394
|
+
function Ce(o, e, t) {
|
|
335
395
|
try {
|
|
336
|
-
return
|
|
396
|
+
return G(o.getQuickInfoAtPosition(e, t)?.tags);
|
|
337
397
|
} catch {
|
|
338
398
|
return;
|
|
339
399
|
}
|
|
340
400
|
}
|
|
341
|
-
function
|
|
401
|
+
function B(o, e) {
|
|
342
402
|
try {
|
|
343
|
-
|
|
403
|
+
const t = G(o?.getJsDocTags(e));
|
|
404
|
+
if (t !== void 0)
|
|
405
|
+
return t;
|
|
406
|
+
const a = o?.declarations?.filter((i) => l.isGetAccessorDeclaration(i) || l.isSetAccessorDeclaration(i)).map((i) => l.getJSDocDeprecatedTag(i)).find((i) => i !== void 0);
|
|
407
|
+
return a === void 0 ? void 0 : a.comment === void 0 ? "" : ce(a.comment);
|
|
344
408
|
} catch {
|
|
345
409
|
return;
|
|
346
410
|
}
|
|
347
411
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
350
|
-
for (; e !== void 0 && (e.flags & f.SymbolFlags.Alias) !== 0; ) {
|
|
351
|
-
const n = S(e, o);
|
|
352
|
-
if (n !== void 0)
|
|
353
|
-
return n;
|
|
354
|
-
e = e.declarations === void 0 ? void 0 : o.getImmediateAliasedSymbol(e);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function z(t, o, e) {
|
|
358
|
-
if (Y(e.name, e.reason))
|
|
412
|
+
function C(o, e, t) {
|
|
413
|
+
if (re(t.name, t.reason))
|
|
359
414
|
return;
|
|
360
|
-
const { line:
|
|
361
|
-
|
|
362
|
-
...
|
|
363
|
-
line:
|
|
364
|
-
column:
|
|
415
|
+
const { line: a, character: i } = e.getLineAndCharacterOfPosition(t.start);
|
|
416
|
+
o.set(`${t.start}:${t.length}`, {
|
|
417
|
+
...t,
|
|
418
|
+
line: a + 1,
|
|
419
|
+
column: i + 1
|
|
365
420
|
});
|
|
366
421
|
}
|
|
367
|
-
function
|
|
368
|
-
return
|
|
369
|
-
const
|
|
370
|
-
return
|
|
422
|
+
function E(o, e, t) {
|
|
423
|
+
return o.some((a) => t !== void 0 && S(a, t)) ? !1 : !e || o.some((a) => {
|
|
424
|
+
const i = F(a);
|
|
425
|
+
return i === void 0 ? t === void 0 || !S(a, t) : ae(i);
|
|
371
426
|
});
|
|
372
427
|
}
|
|
373
|
-
function
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
428
|
+
function F(o) {
|
|
429
|
+
const e = X(o), t = "/node_modules/", a = e.lastIndexOf(t);
|
|
430
|
+
if (a === -1)
|
|
376
431
|
return;
|
|
377
|
-
const [
|
|
378
|
-
return
|
|
432
|
+
const [i, s] = e.slice(a + t.length).split("/");
|
|
433
|
+
return i.startsWith("@") ? `${i}/${s}` : i;
|
|
379
434
|
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
435
|
+
function Ee(o, e = [], t) {
|
|
436
|
+
const a = o[0];
|
|
437
|
+
if (a === void 0)
|
|
383
438
|
return "unknown package";
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
return r;
|
|
387
|
-
const a = o.find(({ root: c }) => k(n, c));
|
|
388
|
-
if (a !== void 0)
|
|
389
|
-
return a.name;
|
|
390
|
-
const i = d.dirname(y(n)), s = X(d.dirname(n), i);
|
|
391
|
-
if (s !== i)
|
|
392
|
-
return s;
|
|
393
|
-
if (e === void 0)
|
|
439
|
+
const i = F(a);
|
|
440
|
+
if (i !== void 0)
|
|
394
441
|
return i;
|
|
395
|
-
const
|
|
396
|
-
|
|
442
|
+
const s = e.find(({ root: p }) => S(a, p));
|
|
443
|
+
if (s !== void 0)
|
|
444
|
+
return s.name;
|
|
445
|
+
const n = v.dirname(x(a)), r = W(v.dirname(a), n);
|
|
446
|
+
if (r !== n)
|
|
447
|
+
return r;
|
|
448
|
+
if (t === void 0)
|
|
449
|
+
return n;
|
|
450
|
+
const c = v.relative(t, a).split("/"), u = c.findIndex((p) => p !== "..");
|
|
451
|
+
return u < 1 ? v.dirname(x(a)) : c.slice(0, u * 2).join("/");
|
|
397
452
|
}
|
|
398
453
|
export {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
454
|
+
We as auditDeprecatedUsages,
|
|
455
|
+
be as collectDeprecatedApiUsages,
|
|
456
|
+
Ee as getDeprecationOriginLabel,
|
|
457
|
+
F as getNodeModulesPackageName,
|
|
458
|
+
E as shouldIncludeDeprecation
|
|
404
459
|
};
|