@arcgis/codemod 5.2.0-next.12 → 5.2.0-next.120
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/LICENSE.md +4 -2
- package/README.md +113 -27
- package/dist/actions-LEFiI8Xk.js +395 -0
- package/dist/cli-DfAgo-jb.js +326 -0
- package/dist/cli.js +4 -3
- package/dist/{codemod-CNOYHe74.js → codemod-BpcMVaZX.js} +6 -6
- package/dist/codemod-DHO2ieDH.js +240 -0
- package/dist/codemod-DTsG5_YU.js +417 -0
- package/dist/codemod-DryX37eS.js +88 -0
- package/dist/codemod-HRcnKq-i.js +74 -0
- package/dist/codemod-YgioOfc7.js +108 -0
- package/dist/codemod-eprC1jEo.js +311 -0
- package/dist/{codemod-CGfWoOzy.js → codemod-lZGspJIz.js} +19 -18
- package/dist/codeowners-CarwYwHK.js +118 -0
- package/dist/config-BP6HDIQa.js +19 -0
- package/dist/index-2_o7gSlk.js +313 -0
- package/dist/index-DomCHjnu.js +142 -0
- package/dist/log-B76HBvov.js +11 -0
- package/dist/packageJson-sf04hyfN.js +39 -0
- package/dist/sync-e0pgnEOM.js +240 -0
- package/dist/useProjectInstance-DtWpxhlT.js +48 -0
- package/package.json +12 -9
- package/dist/actions-D3MzXcqP.js +0 -354
- package/dist/cli-C2S8UH1H.js +0 -262
- package/dist/codemod-gk646ODy.js +0 -157
- package/dist/useProjectInstance-BUOw6lga.js +0 -50
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { findPath as u } from "@arcgis/node-toolkit/file";
|
|
2
|
+
import { path as s, toPosixPathSeparators as l } from "@arcgis/node-toolkit/path";
|
|
3
|
+
import { collectOutputSync as d } from "@arcgis/node-toolkit/shell";
|
|
4
|
+
import m from "typescript";
|
|
5
|
+
import { retrievePackageJson as f } from "@arcgis/node-toolkit/packageJson";
|
|
6
|
+
import { readFileSync as h } from "node:fs";
|
|
7
|
+
import x from "picomatch";
|
|
8
|
+
function E() {
|
|
9
|
+
const e = u(".git");
|
|
10
|
+
if (e === void 0)
|
|
11
|
+
throw new Error("Unable to find a Git repository for the deprecation audit.");
|
|
12
|
+
const t = s.dirname(e), r = d("git", ["remote", "get-url", "origin"], { cwd: t }), n = d("git", ["rev-parse", "HEAD"], { cwd: t });
|
|
13
|
+
return { repository: S(r), repositoryRoot: t, ref: n };
|
|
14
|
+
}
|
|
15
|
+
function O(e, t) {
|
|
16
|
+
return l(s.relative(t, e));
|
|
17
|
+
}
|
|
18
|
+
function W(e, t, r, n) {
|
|
19
|
+
const o = e === "usages" ? "usage" : "definition";
|
|
20
|
+
process.stderr.write(
|
|
21
|
+
`Deprecations: ${t} ${o}${t === 1 ? "" : "s"} across ${r} file${r === 1 ? "" : "s"} from ${n} package${n === 1 ? "" : "s"}.
|
|
22
|
+
`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function S(e) {
|
|
26
|
+
const t = e.replace(/\.git$/u, "");
|
|
27
|
+
if (t.startsWith("http://") || t.startsWith("https://"))
|
|
28
|
+
return new URL(t).href.replace(/^https?:\/\//u, "").replace(/\/$/u, "");
|
|
29
|
+
const r = /^(?:ssh:\/\/)?git@([^/:]+)[:/](.+)$/u.exec(t);
|
|
30
|
+
if (r !== null)
|
|
31
|
+
return `${r[1]}/${r[2]}`;
|
|
32
|
+
throw new Error(`Unsupported Git remote URL: ${e}`);
|
|
33
|
+
}
|
|
34
|
+
function b(e) {
|
|
35
|
+
return typeof e == "string" ? e : e.map((t) => t.kind === m.SyntaxKind.JSDocText ? t.text : w(t.getText())).join("");
|
|
36
|
+
}
|
|
37
|
+
function F(e) {
|
|
38
|
+
return e === void 0 ? void 0 : $(m.displayPartsToString([...e]));
|
|
39
|
+
}
|
|
40
|
+
function $(e) {
|
|
41
|
+
return e.replace(
|
|
42
|
+
/\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
|
|
43
|
+
(t, r) => g(r)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function w(e) {
|
|
47
|
+
const t = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
|
|
48
|
+
return t === void 0 ? e : g(t);
|
|
49
|
+
}
|
|
50
|
+
function g(e) {
|
|
51
|
+
const t = e.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"), r = t.indexOf("|");
|
|
52
|
+
if (r !== -1)
|
|
53
|
+
return t.slice(r + 1).trim() || t.slice(0, r).trim();
|
|
54
|
+
const [n, ...o] = t.split(/\s+/u);
|
|
55
|
+
return o.join(" ") || n;
|
|
56
|
+
}
|
|
57
|
+
function L(e, t) {
|
|
58
|
+
const r = u("package.json", e);
|
|
59
|
+
return r === void 0 ? t : f(s.dirname(r)).name ?? t;
|
|
60
|
+
}
|
|
61
|
+
const c = {
|
|
62
|
+
excludedPackageNames: /* @__PURE__ */ new Set([
|
|
63
|
+
"@arcgis/charts-components-react",
|
|
64
|
+
"@arcgis/coding-components-react",
|
|
65
|
+
"@arcgis/components-build-utils",
|
|
66
|
+
"@arcgis/map-components-react",
|
|
67
|
+
"@arcgis/portal-components-react",
|
|
68
|
+
"@arcgis-test/lit-components-react"
|
|
69
|
+
]),
|
|
70
|
+
excludedDefinitionPathFragments: ["test-package"],
|
|
71
|
+
ignoreDeprecatedApis: ["getReactWrapperOptions"],
|
|
72
|
+
ignoredDeprecationsByIncludes: ["React wrappers are not needed in React 19 or above"]
|
|
73
|
+
};
|
|
74
|
+
function U(e) {
|
|
75
|
+
return e !== void 0 && c.excludedPackageNames.has(e);
|
|
76
|
+
}
|
|
77
|
+
function C(e) {
|
|
78
|
+
return c.excludedDefinitionPathFragments.some(
|
|
79
|
+
(t) => e.includes(t)
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function I(e, t) {
|
|
83
|
+
return c.ignoreDeprecatedApis.some((r) => r === e) || t != null && c.ignoredDeprecationsByIncludes.some((r) => t.includes(r));
|
|
84
|
+
}
|
|
85
|
+
function j() {
|
|
86
|
+
const e = u(".github/CODEOWNERS");
|
|
87
|
+
return e === void 0 ? void 0 : v(h(e, "utf8"), s.dirname(s.dirname(e)));
|
|
88
|
+
}
|
|
89
|
+
function v(e, t) {
|
|
90
|
+
const r = e.split(/\r?\n/u).map((n) => n.trim()).filter((n) => n !== "" && !n.startsWith("#")).map((n) => {
|
|
91
|
+
const [o, ...a] = n.split(/\s+/u), i = o.startsWith("/") ? o.slice(1) : o, p = i.includes("/") ? i : `**/${i}`;
|
|
92
|
+
return {
|
|
93
|
+
matches: x([p, `${p.replace(/\/$/u, "")}/**`], { dot: !0 }),
|
|
94
|
+
owners: a
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
getOwners(n) {
|
|
99
|
+
const o = l(s.relative(t, n));
|
|
100
|
+
let a = [];
|
|
101
|
+
for (const i of r)
|
|
102
|
+
i.matches(o) && (a = i.owners);
|
|
103
|
+
return a;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
O as a,
|
|
109
|
+
L as b,
|
|
110
|
+
I as c,
|
|
111
|
+
F as d,
|
|
112
|
+
C as e,
|
|
113
|
+
b as f,
|
|
114
|
+
E as g,
|
|
115
|
+
j as l,
|
|
116
|
+
W as p,
|
|
117
|
+
U as s
|
|
118
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const s = /(?:esri|arcgis)/iu, a = "@arcgis/codemod", t = {
|
|
2
|
+
usages: "Refactor-out deprecated API usages",
|
|
3
|
+
definitions: "Remove deprecated APIs in next breaking changes release"
|
|
4
|
+
}, i = {
|
|
5
|
+
usages: "The following deprecated APIs are used in files owned by assigned CODEOWNERS. Refactor them before the APIs are removed.",
|
|
6
|
+
definitions: "The following deprecated APIs are owned by assigned CODEOWNERS. Remove them in the next breaking changes release."
|
|
7
|
+
}, n = "This issue is autogenerated and updated regularly based on remaining items. Feel free to add comments and labels, update assignees, set milestone, or create sub-issues. Close it once completed. A new issue will be created if new findings are detected.", o = "Task", r = "deprecations sync-issues";
|
|
8
|
+
function d(e) {
|
|
9
|
+
return s.test(e);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
t as a,
|
|
13
|
+
a as b,
|
|
14
|
+
i as c,
|
|
15
|
+
n as d,
|
|
16
|
+
o as e,
|
|
17
|
+
r as f,
|
|
18
|
+
d as i
|
|
19
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
var k = (t, n) => (n = Symbol[t]) ? n : /* @__PURE__ */ Symbol.for("Symbol." + t), I = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
3
|
+
};
|
|
4
|
+
var C = (t, n, e) => {
|
|
5
|
+
if (n != null) {
|
|
6
|
+
typeof n != "object" && typeof n != "function" && I("Object expected");
|
|
7
|
+
var o, r;
|
|
8
|
+
e && (o = n[k("asyncDispose")]), o === void 0 && (o = n[k("dispose")], e && (r = o)), typeof o != "function" && I("Object not disposable"), r && (o = function() {
|
|
9
|
+
try {
|
|
10
|
+
r.call(this);
|
|
11
|
+
} catch (a) {
|
|
12
|
+
return Promise.reject(a);
|
|
13
|
+
}
|
|
14
|
+
}), t.push([e, o, n]);
|
|
15
|
+
} else e && t.push([e]);
|
|
16
|
+
return n;
|
|
17
|
+
}, J = (t, n, e) => {
|
|
18
|
+
var o = typeof SuppressedError == "function" ? SuppressedError : function(i, s, m, d) {
|
|
19
|
+
return d = Error(m), d.name = "SuppressedError", d.error = i, d.suppressed = s, d;
|
|
20
|
+
}, r = (i) => n = e ? new o(i, n, "An error was suppressed during disposal") : (e = !0, i), a = (i) => {
|
|
21
|
+
for (; i = t.pop(); )
|
|
22
|
+
try {
|
|
23
|
+
var s = i[1] && i[1].call(i[2]);
|
|
24
|
+
if (i[0]) return Promise.resolve(s).then(a, (m) => (r(m), a()));
|
|
25
|
+
} catch (m) {
|
|
26
|
+
r(m);
|
|
27
|
+
}
|
|
28
|
+
if (e) throw n;
|
|
29
|
+
};
|
|
30
|
+
return a();
|
|
31
|
+
};
|
|
32
|
+
import { c as j } from "./useProjectInstance-DtWpxhlT.js";
|
|
33
|
+
import { r as U } from "./cli-DfAgo-jb.js";
|
|
34
|
+
import { f as h } from "./log-B76HBvov.js";
|
|
35
|
+
import { path as g, toPosixPathSeparators as W } from "@arcgis/node-toolkit/path";
|
|
36
|
+
import { log as S } from "@arcgis/toolkit/log";
|
|
37
|
+
import l from "typescript";
|
|
38
|
+
import { g as F, l as z, a as _, s as Q, p as q, b as B, c as G, d as H } from "./codeowners-CarwYwHK.js";
|
|
39
|
+
import { i as K } from "./config-BP6HDIQa.js";
|
|
40
|
+
import { styleText as $ } from "node:util";
|
|
41
|
+
function V(t, n) {
|
|
42
|
+
if (n) {
|
|
43
|
+
const e = F();
|
|
44
|
+
process.stdout.write(`${X(t, z(), e)}
|
|
45
|
+
`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
for (const [e, o] of T(t)) {
|
|
49
|
+
S("info", $("red", e), `${o.length} deprecated API usage${o.length === 1 ? "" : "s"}`);
|
|
50
|
+
for (const { sourceFileName: r, usage: a } of o) {
|
|
51
|
+
const i = $("blue", `${h(r)}:${a.line}:${a.column}`), s = a.reason === void 0 || a.reason === "" ? `\`${a.name}\` is deprecated.` : `\`${a.name}\` is deprecated. ${a.reason}`;
|
|
52
|
+
S("warn", i, s);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function T(t) {
|
|
57
|
+
return [...t].sort(([n], [e]) => n.localeCompare(e));
|
|
58
|
+
}
|
|
59
|
+
function X(t, n, e = F()) {
|
|
60
|
+
const o = {
|
|
61
|
+
kind: "usages",
|
|
62
|
+
repository: e.repository,
|
|
63
|
+
ref: e.ref,
|
|
64
|
+
findings: T(t).flatMap(
|
|
65
|
+
([r, a]) => a.map(({ sourceFileName: i, usage: s }) => ({
|
|
66
|
+
package: r,
|
|
67
|
+
api: s.name,
|
|
68
|
+
reason: s.reason ?? null,
|
|
69
|
+
file: _(i, e.repositoryRoot),
|
|
70
|
+
line: s.line,
|
|
71
|
+
column: s.column,
|
|
72
|
+
codeowners: n?.getOwners(i) ?? []
|
|
73
|
+
}))
|
|
74
|
+
)
|
|
75
|
+
};
|
|
76
|
+
return JSON.stringify(o, void 0, 2);
|
|
77
|
+
}
|
|
78
|
+
async function Pe(t, n, e) {
|
|
79
|
+
await U(
|
|
80
|
+
{
|
|
81
|
+
meta: {
|
|
82
|
+
needsTypeInformation: !0,
|
|
83
|
+
needsFooter: !1
|
|
84
|
+
},
|
|
85
|
+
run(o) {
|
|
86
|
+
Y(o, n, e);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"deprecations audit-usages",
|
|
90
|
+
t
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function Y(t, n, e) {
|
|
94
|
+
const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), a = [
|
|
95
|
+
...new Map(
|
|
96
|
+
t.flatMap(({ packageJson: c }) => {
|
|
97
|
+
const f = c === void 0 ? void 0 : g.dirname(c.filePath), v = c?.contents.name;
|
|
98
|
+
return f !== void 0 && v !== void 0 && N(f, process.cwd()) ? [[f, { root: f, name: v }]] : [];
|
|
99
|
+
})
|
|
100
|
+
).values()
|
|
101
|
+
].toSorted((c, f) => f.root.length - c.root.length);
|
|
102
|
+
for (const c of t) {
|
|
103
|
+
var s = [];
|
|
104
|
+
try {
|
|
105
|
+
if (Q(c.packageJson?.contents.name)) {
|
|
106
|
+
const p = c.packageJson?.filePath;
|
|
107
|
+
p !== void 0 && !r.has(p) && (r.add(p), S(
|
|
108
|
+
"warn",
|
|
109
|
+
h(p),
|
|
110
|
+
`Skipping excluded package \`${c.packageJson?.contents.name ?? c.cwd}\`.`
|
|
111
|
+
));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const f = C(s, j(c, !1));
|
|
115
|
+
const v = f.tsMorph.getLanguageService().compilerObject;
|
|
116
|
+
const y = v.getProgram()?.getTypeChecker();
|
|
117
|
+
if (y === void 0)
|
|
118
|
+
continue;
|
|
119
|
+
const x = c.packageJson === void 0 ? void 0 : g.dirname(c.packageJson.filePath);
|
|
120
|
+
for (const p of f.getCodemodFiles()) {
|
|
121
|
+
const A = p.compilerNode;
|
|
122
|
+
for (const w of Z(
|
|
123
|
+
A,
|
|
124
|
+
v,
|
|
125
|
+
y,
|
|
126
|
+
x,
|
|
127
|
+
n
|
|
128
|
+
)) {
|
|
129
|
+
const D = ce(w.originFileNames, a, x), b = o.get(D) ?? [];
|
|
130
|
+
b.push({ sourceFileName: A.fileName, usage: w }), o.set(D, b);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} catch (m) {
|
|
134
|
+
var d = m, u = !0;
|
|
135
|
+
} finally {
|
|
136
|
+
J(s, d, u);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
V(o, e);
|
|
140
|
+
const i = [...o.values()].flat();
|
|
141
|
+
q(
|
|
142
|
+
"usages",
|
|
143
|
+
i.length,
|
|
144
|
+
new Set(i.map(({ sourceFileName: c }) => c)).size,
|
|
145
|
+
o.size
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function Z(t, n, e, o, r = !1) {
|
|
149
|
+
const a = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const i of n.getSuggestionDiagnostics(t.fileName)) {
|
|
151
|
+
if (i.reportsDeprecated === void 0)
|
|
152
|
+
continue;
|
|
153
|
+
const s = ie(t, i.start, i.start + i.length);
|
|
154
|
+
if (
|
|
155
|
+
// Don't report for imports, only for usages
|
|
156
|
+
l.findAncestor(s, l.isImportDeclaration) !== void 0 || // Don't report closing JSX - only for opening
|
|
157
|
+
l.findAncestor(s, l.isJsxClosingElement) !== void 0
|
|
158
|
+
)
|
|
159
|
+
continue;
|
|
160
|
+
const m = te(
|
|
161
|
+
s,
|
|
162
|
+
e,
|
|
163
|
+
n,
|
|
164
|
+
t.fileName,
|
|
165
|
+
i.start
|
|
166
|
+
);
|
|
167
|
+
R(m, r, o) && E(a, t, {
|
|
168
|
+
start: i.start,
|
|
169
|
+
length: i.length,
|
|
170
|
+
name: oe(s, e, n, t.fileName, i.start) ?? ae(s),
|
|
171
|
+
originFileNames: m,
|
|
172
|
+
reason: re(n, t.fileName, i.start) ?? se(s, e)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return ee(t, e, a, o, r), [...a.values()].toSorted((i, s) => i.start - s.start);
|
|
176
|
+
}
|
|
177
|
+
function ee(t, n, e, o, r) {
|
|
178
|
+
function a(i) {
|
|
179
|
+
if (l.isJsxAttribute(i) && l.isIdentifier(i.name)) {
|
|
180
|
+
const s = i.parent.parent;
|
|
181
|
+
if (l.isJsxOpeningElement(s) || l.isJsxSelfClosingElement(s)) {
|
|
182
|
+
const d = n.getContextualType(s.tagName)?.getProperty(i.name.text), u = P(d, n), c = L(d);
|
|
183
|
+
u !== void 0 && R(c, r, o) && E(e, t, {
|
|
184
|
+
start: i.name.getStart(t),
|
|
185
|
+
length: i.name.getWidth(t),
|
|
186
|
+
name: i.name.text,
|
|
187
|
+
originFileNames: c,
|
|
188
|
+
reason: u
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
l.forEachChild(i, a);
|
|
193
|
+
}
|
|
194
|
+
a(t);
|
|
195
|
+
}
|
|
196
|
+
function te(t, n, e, o, r) {
|
|
197
|
+
const a = ne(t, n);
|
|
198
|
+
return a.length > 0 ? a : [...new Set(e.getDefinitionAtPosition(o, r)?.map(({ fileName: i }) => i))];
|
|
199
|
+
}
|
|
200
|
+
function L(t) {
|
|
201
|
+
return [...new Set(t?.declarations?.map((n) => n.getSourceFile().fileName))];
|
|
202
|
+
}
|
|
203
|
+
function ne(t, n) {
|
|
204
|
+
let e = n.getSymbolAtLocation(t);
|
|
205
|
+
for (; e !== void 0 && (e.flags & l.SymbolFlags.Alias) !== 0; ) {
|
|
206
|
+
if (P(e, n) !== void 0)
|
|
207
|
+
return L(e);
|
|
208
|
+
e = e.declarations === void 0 ? void 0 : n.getImmediateAliasedSymbol(e);
|
|
209
|
+
}
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
function oe(t, n, e, o, r) {
|
|
213
|
+
let a = n.getSymbolAtLocation(t);
|
|
214
|
+
for (; a !== void 0 && (a.flags & l.SymbolFlags.Alias) !== 0; ) {
|
|
215
|
+
if (P(a, n) !== void 0)
|
|
216
|
+
return a.getName();
|
|
217
|
+
a = a.declarations === void 0 ? void 0 : n.getImmediateAliasedSymbol(a);
|
|
218
|
+
}
|
|
219
|
+
return e.getDefinitionAtPosition(o, r)?.[0]?.name;
|
|
220
|
+
}
|
|
221
|
+
function N(t, n) {
|
|
222
|
+
const e = g.relative(n, t);
|
|
223
|
+
return e !== "" && !e.startsWith("../") && !g.isAbsolute(e) && e !== "node_modules" && !e.startsWith("node_modules/");
|
|
224
|
+
}
|
|
225
|
+
function ie(t, n, e) {
|
|
226
|
+
let o = t;
|
|
227
|
+
for (; ; ) {
|
|
228
|
+
let r;
|
|
229
|
+
if (l.forEachChild(o, (a) => {
|
|
230
|
+
r === void 0 && a.getStart(t) <= n && a.getEnd() >= e && (r = a);
|
|
231
|
+
}), r === void 0)
|
|
232
|
+
return o;
|
|
233
|
+
o = r;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function ae(t) {
|
|
237
|
+
return l.isIdentifier(t) || l.isPrivateIdentifier(t) || l.isStringLiteralLike(t) || l.isNumericLiteral(t) ? t.text : t.getText();
|
|
238
|
+
}
|
|
239
|
+
function M(t) {
|
|
240
|
+
const n = t?.find(({ name: e }) => e === "deprecated");
|
|
241
|
+
return n === void 0 ? void 0 : H(n.text);
|
|
242
|
+
}
|
|
243
|
+
function re(t, n, e) {
|
|
244
|
+
try {
|
|
245
|
+
return M(t.getQuickInfoAtPosition(n, e)?.tags);
|
|
246
|
+
} catch {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function P(t, n) {
|
|
251
|
+
try {
|
|
252
|
+
return M(t?.getJsDocTags(n));
|
|
253
|
+
} catch {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function se(t, n) {
|
|
258
|
+
let e = n.getSymbolAtLocation(t);
|
|
259
|
+
for (; e !== void 0 && (e.flags & l.SymbolFlags.Alias) !== 0; ) {
|
|
260
|
+
const o = P(e, n);
|
|
261
|
+
if (o !== void 0)
|
|
262
|
+
return o;
|
|
263
|
+
e = e.declarations === void 0 ? void 0 : n.getImmediateAliasedSymbol(e);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function E(t, n, e) {
|
|
267
|
+
if (G(e.name, e.reason))
|
|
268
|
+
return;
|
|
269
|
+
const { line: o, character: r } = n.getLineAndCharacterOfPosition(e.start);
|
|
270
|
+
t.set(`${e.start}:${e.length}`, {
|
|
271
|
+
...e,
|
|
272
|
+
line: o + 1,
|
|
273
|
+
column: r + 1
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function R(t, n, e) {
|
|
277
|
+
return t.some((o) => e !== void 0 && N(o, e)) ? !1 : !n || t.some((o) => {
|
|
278
|
+
const r = O(o);
|
|
279
|
+
return r === void 0 ? e === void 0 || !N(o, e) : K(r);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function O(t) {
|
|
283
|
+
const n = W(t), e = "/node_modules/", o = n.lastIndexOf(e);
|
|
284
|
+
if (o === -1)
|
|
285
|
+
return;
|
|
286
|
+
const [r, a] = n.slice(o + e.length).split("/");
|
|
287
|
+
return r.startsWith("@") ? `${r}/${a}` : r;
|
|
288
|
+
}
|
|
289
|
+
function ce(t, n = [], e) {
|
|
290
|
+
const o = t[0];
|
|
291
|
+
if (o === void 0)
|
|
292
|
+
return "unknown package";
|
|
293
|
+
const r = O(o);
|
|
294
|
+
if (r !== void 0)
|
|
295
|
+
return r;
|
|
296
|
+
const a = n.find(({ root: c }) => N(o, c));
|
|
297
|
+
if (a !== void 0)
|
|
298
|
+
return a.name;
|
|
299
|
+
const i = g.dirname(h(o)), s = B(g.dirname(o), i);
|
|
300
|
+
if (s !== i)
|
|
301
|
+
return s;
|
|
302
|
+
if (e === void 0)
|
|
303
|
+
return i;
|
|
304
|
+
const d = g.relative(e, o).split("/"), u = d.findIndex((c) => c !== "..");
|
|
305
|
+
return u < 1 ? g.dirname(h(o)) : d.slice(0, u * 2).join("/");
|
|
306
|
+
}
|
|
307
|
+
export {
|
|
308
|
+
Pe as auditDeprecatedUsages,
|
|
309
|
+
Z as collectDeprecatedApiUsages,
|
|
310
|
+
ce as getDeprecationOriginLabel,
|
|
311
|
+
O as getNodeModulesPackageName,
|
|
312
|
+
R as shouldIncludeDeprecation
|
|
313
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var k = (e, o) => (o = Symbol[e]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + e), N = (e) => {
|
|
2
|
+
throw TypeError(e);
|
|
3
|
+
};
|
|
4
|
+
var h = (e, o, a) => {
|
|
5
|
+
if (o != null) {
|
|
6
|
+
typeof o != "object" && typeof o != "function" && N("Object expected");
|
|
7
|
+
var s, t;
|
|
8
|
+
a && (s = o[k("asyncDispose")]), s === void 0 && (s = o[k("dispose")], a && (t = s)), typeof s != "function" && N("Object not disposable"), t && (s = function() {
|
|
9
|
+
try {
|
|
10
|
+
t.call(this);
|
|
11
|
+
} catch (c) {
|
|
12
|
+
return Promise.reject(c);
|
|
13
|
+
}
|
|
14
|
+
}), e.push([a, s, o]);
|
|
15
|
+
} else a && e.push([a]);
|
|
16
|
+
return o;
|
|
17
|
+
}, w = (e, o, a) => {
|
|
18
|
+
var s = typeof SuppressedError == "function" ? SuppressedError : function(n, p, r, m) {
|
|
19
|
+
return m = Error(r), m.name = "SuppressedError", m.error = n, m.suppressed = p, m;
|
|
20
|
+
}, t = (n) => o = a ? new s(n, o, "An error was suppressed during disposal") : (a = !0, n), c = (n) => {
|
|
21
|
+
for (; n = e.pop(); )
|
|
22
|
+
try {
|
|
23
|
+
var p = n[1] && n[1].call(n[2]);
|
|
24
|
+
if (n[0]) return Promise.resolve(p).then(c, (r) => (t(r), c()));
|
|
25
|
+
} catch (r) {
|
|
26
|
+
t(r);
|
|
27
|
+
}
|
|
28
|
+
if (a) throw o;
|
|
29
|
+
};
|
|
30
|
+
return c();
|
|
31
|
+
};
|
|
32
|
+
import { log as D } from "@arcgis/toolkit/log";
|
|
33
|
+
import { path as S } from "@arcgis/node-toolkit/path";
|
|
34
|
+
import { styleText as $ } from "node:util";
|
|
35
|
+
import P from "typescript";
|
|
36
|
+
import { f as g } from "./log-B76HBvov.js";
|
|
37
|
+
import { r as v } from "./cli-DfAgo-jb.js";
|
|
38
|
+
import { c as x } from "./useProjectInstance-DtWpxhlT.js";
|
|
39
|
+
import { g as C, s as T, e as R, a as y, b, p as j, l as E, f as F } from "./codeowners-CarwYwHK.js";
|
|
40
|
+
async function U(e, o) {
|
|
41
|
+
await v(
|
|
42
|
+
{
|
|
43
|
+
meta: { needsTypeInformation: !0, needsFooter: !1 },
|
|
44
|
+
run(a) {
|
|
45
|
+
O(a, o);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"deprecations audit-definitions",
|
|
49
|
+
e
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function O(e, o) {
|
|
53
|
+
const a = [], s = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), c = C();
|
|
54
|
+
for (const i of e) {
|
|
55
|
+
var n = [];
|
|
56
|
+
try {
|
|
57
|
+
if (T(i.packageJson?.contents.name)) {
|
|
58
|
+
const d = i.packageJson?.filePath;
|
|
59
|
+
d !== void 0 && !t.has(d) && (t.add(d), D(
|
|
60
|
+
"warn",
|
|
61
|
+
g(d),
|
|
62
|
+
`Skipping excluded package \`${i.packageJson?.contents.name ?? i.cwd}\`.`
|
|
63
|
+
));
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const f = h(n, x(i, !1));
|
|
67
|
+
const J = i.packageJson?.contents.name ?? g(i.cwd);
|
|
68
|
+
for (const d of f.getCodemodFiles()) {
|
|
69
|
+
if (R(
|
|
70
|
+
y(d.compilerNode.fileName, c.repositoryRoot)
|
|
71
|
+
))
|
|
72
|
+
continue;
|
|
73
|
+
const l = S.dirname(d.compilerNode.fileName), u = s.get(l) ?? b(l, J);
|
|
74
|
+
s.set(l, u), a.push(...z(d.compilerNode, u));
|
|
75
|
+
}
|
|
76
|
+
} catch (p) {
|
|
77
|
+
var r = p, m = !0;
|
|
78
|
+
} finally {
|
|
79
|
+
w(n, r, m);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (o)
|
|
83
|
+
I(a, c);
|
|
84
|
+
else
|
|
85
|
+
for (const i of a) {
|
|
86
|
+
const f = $(
|
|
87
|
+
"blue",
|
|
88
|
+
`${g(i.sourceFileName)}:${i.line}:${i.column}`
|
|
89
|
+
);
|
|
90
|
+
D("warn", f, `\`${i.name}\` is deprecated.${i.reason ? ` ${i.reason}` : ""}`);
|
|
91
|
+
}
|
|
92
|
+
j(
|
|
93
|
+
"definitions",
|
|
94
|
+
a.length,
|
|
95
|
+
new Set(a.map(({ sourceFileName: i }) => i)).size,
|
|
96
|
+
new Set(a.map(({ package: i }) => i)).size
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function z(e, o) {
|
|
100
|
+
const a = /* @__PURE__ */ new Map();
|
|
101
|
+
function s(t) {
|
|
102
|
+
const c = P.getJSDocDeprecatedTag(t), n = A(t);
|
|
103
|
+
if (c !== void 0 && n !== void 0) {
|
|
104
|
+
const p = n.getStart(e), { line: r, character: m } = e.getLineAndCharacterOfPosition(p);
|
|
105
|
+
a.set(`${p}:${n.getWidth(e)}`, {
|
|
106
|
+
package: o,
|
|
107
|
+
name: n.getText(e),
|
|
108
|
+
reason: c.comment === void 0 ? void 0 : F(c.comment),
|
|
109
|
+
sourceFileName: e.fileName,
|
|
110
|
+
line: r + 1,
|
|
111
|
+
column: m + 1
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
P.forEachChild(t, s);
|
|
115
|
+
}
|
|
116
|
+
return s(e), [...a.values()].sort((t, c) => t.line - c.line || t.column - c.column);
|
|
117
|
+
}
|
|
118
|
+
function A(e) {
|
|
119
|
+
return e.name;
|
|
120
|
+
}
|
|
121
|
+
function I(e, o) {
|
|
122
|
+
const a = E(), s = {
|
|
123
|
+
kind: "definitions",
|
|
124
|
+
repository: o.repository,
|
|
125
|
+
ref: o.ref,
|
|
126
|
+
findings: e.map((t) => ({
|
|
127
|
+
package: t.package,
|
|
128
|
+
api: t.name,
|
|
129
|
+
reason: t.reason ?? null,
|
|
130
|
+
file: y(t.sourceFileName, o.repositoryRoot),
|
|
131
|
+
line: t.line,
|
|
132
|
+
column: t.column,
|
|
133
|
+
codeowners: a?.getOwners(t.sourceFileName) ?? []
|
|
134
|
+
}))
|
|
135
|
+
};
|
|
136
|
+
process.stdout.write(`${JSON.stringify(s, void 0, 2)}
|
|
137
|
+
`);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
U as auditDeprecatedDefinitions,
|
|
141
|
+
z as collectDeprecatedApiDefinitions
|
|
142
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { log as r } from "@arcgis/toolkit/log";
|
|
2
|
+
import { writeFile as s } from "node:fs/promises";
|
|
3
|
+
import { f } from "./log-B76HBvov.js";
|
|
4
|
+
async function h(n, a) {
|
|
5
|
+
const o = /* @__PURE__ */ new Set();
|
|
6
|
+
for (const i of n) {
|
|
7
|
+
const e = i.packageJson;
|
|
8
|
+
if (e === void 0 || o.has(e.filePath))
|
|
9
|
+
continue;
|
|
10
|
+
o.add(e.filePath);
|
|
11
|
+
const c = e.contents;
|
|
12
|
+
try {
|
|
13
|
+
const t = await a(c, e.filePath);
|
|
14
|
+
c !== t && await s(e.filePath, `${JSON.stringify(t, null, 2)}
|
|
15
|
+
`, "utf8");
|
|
16
|
+
} catch (t) {
|
|
17
|
+
process.exitCode = 1, r(
|
|
18
|
+
"error",
|
|
19
|
+
f(e.filePath),
|
|
20
|
+
`Error occurred while migrating: ${String(t)}`,
|
|
21
|
+
typeof t == "object" && t !== null && "stack" in t ? { detail: { stack: t.stack } } : void 0
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function u(n, a) {
|
|
27
|
+
for (const o of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
28
|
+
const i = n[o];
|
|
29
|
+
if (i) {
|
|
30
|
+
const e = a(i, o);
|
|
31
|
+
e !== i && (n = { ...n, [o]: e });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return n;
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
u as a,
|
|
38
|
+
h as f
|
|
39
|
+
};
|