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