@arcgis/codemod 6.0.0-next.6 → 6.0.0-next.7
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 +44 -0
- package/dist/chunks/classification.js +105 -134
- package/dist/chunks/cli.js +347 -212
- package/dist/chunks/componentAudit.js +158 -0
- package/dist/chunks/format.js +110 -106
- package/dist/chunks/github.js +124 -0
- package/dist/chunks/index.js +545 -315
- package/dist/chunks/index2.js +102 -88
- package/dist/chunks/index3.js +307 -0
- package/dist/chunks/sync.js +44 -142
- package/dist/chunks/syncMarkdown.js +32 -0
- package/dist/chunks/useProjectInstance.js +22 -22
- package/package.json +4 -4
- package/dist/chunks/hardcodedBehavior.js +0 -63
package/dist/chunks/index.js
CHANGED
|
@@ -1,459 +1,689 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var Q = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), V = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
4
|
+
var G = (n, e, o) => {
|
|
5
5
|
if (e != null) {
|
|
6
|
-
typeof e != "object" && typeof e != "function" &&
|
|
7
|
-
var
|
|
8
|
-
|
|
6
|
+
typeof e != "object" && typeof e != "function" && V("Object expected");
|
|
7
|
+
var t, i;
|
|
8
|
+
o && (t = e[Q("asyncDispose")]), t === void 0 && (t = e[Q("dispose")], o && (i = t)), typeof t != "function" && V("Object not disposable"), i && (t = function() {
|
|
9
9
|
try {
|
|
10
10
|
i.call(this);
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
11
|
+
} catch (a) {
|
|
12
|
+
return Promise.reject(a);
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
} else
|
|
14
|
+
}), n.push([o, t, e]);
|
|
15
|
+
} else o && n.push([o]);
|
|
16
16
|
return e;
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
return
|
|
20
|
-
}, i = (
|
|
21
|
-
for (;
|
|
17
|
+
}, _ = (n, e, o) => {
|
|
18
|
+
var t = typeof SuppressedError == "function" ? SuppressedError : function(s, l, d, m) {
|
|
19
|
+
return m = Error(d), m.name = "SuppressedError", m.error = s, m.suppressed = l, m;
|
|
20
|
+
}, i = (s) => e = o ? new t(s, e, "An error was suppressed during disposal") : (o = !0, s), a = (s) => {
|
|
21
|
+
for (; s = n.pop(); )
|
|
22
22
|
try {
|
|
23
|
-
var
|
|
24
|
-
if (
|
|
25
|
-
} catch (
|
|
26
|
-
i(
|
|
23
|
+
var l = s[1] && s[1].call(s[2]);
|
|
24
|
+
if (s[0]) return Promise.resolve(l).then(a, (d) => (i(d), a()));
|
|
25
|
+
} catch (d) {
|
|
26
|
+
i(d);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (o) throw e;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return a();
|
|
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
|
|
39
|
-
import { s as
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import { f as
|
|
43
|
-
|
|
32
|
+
import { c as me } from "./useProjectInstance.js";
|
|
33
|
+
import { d as I, r as de, i as pe, a as ue, b as fe } from "./cli.js";
|
|
34
|
+
import { f as $ } from "./log.js";
|
|
35
|
+
import { path as P, toPosixPathSeparators as ge } from "@arcgis/node-toolkit/path";
|
|
36
|
+
import { log as xe } from "@arcgis/toolkit/log";
|
|
37
|
+
import { forEachWithConcurrency as ve } from "@arcgis/toolkit/promise";
|
|
38
|
+
import c from "typescript";
|
|
39
|
+
import { s as he, g as C, a as ye, p as we } from "./artifact.js";
|
|
40
|
+
import { loadCodeowners as te } from "@arcgis/node-toolkit/codeowners";
|
|
41
|
+
import { c as q, s as Ne, l as Se, a as ne, g as oe, b as be, d as Ae, e as ke } from "./componentAudit.js";
|
|
42
|
+
import { g as Pe, a as J, c as se, b as De, d as Ce, e as L, f as H, h as Ee } from "./classification.js";
|
|
43
|
+
import { styleText as M } from "node:util";
|
|
44
|
+
import { f as $e } from "./format.js";
|
|
45
|
+
import { readFile as Oe } from "node:fs/promises";
|
|
46
|
+
function Te(n, e, o) {
|
|
44
47
|
if (e === "json") {
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
if (o !== void 0) {
|
|
49
|
+
process.stdout.write(`${JSON.stringify(o, void 0, 2)}
|
|
50
|
+
`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const t = C();
|
|
54
|
+
process.stdout.write(`${Fe(n, te(), t)}
|
|
47
55
|
`);
|
|
48
56
|
return;
|
|
49
57
|
}
|
|
50
58
|
if (e === "md") {
|
|
51
|
-
process.stdout.write(`${
|
|
59
|
+
process.stdout.write(`${Ue(n)}
|
|
52
60
|
`);
|
|
53
61
|
return;
|
|
54
62
|
}
|
|
55
|
-
process.stdout.write(`${
|
|
63
|
+
process.stdout.write(`${Ie(n)}
|
|
56
64
|
`);
|
|
57
65
|
}
|
|
58
|
-
function
|
|
59
|
-
const e =
|
|
60
|
-
for (const { categoryName: i, count:
|
|
61
|
-
|
|
62
|
-
for (const {
|
|
63
|
-
|
|
66
|
+
function Ie(n) {
|
|
67
|
+
const e = ie(n), o = e.reduce((i, a) => i + a.count, 0), t = [X("Deprecation summary", o)];
|
|
68
|
+
for (const { categoryName: i, count: a, packages: s } of e) {
|
|
69
|
+
t.push(`${I[i].label} (${a})`);
|
|
70
|
+
for (const { displayName: l, count: d } of s)
|
|
71
|
+
t.push(` ${Y(l)} (${d})`);
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
for (const { categoryName: i, count:
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
for (const {
|
|
70
|
-
|
|
71
|
-
for (const {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
for (const
|
|
75
|
-
|
|
76
|
-
for (const { sourceFileName:
|
|
77
|
-
|
|
73
|
+
t.push("", "", X("Deprecation details", o));
|
|
74
|
+
for (const { categoryName: i, count: a, packages: s } of e) {
|
|
75
|
+
const l = I[i];
|
|
76
|
+
t.push("", `${l.label} (${a})`), "description" in l && t.push(` ${l.description}`);
|
|
77
|
+
for (const { displayName: d, count: m, apis: f } of s) {
|
|
78
|
+
t.push("", ` ${Y(d)} (${m})`);
|
|
79
|
+
for (const { name: r, reasons: p, items: x } of f) {
|
|
80
|
+
const h = x[0].usage, u = De({ name: r, memberOf: h.memberOf, kind: h.kind });
|
|
81
|
+
t.push(` ${Le(u)}${Ce(h.kind)} (${x.length})`);
|
|
82
|
+
for (const y of p)
|
|
83
|
+
t.push(Je(y, 6));
|
|
84
|
+
for (const { sourceFileName: y, usage: w } of Me(x))
|
|
85
|
+
t.push(` ${$(y)}:${w.line}:${w.column}`);
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
|
-
return
|
|
89
|
+
return t.join(`
|
|
82
90
|
`);
|
|
83
91
|
}
|
|
84
|
-
function
|
|
85
|
-
const e = [...
|
|
86
|
-
([
|
|
92
|
+
function ie(n) {
|
|
93
|
+
const e = [...n].flatMap(
|
|
94
|
+
([o, t]) => t.map((i) => ({ ...i, packageName: o }))
|
|
87
95
|
);
|
|
88
|
-
return
|
|
89
|
-
package:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
return Pe(e, ({ packageName: o, usage: t }) => ({
|
|
97
|
+
package: o,
|
|
98
|
+
name: t.name,
|
|
99
|
+
kind: t.kind,
|
|
100
|
+
category: t.category,
|
|
101
|
+
memberOf: t.memberOf,
|
|
102
|
+
module: t.module ?? J(t.originFileNames, o),
|
|
103
|
+
deprecated: t.reason ?? !0
|
|
95
104
|
}));
|
|
96
105
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
106
|
+
function X(n, e) {
|
|
107
|
+
return M(["bold", "yellow"], `${n} (${e})`);
|
|
99
108
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
109
|
+
function Y(n) {
|
|
110
|
+
return M("blue", n);
|
|
102
111
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
112
|
+
function Le(n) {
|
|
113
|
+
return M(["bold", "white"], n);
|
|
105
114
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
return
|
|
115
|
+
function Je(n, e) {
|
|
116
|
+
const o = " ".repeat(e);
|
|
117
|
+
return n.split(/\r?\n/u).map((t) => `${o}${t}`).join(`
|
|
109
118
|
`);
|
|
110
119
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
-
(e,
|
|
120
|
+
function Me(n) {
|
|
121
|
+
return n.toSorted(
|
|
122
|
+
(e, o) => e.sourceFileName.localeCompare(o.sourceFileName) || e.usage.line - o.usage.line || e.usage.column - o.usage.column
|
|
114
123
|
);
|
|
115
124
|
}
|
|
116
|
-
function
|
|
117
|
-
return [...
|
|
125
|
+
function Re(n) {
|
|
126
|
+
return [...n].sort(([e], [o]) => e.localeCompare(o));
|
|
118
127
|
}
|
|
119
|
-
function
|
|
120
|
-
return JSON.stringify(
|
|
128
|
+
function Fe(n, e, o = C()) {
|
|
129
|
+
return JSON.stringify(R(n, e, o), void 0, 2);
|
|
121
130
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
131
|
+
function Ue(n, e = C()) {
|
|
132
|
+
return $e(R(n, void 0, e));
|
|
124
133
|
}
|
|
125
|
-
function
|
|
126
|
-
const
|
|
134
|
+
function R(n, e, o, t) {
|
|
135
|
+
const i = ie(n);
|
|
127
136
|
return {
|
|
128
|
-
|
|
129
|
-
repository:
|
|
130
|
-
ref:
|
|
137
|
+
auditKind: "usages",
|
|
138
|
+
repository: o.repository,
|
|
139
|
+
ref: o.ref,
|
|
140
|
+
branch: o.branch,
|
|
141
|
+
scannerVersion: he,
|
|
142
|
+
scanDate: Date.now(),
|
|
143
|
+
...t === void 0 ? {} : { complete: t },
|
|
131
144
|
summary: {
|
|
132
|
-
total:
|
|
133
|
-
categories:
|
|
145
|
+
total: i.reduce((s, { count: l }) => s + l, 0),
|
|
146
|
+
categories: i.map(({ categoryName: s, count: l, packages: d }) => ({
|
|
134
147
|
category: s,
|
|
135
|
-
label:
|
|
136
|
-
count:
|
|
137
|
-
packages:
|
|
148
|
+
label: I[s].label,
|
|
149
|
+
count: l,
|
|
150
|
+
packages: d.map(({ packageName: m, displayName: f, count: r }) => ({
|
|
138
151
|
package: m,
|
|
139
|
-
|
|
152
|
+
...f === m ? {} : { displayName: f },
|
|
153
|
+
count: r
|
|
140
154
|
}))
|
|
141
155
|
}))
|
|
142
156
|
},
|
|
143
|
-
findings:
|
|
157
|
+
findings: ze(n, e, o)
|
|
144
158
|
};
|
|
145
159
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
148
|
-
([
|
|
149
|
-
const
|
|
150
|
-
package:
|
|
151
|
-
|
|
152
|
-
category:
|
|
153
|
-
memberOf:
|
|
154
|
-
module:
|
|
155
|
-
|
|
160
|
+
function ze(n, e, o) {
|
|
161
|
+
return Re(n).flatMap(
|
|
162
|
+
([t, i]) => i.map((a) => {
|
|
163
|
+
const s = a.usage.module ?? J(a.usage.originFileNames, t), l = {
|
|
164
|
+
package: t,
|
|
165
|
+
name: a.usage.name,
|
|
166
|
+
category: a.usage.category,
|
|
167
|
+
memberOf: a.usage.memberOf,
|
|
168
|
+
module: s,
|
|
169
|
+
deprecated: a.usage.reason ?? !0
|
|
156
170
|
};
|
|
157
171
|
return {
|
|
158
|
-
...
|
|
159
|
-
category:
|
|
160
|
-
|
|
161
|
-
memberOf:
|
|
162
|
-
file:
|
|
163
|
-
line:
|
|
164
|
-
column:
|
|
165
|
-
codeowners: e?.getOwners(
|
|
172
|
+
...l,
|
|
173
|
+
category: se(l),
|
|
174
|
+
kind: a.usage.kind,
|
|
175
|
+
memberOf: a.usage.memberOf,
|
|
176
|
+
file: ye(a.sourceFileName, o.repositoryRoot),
|
|
177
|
+
line: a.usage.line,
|
|
178
|
+
column: a.usage.column,
|
|
179
|
+
codeowners: e?.getOwners(a.sourceFileName) ?? []
|
|
166
180
|
};
|
|
167
181
|
})
|
|
168
182
|
);
|
|
169
183
|
}
|
|
170
|
-
|
|
171
|
-
|
|
184
|
+
function Z(n, e, o) {
|
|
185
|
+
if (!e.hasDeprecatedApis)
|
|
186
|
+
return [];
|
|
187
|
+
const t = "getLineAndCharacterOfPosition" in n ? (r) => n.getLineAndCharacterOfPosition(r) : We(n.text), i = /* @__PURE__ */ new Map();
|
|
188
|
+
for (const [r, p] of e.cssVariables)
|
|
189
|
+
for (let x = n.text.indexOf(r); x !== -1; x = n.text.indexOf(r, x + r.length))
|
|
190
|
+
s(p, x, r.length);
|
|
191
|
+
const a = P.extname(n.fileName).slice(1).toLowerCase();
|
|
192
|
+
return a === "html" ? Ke(
|
|
193
|
+
n.text,
|
|
194
|
+
(r, p, x) => {
|
|
195
|
+
d(
|
|
196
|
+
r,
|
|
197
|
+
p,
|
|
198
|
+
x.map(({ name: h, start: u }) => ({ name: h, start: u }))
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
(r, p) => ee(r, p, m)
|
|
202
|
+
) : a === "css" || a === "scss" || a === "sass" ? ee(n.text, 0, m, a !== "css") : "kind" in n && f(n, n), [...i.values()].sort((r, p) => r.usage.start - p.usage.start);
|
|
203
|
+
function s(r, p, x) {
|
|
204
|
+
const { line: h, character: u } = t(p);
|
|
205
|
+
i.set(JSON.stringify([r.package, r.kind, r.memberOf, r.name, p]), {
|
|
206
|
+
packageName: r.package,
|
|
207
|
+
sourceFileName: n.fileName,
|
|
208
|
+
usage: {
|
|
209
|
+
name: r.name,
|
|
210
|
+
kind: r.kind,
|
|
211
|
+
memberOf: r.kind === "css-property" ? void 0 : r.memberOf,
|
|
212
|
+
module: r.module,
|
|
213
|
+
reason: r.reason,
|
|
214
|
+
originFileNames: [r.sourceFileName],
|
|
215
|
+
start: p,
|
|
216
|
+
length: x,
|
|
217
|
+
line: h + 1,
|
|
218
|
+
column: u + 1
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function l(r, p, x) {
|
|
223
|
+
const h = e.components.get(r);
|
|
224
|
+
return h?.length === 1 ? h[0].definitions.find(
|
|
225
|
+
(u) => u.kind === p && u.name === x && (p === "element" || u.memberOf === r)
|
|
226
|
+
) : void 0;
|
|
227
|
+
}
|
|
228
|
+
function d(r, p, x) {
|
|
229
|
+
const h = l(r, "element", r);
|
|
230
|
+
h !== void 0 && s(h, p, r.length);
|
|
231
|
+
for (const u of x) {
|
|
232
|
+
const y = l(r, "attribute", u.name);
|
|
233
|
+
y !== void 0 && s(y, u.start, u.name.length);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function m(r, p, x, h) {
|
|
237
|
+
const u = l(r, p, x);
|
|
238
|
+
u !== void 0 && s(u, h, x.length);
|
|
239
|
+
}
|
|
240
|
+
function f(r, p) {
|
|
241
|
+
if (c.isJsxOpeningElement(r) || c.isJsxSelfClosingElement(r)) {
|
|
242
|
+
const x = r.tagName.getText(p), h = r.attributes.properties.filter(c.isJsxAttribute);
|
|
243
|
+
if (d(
|
|
244
|
+
x,
|
|
245
|
+
r.tagName.getStart(p),
|
|
246
|
+
h.map((u) => ({
|
|
247
|
+
name: u.name.getText(p),
|
|
248
|
+
start: u.name.getStart(p)
|
|
249
|
+
}))
|
|
250
|
+
), /^[a-z][\w-]*$/u.test(x)) {
|
|
251
|
+
const u = h.find((v) => v.name.getText(p) === "slot"), y = u?.initializer, w = y !== void 0 && c.isJsxExpression(y) ? y.expression : y, E = u === void 0 ? -1 : r.attributes.properties.indexOf(u), g = r.attributes.properties.slice(E + 1).some(c.isJsxSpreadAttribute);
|
|
252
|
+
if (w !== void 0 && (c.isStringLiteral(w) || c.isNoSubstitutionTemplateLiteral(w)) && !g) {
|
|
253
|
+
const v = je(c.isJsxOpeningElement(r) ? r.parent : r, o), N = v === void 0 ? void 0 : l(v, "slot", w.text);
|
|
254
|
+
N !== void 0 && s(N, w.getStart(p) + 1, w.getWidth(p) - 2);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
c.forEachChild(r, (x) => f(x, p));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function We(n) {
|
|
262
|
+
const e = [
|
|
263
|
+
0,
|
|
264
|
+
...Array.from(n.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (o) => o.index + o[0].length)
|
|
265
|
+
];
|
|
266
|
+
return (o) => {
|
|
267
|
+
let t = 0, i = e.length;
|
|
268
|
+
for (; t + 1 < i; ) {
|
|
269
|
+
const a = Math.floor((t + i) / 2);
|
|
270
|
+
e[a] <= o ? t = a : i = a;
|
|
271
|
+
}
|
|
272
|
+
return { line: t, character: o - e[t] };
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function je(n, e) {
|
|
276
|
+
let o = n;
|
|
277
|
+
for (let t = o.parent; t !== void 0; o = t, t = t.parent) {
|
|
278
|
+
if (c.isJsxElement(t))
|
|
279
|
+
return t.openingElement.tagName.getText();
|
|
280
|
+
if (!(c.isJsxFragment(t) || c.isJsxExpression(t) || c.isParenthesizedExpression(t)) && !(c.isConditionalExpression(t) && o !== t.condition) && !(c.isBinaryExpression(t) && (t.operatorToken.kind === c.SyntaxKind.AmpersandAmpersandToken && o === t.right || t.operatorToken.kind === c.SyntaxKind.BarBarToken || t.operatorToken.kind === c.SyntaxKind.QuestionQuestionToken))) {
|
|
281
|
+
if (c.isReturnStatement(t)) {
|
|
282
|
+
const i = c.findAncestor(t, c.isFunctionLike);
|
|
283
|
+
if (i === void 0 || !c.isArrowFunction(i) && !c.isFunctionExpression(i))
|
|
284
|
+
return;
|
|
285
|
+
o = i.body, t = i;
|
|
286
|
+
}
|
|
287
|
+
if ((c.isArrowFunction(t) || c.isFunctionExpression(t)) && o === t.body) {
|
|
288
|
+
const i = t.parent;
|
|
289
|
+
if (!c.isCallExpression(i) || i.arguments[0] !== t || !c.isPropertyAccessExpression(i.expression) || i.expression.name.text !== "map")
|
|
290
|
+
return;
|
|
291
|
+
const a = i.expression.expression, s = e?.getTypeAtLocation(a);
|
|
292
|
+
if (!c.isArrayLiteralExpression(a) && (s === void 0 || !e.isArrayType(s) && !e.isTupleType(s)))
|
|
293
|
+
return;
|
|
294
|
+
o = t, t = i;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function ee(n, e, o, t = !1) {
|
|
302
|
+
const i = t ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, a = n.replace(i, (m) => m.replace(/[^\r\n]/gu, " ")), s = [];
|
|
303
|
+
let l = 0, d = 0;
|
|
304
|
+
for (const m of a.matchAll(/[{};]/gu)) {
|
|
305
|
+
const f = m.index;
|
|
306
|
+
if (d > 0) {
|
|
307
|
+
d += m[0] === "{" ? 1 : m[0] === "}" ? -1 : 0, l = f + 1;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (m[0] === "}")
|
|
311
|
+
s.pop();
|
|
312
|
+
else if (m[0] === "{") {
|
|
313
|
+
const r = a.slice(l, f), p = s.at(-1) ?? [];
|
|
314
|
+
if (/^\s*--[\w-]+\s*:/u.test(r))
|
|
315
|
+
d = 1;
|
|
316
|
+
else if (r.trimStart().startsWith("@"))
|
|
317
|
+
s.push(p);
|
|
318
|
+
else {
|
|
319
|
+
const h = r.split(",").map((u) => u.trim()).flatMap(
|
|
320
|
+
(u) => p.length === 0 ? [u] : p.map(
|
|
321
|
+
(y) => u.includes("&") ? u.replaceAll("&", y) : `${y} ${u}`
|
|
322
|
+
)
|
|
323
|
+
);
|
|
324
|
+
for (const u of r.matchAll(/::part\(\s*([\w\s-]+?)\s*\)|:state\(\s*([\w-]+)\s*\)/gu)) {
|
|
325
|
+
const y = r.lastIndexOf(",", u.index) + 1, w = r.slice(y, u.index), g = (p.length === 0 ? [w] : p.map(
|
|
326
|
+
(S) => w.includes("&") ? w.replaceAll("&", S) : `${S} ${w}`
|
|
327
|
+
)).map(Be);
|
|
328
|
+
if (g.includes(void 0) || new Set(g).size !== 1)
|
|
329
|
+
continue;
|
|
330
|
+
const v = u[1] === void 0 ? "css-state" : "css-part", N = u[1] ?? u[2], A = u.index + u[0].indexOf(N);
|
|
331
|
+
for (const S of N.matchAll(/[\w-]+/gu))
|
|
332
|
+
o(g[0], v, S[0], e + l + A + S.index);
|
|
333
|
+
}
|
|
334
|
+
s.push(h);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
l = f + 1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function Be(n) {
|
|
341
|
+
const e = n.replace(/:state\([\w-]+\)/gu, "").trimStart();
|
|
342
|
+
return /(?:^|[\s>+~])([a-z][\w-]*)(?:[.#:][\w-]+|\[[^\]]*\])*$/iu.exec(e)?.[1]?.toLowerCase();
|
|
343
|
+
}
|
|
344
|
+
function Ke(n, e, o) {
|
|
345
|
+
const t = /<!--[\s\S]*?(?:-->|$)|<![^>]*>|<\/?([a-z][\w:-]*)\b((?:"[^"]*"|'[^']*'|[^'">])*)>/giu;
|
|
346
|
+
for (let i = t.exec(n); i !== null; i = t.exec(n)) {
|
|
347
|
+
if (i[1] === void 0 || i[0].startsWith("</"))
|
|
348
|
+
continue;
|
|
349
|
+
const a = i[1].toLowerCase(), s = i.index + 1 + i[1].length, l = [...i[2].matchAll(/([^\s"'<>/=]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/gu)].map(
|
|
350
|
+
(d) => ({ name: d[1].toLowerCase(), start: s + d.index })
|
|
351
|
+
);
|
|
352
|
+
if (e(a, i.index + 1, l), a === "plaintext")
|
|
353
|
+
break;
|
|
354
|
+
if (["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes"].includes(a)) {
|
|
355
|
+
const d = new RegExp(`</${a}\\s*>`, "giu");
|
|
356
|
+
d.lastIndex = t.lastIndex;
|
|
357
|
+
const m = d.exec(n);
|
|
358
|
+
a === "style" && o(n.slice(t.lastIndex, m?.index ?? n.length), t.lastIndex), t.lastIndex = m === null ? n.length : d.lastIndex;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
async function xt(n, e) {
|
|
363
|
+
if (e.reportingUrl && (n || e.esriOnly || e.category || e.packageName))
|
|
364
|
+
throw new Error("Reporting requires a complete, unfiltered repository scan.");
|
|
365
|
+
const o = e.outputFormat === "json" || e.reportingUrl ? process.cwd() === C().repositoryRoot : !1;
|
|
366
|
+
if (e.reportingUrl && !o)
|
|
367
|
+
throw new Error("Reporting requires scanning from the Git repository root.");
|
|
368
|
+
let t = !n && !e.esriOnly && !e.category && !e.packageName;
|
|
369
|
+
(e.outputFormat === "json" || e.reportingUrl) && (t &&= o), await de(
|
|
172
370
|
{
|
|
173
371
|
meta: {
|
|
174
372
|
needsTypeInformation: !0,
|
|
175
|
-
needsFooter: !1
|
|
373
|
+
needsFooter: !1,
|
|
374
|
+
includeComponentFiles: !0
|
|
176
375
|
},
|
|
177
|
-
run(
|
|
178
|
-
|
|
376
|
+
async run(i) {
|
|
377
|
+
await Qe(i, e, t);
|
|
179
378
|
}
|
|
180
379
|
},
|
|
181
380
|
"deprecations audit-usages",
|
|
182
|
-
|
|
381
|
+
n
|
|
183
382
|
);
|
|
184
383
|
}
|
|
185
|
-
function
|
|
186
|
-
const t = /* @__PURE__ */ new Map(),
|
|
384
|
+
async function Qe(n, e, o) {
|
|
385
|
+
const t = /* @__PURE__ */ new Map(), i = be("warn", () => {
|
|
386
|
+
o = !1;
|
|
387
|
+
}), a = /* @__PURE__ */ new Map(), s = q([]), l = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), m = [
|
|
187
388
|
...new Map(
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
return
|
|
389
|
+
n.flatMap(({ packageJson: g }) => {
|
|
390
|
+
const v = g === void 0 ? void 0 : P.dirname(g.filePath), N = g?.contents.name;
|
|
391
|
+
return v !== void 0 && N !== void 0 && O(v, process.cwd()) ? [[v, { root: v, name: N }]] : [];
|
|
191
392
|
})
|
|
192
393
|
).values()
|
|
193
|
-
].toSorted((
|
|
194
|
-
for (const
|
|
195
|
-
var
|
|
394
|
+
].toSorted((g, v) => v.root.length - g.root.length);
|
|
395
|
+
for (const g of n) {
|
|
396
|
+
var u = [];
|
|
196
397
|
try {
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
|
|
398
|
+
if (Ne(g.packageJson?.contents.name)) {
|
|
399
|
+
const b = g.packageJson?.filePath;
|
|
400
|
+
b !== void 0 && !d.has(b) && (d.add(b), xe(
|
|
200
401
|
"warn",
|
|
201
|
-
|
|
202
|
-
`Skipping excluded package \`${
|
|
402
|
+
$(b),
|
|
403
|
+
`Skipping excluded package \`${g.packageJson?.contents.name ?? g.cwd}\`.`
|
|
203
404
|
));
|
|
204
405
|
continue;
|
|
205
406
|
}
|
|
206
|
-
|
|
207
|
-
const d = g.tsMorph.getLanguageService().compilerObject;
|
|
208
|
-
const y = d.getProgram()?.getTypeChecker();
|
|
209
|
-
if (y === void 0)
|
|
407
|
+
if (g.filePaths.length === 0)
|
|
210
408
|
continue;
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
409
|
+
const v = await x(g.packageJson);
|
|
410
|
+
const N = g.packageJson === void 0 ? void 0 : P.dirname(g.packageJson.filePath);
|
|
411
|
+
const A = G(u, g.filePaths.some(pe) ? me(g, !1) : void 0);
|
|
412
|
+
const S = A?.tsMorph.getLanguageService().compilerObject;
|
|
413
|
+
const D = S?.getProgram()?.getTypeChecker();
|
|
414
|
+
for (const b of A?.getCodemodFiles() ?? []) {
|
|
415
|
+
const k = b.compilerNode;
|
|
416
|
+
if (S !== void 0 && D !== void 0) {
|
|
417
|
+
const le = Ge(
|
|
418
|
+
k,
|
|
419
|
+
S,
|
|
420
|
+
D,
|
|
421
|
+
N,
|
|
422
|
+
e.esriOnly
|
|
423
|
+
);
|
|
424
|
+
for (const j of le) {
|
|
425
|
+
const B = et(j.originFileNames, m, N), K = t.get(B) ?? [];
|
|
426
|
+
K.push({ sourceFileName: k.fileName, usage: j }), t.set(B, K);
|
|
427
|
+
}
|
|
223
428
|
}
|
|
429
|
+
h(Z(k, v, D)), l.add(k.fileName);
|
|
224
430
|
}
|
|
225
|
-
|
|
226
|
-
|
|
431
|
+
v.hasDeprecatedApis && await ve(g.filePaths, 8, async (b) => {
|
|
432
|
+
if (l.has(b))
|
|
433
|
+
return;
|
|
434
|
+
const k = await Oe(b, "utf8");
|
|
435
|
+
h(Z({ fileName: b, text: k }, v)), l.add(b);
|
|
436
|
+
});
|
|
437
|
+
} catch (y) {
|
|
438
|
+
var w = y, E = !0;
|
|
227
439
|
} finally {
|
|
228
|
-
|
|
440
|
+
_(u, w, E);
|
|
229
441
|
}
|
|
230
442
|
}
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
443
|
+
const f = Ve(t, e), r = e.reportingUrl || e.outputFormat === "json" ? R(f, te(), C(), o) : void 0;
|
|
444
|
+
Te(f, e.outputFormat, r);
|
|
445
|
+
const p = [...f.values()].flat();
|
|
446
|
+
we(
|
|
235
447
|
"usages",
|
|
236
|
-
|
|
237
|
-
new Set(
|
|
238
|
-
|
|
239
|
-
);
|
|
448
|
+
p.length,
|
|
449
|
+
new Set(p.map(({ sourceFileName: g }) => g)).size,
|
|
450
|
+
f.size
|
|
451
|
+
), e.reportingUrl && r !== void 0 && await ue(r, e.reportingUrl);
|
|
452
|
+
async function x(g) {
|
|
453
|
+
if (g === void 0)
|
|
454
|
+
return s;
|
|
455
|
+
let v = a.get(g.filePath);
|
|
456
|
+
return v === void 0 && (v = q(
|
|
457
|
+
await Se(g, i, e.esriOnly)
|
|
458
|
+
), a.set(g.filePath, v)), v;
|
|
459
|
+
}
|
|
460
|
+
function h(g) {
|
|
461
|
+
for (const { packageName: v, sourceFileName: N, usage: A } of g) {
|
|
462
|
+
if (ne(A.name, A.reason))
|
|
463
|
+
continue;
|
|
464
|
+
const S = t.get(v) ?? [], D = S.findIndex(
|
|
465
|
+
(k) => k.sourceFileName === N && k.usage.start === A.start && k.usage.length === A.length
|
|
466
|
+
), b = { sourceFileName: N, usage: A };
|
|
467
|
+
D === -1 ? S.push(b) : S[D] = b, t.set(v, S);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
240
470
|
}
|
|
241
|
-
function
|
|
242
|
-
const
|
|
243
|
-
for (const [
|
|
244
|
-
if (e.packageName !== void 0 &&
|
|
471
|
+
function Ve(n, e) {
|
|
472
|
+
const o = /* @__PURE__ */ new Map();
|
|
473
|
+
for (const [t, i] of n) {
|
|
474
|
+
if (e.packageName !== void 0 && t !== e.packageName)
|
|
245
475
|
continue;
|
|
246
|
-
const
|
|
247
|
-
({ usage:
|
|
248
|
-
package:
|
|
249
|
-
|
|
250
|
-
category:
|
|
251
|
-
memberOf:
|
|
252
|
-
module:
|
|
253
|
-
|
|
476
|
+
const a = i.filter(
|
|
477
|
+
({ usage: s }) => e.category === void 0 || se({
|
|
478
|
+
package: t,
|
|
479
|
+
name: s.name,
|
|
480
|
+
category: s.category,
|
|
481
|
+
memberOf: s.memberOf,
|
|
482
|
+
module: s.module ?? J(s.originFileNames, t),
|
|
483
|
+
deprecated: s.reason ?? !0
|
|
254
484
|
}) === e.category
|
|
255
485
|
);
|
|
256
|
-
|
|
486
|
+
a.length > 0 && o.set(t, a);
|
|
257
487
|
}
|
|
258
|
-
return
|
|
488
|
+
return o;
|
|
259
489
|
}
|
|
260
|
-
function
|
|
261
|
-
const
|
|
262
|
-
for (const
|
|
263
|
-
if (
|
|
490
|
+
function Ge(n, e, o, t, i = !1) {
|
|
491
|
+
const a = /* @__PURE__ */ new Map();
|
|
492
|
+
for (const s of e.getSuggestionDiagnostics(n.fileName)) {
|
|
493
|
+
if (s.reportsDeprecated === void 0)
|
|
264
494
|
continue;
|
|
265
|
-
const
|
|
495
|
+
const l = ae(n, s.start, s.start + s.length);
|
|
266
496
|
if (
|
|
267
497
|
// Don't report for imports, only for usages
|
|
268
|
-
|
|
269
|
-
|
|
498
|
+
c.findAncestor(l, c.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
|
|
499
|
+
c.findAncestor(l, c.isJsxClosingElement) !== void 0
|
|
270
500
|
)
|
|
271
501
|
continue;
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
start:
|
|
275
|
-
length:
|
|
276
|
-
...
|
|
277
|
-
originFileNames:
|
|
278
|
-
reason:
|
|
502
|
+
const d = He(l, o), m = d.reason === void 0 ? [] : F(d.symbol), f = m.length > 0 ? void 0 : e.getDefinitionAtPosition(n.fileName, s.start), r = m.length > 0 ? m : [...new Set(f?.map(({ fileName: p }) => p))];
|
|
503
|
+
z(r, i, t) && U(a, n, {
|
|
504
|
+
start: s.start,
|
|
505
|
+
length: s.length,
|
|
506
|
+
...Xe(l, d, o, e, f?.[0]),
|
|
507
|
+
originFileNames: r,
|
|
508
|
+
reason: Ze(e, n.fileName, s.start) ?? d.reason
|
|
279
509
|
});
|
|
280
510
|
}
|
|
281
|
-
return
|
|
282
|
-
}
|
|
283
|
-
function
|
|
284
|
-
function s
|
|
285
|
-
|
|
286
|
-
let
|
|
287
|
-
if (
|
|
288
|
-
const
|
|
289
|
-
(
|
|
290
|
-
} else if ((
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
} else if (
|
|
294
|
-
|
|
295
|
-
else if (
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
} else if (
|
|
299
|
-
const
|
|
300
|
-
|
|
511
|
+
return _e(n, o, a, t, i), [...a.values()].toSorted((s, l) => s.start - l.start);
|
|
512
|
+
}
|
|
513
|
+
function _e(n, e, o, t, i) {
|
|
514
|
+
function a(s) {
|
|
515
|
+
c.isNewExpression(s) && qe(s, e, o, t, i);
|
|
516
|
+
let l, d;
|
|
517
|
+
if (c.isJsxAttribute(s) && c.isIdentifier(s.name)) {
|
|
518
|
+
const m = s.parent.parent;
|
|
519
|
+
(c.isJsxOpeningElement(m) || c.isJsxSelfClosingElement(m)) && (d = e.getContextualType(m.tagName)?.getProperty(s.name.text), l = s.name);
|
|
520
|
+
} else if ((c.isPropertyAssignment(s) || c.isShorthandPropertyAssignment(s) || c.isMethodDeclaration(s)) && c.isObjectLiteralExpression(s.parent)) {
|
|
521
|
+
const m = c.isComputedPropertyName(s.name) ? T(s.name.expression, e) : s.name.text, f = e.getContextualType(s.parent);
|
|
522
|
+
d = m === void 0 || f === void 0 ? void 0 : e.getNonNullableType(f).getProperty(m), l = s.name;
|
|
523
|
+
} else if (c.isPropertyAccessExpression(s))
|
|
524
|
+
d = e.getSymbolAtLocation(s.name), l = s.name;
|
|
525
|
+
else if (c.isElementAccessExpression(s)) {
|
|
526
|
+
const m = T(s.argumentExpression, e);
|
|
527
|
+
d = m === void 0 ? void 0 : e.getTypeAtLocation(s.expression).getProperty(m), l = s.argumentExpression;
|
|
528
|
+
} else if (c.isBindingElement(s) && c.isObjectBindingPattern(s.parent) && s.dotDotDotToken === void 0) {
|
|
529
|
+
const m = s.propertyName ?? (c.isIdentifier(s.name) ? s.name : void 0), f = m === void 0 ? void 0 : c.isComputedPropertyName(m) ? T(m.expression, e) : m.text;
|
|
530
|
+
d = f === void 0 ? void 0 : e.getTypeAtLocation(s.parent).getProperty(f), l = m;
|
|
301
531
|
}
|
|
302
|
-
if ((
|
|
303
|
-
(
|
|
304
|
-
) && (
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
start:
|
|
308
|
-
length:
|
|
309
|
-
name:
|
|
310
|
-
...
|
|
311
|
-
originFileNames:
|
|
312
|
-
reason:
|
|
532
|
+
if ((c.isPropertyAccessExpression(s) || c.isElementAccessExpression(s) || c.isBindingElement(s)) && !d?.declarations?.some(
|
|
533
|
+
(m) => c.isGetAccessorDeclaration(m) || c.isSetAccessorDeclaration(m)
|
|
534
|
+
) && (d = void 0), d !== void 0 && l !== void 0) {
|
|
535
|
+
const m = ce(d, e), f = F(d);
|
|
536
|
+
m !== void 0 && z(f, i, t) && U(o, n, {
|
|
537
|
+
start: l.getStart(n),
|
|
538
|
+
length: l.getWidth(n),
|
|
539
|
+
name: d.getName(),
|
|
540
|
+
...L(d.declarations?.[0]),
|
|
541
|
+
originFileNames: f,
|
|
542
|
+
reason: m
|
|
313
543
|
});
|
|
314
544
|
}
|
|
315
|
-
|
|
545
|
+
c.forEachChild(s, a);
|
|
316
546
|
}
|
|
317
|
-
|
|
547
|
+
a(n);
|
|
318
548
|
}
|
|
319
|
-
function
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
549
|
+
function qe(n, e, o, t, i) {
|
|
550
|
+
const a = e.getTypeAtLocation(n).getSymbol(), s = a?.declarations?.[0], l = s !== void 0 && (c.isClassDeclaration(s) || c.isInterfaceDeclaration(s)) ? s.name?.text : void 0, d = l === void 0 ? void 0 : Ee.get(l);
|
|
551
|
+
if (d === void 0 || l === void 0)
|
|
322
552
|
return;
|
|
323
|
-
const
|
|
324
|
-
if (!
|
|
325
|
-
(
|
|
326
|
-
) || !
|
|
553
|
+
const m = F(a);
|
|
554
|
+
if (!m.some(
|
|
555
|
+
(p) => (W(p) ?? oe(P.dirname(p), "")) === "@arcgis/core"
|
|
556
|
+
) || !z(m, i, t))
|
|
327
557
|
return;
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
start:
|
|
331
|
-
length:
|
|
332
|
-
name:
|
|
333
|
-
|
|
558
|
+
const f = c.isPropertyAccessExpression(n.expression) ? n.expression.name : n.expression, r = n.getSourceFile();
|
|
559
|
+
U(o, r, {
|
|
560
|
+
start: f.getStart(r),
|
|
561
|
+
length: f.getWidth(r),
|
|
562
|
+
name: l,
|
|
563
|
+
kind: "class",
|
|
334
564
|
category: "coreViews",
|
|
335
|
-
originFileNames:
|
|
336
|
-
reason: `Direct construction with new ${
|
|
565
|
+
originFileNames: m,
|
|
566
|
+
reason: `Direct construction with new ${l}() is discouraged. Use \`<${d}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
|
|
337
567
|
});
|
|
338
568
|
}
|
|
339
|
-
function
|
|
340
|
-
const
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
function
|
|
344
|
-
let
|
|
345
|
-
for (;
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
return { symbol:
|
|
349
|
-
|
|
569
|
+
function T(n, e) {
|
|
570
|
+
const o = e.getTypeAtLocation(n);
|
|
571
|
+
return o.isStringLiteral() || o.isNumberLiteral() ? String(o.value) : void 0;
|
|
572
|
+
}
|
|
573
|
+
function He(n, e) {
|
|
574
|
+
let o = e.getSymbolAtLocation(n);
|
|
575
|
+
for (; o !== void 0 && (o.flags & c.SymbolFlags.Alias) !== 0; ) {
|
|
576
|
+
const t = ce(o, e);
|
|
577
|
+
if (t !== void 0)
|
|
578
|
+
return { symbol: o, reason: t };
|
|
579
|
+
o = o.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(o);
|
|
350
580
|
}
|
|
351
|
-
return { symbol:
|
|
581
|
+
return { symbol: o, reason: void 0 };
|
|
352
582
|
}
|
|
353
|
-
function
|
|
354
|
-
return [...new Set(
|
|
583
|
+
function F(n) {
|
|
584
|
+
return [...new Set(n?.declarations?.map((e) => e.getSourceFile().fileName))];
|
|
355
585
|
}
|
|
356
|
-
function
|
|
586
|
+
function Xe(n, e, o, t, i) {
|
|
357
587
|
if (e.reason !== void 0)
|
|
358
588
|
return {
|
|
359
|
-
name:
|
|
360
|
-
...
|
|
589
|
+
name: H(e.symbol.declarations?.[0], e.symbol.getName()),
|
|
590
|
+
...L(e.symbol.declarations?.[0])
|
|
361
591
|
};
|
|
362
|
-
const
|
|
363
|
-
|
|
592
|
+
const a = i === void 0 ? void 0 : t.getProgram()?.getSourceFile(i.fileName), s = i === void 0 || a === void 0 ? void 0 : ae(
|
|
593
|
+
a,
|
|
364
594
|
i.textSpan.start,
|
|
365
595
|
i.textSpan.start + i.textSpan.length
|
|
366
|
-
),
|
|
596
|
+
), l = (s === void 0 ? void 0 : o.getSymbolAtLocation(s)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], d = i?.name;
|
|
367
597
|
return {
|
|
368
|
-
name:
|
|
369
|
-
...
|
|
598
|
+
name: d === void 0 ? Ye(n) : H(l, d),
|
|
599
|
+
...L(l)
|
|
370
600
|
};
|
|
371
601
|
}
|
|
372
|
-
function
|
|
373
|
-
const
|
|
374
|
-
return
|
|
602
|
+
function O(n, e) {
|
|
603
|
+
const o = P.relative(e, n);
|
|
604
|
+
return o !== "" && !o.startsWith("../") && !P.isAbsolute(o) && o !== "node_modules" && !o.startsWith("node_modules/");
|
|
375
605
|
}
|
|
376
|
-
function
|
|
377
|
-
let
|
|
606
|
+
function ae(n, e, o) {
|
|
607
|
+
let t = n;
|
|
378
608
|
for (; ; ) {
|
|
379
609
|
let i;
|
|
380
|
-
if (
|
|
381
|
-
i === void 0 &&
|
|
610
|
+
if (c.forEachChild(t, (a) => {
|
|
611
|
+
i === void 0 && a.getStart(n) <= e && a.getEnd() >= o && (i = a);
|
|
382
612
|
}), i === void 0)
|
|
383
|
-
return
|
|
384
|
-
|
|
613
|
+
return t;
|
|
614
|
+
t = i;
|
|
385
615
|
}
|
|
386
616
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
617
|
+
function Ye(n) {
|
|
618
|
+
return c.isIdentifier(n) || c.isPrivateIdentifier(n) || c.isStringLiteralLike(n) || c.isNumericLiteral(n) ? n.text : n.getText();
|
|
389
619
|
}
|
|
390
|
-
function
|
|
391
|
-
const e =
|
|
392
|
-
return e === void 0 ? void 0 :
|
|
620
|
+
function re(n) {
|
|
621
|
+
const e = n?.find(({ name: o }) => o === "deprecated");
|
|
622
|
+
return e === void 0 ? void 0 : ke(e.text) ?? "";
|
|
393
623
|
}
|
|
394
|
-
function
|
|
624
|
+
function Ze(n, e, o) {
|
|
395
625
|
try {
|
|
396
|
-
return
|
|
626
|
+
return re(n.getQuickInfoAtPosition(e, o)?.tags);
|
|
397
627
|
} catch {
|
|
398
628
|
return;
|
|
399
629
|
}
|
|
400
630
|
}
|
|
401
|
-
function
|
|
631
|
+
function ce(n, e) {
|
|
402
632
|
try {
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
405
|
-
return
|
|
406
|
-
const
|
|
407
|
-
return
|
|
633
|
+
const o = re(n?.getJsDocTags(e));
|
|
634
|
+
if (o !== void 0)
|
|
635
|
+
return o;
|
|
636
|
+
const t = n?.declarations?.filter((i) => c.isGetAccessorDeclaration(i) || c.isSetAccessorDeclaration(i)).map((i) => c.getJSDocDeprecatedTag(i)).find((i) => i !== void 0);
|
|
637
|
+
return t === void 0 ? void 0 : t.comment === void 0 ? "" : Ae(t.comment);
|
|
408
638
|
} catch {
|
|
409
639
|
return;
|
|
410
640
|
}
|
|
411
641
|
}
|
|
412
|
-
function
|
|
413
|
-
if (
|
|
642
|
+
function U(n, e, o) {
|
|
643
|
+
if (ne(o.name, o.reason))
|
|
414
644
|
return;
|
|
415
|
-
const { line:
|
|
416
|
-
|
|
417
|
-
...
|
|
418
|
-
line:
|
|
645
|
+
const { line: t, character: i } = e.getLineAndCharacterOfPosition(o.start);
|
|
646
|
+
n.set(`${o.start}:${o.length}`, {
|
|
647
|
+
...o,
|
|
648
|
+
line: t + 1,
|
|
419
649
|
column: i + 1
|
|
420
650
|
});
|
|
421
651
|
}
|
|
422
|
-
function
|
|
423
|
-
return
|
|
424
|
-
const i =
|
|
425
|
-
return i === void 0 ?
|
|
652
|
+
function z(n, e, o) {
|
|
653
|
+
return n.some((t) => o !== void 0 && O(t, o)) ? !1 : !e || n.some((t) => {
|
|
654
|
+
const i = W(t);
|
|
655
|
+
return i === void 0 ? o === void 0 || !O(t, o) : fe(i);
|
|
426
656
|
});
|
|
427
657
|
}
|
|
428
|
-
function
|
|
429
|
-
const e =
|
|
430
|
-
if (
|
|
658
|
+
function W(n) {
|
|
659
|
+
const e = ge(n), o = "/node_modules/", t = e.lastIndexOf(o);
|
|
660
|
+
if (t === -1)
|
|
431
661
|
return;
|
|
432
|
-
const [i,
|
|
433
|
-
return i.startsWith("@") ? `${i}/${
|
|
662
|
+
const [i, a] = e.slice(t + o.length).split("/");
|
|
663
|
+
return i.startsWith("@") ? `${i}/${a}` : i;
|
|
434
664
|
}
|
|
435
|
-
function
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
665
|
+
function et(n, e = [], o) {
|
|
666
|
+
const t = n[0];
|
|
667
|
+
if (t === void 0)
|
|
438
668
|
return "unknown package";
|
|
439
|
-
const i =
|
|
669
|
+
const i = W(t);
|
|
440
670
|
if (i !== void 0)
|
|
441
671
|
return i;
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
return
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
return
|
|
448
|
-
if (
|
|
449
|
-
return
|
|
450
|
-
const
|
|
451
|
-
return
|
|
672
|
+
const a = e.find(({ root: r }) => O(t, r));
|
|
673
|
+
if (a !== void 0)
|
|
674
|
+
return a.name;
|
|
675
|
+
const s = P.dirname($(t)), l = oe(P.dirname(t), s);
|
|
676
|
+
if (l !== s)
|
|
677
|
+
return l;
|
|
678
|
+
if (o === void 0)
|
|
679
|
+
return s;
|
|
680
|
+
const m = P.relative(o, t).split("/"), f = m.findIndex((r) => r !== "..");
|
|
681
|
+
return f < 1 ? P.dirname($(t)) : m.slice(0, f * 2).join("/");
|
|
452
682
|
}
|
|
453
683
|
export {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
684
|
+
xt as auditDeprecatedUsages,
|
|
685
|
+
Ge as collectDeprecatedApiUsages,
|
|
686
|
+
et as getDeprecationOriginLabel,
|
|
687
|
+
W as getNodeModulesPackageName,
|
|
688
|
+
z as shouldIncludeDeprecation
|
|
459
689
|
};
|