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