@arcgis/codemod 6.0.0-next.3 → 6.0.0-next.30
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 +48 -0
- package/dist/chunks/classification.js +131 -141
- package/dist/chunks/cli.js +388 -223
- package/dist/chunks/codemod5.js +0 -1
- package/dist/chunks/codemod7.js +1214 -1232
- package/dist/chunks/componentAudit.js +258 -0
- package/dist/chunks/format.js +109 -105
- package/dist/chunks/github.js +124 -0
- package/dist/chunks/index.js +919 -308
- package/dist/chunks/index2.js +116 -103
- package/dist/chunks/index3.js +342 -0
- package/dist/chunks/sync.js +44 -142
- package/dist/chunks/syncMarkdown.js +32 -0
- package/dist/chunks/useProjectInstance.js +27 -24
- package/package.json +7 -5
- package/dist/chunks/hardcodedBehavior.js +0 -63
package/dist/chunks/index.js
CHANGED
|
@@ -1,459 +1,1070 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var ee = (s, e) => (e = Symbol[s]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + s), te = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
4
|
+
var ne = (s, e, t) => {
|
|
5
5
|
if (e != null) {
|
|
6
|
-
typeof e != "object" && typeof e != "function" &&
|
|
7
|
-
var
|
|
8
|
-
t && (
|
|
6
|
+
typeof e != "object" && typeof e != "function" && te("Object expected");
|
|
7
|
+
var n, o;
|
|
8
|
+
t && (n = e[ee("asyncDispose")]), n === void 0 && (n = e[ee("dispose")], t && (o = n)), typeof n != "function" && te("Object not disposable"), o && (n = function() {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
10
|
+
o.call(this);
|
|
11
|
+
} catch (r) {
|
|
12
|
+
return Promise.reject(r);
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
} else t &&
|
|
14
|
+
}), s.push([t, n, e]);
|
|
15
|
+
} else t && s.push([t]);
|
|
16
16
|
return e;
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
return c = Error(
|
|
20
|
-
},
|
|
21
|
-
for (;
|
|
17
|
+
}, se = (s, e, t) => {
|
|
18
|
+
var n = typeof SuppressedError == "function" ? SuppressedError : function(i, d, l, c) {
|
|
19
|
+
return c = Error(l), c.name = "SuppressedError", c.error = i, c.suppressed = d, c;
|
|
20
|
+
}, o = (i) => e = t ? new n(i, e, "An error was suppressed during disposal") : (t = !0, i), r = (i) => {
|
|
21
|
+
for (; i = s.pop(); )
|
|
22
22
|
try {
|
|
23
|
-
var
|
|
24
|
-
if (
|
|
25
|
-
} catch (
|
|
26
|
-
|
|
23
|
+
var d = i[1] && i[1].call(i[2]);
|
|
24
|
+
if (i[0]) return Promise.resolve(d).then(r, (l) => (o(l), r()));
|
|
25
|
+
} catch (l) {
|
|
26
|
+
o(l);
|
|
27
27
|
}
|
|
28
28
|
if (t) throw e;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return r();
|
|
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 be } from "./useProjectInstance.js";
|
|
33
|
+
import { d as V, r as ke, i as Ae, a as Pe, b as De } from "./cli.js";
|
|
34
|
+
import { f as I } from "./log.js";
|
|
35
|
+
import { path as $, toPosixPathSeparators as $e } from "@arcgis/node-toolkit/path";
|
|
36
|
+
import { log as R } from "@arcgis/toolkit/log";
|
|
37
|
+
import { forEachWithConcurrency as me } from "@arcgis/toolkit/promise";
|
|
38
|
+
import a from "typescript";
|
|
39
|
+
import { s as Ce, g as J, a as Ee, c as Le, p as Te } from "./artifact.js";
|
|
40
|
+
import { loadCodeowners as ue } from "@arcgis/node-toolkit/codeowners";
|
|
41
|
+
import { c as ie, s as U, g as Oe, a as oe, l as Fe, b as ge, d as fe, e as Ie, f as Me, h as Je } from "./componentAudit.js";
|
|
42
|
+
import { g as je, a as K, c as he, b as Re, d as ze, e as B, f as ae, h as Ue } from "./classification.js";
|
|
43
|
+
import { styleText as q } from "node:util";
|
|
44
|
+
import { f as ve } from "./format.js";
|
|
45
|
+
import { realpath as j, readFile as z } from "node:fs/promises";
|
|
46
|
+
import L from "semver";
|
|
47
|
+
import { asyncFindPath as ye } from "@arcgis/node-toolkit/file";
|
|
48
|
+
import { asyncRetrievePackageJson as We } from "@arcgis/node-toolkit/packageJson";
|
|
49
|
+
import { LineCounter as Ve, parseDocument as Be, isMap as Ke, isScalar as re } from "yaml";
|
|
50
|
+
function qe(s, e, t) {
|
|
44
51
|
if (e === "json") {
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
if (t !== void 0) {
|
|
53
|
+
process.stdout.write(`${JSON.stringify(t, void 0, 2)}
|
|
54
|
+
`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const n = J();
|
|
58
|
+
process.stdout.write(`${Xe(s, ue(), n)}
|
|
47
59
|
`);
|
|
48
60
|
return;
|
|
49
61
|
}
|
|
50
62
|
if (e === "md") {
|
|
51
|
-
process.stdout.write(
|
|
52
|
-
|
|
63
|
+
process.stdout.write(
|
|
64
|
+
`${t === void 0 ? Ye(s) : ve(t)}
|
|
65
|
+
`
|
|
66
|
+
);
|
|
53
67
|
return;
|
|
54
68
|
}
|
|
55
|
-
process.stdout.write(`${
|
|
69
|
+
process.stdout.write(`${He(s)}
|
|
56
70
|
`);
|
|
57
71
|
}
|
|
58
|
-
function
|
|
59
|
-
const e =
|
|
60
|
-
for (const { categoryName:
|
|
61
|
-
|
|
62
|
-
for (const {
|
|
63
|
-
|
|
72
|
+
function He(s) {
|
|
73
|
+
const e = xe(s), t = e.reduce((o, r) => o + r.count, 0), n = [ce("Deprecation summary", t)];
|
|
74
|
+
for (const { categoryName: o, count: r, packages: i } of e) {
|
|
75
|
+
n.push(`${V[o].label} (${r})`);
|
|
76
|
+
for (const { displayName: d, count: l } of i)
|
|
77
|
+
n.push(` ${le(d)} (${l})`);
|
|
64
78
|
}
|
|
65
|
-
|
|
66
|
-
for (const { categoryName:
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
for (const {
|
|
70
|
-
|
|
71
|
-
for (const {
|
|
72
|
-
const y =
|
|
73
|
-
|
|
74
|
-
for (const
|
|
75
|
-
|
|
76
|
-
for (const { sourceFileName:
|
|
77
|
-
|
|
79
|
+
n.push("", "", ce("Deprecation details", t));
|
|
80
|
+
for (const { categoryName: o, count: r, packages: i } of e) {
|
|
81
|
+
const d = V[o];
|
|
82
|
+
n.push("", `${d.label} (${r})`), "description" in d && n.push(` ${d.description}`);
|
|
83
|
+
for (const { displayName: l, count: c, apis: f } of i) {
|
|
84
|
+
n.push("", ` ${le(l)} (${c})`);
|
|
85
|
+
for (const { name: g, reasons: p, items: m } of f) {
|
|
86
|
+
const y = m[0].usage, h = Re({ name: g, memberOf: y.memberOf, kind: y.kind });
|
|
87
|
+
n.push(` ${Qe(h)}${ze(y.kind)} (${m.length})`);
|
|
88
|
+
for (const v of p)
|
|
89
|
+
n.push(Ge(v, 6));
|
|
90
|
+
for (const { sourceFileName: v, usage: w } of _e(m))
|
|
91
|
+
n.push(` ${I(v)}:${w.line}:${w.column}`);
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
|
-
return
|
|
95
|
+
return n.join(`
|
|
82
96
|
`);
|
|
83
97
|
}
|
|
84
|
-
function
|
|
85
|
-
const e = [...
|
|
86
|
-
([t,
|
|
98
|
+
function xe(s) {
|
|
99
|
+
const e = [...s].flatMap(
|
|
100
|
+
([t, n]) => n.map((o) => ({ ...o, packageName: t }))
|
|
87
101
|
);
|
|
88
|
-
return
|
|
102
|
+
return je(e, ({ packageName: t, usage: n }) => ({
|
|
89
103
|
package: t,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
name: n.name,
|
|
105
|
+
kind: n.kind,
|
|
106
|
+
category: n.category,
|
|
107
|
+
memberOf: n.memberOf,
|
|
108
|
+
module: n.module ?? K(n.originFileNames, t),
|
|
109
|
+
deprecated: n.reason ?? !0
|
|
95
110
|
}));
|
|
96
111
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
112
|
+
function ce(s, e) {
|
|
113
|
+
return q(["bold", "yellow"], `${s} (${e})`);
|
|
99
114
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
115
|
+
function le(s) {
|
|
116
|
+
return q("blue", s);
|
|
102
117
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
118
|
+
function Qe(s) {
|
|
119
|
+
return q(["bold", "white"], s);
|
|
105
120
|
}
|
|
106
|
-
function
|
|
121
|
+
function Ge(s, e) {
|
|
107
122
|
const t = " ".repeat(e);
|
|
108
|
-
return
|
|
123
|
+
return s.split(/\r?\n/u).map((n) => `${t}${n}`).join(`
|
|
109
124
|
`);
|
|
110
125
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
126
|
+
function _e(s) {
|
|
127
|
+
return s.toSorted(
|
|
113
128
|
(e, t) => e.sourceFileName.localeCompare(t.sourceFileName) || e.usage.line - t.usage.line || e.usage.column - t.usage.column
|
|
114
129
|
);
|
|
115
130
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
131
|
+
function Xe(s, e, t = J()) {
|
|
132
|
+
return JSON.stringify(H(s, e, t), void 0, 2);
|
|
118
133
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
134
|
+
function Ye(s, e = J()) {
|
|
135
|
+
return ve(H(s, void 0, e));
|
|
121
136
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
function V(o, e, t) {
|
|
126
|
-
const a = Q(o);
|
|
137
|
+
function H(s, e, t, n) {
|
|
138
|
+
const o = xe(s);
|
|
127
139
|
return {
|
|
128
|
-
|
|
140
|
+
auditKind: "usages",
|
|
129
141
|
repository: t.repository,
|
|
130
142
|
ref: t.ref,
|
|
143
|
+
branch: t.branch,
|
|
144
|
+
scannerVersion: Ce,
|
|
145
|
+
scanDate: Date.now(),
|
|
146
|
+
...n === void 0 ? {} : { complete: n },
|
|
131
147
|
summary: {
|
|
132
|
-
total:
|
|
133
|
-
categories:
|
|
134
|
-
category:
|
|
135
|
-
label:
|
|
136
|
-
count:
|
|
137
|
-
packages:
|
|
138
|
-
package:
|
|
139
|
-
|
|
148
|
+
total: o.reduce((i, { count: d }) => i + d, 0),
|
|
149
|
+
categories: o.map(({ categoryName: i, count: d, packages: l }) => ({
|
|
150
|
+
category: i,
|
|
151
|
+
label: V[i].label,
|
|
152
|
+
count: d,
|
|
153
|
+
packages: l.map(({ packageName: c, displayName: f, count: g }) => ({
|
|
154
|
+
package: c,
|
|
155
|
+
...f === c ? {} : { displayName: f },
|
|
156
|
+
count: g
|
|
140
157
|
}))
|
|
141
158
|
}))
|
|
142
159
|
},
|
|
143
|
-
findings:
|
|
160
|
+
findings: Ze(s, e, t)
|
|
144
161
|
};
|
|
145
162
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
148
|
-
([
|
|
149
|
-
const
|
|
150
|
-
package:
|
|
151
|
-
|
|
152
|
-
category:
|
|
153
|
-
memberOf:
|
|
154
|
-
module:
|
|
155
|
-
|
|
163
|
+
function Ze(s, e, t) {
|
|
164
|
+
return [...s].flatMap(
|
|
165
|
+
([n, o]) => o.map((r) => {
|
|
166
|
+
const i = r.usage.module ?? K(r.usage.originFileNames, n), d = {
|
|
167
|
+
package: n,
|
|
168
|
+
name: r.usage.name,
|
|
169
|
+
category: r.usage.category,
|
|
170
|
+
memberOf: r.usage.memberOf,
|
|
171
|
+
module: i,
|
|
172
|
+
deprecated: r.usage.reason ?? !0
|
|
156
173
|
};
|
|
157
174
|
return {
|
|
158
|
-
...
|
|
159
|
-
category:
|
|
160
|
-
|
|
161
|
-
memberOf:
|
|
162
|
-
file:
|
|
163
|
-
line:
|
|
164
|
-
column:
|
|
165
|
-
codeowners: e?.getOwners(
|
|
175
|
+
...d,
|
|
176
|
+
category: he(d),
|
|
177
|
+
kind: r.usage.kind,
|
|
178
|
+
memberOf: r.usage.memberOf,
|
|
179
|
+
file: Ee(r.sourceFileName, t.repositoryRoot),
|
|
180
|
+
line: r.usage.line,
|
|
181
|
+
column: r.usage.column,
|
|
182
|
+
codeowners: e?.getOwners(r.sourceFileName) ?? []
|
|
166
183
|
};
|
|
167
184
|
})
|
|
185
|
+
).sort(Le);
|
|
186
|
+
}
|
|
187
|
+
function pe(s, e, t) {
|
|
188
|
+
const n = $.extname(s.fileName).slice(1).toLowerCase();
|
|
189
|
+
if (!e.hasDeprecatedApis && t === void 0 && n !== "html")
|
|
190
|
+
return [];
|
|
191
|
+
const o = "getLineAndCharacterOfPosition" in s ? (p) => s.getLineAndCharacterOfPosition(p) : nt(s.text), r = /* @__PURE__ */ new Map(), i = /\bdefine\s*(?:\.\s*amd\b|\[\s*(?:"amd"|'amd')\s*\])/u.test(s.text);
|
|
192
|
+
for (const p of s.text.matchAll(/(?<![-\w\u0080-\uFFFF])--[-\w\u0080-\uFFFF]+/gu)) {
|
|
193
|
+
const m = e.cssVariables.get(p[0]);
|
|
194
|
+
m !== void 0 && d(m, p.index, p[0].length);
|
|
195
|
+
}
|
|
196
|
+
if (n === "html") {
|
|
197
|
+
const p = /* @__PURE__ */ new Map();
|
|
198
|
+
if (ot({
|
|
199
|
+
contents: s.text,
|
|
200
|
+
scanElement: (m, y, h) => {
|
|
201
|
+
c(
|
|
202
|
+
m,
|
|
203
|
+
y,
|
|
204
|
+
h.map(({ name: v, start: w }) => ({ name: v, start: w }))
|
|
205
|
+
);
|
|
206
|
+
},
|
|
207
|
+
scanStyle: (m, y) => de(m, y, f),
|
|
208
|
+
scanScript: (m, y, h) => {
|
|
209
|
+
const v = h.find(({ name: N }) => N === "type")?.value?.trim().toLowerCase() ?? "";
|
|
210
|
+
if (h.some(({ name: N }) => N === "src") || ![
|
|
211
|
+
"",
|
|
212
|
+
"module",
|
|
213
|
+
"text/javascript",
|
|
214
|
+
"application/javascript",
|
|
215
|
+
"text/ecmascript",
|
|
216
|
+
"application/ecmascript"
|
|
217
|
+
].includes(v.split(";")[0]))
|
|
218
|
+
return;
|
|
219
|
+
const w = `${s.fileName}.script-${p.size}.js`;
|
|
220
|
+
p.set(w, {
|
|
221
|
+
source: a.createSourceFile(
|
|
222
|
+
w,
|
|
223
|
+
v === "module" ? `${m}
|
|
224
|
+
export {};` : m,
|
|
225
|
+
a.ScriptTarget.Latest,
|
|
226
|
+
!0,
|
|
227
|
+
a.ScriptKind.JS
|
|
228
|
+
),
|
|
229
|
+
offset: y
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}), p.size > 0) {
|
|
233
|
+
const m = {
|
|
234
|
+
allowJs: !0,
|
|
235
|
+
noLib: !0,
|
|
236
|
+
noResolve: !0,
|
|
237
|
+
types: [],
|
|
238
|
+
target: a.ScriptTarget.Latest
|
|
239
|
+
}, h = a.createProgram([...p.keys()], m, {
|
|
240
|
+
...a.createCompilerHost(m),
|
|
241
|
+
getSourceFile: (v) => p.get(v)?.source
|
|
242
|
+
}).getTypeChecker();
|
|
243
|
+
for (const { source: v, offset: w } of p.values())
|
|
244
|
+
g({ node: v, jsxSourceFile: v, typeChecker: h, offset: w });
|
|
245
|
+
}
|
|
246
|
+
} else n === "css" || n === "scss" || n === "sass" ? de(s.text, 0, f, n !== "css") : "kind" in s && g({ node: s, jsxSourceFile: s, typeChecker: t });
|
|
247
|
+
return [...r.values()].sort((p, m) => p.usage.start - m.usage.start);
|
|
248
|
+
function d(p, m, y) {
|
|
249
|
+
const { line: h, character: v } = o(m);
|
|
250
|
+
r.set(JSON.stringify([p.package, p.kind, p.memberOf, p.name, m]), {
|
|
251
|
+
packageName: p.package,
|
|
252
|
+
sourceFileName: s.fileName,
|
|
253
|
+
usage: {
|
|
254
|
+
name: p.name,
|
|
255
|
+
kind: p.kind,
|
|
256
|
+
memberOf: p.kind === "css-property" ? void 0 : p.memberOf,
|
|
257
|
+
module: p.module,
|
|
258
|
+
reason: p.reason,
|
|
259
|
+
originFileNames: [p.sourceFileName],
|
|
260
|
+
start: m,
|
|
261
|
+
length: y,
|
|
262
|
+
line: h + 1,
|
|
263
|
+
column: v + 1
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function l(p, m, y) {
|
|
268
|
+
const h = e.components.get(p);
|
|
269
|
+
if (h?.length === 1)
|
|
270
|
+
return h[0].definitions.find((v) => et({ entry: v, tag: p, kind: m, name: y }));
|
|
271
|
+
}
|
|
272
|
+
function c(p, m, y) {
|
|
273
|
+
const h = l(p, "element", p);
|
|
274
|
+
h !== void 0 && d(h, m, p.length);
|
|
275
|
+
for (const v of y) {
|
|
276
|
+
const w = l(p, "attribute", v.name);
|
|
277
|
+
w !== void 0 && d(w, v.start, v.name.length);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function f(p, m, y, h) {
|
|
281
|
+
const v = l(p, m, y);
|
|
282
|
+
v !== void 0 && d(v, h, y.length);
|
|
283
|
+
}
|
|
284
|
+
function g({
|
|
285
|
+
node: p,
|
|
286
|
+
jsxSourceFile: m,
|
|
287
|
+
typeChecker: y,
|
|
288
|
+
offset: h = 0
|
|
289
|
+
}) {
|
|
290
|
+
const v = tt({ node: p, checker: y });
|
|
291
|
+
if (v !== void 0 && (v.text !== "define" || !i)) {
|
|
292
|
+
const w = h + v.getStart(m), { line: N, character: b } = o(w);
|
|
293
|
+
r.set(`amd:${w}`, {
|
|
294
|
+
packageName: "@arcgis/core",
|
|
295
|
+
sourceFileName: s.fileName,
|
|
296
|
+
usage: {
|
|
297
|
+
name: v.text,
|
|
298
|
+
kind: "function",
|
|
299
|
+
module: "amd",
|
|
300
|
+
reason: "require/define is deprecated. Use $arcgis.import() or ESM instead. See https://developers.arcgis.com/javascript/latest/get-started/",
|
|
301
|
+
originFileNames: [],
|
|
302
|
+
start: w,
|
|
303
|
+
length: v.getWidth(m),
|
|
304
|
+
line: N + 1,
|
|
305
|
+
column: b + 1
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
if (a.isJsxOpeningElement(p) || a.isJsxSelfClosingElement(p)) {
|
|
310
|
+
const w = p.tagName.getText(m), N = p.attributes.properties.filter(a.isJsxAttribute);
|
|
311
|
+
if (c(
|
|
312
|
+
w,
|
|
313
|
+
p.tagName.getStart(m),
|
|
314
|
+
N.map((b) => ({
|
|
315
|
+
name: b.name.getText(m),
|
|
316
|
+
start: b.name.getStart(m)
|
|
317
|
+
}))
|
|
318
|
+
), /^[a-z][\w-]*$/u.test(w)) {
|
|
319
|
+
const b = N.find((A) => A.name.getText(m) === "slot"), k = b?.initializer, u = k !== void 0 && a.isJsxExpression(k) ? k.expression : k, x = b === void 0 ? -1 : p.attributes.properties.indexOf(b), S = p.attributes.properties.slice(x + 1).some(a.isJsxSpreadAttribute);
|
|
320
|
+
if (u !== void 0 && (a.isStringLiteral(u) || a.isNoSubstitutionTemplateLiteral(u)) && !S) {
|
|
321
|
+
const A = st(a.isJsxOpeningElement(p) ? p.parent : p, y), C = A === void 0 ? void 0 : l(A, "slot", u.text);
|
|
322
|
+
C !== void 0 && d(C, u.getStart(m) + 1, u.getWidth(m) - 2);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
a.forEachChild(p, (w) => g({ node: w, jsxSourceFile: m, typeChecker: y, offset: h }));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function et({
|
|
330
|
+
entry: s,
|
|
331
|
+
tag: e,
|
|
332
|
+
kind: t,
|
|
333
|
+
name: n
|
|
334
|
+
}) {
|
|
335
|
+
const o = s.attribute;
|
|
336
|
+
if (t === "attribute" && o !== void 0) {
|
|
337
|
+
const r = o.tagName === e, i = o.name === n;
|
|
338
|
+
return r && i;
|
|
339
|
+
}
|
|
340
|
+
return s.kind !== t || s.name !== n ? !1 : t === "element" ? !0 : s.memberOf === e;
|
|
341
|
+
}
|
|
342
|
+
function tt({
|
|
343
|
+
node: s,
|
|
344
|
+
checker: e
|
|
345
|
+
}) {
|
|
346
|
+
if (e === void 0 || !a.isCallExpression(s))
|
|
347
|
+
return;
|
|
348
|
+
const t = s.expression;
|
|
349
|
+
let n, o;
|
|
350
|
+
if (a.isIdentifier(t))
|
|
351
|
+
n = t, o = t;
|
|
352
|
+
else if (a.isPropertyAccessExpression(t) && a.isIdentifier(t.name) && a.isIdentifier(t.expression) && ["window", "opener", "globalThis"].includes(t.expression.text))
|
|
353
|
+
n = t.name, o = t.expression;
|
|
354
|
+
else
|
|
355
|
+
return;
|
|
356
|
+
if (n.text !== "define" && n.text !== "require")
|
|
357
|
+
return;
|
|
358
|
+
if (n.text === "require") {
|
|
359
|
+
const i = s.arguments[0];
|
|
360
|
+
if (!(i !== void 0 && a.isArrayLiteralExpression(i)) && s.getSourceFile().fileName.toLowerCase().endsWith(".cjs") || i !== void 0 && a.isStringLiteralLike(i) && !i.text.startsWith("esri/"))
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
return (e.getSymbolAtLocation(o)?.declarations ?? []).every(
|
|
364
|
+
(i) => a.isPropertyAccessExpression(t) && i.getSourceFile().isDeclarationFile
|
|
365
|
+
) ? n : void 0;
|
|
366
|
+
}
|
|
367
|
+
function nt(s) {
|
|
368
|
+
const e = [
|
|
369
|
+
0,
|
|
370
|
+
...Array.from(s.matchAll(/\r\n|[\r\n\u2028\u2029]/gu), (t) => t.index + t[0].length)
|
|
371
|
+
];
|
|
372
|
+
return (t) => {
|
|
373
|
+
let n = 0, o = e.length;
|
|
374
|
+
for (; n + 1 < o; ) {
|
|
375
|
+
const r = Math.floor((n + o) / 2);
|
|
376
|
+
e[r] <= t ? n = r : o = r;
|
|
377
|
+
}
|
|
378
|
+
return { line: n, character: t - e[n] };
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function st(s, e) {
|
|
382
|
+
let t = s;
|
|
383
|
+
for (let n = t.parent; n !== void 0; t = n, n = n.parent) {
|
|
384
|
+
if (a.isJsxElement(n))
|
|
385
|
+
return n.openingElement.tagName.getText();
|
|
386
|
+
if (!(a.isJsxFragment(n) || a.isJsxExpression(n) || a.isParenthesizedExpression(n)) && !(a.isConditionalExpression(n) && t !== n.condition) && !(a.isBinaryExpression(n) && (n.operatorToken.kind === a.SyntaxKind.AmpersandAmpersandToken && t === n.right || n.operatorToken.kind === a.SyntaxKind.BarBarToken || n.operatorToken.kind === a.SyntaxKind.QuestionQuestionToken))) {
|
|
387
|
+
if (a.isReturnStatement(n)) {
|
|
388
|
+
const o = a.findAncestor(n, a.isFunctionLike);
|
|
389
|
+
if (o === void 0 || !a.isArrowFunction(o) && !a.isFunctionExpression(o))
|
|
390
|
+
return;
|
|
391
|
+
t = o.body, n = o;
|
|
392
|
+
}
|
|
393
|
+
if ((a.isArrowFunction(n) || a.isFunctionExpression(n)) && t === n.body) {
|
|
394
|
+
const o = n.parent;
|
|
395
|
+
if (!a.isCallExpression(o) || o.arguments[0] !== n || !a.isPropertyAccessExpression(o.expression) || o.expression.name.text !== "map")
|
|
396
|
+
return;
|
|
397
|
+
const r = o.expression.expression, i = e?.getTypeAtLocation(r);
|
|
398
|
+
if (!a.isArrayLiteralExpression(r) && (i === void 0 || !e.isArrayType(i) && !e.isTupleType(i)))
|
|
399
|
+
return;
|
|
400
|
+
t = n, n = o;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function de(s, e, t, n = !1) {
|
|
408
|
+
const o = n ? /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\/\/[^\r\n]*/gu : /\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/gu, r = s.replace(o, (c) => c.replace(/[^\r\n]/gu, " ")), i = [];
|
|
409
|
+
let d = 0, l = 0;
|
|
410
|
+
for (const c of r.matchAll(/[{};]/gu)) {
|
|
411
|
+
const f = c.index;
|
|
412
|
+
if (l > 0) {
|
|
413
|
+
l += c[0] === "{" ? 1 : c[0] === "}" ? -1 : 0, d = f + 1;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (c[0] === "}")
|
|
417
|
+
i.pop();
|
|
418
|
+
else if (c[0] === "{") {
|
|
419
|
+
const g = r.slice(d, f), p = i.at(-1) ?? [];
|
|
420
|
+
if (/^\s*--[\w-]+\s*:/u.test(g))
|
|
421
|
+
l = 1;
|
|
422
|
+
else if (g.trimStart().startsWith("@"))
|
|
423
|
+
i.push(p);
|
|
424
|
+
else {
|
|
425
|
+
const y = g.split(",").map((h) => h.trim()).flatMap(
|
|
426
|
+
(h) => p.length === 0 ? [h] : p.map(
|
|
427
|
+
(v) => h.includes("&") ? h.replaceAll("&", v) : `${v} ${h}`
|
|
428
|
+
)
|
|
429
|
+
);
|
|
430
|
+
for (const h of g.matchAll(/::part\(\s*([\w\s-]+?)\s*\)|:state\(\s*([\w-]+)\s*\)/gu)) {
|
|
431
|
+
const v = g.lastIndexOf(",", h.index) + 1, w = g.slice(v, h.index), b = (p.length === 0 ? [w] : p.map(
|
|
432
|
+
(S) => w.includes("&") ? w.replaceAll("&", S) : `${S} ${w}`
|
|
433
|
+
)).map(it);
|
|
434
|
+
if (b.includes(void 0) || new Set(b).size !== 1)
|
|
435
|
+
continue;
|
|
436
|
+
const k = h[1] === void 0 ? "css-state" : "css-part", u = h[1] ?? h[2], x = h.index + h[0].indexOf(u);
|
|
437
|
+
for (const S of u.matchAll(/[\w-]+/gu))
|
|
438
|
+
t(b[0], k, S[0], e + d + x + S.index);
|
|
439
|
+
}
|
|
440
|
+
i.push(y);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
d = f + 1;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function it(s) {
|
|
447
|
+
const e = s.replace(/:state\([\w-]+\)/gu, "").trimStart();
|
|
448
|
+
return /(?:^|[\s>+~])([a-z][\w-]*)(?:[.#:][\w-]+|\[[^\]]*\])*$/iu.exec(e)?.[1]?.toLowerCase();
|
|
449
|
+
}
|
|
450
|
+
function ot({
|
|
451
|
+
contents: s,
|
|
452
|
+
scanElement: e,
|
|
453
|
+
scanStyle: t,
|
|
454
|
+
scanScript: n
|
|
455
|
+
}) {
|
|
456
|
+
const o = /<!--[\s\S]*?(?:-->|$)|<![^>]*>|<\/?([a-z][\w:-]*)\b((?:"[^"]*"|'[^']*'|[^'">])*)>/giu;
|
|
457
|
+
for (let r = o.exec(s); r !== null; r = o.exec(s)) {
|
|
458
|
+
if (r[1] === void 0 || r[0].startsWith("</"))
|
|
459
|
+
continue;
|
|
460
|
+
const i = r[1].toLowerCase(), d = r.index + 1 + r[1].length, l = [...r[2].matchAll(/([^\s"'<>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gu)].map(
|
|
461
|
+
(c) => ({
|
|
462
|
+
name: c[1].toLowerCase(),
|
|
463
|
+
start: d + c.index,
|
|
464
|
+
value: c[2] ?? c[3] ?? c[4]
|
|
465
|
+
})
|
|
466
|
+
);
|
|
467
|
+
if (e(i, r.index + 1, l), i === "plaintext")
|
|
468
|
+
break;
|
|
469
|
+
if (["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes"].includes(i)) {
|
|
470
|
+
const c = new RegExp(`</${i}\\s*>`, "giu");
|
|
471
|
+
c.lastIndex = o.lastIndex;
|
|
472
|
+
const f = c.exec(s);
|
|
473
|
+
i === "style" ? t(s.slice(o.lastIndex, f?.index ?? s.length), o.lastIndex) : i === "script" && n?.(s.slice(o.lastIndex, f?.index ?? s.length), o.lastIndex, l), o.lastIndex = f === null ? s.length : c.lastIndex;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const at = /[:/@\\]|^\.{1,2}$|\.(?:tgz|tar(?:\.gz)?)$/iu;
|
|
478
|
+
async function rt(s, e, t) {
|
|
479
|
+
const n = JSON.parse('["@arcgis/ai-components","@arcgis/api-extractor","@arcgis/arcade-parser","@arcgis/arcade-languageservice","@arcgis/charts-components","@arcgis/codemod","@arcgis/coding-components","@arcgis/common-components","@arcgis/core","@arcgis/lumina-toolkit","@arcgis/create","@arcgis/eslint-config","@arcgis/languages-api-utils","@arcgis/languages-sdk-spec","@arcgis/lumina","@arcgis/lumina-compiler","@arcgis/map-components","@arcgis/node-toolkit","@arcgis/portal-components","@arcgis/toolkit"]'), o = new Set(n), r = /* @__PURE__ */ new Set([...n, "@esri/calcite-components"]), i = [...new Map(s.map((g) => [g.filePath, g])).values()], d = new Set(
|
|
480
|
+
(await Promise.all(
|
|
481
|
+
i.map(async ({ filePath: g, contents: p }) => {
|
|
482
|
+
const m = [await j(g)], y = p.publishConfig?.directory;
|
|
483
|
+
if (typeof y == "string") {
|
|
484
|
+
const h = $.resolve($.dirname(g), y, "package.json");
|
|
485
|
+
a.sys.fileExists(h) && m.push(await j(h));
|
|
486
|
+
}
|
|
487
|
+
return m;
|
|
488
|
+
})
|
|
489
|
+
)).flat()
|
|
490
|
+
), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = [];
|
|
491
|
+
await me(i, 4, async (g) => {
|
|
492
|
+
let p;
|
|
493
|
+
const m = [], y = {
|
|
494
|
+
...g.contents.peerDependencies,
|
|
495
|
+
...g.contents.optionalDependencies,
|
|
496
|
+
...g.contents.devDependencies,
|
|
497
|
+
...g.contents.dependencies
|
|
498
|
+
};
|
|
499
|
+
for (const [N, b] of Object.entries(y)) {
|
|
500
|
+
const k = b.replace(/^npm:/u, "");
|
|
501
|
+
if (!r.has(N) || !b.startsWith("catalog:") && at.test(k))
|
|
502
|
+
continue;
|
|
503
|
+
const u = await ye(
|
|
504
|
+
$.join("node_modules", N, "package.json"),
|
|
505
|
+
$.dirname(g.filePath)
|
|
506
|
+
);
|
|
507
|
+
if (u === void 0) {
|
|
508
|
+
(e === void 0 || N === e) && f.push(`${N} (${g.contents.name ?? g.filePath})`);
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (d.has(await j(u)))
|
|
512
|
+
continue;
|
|
513
|
+
const x = await We($.dirname(u));
|
|
514
|
+
!x.name || !x.version || !r.has(x.name) || m.push({ declared: b, location: u, name: x.name, version: x.version });
|
|
515
|
+
}
|
|
516
|
+
const h = Map.groupBy(
|
|
517
|
+
m.filter(({ name: N }) => o.has(N)),
|
|
518
|
+
({ version: N }) => N
|
|
519
|
+
), v = L.maxSatisfying([...h.keys()], "*", {
|
|
520
|
+
includePrerelease: !0
|
|
521
|
+
}), w = [...h].sort(([N], [b]) => N.localeCompare(b)).map(
|
|
522
|
+
([N, b]) => `${N}: ${b.map(({ name: k }) => `\`${k}\``).sort().join(", ")}`
|
|
523
|
+
).join("; ");
|
|
524
|
+
for (const { declared: N, location: b, name: k, version: u } of m) {
|
|
525
|
+
if (e !== void 0 && k !== e)
|
|
526
|
+
continue;
|
|
527
|
+
let x = l.get(k);
|
|
528
|
+
x === void 0 && (x = lt(k), l.set(k, x));
|
|
529
|
+
const S = await x;
|
|
530
|
+
S === void 0 && t?.();
|
|
531
|
+
const A = S === void 0 ? void 0 : dt(u, S), C = [];
|
|
532
|
+
A !== void 0 && C.push({
|
|
533
|
+
category: "outdatedDependencies",
|
|
534
|
+
targetVersion: A.expected,
|
|
535
|
+
reason: `Update to ${A.expected} (declared ${N}). ${A.reason}`
|
|
536
|
+
}), o.has(k) && v !== null && L.lt(u, v) && C.push({
|
|
537
|
+
category: "mismatchedDependencies",
|
|
538
|
+
targetVersion: v,
|
|
539
|
+
reason: `Web GIS SDK packages within the same package.json must use the same exact version (found ${w}).`
|
|
540
|
+
});
|
|
541
|
+
for (const { category: E, targetVersion: T, reason: P } of C) {
|
|
542
|
+
let D;
|
|
543
|
+
if (E === "outdatedDependencies" && N.startsWith("catalog:"))
|
|
544
|
+
try {
|
|
545
|
+
D = await ct(g.filePath, k, N);
|
|
546
|
+
} catch (O) {
|
|
547
|
+
t?.(), R(
|
|
548
|
+
"warn",
|
|
549
|
+
I(g.filePath),
|
|
550
|
+
`Unable to locate dependency catalog: ${String(O)}`
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
D === void 0 && (p ??= a.parseJsonText(g.filePath, await z(g.filePath, "utf8")));
|
|
554
|
+
const F = c.get(k) ?? [];
|
|
555
|
+
D !== void 0 && F.some(
|
|
556
|
+
(O) => O.sourceFileName === D.sourceFileName && O.usage.start === D.location.start && O.usage.category === E
|
|
557
|
+
) || (F.push({
|
|
558
|
+
sourceFileName: D?.sourceFileName ?? g.filePath,
|
|
559
|
+
usage: {
|
|
560
|
+
name: `${u} => ${T}`,
|
|
561
|
+
category: E,
|
|
562
|
+
module: D === void 0 ? "package.json" : "pnpm-workspace.yaml",
|
|
563
|
+
originFileNames: [b],
|
|
564
|
+
reason: P,
|
|
565
|
+
...D?.location ?? pt(p, k, N)
|
|
566
|
+
}
|
|
567
|
+
}), c.set(k, F));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
for (const g of c.values())
|
|
572
|
+
g.sort(
|
|
573
|
+
(p, m) => p.sourceFileName.localeCompare(m.sourceFileName) || p.usage.start - m.usage.start
|
|
574
|
+
);
|
|
575
|
+
return f.length > 0 && (t?.(), f.sort(), R(
|
|
576
|
+
"warn",
|
|
577
|
+
"dependency-versions",
|
|
578
|
+
`Failed to find installed locations for ${f.length} dependencies: ${f.slice(0, 15).join(", ")}${f.length > 15 ? `, and ${f.length - 15} more` : ""}.`
|
|
579
|
+
)), c;
|
|
580
|
+
}
|
|
581
|
+
async function ct(s, e, t) {
|
|
582
|
+
const n = await ye("pnpm-workspace.yaml", $.dirname(s));
|
|
583
|
+
if (n === void 0)
|
|
584
|
+
throw new Error(`Missing pnpm-workspace.yaml for ${t}`);
|
|
585
|
+
const o = await j(n), r = new Ve(), i = Be(await z(o, "utf8"), { lineCounter: r });
|
|
586
|
+
if (i.errors.length > 0)
|
|
587
|
+
throw i.errors[0];
|
|
588
|
+
const d = t.slice(8), l = i.getIn(
|
|
589
|
+
d === "" || d === "default" ? ["catalog"] : ["catalogs", d],
|
|
590
|
+
!0
|
|
591
|
+
), c = Ke(l) ? l.items.find(({ key: y }) => re(y) && y.value === e)?.key : void 0;
|
|
592
|
+
if (!re(c) || c.range === void 0)
|
|
593
|
+
throw new Error(`Missing ${e} in ${t} in ${o}`);
|
|
594
|
+
const [f, g] = c.range, { line: p, col: m } = r.linePos(f);
|
|
595
|
+
return { sourceFileName: o, location: { start: f, length: g - f, line: p, column: m } };
|
|
596
|
+
}
|
|
597
|
+
async function lt(s) {
|
|
598
|
+
try {
|
|
599
|
+
const e = await fetch(`https://registry.npmjs.org/-/package/${encodeURIComponent(s)}/dist-tags`, {
|
|
600
|
+
signal: AbortSignal.timeout(5e3),
|
|
601
|
+
redirect: "error"
|
|
602
|
+
});
|
|
603
|
+
if (!e.ok)
|
|
604
|
+
throw new Error(`Registry returned HTTP ${e.status}`);
|
|
605
|
+
const t = await e.json();
|
|
606
|
+
if (typeof t != "object" || t === null || Array.isArray(t))
|
|
607
|
+
throw new Error("Invalid registry dist-tags response");
|
|
608
|
+
const n = {};
|
|
609
|
+
for (const [o, r] of Object.entries(t))
|
|
610
|
+
["latest", "rc", "next"].includes(o) && typeof r == "string" && L.valid(r) !== null && (n[o] = r);
|
|
611
|
+
if (Object.keys(n).length === 0)
|
|
612
|
+
throw new Error("Registry returned no supported release tags");
|
|
613
|
+
return n;
|
|
614
|
+
} catch (e) {
|
|
615
|
+
R("warn", s, `Dependency freshness unavailable: ${String(e)}`);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function pt(s, e, t) {
|
|
620
|
+
const n = a.forEachChild(s, d), o = n.getStart(s), { line: r, character: i } = s.getLineAndCharacterOfPosition(o);
|
|
621
|
+
return { start: o, length: n.getWidth(s), line: r + 1, column: i + 1 };
|
|
622
|
+
function d(l) {
|
|
623
|
+
return a.isPropertyAssignment(l) && a.isStringLiteral(l.name) && ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"].includes(l.name.text) && a.isObjectLiteralExpression(l.initializer) ? l.initializer.properties.find(
|
|
624
|
+
(c) => a.isPropertyAssignment(c) && a.isStringLiteral(c.name) && c.name.text === e && a.isStringLiteral(c.initializer) && c.initializer.text === t
|
|
625
|
+
)?.name : a.forEachChild(l, d);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function dt(s, e) {
|
|
629
|
+
const t = L.parse(s), n = L.parse(e.latest ?? "");
|
|
630
|
+
if (t === null)
|
|
631
|
+
return;
|
|
632
|
+
if (
|
|
633
|
+
// Permit packages without latest dist-tag
|
|
634
|
+
n !== null && // Permit installed to be newer than latest
|
|
635
|
+
L.lt(t, n) && // Require using stable over prerelease
|
|
636
|
+
(t.prerelease.length > 0 || // Forbid major being behind stable
|
|
637
|
+
t.major !== n.major || // Forbid minor being behind stable
|
|
638
|
+
t.minor !== n.minor)
|
|
639
|
+
)
|
|
640
|
+
return {
|
|
641
|
+
expected: n.version,
|
|
642
|
+
reason: "A newer stable release is available. Prerelease versions are deprecated."
|
|
643
|
+
};
|
|
644
|
+
if (
|
|
645
|
+
// Enforce policy only for next.N prereleases
|
|
646
|
+
t.prerelease.length !== 2 || // Only enforce policy for -next
|
|
647
|
+
t.prerelease[0] !== "next"
|
|
648
|
+
)
|
|
649
|
+
return;
|
|
650
|
+
const o = t.prerelease[1];
|
|
651
|
+
if (typeof o != "number")
|
|
652
|
+
return;
|
|
653
|
+
const i = [e.next, e.rc].flatMap((d) => {
|
|
654
|
+
const l = L.parse(d ?? "");
|
|
655
|
+
return l !== null && // Support packages without latest dist-tag
|
|
656
|
+
(n === null || // Ignore rc dist-tag if it is behind latest
|
|
657
|
+
L.gt(l, n)) && // Require same major.minor.patch for -next version comparison
|
|
658
|
+
l.major === t.major && l.minor === t.minor && l.patch === t.patch && // Require next.N format for comparison
|
|
659
|
+
l.prerelease.length === 2 && l.prerelease[0] === "next" && typeof l.prerelease[1] == "number" ? [l] : [];
|
|
660
|
+
}).sort(L.rcompare).at(0);
|
|
661
|
+
if (i !== void 0 && Number(i.prerelease[1]) - o >= 30)
|
|
662
|
+
return {
|
|
663
|
+
expected: i.version,
|
|
664
|
+
reason: "Installed -next is significantly behind the most recent -next build."
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const mt = /* @__PURE__ */ new Set(["none", "amd", "umd", "system", "systemjs", "node", "node10", "legacy"]), ut = /* @__PURE__ */ new Set(["node", "node10", "classic"]);
|
|
668
|
+
async function gt(s) {
|
|
669
|
+
const e = "es2024", t = [];
|
|
670
|
+
for (const n of [...new Set(s)].sort()) {
|
|
671
|
+
const o = a.parseJsonText(n, await z(n, "utf8"));
|
|
672
|
+
t.push(...ft(o, e));
|
|
673
|
+
}
|
|
674
|
+
return t;
|
|
675
|
+
}
|
|
676
|
+
function ft(s, e) {
|
|
677
|
+
const t = s.statements[0];
|
|
678
|
+
if (t === void 0 || !a.isExpressionStatement(t) || !a.isObjectLiteralExpression(t.expression))
|
|
679
|
+
return [];
|
|
680
|
+
const n = t.expression.properties.find(
|
|
681
|
+
(i) => a.isPropertyAssignment(i) && a.isStringLiteral(i.name) && i.name.text === "compilerOptions"
|
|
168
682
|
);
|
|
683
|
+
if (n === void 0 || !a.isObjectLiteralExpression(n.initializer))
|
|
684
|
+
return [];
|
|
685
|
+
const o = a.convertCompilerOptionsFromJson({ target: e }, ".").options.target, r = [];
|
|
686
|
+
for (const i of n.initializer.properties) {
|
|
687
|
+
if (!a.isPropertyAssignment(i) || !a.isStringLiteral(i.name))
|
|
688
|
+
continue;
|
|
689
|
+
const d = i.name.text, l = a.isStringLiteral(i.initializer) ? i.initializer.text.toLowerCase() : void 0;
|
|
690
|
+
let c;
|
|
691
|
+
if (d === "module" && l !== void 0 && mt.has(l))
|
|
692
|
+
c = `The ${l} module setting is legacy or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
|
|
693
|
+
else if (d === "moduleResolution" && l !== void 0 && ut.has(l))
|
|
694
|
+
c = `The ${l} module resolution setting is deprecated or unsupported. Update to newer module setting. See https://webgis.esri.com/references/support-packages/typescript.`;
|
|
695
|
+
else if (d === "target" && l !== void 0) {
|
|
696
|
+
const m = a.convertCompilerOptionsFromJson({ target: l }, ".").options.target;
|
|
697
|
+
m !== void 0 && m < o && (c = `Targets below ${e} are older than Maps SDK's for JavaScript supported targets. See https://next.gha.afd.arcgis.com/javascript/latest/system-requirements/.`);
|
|
698
|
+
} else d === "ignoreDeprecations" && (c = "Address deprecations that were suppressed by ignoreDeprecations.");
|
|
699
|
+
if (c === void 0)
|
|
700
|
+
continue;
|
|
701
|
+
const f = i.name.getStart(s), { line: g, character: p } = s.getLineAndCharacterOfPosition(f);
|
|
702
|
+
r.push({
|
|
703
|
+
sourceFileName: s.fileName,
|
|
704
|
+
usage: {
|
|
705
|
+
name: `compilerOptions.${d}${l === void 0 ? "" : `: ${l}`}`,
|
|
706
|
+
category: "outdatedTypeScriptConfig",
|
|
707
|
+
module: "tsconfig.json",
|
|
708
|
+
originFileNames: [],
|
|
709
|
+
reason: c,
|
|
710
|
+
start: f,
|
|
711
|
+
length: i.name.getWidth(s),
|
|
712
|
+
line: g + 1,
|
|
713
|
+
column: p + 1
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
return r;
|
|
169
718
|
}
|
|
170
|
-
async function
|
|
171
|
-
|
|
719
|
+
async function Kt(s, e) {
|
|
720
|
+
if (e.reportingUrl && (s || e.esriOnly || e.category || e.packageName))
|
|
721
|
+
throw new Error("Reporting requires a complete, unfiltered repository scan.");
|
|
722
|
+
const t = e.outputFormat === "json" || e.reportingUrl ? process.cwd() === J().repositoryRoot : !1;
|
|
723
|
+
if (e.reportingUrl && !t)
|
|
724
|
+
throw new Error("Reporting requires scanning from the Git repository root.");
|
|
725
|
+
let n = !s && !e.esriOnly && !e.category && !e.packageName;
|
|
726
|
+
(e.outputFormat === "json" || e.reportingUrl) && (n &&= t), await ke(
|
|
172
727
|
{
|
|
173
728
|
meta: {
|
|
174
729
|
needsTypeInformation: !0,
|
|
175
|
-
needsFooter: !1
|
|
730
|
+
needsFooter: !1,
|
|
731
|
+
includeComponentFiles: !0,
|
|
732
|
+
includeTsConfigFiles: !0
|
|
176
733
|
},
|
|
177
|
-
run(
|
|
178
|
-
|
|
734
|
+
async run(o) {
|
|
735
|
+
await ht(o, e, n, s);
|
|
179
736
|
}
|
|
180
737
|
},
|
|
181
738
|
"deprecations audit-usages",
|
|
182
|
-
|
|
739
|
+
s
|
|
183
740
|
);
|
|
184
741
|
}
|
|
185
|
-
function
|
|
186
|
-
const
|
|
742
|
+
async function ht(s, e, t, n) {
|
|
743
|
+
const o = /* @__PURE__ */ new Map(), r = Ie("warn", () => {
|
|
744
|
+
t = !1;
|
|
745
|
+
}), i = /* @__PURE__ */ new Map(), d = ie([]), l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), f = [
|
|
187
746
|
...new Map(
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
return
|
|
747
|
+
s.flatMap(({ packageJson: u }) => {
|
|
748
|
+
const x = u === void 0 ? void 0 : $.dirname(u.filePath), S = u?.contents.name;
|
|
749
|
+
return x !== void 0 && S !== void 0 && M(x, process.cwd()) ? [[x, { root: x, name: S }]] : [];
|
|
191
750
|
})
|
|
192
751
|
).values()
|
|
193
|
-
].toSorted((
|
|
194
|
-
for (const
|
|
195
|
-
var
|
|
752
|
+
].toSorted((u, x) => x.root.length - u.root.length);
|
|
753
|
+
for (const u of s) {
|
|
754
|
+
var w = [];
|
|
196
755
|
try {
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
|
|
756
|
+
if (U(u.packageJson?.contents.name)) {
|
|
757
|
+
const P = u.packageJson?.filePath;
|
|
758
|
+
P !== void 0 && !c.has(P) && (c.add(P), R(
|
|
200
759
|
"warn",
|
|
201
|
-
|
|
202
|
-
`Skipping excluded package \`${
|
|
760
|
+
I(P),
|
|
761
|
+
`Skipping excluded package \`${u.packageJson?.contents.name ?? u.cwd}\`.`
|
|
203
762
|
));
|
|
204
763
|
continue;
|
|
205
764
|
}
|
|
206
|
-
|
|
207
|
-
const d = g.tsMorph.getLanguageService().compilerObject;
|
|
208
|
-
const y = d.getProgram()?.getTypeChecker();
|
|
209
|
-
if (y === void 0)
|
|
765
|
+
if (u.filePaths.length === 0)
|
|
210
766
|
continue;
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
767
|
+
const x = Oe(u.packageJson);
|
|
768
|
+
const S = await h(u.packageJson, x.packages);
|
|
769
|
+
const A = u.packageJson === void 0 ? void 0 : $.dirname(u.packageJson.filePath);
|
|
770
|
+
const C = ne(w, u.filePaths.some(Ae) ? be(u, !1, {
|
|
771
|
+
paths: { ...u.typeScriptConfig?.compilerOptions.paths, ...x.paths }
|
|
772
|
+
}) : void 0);
|
|
773
|
+
const E = C?.tsMorph.getLanguageService().compilerObject;
|
|
774
|
+
const T = E?.getProgram()?.getTypeChecker();
|
|
775
|
+
for (const P of C?.getCodemodFiles() ?? []) {
|
|
776
|
+
const D = P.compilerNode;
|
|
777
|
+
if (!oe(D.fileName)) {
|
|
778
|
+
if (E !== void 0 && T !== void 0) {
|
|
779
|
+
const F = yt(
|
|
780
|
+
D,
|
|
781
|
+
E,
|
|
782
|
+
T,
|
|
783
|
+
A,
|
|
784
|
+
e.esriOnly
|
|
785
|
+
);
|
|
786
|
+
for (const O of F) {
|
|
787
|
+
const Y = At(O.originFileNames, f, A), Z = o.get(Y) ?? [];
|
|
788
|
+
Z.push({ sourceFileName: D.fileName, usage: O }), o.set(Y, Z);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
v(pe(D, S, T)), l.add(D.fileName);
|
|
223
792
|
}
|
|
224
793
|
}
|
|
225
|
-
|
|
226
|
-
|
|
794
|
+
await me(u.filePaths, 8, async (P) => {
|
|
795
|
+
const D = P.toLowerCase().endsWith(".html");
|
|
796
|
+
if (l.has(P) || oe(P) || !S.hasDeprecatedApis && !D)
|
|
797
|
+
return;
|
|
798
|
+
const F = await z(P, "utf8");
|
|
799
|
+
v(pe({ fileName: P, text: F }, S)), l.add(P);
|
|
800
|
+
});
|
|
801
|
+
} catch (N) {
|
|
802
|
+
var b = N, k = !0;
|
|
227
803
|
} finally {
|
|
228
|
-
|
|
804
|
+
se(w, b, k);
|
|
229
805
|
}
|
|
230
806
|
}
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
807
|
+
const g = await rt(
|
|
808
|
+
s.flatMap(
|
|
809
|
+
({ packageJson: u }) => u === void 0 || U(u.contents.name) ? [] : [u]
|
|
810
|
+
),
|
|
811
|
+
e.packageName,
|
|
812
|
+
() => {
|
|
813
|
+
t = !1;
|
|
814
|
+
}
|
|
239
815
|
);
|
|
816
|
+
for (const [u, x] of g)
|
|
817
|
+
o.set(u, [...o.get(u) ?? [], ...x]);
|
|
818
|
+
if (!e.esriOnly && (e.packageName === void 0 || e.packageName === "typescript") && (e.category === void 0 || e.category === "outdatedTypeScriptConfig")) {
|
|
819
|
+
const u = s.flatMap(
|
|
820
|
+
({ typeScriptConfig: S, packageJson: A }) => S !== void 0 && !U(A?.contents.name) && M(S.filePath, process.cwd()) && (n === void 0 || n === S.filePath) ? [S.filePath] : []
|
|
821
|
+
), x = await gt(u);
|
|
822
|
+
x.length > 0 && o.set("typescript", [...o.get("typescript") ?? [], ...x]);
|
|
823
|
+
}
|
|
824
|
+
const p = vt(o, e), m = e.reportingUrl || e.outputFormat === "json" ? H(p, ue(), J(), t) : void 0;
|
|
825
|
+
qe(p, e.outputFormat, m);
|
|
826
|
+
const y = [...p.values()].flat();
|
|
827
|
+
Te(
|
|
828
|
+
"usages",
|
|
829
|
+
y.length,
|
|
830
|
+
new Set(y.map(({ sourceFileName: u }) => u)).size,
|
|
831
|
+
p.size
|
|
832
|
+
), e.reportingUrl && m !== void 0 && await Pe(m, e.reportingUrl);
|
|
833
|
+
async function h(u, x) {
|
|
834
|
+
if (u === void 0)
|
|
835
|
+
return d;
|
|
836
|
+
let S = i.get(u.filePath);
|
|
837
|
+
return S === void 0 && (S = ie(
|
|
838
|
+
await Fe(u, r, e.esriOnly, x)
|
|
839
|
+
), i.set(u.filePath, S)), S;
|
|
840
|
+
}
|
|
841
|
+
function v(u) {
|
|
842
|
+
for (const { packageName: x, sourceFileName: S, usage: A } of u) {
|
|
843
|
+
if (ge(A.name, A.reason))
|
|
844
|
+
continue;
|
|
845
|
+
const C = o.get(x) ?? [], E = C.findIndex(
|
|
846
|
+
(P) => P.sourceFileName === S && P.usage.start === A.start && P.usage.length === A.length
|
|
847
|
+
), T = { sourceFileName: S, usage: A };
|
|
848
|
+
E === -1 ? C.push(T) : C[E] = T, o.set(x, C);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
240
851
|
}
|
|
241
|
-
function
|
|
852
|
+
function vt(s, e) {
|
|
242
853
|
const t = /* @__PURE__ */ new Map();
|
|
243
|
-
for (const [
|
|
244
|
-
if (e.packageName !== void 0 &&
|
|
854
|
+
for (const [n, o] of s) {
|
|
855
|
+
if (e.packageName !== void 0 && n !== e.packageName)
|
|
245
856
|
continue;
|
|
246
|
-
const
|
|
247
|
-
({ usage:
|
|
248
|
-
package:
|
|
249
|
-
|
|
250
|
-
category:
|
|
251
|
-
memberOf:
|
|
252
|
-
module:
|
|
253
|
-
|
|
857
|
+
const r = o.filter(
|
|
858
|
+
({ usage: i }) => e.category === void 0 || he({
|
|
859
|
+
package: n,
|
|
860
|
+
name: i.name,
|
|
861
|
+
category: i.category,
|
|
862
|
+
memberOf: i.memberOf,
|
|
863
|
+
module: i.module ?? K(i.originFileNames, n),
|
|
864
|
+
deprecated: i.reason ?? !0
|
|
254
865
|
}) === e.category
|
|
255
866
|
);
|
|
256
|
-
|
|
867
|
+
r.length > 0 && t.set(n, r);
|
|
257
868
|
}
|
|
258
869
|
return t;
|
|
259
870
|
}
|
|
260
|
-
function
|
|
261
|
-
const
|
|
262
|
-
for (const
|
|
263
|
-
if (
|
|
871
|
+
function yt(s, e, t, n, o = !1) {
|
|
872
|
+
const r = /* @__PURE__ */ new Map();
|
|
873
|
+
for (const i of e.getSuggestionDiagnostics(s.fileName)) {
|
|
874
|
+
if (i.reportsDeprecated === void 0)
|
|
264
875
|
continue;
|
|
265
|
-
const
|
|
876
|
+
const d = we(s, i.start, i.start + i.length);
|
|
266
877
|
if (
|
|
267
878
|
// Don't report for imports, only for usages
|
|
268
|
-
|
|
269
|
-
|
|
879
|
+
a.findAncestor(d, a.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
|
|
880
|
+
a.findAncestor(d, a.isJsxClosingElement) !== void 0
|
|
270
881
|
)
|
|
271
882
|
continue;
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
start:
|
|
275
|
-
length:
|
|
276
|
-
...
|
|
277
|
-
originFileNames:
|
|
278
|
-
reason:
|
|
883
|
+
const l = St(d, t), c = l.reason === void 0 ? [] : Q(l.symbol), f = c.length > 0 ? void 0 : e.getDefinitionAtPosition(s.fileName, i.start), g = c.length > 0 ? c : [...new Set(f?.map(({ fileName: p }) => p))];
|
|
884
|
+
_(g, o, n) && G(r, s, {
|
|
885
|
+
start: i.start,
|
|
886
|
+
length: i.length,
|
|
887
|
+
...Nt(d, l, t, e, f?.[0]),
|
|
888
|
+
originFileNames: g,
|
|
889
|
+
reason: kt(e, s.fileName, i.start) ?? l.reason
|
|
279
890
|
});
|
|
280
891
|
}
|
|
281
|
-
return
|
|
282
|
-
}
|
|
283
|
-
function
|
|
284
|
-
function
|
|
285
|
-
|
|
286
|
-
let
|
|
287
|
-
if (
|
|
288
|
-
const c =
|
|
289
|
-
(
|
|
290
|
-
} else if ((
|
|
291
|
-
const c =
|
|
292
|
-
|
|
293
|
-
} else if (
|
|
294
|
-
|
|
295
|
-
else if (
|
|
296
|
-
const c =
|
|
297
|
-
|
|
298
|
-
} else if (
|
|
299
|
-
const c =
|
|
300
|
-
|
|
892
|
+
return xt(s, t, r, n, o), [...r.values()].toSorted((i, d) => i.start - d.start);
|
|
893
|
+
}
|
|
894
|
+
function xt(s, e, t, n, o) {
|
|
895
|
+
function r(i) {
|
|
896
|
+
a.isNewExpression(i) && wt(i, e, t, n, o);
|
|
897
|
+
let d, l;
|
|
898
|
+
if (a.isJsxAttribute(i) && a.isIdentifier(i.name)) {
|
|
899
|
+
const c = i.parent.parent;
|
|
900
|
+
(a.isJsxOpeningElement(c) || a.isJsxSelfClosingElement(c)) && (l = e.getContextualType(c.tagName)?.getProperty(i.name.text), d = i.name);
|
|
901
|
+
} else if ((a.isPropertyAssignment(i) || a.isShorthandPropertyAssignment(i) || a.isMethodDeclaration(i)) && a.isObjectLiteralExpression(i.parent)) {
|
|
902
|
+
const c = a.isComputedPropertyName(i.name) ? W(i.name.expression, e) : i.name.text, f = e.getContextualType(i.parent);
|
|
903
|
+
l = c === void 0 || f === void 0 ? void 0 : e.getNonNullableType(f).getProperty(c), d = i.name;
|
|
904
|
+
} else if (a.isPropertyAccessExpression(i))
|
|
905
|
+
l = e.getSymbolAtLocation(i.name), d = i.name;
|
|
906
|
+
else if (a.isElementAccessExpression(i)) {
|
|
907
|
+
const c = W(i.argumentExpression, e);
|
|
908
|
+
l = c === void 0 ? void 0 : e.getTypeAtLocation(i.expression).getProperty(c), d = i.argumentExpression;
|
|
909
|
+
} else if (a.isBindingElement(i) && a.isObjectBindingPattern(i.parent) && i.dotDotDotToken === void 0) {
|
|
910
|
+
const c = i.propertyName ?? (a.isIdentifier(i.name) ? i.name : void 0), f = c === void 0 ? void 0 : a.isComputedPropertyName(c) ? W(c.expression, e) : c.text;
|
|
911
|
+
l = f === void 0 ? void 0 : e.getTypeAtLocation(i.parent).getProperty(f), d = c;
|
|
301
912
|
}
|
|
302
|
-
if ((
|
|
303
|
-
(c) =>
|
|
304
|
-
) && (
|
|
305
|
-
const c =
|
|
306
|
-
c !== void 0 &&
|
|
307
|
-
start:
|
|
308
|
-
length:
|
|
309
|
-
name:
|
|
310
|
-
...
|
|
311
|
-
originFileNames:
|
|
913
|
+
if ((a.isPropertyAccessExpression(i) || a.isElementAccessExpression(i) || a.isBindingElement(i)) && !l?.declarations?.some(
|
|
914
|
+
(c) => a.isGetAccessorDeclaration(c) || a.isSetAccessorDeclaration(c)
|
|
915
|
+
) && (l = void 0), l !== void 0 && d !== void 0) {
|
|
916
|
+
const c = Ne(l, e), f = Q(l);
|
|
917
|
+
c !== void 0 && _(f, o, n) && G(t, s, {
|
|
918
|
+
start: d.getStart(s),
|
|
919
|
+
length: d.getWidth(s),
|
|
920
|
+
name: l.getName(),
|
|
921
|
+
...B(l.declarations?.[0]),
|
|
922
|
+
originFileNames: f,
|
|
312
923
|
reason: c
|
|
313
924
|
});
|
|
314
925
|
}
|
|
315
|
-
|
|
926
|
+
a.forEachChild(i, r);
|
|
316
927
|
}
|
|
317
|
-
s
|
|
928
|
+
r(s);
|
|
318
929
|
}
|
|
319
|
-
function
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
930
|
+
function wt(s, e, t, n, o) {
|
|
931
|
+
const r = e.getTypeAtLocation(s).getSymbol(), i = r?.declarations?.[0], d = i !== void 0 && (a.isClassDeclaration(i) || a.isInterfaceDeclaration(i)) ? i.name?.text : void 0, l = d === void 0 ? void 0 : Ue.get(d);
|
|
932
|
+
if (l === void 0 || d === void 0)
|
|
322
933
|
return;
|
|
323
|
-
const c =
|
|
934
|
+
const c = Q(r);
|
|
324
935
|
if (!c.some(
|
|
325
|
-
(
|
|
326
|
-
) || !
|
|
936
|
+
(p) => (X(p) ?? fe($.dirname(p), "")) === "@arcgis/core"
|
|
937
|
+
) || !_(c, o, n))
|
|
327
938
|
return;
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
start:
|
|
331
|
-
length:
|
|
332
|
-
name:
|
|
333
|
-
|
|
939
|
+
const f = a.isPropertyAccessExpression(s.expression) ? s.expression.name : s.expression, g = s.getSourceFile();
|
|
940
|
+
G(t, g, {
|
|
941
|
+
start: f.getStart(g),
|
|
942
|
+
length: f.getWidth(g),
|
|
943
|
+
name: d,
|
|
944
|
+
kind: "class",
|
|
334
945
|
category: "coreViews",
|
|
335
946
|
originFileNames: c,
|
|
336
|
-
reason: `Direct construction with new ${
|
|
947
|
+
reason: `Direct construction with new ${d}() is discouraged. Use \`<${l}>\` instead. In 6.0, directly constructed views will no longer include .ui; use component slots for UI.`
|
|
337
948
|
});
|
|
338
949
|
}
|
|
339
|
-
function
|
|
340
|
-
const t = e.getTypeAtLocation(
|
|
950
|
+
function W(s, e) {
|
|
951
|
+
const t = e.getTypeAtLocation(s);
|
|
341
952
|
return t.isStringLiteral() || t.isNumberLiteral() ? String(t.value) : void 0;
|
|
342
953
|
}
|
|
343
|
-
function
|
|
344
|
-
let t = e.getSymbolAtLocation(
|
|
345
|
-
for (; t !== void 0 && (t.flags &
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
return { symbol: t, reason:
|
|
954
|
+
function St(s, e) {
|
|
955
|
+
let t = e.getSymbolAtLocation(s);
|
|
956
|
+
for (; t !== void 0 && (t.flags & a.SymbolFlags.Alias) !== 0; ) {
|
|
957
|
+
const n = Ne(t, e);
|
|
958
|
+
if (n !== void 0)
|
|
959
|
+
return { symbol: t, reason: n };
|
|
349
960
|
t = t.declarations === void 0 ? void 0 : e.getImmediateAliasedSymbol(t);
|
|
350
961
|
}
|
|
351
962
|
return { symbol: t, reason: void 0 };
|
|
352
963
|
}
|
|
353
|
-
function
|
|
354
|
-
return [...new Set(
|
|
964
|
+
function Q(s) {
|
|
965
|
+
return [...new Set(s?.declarations?.map((e) => e.getSourceFile().fileName))];
|
|
355
966
|
}
|
|
356
|
-
function
|
|
967
|
+
function Nt(s, e, t, n, o) {
|
|
357
968
|
if (e.reason !== void 0)
|
|
358
969
|
return {
|
|
359
|
-
name:
|
|
360
|
-
...
|
|
970
|
+
name: ae(e.symbol.declarations?.[0], e.symbol.getName()),
|
|
971
|
+
...B(e.symbol.declarations?.[0])
|
|
361
972
|
};
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
),
|
|
973
|
+
const r = o === void 0 ? void 0 : n.getProgram()?.getSourceFile(o.fileName), i = o === void 0 || r === void 0 ? void 0 : we(
|
|
974
|
+
r,
|
|
975
|
+
o.textSpan.start,
|
|
976
|
+
o.textSpan.start + o.textSpan.length
|
|
977
|
+
), d = (i === void 0 ? void 0 : t.getSymbolAtLocation(i)?.declarations?.[0]) ?? e.symbol?.declarations?.[0], l = o?.name;
|
|
367
978
|
return {
|
|
368
|
-
name:
|
|
369
|
-
...
|
|
979
|
+
name: l === void 0 ? bt(s) : ae(d, l),
|
|
980
|
+
...B(d)
|
|
370
981
|
};
|
|
371
982
|
}
|
|
372
|
-
function
|
|
373
|
-
const t =
|
|
374
|
-
return t !== "" && !t.startsWith("../") &&
|
|
983
|
+
function M(s, e) {
|
|
984
|
+
const t = $.relative(e, s);
|
|
985
|
+
return t !== "" && !t.startsWith("../") && !$.isAbsolute(t) && t !== "node_modules" && !t.startsWith("node_modules/");
|
|
375
986
|
}
|
|
376
|
-
function
|
|
377
|
-
let
|
|
987
|
+
function we(s, e, t) {
|
|
988
|
+
let n = s;
|
|
378
989
|
for (; ; ) {
|
|
379
|
-
let
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
}),
|
|
383
|
-
return
|
|
384
|
-
|
|
990
|
+
let o;
|
|
991
|
+
if (a.forEachChild(n, (r) => {
|
|
992
|
+
o === void 0 && r.getStart(s) <= e && r.getEnd() >= t && (o = r);
|
|
993
|
+
}), o === void 0)
|
|
994
|
+
return n;
|
|
995
|
+
n = o;
|
|
385
996
|
}
|
|
386
997
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
998
|
+
function bt(s) {
|
|
999
|
+
return a.isIdentifier(s) || a.isPrivateIdentifier(s) || a.isStringLiteralLike(s) || a.isNumericLiteral(s) ? s.text : s.getText();
|
|
389
1000
|
}
|
|
390
|
-
function
|
|
391
|
-
const e =
|
|
392
|
-
return e === void 0 ? void 0 :
|
|
1001
|
+
function Se(s) {
|
|
1002
|
+
const e = s?.find(({ name: t }) => t === "deprecated");
|
|
1003
|
+
return e === void 0 ? void 0 : Je(e.text) ?? "";
|
|
393
1004
|
}
|
|
394
|
-
function
|
|
1005
|
+
function kt(s, e, t) {
|
|
395
1006
|
try {
|
|
396
|
-
return
|
|
1007
|
+
return Se(s.getQuickInfoAtPosition(e, t)?.tags);
|
|
397
1008
|
} catch {
|
|
398
1009
|
return;
|
|
399
1010
|
}
|
|
400
1011
|
}
|
|
401
|
-
function
|
|
1012
|
+
function Ne(s, e) {
|
|
402
1013
|
try {
|
|
403
|
-
const t =
|
|
1014
|
+
const t = Se(s?.getJsDocTags(e));
|
|
404
1015
|
if (t !== void 0)
|
|
405
1016
|
return t;
|
|
406
|
-
const
|
|
407
|
-
return
|
|
1017
|
+
const n = s?.declarations?.filter((o) => a.isGetAccessorDeclaration(o) || a.isSetAccessorDeclaration(o)).map((o) => a.getJSDocDeprecatedTag(o)).find((o) => o !== void 0);
|
|
1018
|
+
return n === void 0 ? void 0 : n.comment === void 0 ? "" : Me(n.comment);
|
|
408
1019
|
} catch {
|
|
409
1020
|
return;
|
|
410
1021
|
}
|
|
411
1022
|
}
|
|
412
|
-
function
|
|
413
|
-
if (
|
|
1023
|
+
function G(s, e, t) {
|
|
1024
|
+
if (ge(t.name, t.reason))
|
|
414
1025
|
return;
|
|
415
|
-
const { line:
|
|
416
|
-
|
|
1026
|
+
const { line: n, character: o } = e.getLineAndCharacterOfPosition(t.start);
|
|
1027
|
+
s.set(`${t.start}:${t.length}`, {
|
|
417
1028
|
...t,
|
|
418
|
-
line:
|
|
419
|
-
column:
|
|
1029
|
+
line: n + 1,
|
|
1030
|
+
column: o + 1
|
|
420
1031
|
});
|
|
421
1032
|
}
|
|
422
|
-
function
|
|
423
|
-
return
|
|
424
|
-
const
|
|
425
|
-
return
|
|
1033
|
+
function _(s, e, t) {
|
|
1034
|
+
return s.some((n) => t !== void 0 && M(n, t)) ? !1 : !e || s.some((n) => {
|
|
1035
|
+
const o = X(n);
|
|
1036
|
+
return o === void 0 ? t === void 0 || !M(n, t) : De(o);
|
|
426
1037
|
});
|
|
427
1038
|
}
|
|
428
|
-
function
|
|
429
|
-
const e =
|
|
430
|
-
if (
|
|
1039
|
+
function X(s) {
|
|
1040
|
+
const e = $e(s), t = "/node_modules/", n = e.lastIndexOf(t);
|
|
1041
|
+
if (n === -1)
|
|
431
1042
|
return;
|
|
432
|
-
const [
|
|
433
|
-
return
|
|
1043
|
+
const [o, r] = e.slice(n + t.length).split("/");
|
|
1044
|
+
return o.startsWith("@") ? `${o}/${r}` : o;
|
|
434
1045
|
}
|
|
435
|
-
function
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
1046
|
+
function At(s, e = [], t) {
|
|
1047
|
+
const n = s[0];
|
|
1048
|
+
if (n === void 0)
|
|
438
1049
|
return "unknown package";
|
|
439
|
-
const
|
|
440
|
-
if (
|
|
441
|
-
return
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
return
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
return
|
|
1050
|
+
const o = X(n);
|
|
1051
|
+
if (o !== void 0)
|
|
1052
|
+
return o;
|
|
1053
|
+
const r = e.find(({ root: g }) => M(n, g));
|
|
1054
|
+
if (r !== void 0)
|
|
1055
|
+
return r.name;
|
|
1056
|
+
const i = $.dirname(I(n)), d = fe($.dirname(n), i);
|
|
1057
|
+
if (d !== i)
|
|
1058
|
+
return d;
|
|
448
1059
|
if (t === void 0)
|
|
449
|
-
return
|
|
450
|
-
const c =
|
|
451
|
-
return
|
|
1060
|
+
return i;
|
|
1061
|
+
const c = $.relative(t, n).split("/"), f = c.findIndex((g) => g !== "..");
|
|
1062
|
+
return f < 1 ? $.dirname(I(n)) : c.slice(0, f * 2).join("/");
|
|
452
1063
|
}
|
|
453
1064
|
export {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
1065
|
+
Kt as auditDeprecatedUsages,
|
|
1066
|
+
yt as collectDeprecatedApiUsages,
|
|
1067
|
+
At as getDeprecationOriginLabel,
|
|
1068
|
+
X as getNodeModulesPackageName,
|
|
1069
|
+
_ as shouldIncludeDeprecation
|
|
459
1070
|
};
|