@arcgis/codemod 6.0.0-next.4 → 6.0.0-next.41

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.
@@ -1,160 +0,0 @@
1
- var N = (a, o) => (o = Symbol[a]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + a), h = (a) => {
2
- throw TypeError(a);
3
- };
4
- var D = (a, o, t) => {
5
- if (o != null) {
6
- typeof o != "object" && typeof o != "function" && h("Object expected");
7
- var c, e;
8
- t && (c = o[N("asyncDispose")]), c === void 0 && (c = o[N("dispose")], t && (e = c)), typeof c != "function" && h("Object not disposable"), e && (c = function() {
9
- try {
10
- e.call(this);
11
- } catch (i) {
12
- return Promise.reject(i);
13
- }
14
- }), a.push([t, c, o]);
15
- } else t && a.push([t]);
16
- return o;
17
- }, w = (a, o, t) => {
18
- var c = typeof SuppressedError == "function" ? SuppressedError : function(s, r, m, d) {
19
- return d = Error(m), d.name = "SuppressedError", d.error = s, d.suppressed = r, d;
20
- }, e = (s) => o = t ? new c(s, o, "An error was suppressed during disposal") : (t = !0, s), i = (s) => {
21
- for (; s = a.pop(); )
22
- try {
23
- var r = s[1] && s[1].call(s[2]);
24
- if (s[0]) return Promise.resolve(r).then(i, (m) => (e(m), i()));
25
- } catch (m) {
26
- e(m);
27
- }
28
- if (t) throw o;
29
- };
30
- return i();
31
- };
32
- import { log as y } from "@arcgis/toolkit/log";
33
- import { path as $ } from "@arcgis/node-toolkit/path";
34
- import { styleText as b } from "node:util";
35
- import P from "typescript";
36
- import { f as u } from "./log.js";
37
- import { r as x } from "./cli.js";
38
- import { c as J } from "./useProjectInstance.js";
39
- import { g as O, e as S, a as v, b as C, p as T, d as A, f as K, h as R, j } from "./classification.js";
40
- import { loadCodeowners as M } from "@arcgis/node-toolkit/codeowners";
41
- import { s as E, d as z, g as F, b as I } from "./hardcodedBehavior.js";
42
- async function oe(a, o) {
43
- await x(
44
- {
45
- meta: { needsTypeInformation: !0, needsFooter: !1 },
46
- run(t) {
47
- L(t, o);
48
- }
49
- },
50
- "deprecations audit-definitions",
51
- a
52
- );
53
- }
54
- function L(a, o) {
55
- const t = [], c = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set(), i = O();
56
- for (const n of a) {
57
- var s = [];
58
- try {
59
- if (E(n.packageJson?.contents.name)) {
60
- const p = n.packageJson?.filePath;
61
- p !== void 0 && !e.has(p) && (e.add(p), y(
62
- "warn",
63
- u(p),
64
- `Skipping excluded package \`${n.packageJson?.contents.name ?? n.cwd}\`.`
65
- ));
66
- continue;
67
- }
68
- const l = D(s, J(n, !1));
69
- const f = n.packageJson?.contents.name ?? u(n.cwd);
70
- for (const p of l.getCodemodFiles()) {
71
- if (z(
72
- S(p.compilerNode.fileName, i.repositoryRoot)
73
- ))
74
- continue;
75
- const g = $.dirname(p.compilerNode.fileName), k = c.get(g) ?? F(g, f);
76
- c.set(g, k), t.push(...Q(p.compilerNode, k));
77
- }
78
- } catch (r) {
79
- var m = r, d = !0;
80
- } finally {
81
- w(s, m, d);
82
- }
83
- }
84
- if (o)
85
- q(t, i);
86
- else
87
- for (const n of t) {
88
- const l = b(
89
- "blue",
90
- `${u(n.sourceFileName)}:${n.line}:${n.column}`
91
- ), f = v({
92
- api: n.name,
93
- memberOf: n.memberOf,
94
- apiKind: n.apiKind
95
- }), p = C(n.apiKind, "parentheses");
96
- y("warn", l, `\`${f}\`${p} is deprecated.${n.reason ? ` ${n.reason}` : ""}`);
97
- }
98
- T(
99
- "definitions",
100
- t.length,
101
- new Set(t.map(({ sourceFileName: n }) => n)).size,
102
- new Set(t.map(({ package: n }) => n)).size
103
- );
104
- }
105
- function Q(a, o) {
106
- const t = /* @__PURE__ */ new Map(), c = A([a.fileName], o);
107
- function e(i) {
108
- const s = P.getJSDocDeprecatedTag(i), r = W(i);
109
- if (s !== void 0 && r !== void 0) {
110
- const m = r.getStart(a), { line: d, character: n } = a.getLineAndCharacterOfPosition(m);
111
- t.set(`${m}:${r.getWidth(a)}`, {
112
- package: o,
113
- module: c,
114
- name: j(i, r.getText(a)),
115
- ...R(i),
116
- reason: s.comment === void 0 ? void 0 : I(s.comment),
117
- sourceFileName: a.fileName,
118
- line: d + 1,
119
- column: n + 1
120
- });
121
- }
122
- P.forEachChild(i, e);
123
- }
124
- return e(a), [...t.values()].sort((i, s) => i.line - s.line || i.column - s.column);
125
- }
126
- function W(a) {
127
- return a.name;
128
- }
129
- function q(a, o) {
130
- const t = M(), c = {
131
- kind: "definitions",
132
- repository: o.repository,
133
- ref: o.ref,
134
- findings: a.map((e) => ({
135
- package: e.package,
136
- api: e.name,
137
- module: e.module,
138
- apiKind: e.apiKind,
139
- memberOf: e.memberOf,
140
- category: K({
141
- package: e.package,
142
- api: e.name,
143
- memberOf: e.memberOf,
144
- module: e.module,
145
- reason: e.reason ?? null
146
- }),
147
- reason: e.reason ?? null,
148
- file: S(e.sourceFileName, o.repositoryRoot),
149
- line: e.line,
150
- column: e.column,
151
- codeowners: t?.getOwners(e.sourceFileName) ?? []
152
- }))
153
- };
154
- process.stdout.write(`${JSON.stringify(c, void 0, 2)}
155
- `);
156
- }
157
- export {
158
- oe as auditDeprecatedDefinitions,
159
- Q as collectDeprecatedApiDefinitions
160
- };