@arcgis/codemod 6.0.0-next.15 → 6.0.0-next.17

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