@arcgis/codemod 6.0.0-next.37 → 6.0.0-next.38

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.
@@ -4,8 +4,8 @@ import { collectOutputSync as v } from "@arcgis/node-toolkit/shell";
4
4
  import $ from "picomatch";
5
5
  import i from "typescript";
6
6
  import { retrievePackageJson as O } from "@arcgis/node-toolkit/packageJson";
7
- import { b as C, d as P } from "./cli.js";
8
- const K = "6.0.0-next.37";
7
+ import { e as C, d as P } from "./cli.js";
8
+ const K = "6.0.0-next.38";
9
9
  function I(e, r) {
10
10
  return e.package.localeCompare(r.package) || e.file.localeCompare(r.file) || e.line - r.line || e.column - r.column || g(e.module, r.module) || g(e.memberOf, r.memberOf) || e.name.localeCompare(r.name) || g(e.kind, r.kind) || g(e.category, r.category) || g(e.provenance, r.provenance) || String(e.deprecated).localeCompare(String(r.deprecated));
11
11
  }
@@ -1,17 +1,17 @@
1
- import { log as m } from "@arcgis/toolkit/log";
2
- import { Command as de, InvalidArgumentError as F } from "@commander-js/extra-typings";
3
- import { stat as Y, realpath as Z } from "node:fs/promises";
4
- import { path as r, getCwd as W, toPosixPathSeparators as q } from "@arcgis/node-toolkit/path";
5
- import { asyncFindPath as $, existsAsync as J } from "@arcgis/node-toolkit/file";
1
+ import { log as g } from "@arcgis/toolkit/log";
2
+ import { Command as ce, InvalidArgumentError as A } from "@commander-js/extra-typings";
3
+ import { realpath as X, stat as Y } from "node:fs/promises";
4
+ import { path as r, getCwd as W, toPosixPathSeparators as H } from "@arcgis/node-toolkit/path";
5
+ import { asyncFindPath as T, existsAsync as J } from "@arcgis/node-toolkit/file";
6
6
  import "ts-morph";
7
7
  import d from "typescript";
8
- import { asyncRetrievePackageJson as le } from "@arcgis/node-toolkit/packageJson";
9
- import { glob as ee } from "tinyglobby";
10
- import { gitIgnoreFileToGlobs as te } from "@arcgis/node-toolkit/glob";
11
- import { identity as z } from "@arcgis/toolkit/function";
8
+ import { asyncRetrievePackageJson as de } from "@arcgis/node-toolkit/packageJson";
9
+ import { glob as Z } from "tinyglobby";
10
+ import { gitIgnoreFileToGlobs as ee } from "@arcgis/node-toolkit/glob";
11
+ import { identity as q } from "@arcgis/toolkit/function";
12
12
  import { styleText as M } from "node:util";
13
- import { randomUUID as ue } from "node:crypto";
14
- const me = (t, e, o) => {
13
+ import { randomUUID as le } from "node:crypto";
14
+ const pe = (t, e, o) => {
15
15
  const s = t[e];
16
16
  return s ? typeof s == "function" ? s() : Promise.resolve(s) : new Promise((n, l) => {
17
17
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(l.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + e + (e.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
@@ -35,12 +35,12 @@ const me = (t, e, o) => {
35
35
  target: d.ScriptTarget.ESNext,
36
36
  resolveJsonModule: !0,
37
37
  esModuleInterop: !0
38
- }, v = {
38
+ }, S = {
39
39
  codemod: void 0,
40
40
  codemodName: void 0,
41
41
  projectsData: void 0,
42
42
  project: void 0
43
- }, oe = [
43
+ }, te = [
44
44
  // Hardcoded ignores in TypeScript
45
45
  "**/node_modules/**",
46
46
  "**/bower_components/**",
@@ -48,69 +48,69 @@ const me = (t, e, o) => {
48
48
  // Default build output folder in bundlers
49
49
  "**/dist/**"
50
50
  ];
51
- async function pe() {
52
- const { ignorePatterns: t, globRoot: e, hasIgnoreFiles: o } = await ge(), s = await fe(e);
53
- return t.push(...s.ignorePatterns), !o && !s.hasIgnoreFiles && t.push(...oe), { ignorePatterns: t, globRoot: e };
51
+ async function ue() {
52
+ const { ignorePatterns: t, globRoot: e, hasIgnoreFiles: o } = await me(), s = await ge(e);
53
+ return t.push(...s.ignorePatterns), !o && !s.hasIgnoreFiles && t.push(...te), { ignorePatterns: t, globRoot: e };
54
54
  }
55
- async function ge() {
55
+ async function me() {
56
56
  const t = [];
57
57
  let e = !1;
58
- const o = await $(".git"), s = o === void 0 ? void 0 : r.dirname(o);
58
+ const o = await T(".git"), s = o === void 0 ? void 0 : r.dirname(o);
59
59
  let n, l = W(), f = r.dirname(l);
60
60
  do {
61
61
  if (n = f, s !== void 0 && n !== s && !n.startsWith(`${s}/`))
62
62
  break;
63
- const p = r.join(n, ".gitignore");
64
- if (await J(p)) {
65
- e = !0, l = r.dirname(p);
66
- const h = r.relative(l, W()).split("/"), T = te(p);
67
- for (const b of T) {
68
- const w = b.startsWith("!") ? b.slice(1) : b, y = w.search(/[*?[]/u), P = y === -1 ? w : w.slice(0, y), g = P.split("/"), I = y !== -1 && !P.endsWith("/");
69
- let x = !0;
70
- const D = Math.min(h.length, g.length);
63
+ const u = r.join(n, ".gitignore");
64
+ if (await J(u)) {
65
+ e = !0, l = r.dirname(u);
66
+ const h = r.relative(l, W()).split("/"), N = ee(u);
67
+ for (const b of N) {
68
+ const w = b.startsWith("!") ? b.slice(1) : b, y = w.search(/[*?[]/u), P = y === -1 ? w : w.slice(0, y), m = P.split("/"), I = y !== -1 && !P.endsWith("/");
69
+ let v = !0;
70
+ const D = Math.min(h.length, m.length);
71
71
  for (let i = 0; i < D; i++) {
72
- const a = g[i];
73
- if (!(I && i === g.length - 1 ? h[i].startsWith(a) : h[i] === a) && a !== "") {
74
- x = !1;
72
+ const a = m[i];
73
+ if (!(I && i === m.length - 1 ? h[i].startsWith(a) : h[i] === a) && a !== "") {
74
+ v = !1;
75
75
  break;
76
76
  }
77
77
  }
78
- x && (b.startsWith("!") || t.push(b));
78
+ v && (b.startsWith("!") || t.push(b));
79
79
  }
80
80
  }
81
81
  f = r.dirname(n);
82
82
  } while (f !== n);
83
83
  return { ignorePatterns: t, globRoot: l, hasIgnoreFiles: e };
84
84
  }
85
- async function fe(t) {
86
- const e = await ee("**/.gitignore", {
85
+ async function ge(t) {
86
+ const e = await Z("**/.gitignore", {
87
87
  cwd: W(),
88
88
  // Gitignore files are unlikely to be symbolic links
89
89
  followSymbolicLinks: !1,
90
90
  // Don't look for ignore files in these places for speed:
91
- ignore: oe,
91
+ ignore: te,
92
92
  // Not applicable for our glob pattern
93
93
  expandDirectories: !1
94
94
  });
95
95
  return { ignorePatterns: e.flatMap((s) => {
96
- const n = r.relative(t, r.dirname(s)), l = te(s), f = [];
97
- for (const p of l)
98
- p.startsWith("!") || f.push(r.join(n, p));
96
+ const n = r.relative(t, r.dirname(s)), l = ee(s), f = [];
97
+ for (const u of l)
98
+ u.startsWith("!") || f.push(r.join(n, u));
99
99
  return f;
100
100
  }), hasIgnoreFiles: e.length > 0 };
101
101
  }
102
- const se = ["js", "jsx", "mjs", "cjs"], ie = ["ts", "tsx", "mts", "cts"], he = /* @__PURE__ */ new Set([...se, ...ie]), be = ["json"], we = ["css", "scss", "sass", "html"];
103
- async function ye({
102
+ const oe = ["js", "jsx", "mjs", "cjs"], se = ["ts", "tsx", "mts", "cts"], fe = /* @__PURE__ */ new Set([...oe, ...se]), he = ["json"], be = ["css", "scss", "sass", "html"];
103
+ async function we({
104
104
  targetFilePath: t,
105
105
  includeComponentFiles: e = !1,
106
106
  includeTsConfigFiles: o = !1
107
107
  } = {}) {
108
- const s = await pe(), l = `**/*.{${[
108
+ const s = await ue(), l = `**/*.{${[
109
+ ...oe,
109
110
  ...se,
110
- ...ie,
111
- ...be,
112
- ...e ? we : []
113
- ].join(",")}}`, f = r.join(process.cwd(), l), p = r.join(r.resolve(s.globRoot), "/"), L = (await ee(f, {
111
+ ...he,
112
+ ...e ? be : []
113
+ ].join(",")}}`, f = r.join(process.cwd(), l), u = r.join(r.resolve(s.globRoot), "/"), U = (await Z(f, {
114
114
  cwd: s.globRoot,
115
115
  ignore: s.ignorePatterns,
116
116
  // The files we are looking for are unlikely to be symbolic links
@@ -121,13 +121,13 @@ async function ye({
121
121
  // default behavior). If any tsconfig.json explicitly includes such files,
122
122
  // they will still be codemodded.
123
123
  })).filter(
124
- (i) => i.endsWith(".json") || t === void 0 || p + i === t
124
+ (i) => i.endsWith(".json") || t === void 0 || u + i === t
125
125
  );
126
126
  let h = r.relative(s.globRoot, process.cwd());
127
127
  h !== "" && (h += "/");
128
- const T = p.length + h.length, b = [], w = [], y = /* @__PURE__ */ new Set();
129
- for (const i of L) {
130
- const a = p + i;
128
+ const N = u.length + h.length, b = [], w = [], y = /* @__PURE__ */ new Set();
129
+ for (const i of U) {
130
+ const a = u + i;
131
131
  if (i.endsWith(".json")) {
132
132
  const c = r.basename(i);
133
133
  c === "package.json" ? b.push(a) : (c.startsWith("tsconfig.") || c.startsWith("jsconfig.")) && w.push(a);
@@ -136,97 +136,97 @@ async function ye({
136
136
  y.add(c);
137
137
  }
138
138
  }
139
- let P = await $("tsconfig.json", r.dirname(process.cwd()));
140
- P !== void 0 && (P = q(P), w.push(P)), w.sort((i, a) => {
139
+ let P = await T("tsconfig.json", r.dirname(process.cwd()));
140
+ P !== void 0 && (P = H(P), w.push(P)), w.sort((i, a) => {
141
141
  const c = a.split("/").length - i.split("/").length;
142
142
  if (c !== 0)
143
143
  return c;
144
- const u = r.basename(i), S = r.basename(a);
145
- return u === S ? 0 : u.endsWith("tsconfig.json") ? -1 : S.endsWith("tsconfig.json") ? 1 : u.endsWith("tsconfig.build.json") ? -1 : S.endsWith("tsconfig.build.json") ? 1 : u.localeCompare(S);
144
+ const p = r.basename(i), x = r.basename(a);
145
+ return p === x ? 0 : p.endsWith("tsconfig.json") ? -1 : x.endsWith("tsconfig.json") ? 1 : p.endsWith("tsconfig.build.json") ? -1 : x.endsWith("tsconfig.build.json") ? 1 : p.localeCompare(x);
146
146
  });
147
- let g = await $("package.json");
148
- g !== void 0 && (g = q(g));
147
+ let m = await T("package.json");
148
+ m !== void 0 && (m = H(m));
149
149
  const I = [
150
- .../* @__PURE__ */ new Set([...b, ...g === void 0 ? [] : [g]])
151
- ].sort((i, a) => a.length - i.length), x = [], D = /* @__PURE__ */ new Set();
150
+ .../* @__PURE__ */ new Set([...b, ...m === void 0 ? [] : [m]])
151
+ ].sort((i, a) => a.length - i.length), v = [], D = /* @__PURE__ */ new Set();
152
152
  if (await Promise.all(
153
153
  w.map(async (i) => {
154
154
  const a = r.relative(process.cwd(), i), c = d.readConfigFile(i, d.sys.readFile);
155
155
  if (c.error !== void 0) {
156
- m(
156
+ g(
157
157
  "error",
158
158
  a,
159
159
  d.formatDiagnosticsWithColorAndContext([c.error], {
160
- getCanonicalFileName: z,
160
+ getCanonicalFileName: q,
161
161
  getCurrentDirectory: d.sys.getCurrentDirectory,
162
162
  getNewLine: () => d.sys.newLine
163
163
  })
164
164
  );
165
165
  return;
166
166
  }
167
- const u = d.parseJsonConfigFileContent(
167
+ const p = d.parseJsonConfigFileContent(
168
168
  c.config,
169
169
  d.sys,
170
170
  r.dirname(i),
171
171
  void 0,
172
172
  i
173
- ), S = 18003;
174
- u.errors.filter((k) => k.code !== S).length > 0 && m(
173
+ ), x = 18003;
174
+ p.errors.filter((k) => k.code !== x).length > 0 && g(
175
175
  "warn",
176
176
  a,
177
- d.formatDiagnosticsWithColorAndContext(u.errors, {
178
- getCanonicalFileName: z,
177
+ d.formatDiagnosticsWithColorAndContext(p.errors, {
178
+ getCanonicalFileName: q,
179
179
  getCurrentDirectory: d.sys.getCurrentDirectory,
180
180
  getNewLine: () => d.sys.newLine
181
181
  })
182
182
  );
183
- const K = i === P, _ = u.fileNames.filter((k) => {
183
+ const L = i === P, K = p.fileNames.filter((k) => {
184
184
  if (t !== void 0 && k !== t)
185
185
  return !1;
186
- const E = k.slice(T);
187
- return y.delete(E) ? (D.add(E), !0) : D.has(E) || E.endsWith(".json") || k.includes("node_modules") || K ? !1 : d.sys.fileExists(k);
188
- }), ae = (
186
+ const E = k.slice(N);
187
+ return y.delete(E) ? (D.add(E), !0) : D.has(E) || E.endsWith(".json") || k.includes("node_modules") || L ? !1 : d.sys.fileExists(k);
188
+ }), re = (
189
189
  // Scanning tsconfig.json
190
190
  o && // Don't include tsconfig outside the scanned scope
191
- !K && // If filtering by file, ensure this tsconfig is the one being targeted
191
+ !L && // If filtering by file, ensure this tsconfig is the one being targeted
192
192
  (t === void 0 || t === i)
193
193
  );
194
- if (_.length === 0 && !ae)
194
+ if (K.length === 0 && !re)
195
195
  return;
196
- const H = r.dirname(i), ce = B(H, I) ?? g;
197
- x.push(
198
- await V(_, H, ce, {
196
+ const _ = r.dirname(i), ae = z(_, I) ?? m;
197
+ v.push(
198
+ await B(K, _, ae, {
199
199
  filePath: i,
200
- compilerOptions: u.options
200
+ compilerOptions: p.options
201
201
  })
202
202
  );
203
203
  })
204
204
  ), y.size > 0) {
205
- const i = [...y].map((c) => r.join(process.cwd(), c)), a = Map.groupBy(i, (c) => B(c, I));
206
- x.push(
205
+ const i = [...y].map((c) => r.join(process.cwd(), c)), a = Map.groupBy(i, (c) => z(c, I));
206
+ v.push(
207
207
  ...await Promise.all(
208
- [...a].map(async ([c, u]) => await V(u, process.cwd(), c))
208
+ [...a].map(async ([c, p]) => await B(p, process.cwd(), c))
209
209
  )
210
210
  );
211
211
  }
212
- return x.sort(
212
+ return v.sort(
213
213
  (i, a) => i.cwd.localeCompare(a.cwd) || (i.typeScriptConfig?.filePath ?? "").localeCompare(a.typeScriptConfig?.filePath ?? "") || (i.packageJson?.filePath ?? "").localeCompare(a.packageJson?.filePath ?? "")
214
- ), v.projectsData = x, x;
214
+ ), S.projectsData = v, v;
215
215
  }
216
216
  function Ue(t) {
217
217
  const e = r.extname(t).slice(1);
218
- return he.has(e);
218
+ return fe.has(e);
219
219
  }
220
- function B(t, e) {
220
+ function z(t, e) {
221
221
  return e.find((o) => {
222
222
  const s = r.dirname(o);
223
223
  return t === s || t.startsWith(`${s}/`);
224
224
  });
225
225
  }
226
- async function V(t, e, o, s) {
226
+ async function B(t, e, o, s) {
227
227
  const n = o === void 0 ? void 0 : {
228
228
  filePath: o,
229
- contents: await le(r.dirname(o))
229
+ contents: await de(r.dirname(o))
230
230
  };
231
231
  return {
232
232
  typeScriptConfig: s,
@@ -236,14 +236,14 @@ async function V(t, e, o, s) {
236
236
  logName: M("blue", n?.contents.name ?? e)
237
237
  };
238
238
  }
239
- function Pe() {
240
- v.codemod.meta.needsFooter && (v.codemod.meta.needsFooter = !1, process.exitCode !== void 0 && process.exitCode !== 0 ? m(
239
+ function ye() {
240
+ S.codemod.meta.needsFooter && (S.codemod.meta.needsFooter = !1, process.exitCode !== void 0 && process.exitCode !== 0 ? g(
241
241
  "warn",
242
- v.codemodName,
242
+ S.codemodName,
243
243
  "One or more exceptions occurred during the codemod run. Please review the output above."
244
- ) : m(
244
+ ) : g(
245
245
  "info",
246
- v.codemodName,
246
+ S.codemodName,
247
247
  `${M("green", "Codemod completed successfully.")} Recommended next steps:
248
248
  - Review the codemod changes.
249
249
  - If your project uses ESLint, run ESLint autofix on the changed files.
@@ -251,19 +251,25 @@ function Pe() {
251
251
  - If your project uses TypeScript, run type checking to ensure there are no type errors.`
252
252
  ));
253
253
  }
254
- async function xe(t, e, o) {
255
- v.codemod = t, v.codemodName = e;
256
- const s = await ye({
254
+ async function Pe(t, e, o) {
255
+ S.codemod = t, S.codemodName = e;
256
+ const s = await we({
257
257
  targetFilePath: o,
258
258
  includeComponentFiles: t.meta.includeComponentFiles,
259
259
  includeTsConfigFiles: t.meta.includeTsConfigFiles
260
260
  });
261
261
  if (s.length === 0) {
262
262
  const n = t.meta.includeComponentFiles ? "source files or component manifests" : ".js or .ts files";
263
- m("error", e, `Failed to find any ${n} in ${process.cwd()} to run the codemod on.`), process.exitCode = 1;
263
+ g("error", e, `Failed to find any ${n} in ${process.cwd()} to run the codemod on.`), process.exitCode = 1;
264
264
  return;
265
265
  }
266
- await t.run(s), Pe();
266
+ await t.run(s), ye();
267
+ }
268
+ async function ve(t) {
269
+ const e = r.resolve(t);
270
+ await J(e) || (g("error", "@arcgis/codemod", `Failed to find the target path: ${t}`), process.exit(1));
271
+ const o = await X(e), s = (await Y(o)).isFile();
272
+ return process.chdir(s ? r.dirname(o) : o), s ? o : void 0;
267
273
  }
268
274
  const R = {
269
275
  outdatedDependencies: {
@@ -310,9 +316,9 @@ const R = {
310
316
  label: "Non-Esri packages and web platform - low priority",
311
317
  description: "These deprecations do not block updating Esri packages and are not tied to an ArcGIS release."
312
318
  }
313
- }, A = "https://webgis.esri.com/api/deprecations";
319
+ }, $ = "https://webgis.esri.com/api/deprecations";
314
320
  async function Le(t, e) {
315
- const o = ue();
321
+ const o = le();
316
322
  process.stderr.write(`Submitting deprecation report (${o}).
317
323
  `);
318
324
  let s;
@@ -340,7 +346,7 @@ async function Le(t, e) {
340
346
  process.stderr.write(`Deprecation report submitted to ${e} (${o}).
341
347
  `);
342
348
  }
343
- const ve = /(?:esri|arcgis)/iu, Se = ["/.astro/"], G = ["all", "repositories", "apis", "unused-apis"], Ke = {
349
+ const Se = /(?:esri|arcgis)/iu, xe = ["/.astro/"], G = ["all", "repositories", "apis", "unused-apis"], Ke = {
344
350
  usages: "Refactor-out deprecated API usages",
345
351
  definitions: "Remove deprecated APIs in next breaking changes release"
346
352
  }, _e = {
@@ -348,49 +354,49 @@ const ve = /(?:esri|arcgis)/iu, Se = ["/.astro/"], G = ["all", "repositories", "
348
354
  definitions: "The following deprecated APIs are owned by assigned CODEOWNERS. Remove them in the next breaking changes release."
349
355
  }, He = "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.", qe = "Task", ze = "deprecations sync-issues";
350
356
  function Be(t) {
351
- return ve.test(t);
357
+ return Se.test(t);
352
358
  }
353
359
  function Ve(t) {
354
- return Se.some((e) => `/${t}`.includes(e));
360
+ return xe.some((e) => `/${t}`.includes(e));
355
361
  }
356
- const N = new de(), O = "See https://www.npmjs.com/package/@arcgis/codemod for a list of available public codemods. [Esri internal] Non-public codemods are documented at https://webgis.esri.com/references/codemod/introduction.";
357
- N.name("@arcgis/codemod").description("Codemod for migrating or refactoring usages of ArcGIS Maps SDK for JavaScript");
358
- N.command("run").description("Run a single codemod").argument("<codemodName>", `Name of the codemod. ${O}`).argument("[path]", "Directory to transform", process.cwd()).showHelpAfterError(O).action(async (t, e) => {
359
- const o = await U(e);
362
+ const F = new ce(), O = "See https://www.npmjs.com/package/@arcgis/codemod for a list of available public codemods. [Esri internal] Non-public codemods are documented at https://webgis.esri.com/references/codemod/introduction.";
363
+ F.name("@arcgis/codemod").description("Codemod for migrating or refactoring usages of ArcGIS Maps SDK for JavaScript");
364
+ F.command("run").description("Run a single codemod").argument("<codemodName>", `Name of the codemod. ${O}`).argument("[path]", "Directory to transform", process.cwd()).showHelpAfterError(O).action(async (t, e) => {
365
+ const o = await ve(e);
360
366
  let s;
361
367
  try {
362
- s = await me(/* @__PURE__ */ Object.assign({ "./codemods/api-extractor-strict-mode/codemod.ts": () => import("./codemod.js"), "./codemods/geometry-operator-renames/codemod.ts": () => import("./codemod2.js"), "./codemods/lumina-component-extras-improvements/codemod.ts": () => import("./codemod3.js"), "./codemods/lumina-toolkit/codemod.ts": () => import("./codemod4.js"), "./codemods/node-toolkit/codemod.ts": () => import("./codemod5.js"), "./codemods/normalize-calcite-icon-names/codemod.ts": () => import("./codemod6.js"), "./codemods/refactor-out-esri-namespace/codemod.ts": () => import("./codemod7.js"), "./codemods/toolkit-5.2-renames/codemod.ts": () => import("./codemod8.js") }), `./codemods/${t}/codemod.ts`, 4);
368
+ s = await pe(/* @__PURE__ */ Object.assign({ "./codemods/api-extractor-strict-mode/codemod.ts": () => import("./codemod.js"), "./codemods/geometry-operator-renames/codemod.ts": () => import("./codemod2.js"), "./codemods/lumina-component-extras-improvements/codemod.ts": () => import("./codemod3.js"), "./codemods/lumina-toolkit/codemod.ts": () => import("./codemod4.js"), "./codemods/node-toolkit/codemod.ts": () => import("./codemod5.js"), "./codemods/normalize-calcite-icon-names/codemod.ts": () => import("./codemod6.js"), "./codemods/refactor-out-esri-namespace/codemod.ts": () => import("./codemod7.js"), "./codemods/toolkit-5.2-renames/codemod.ts": () => import("./codemod8.js") }), `./codemods/${t}/codemod.ts`, 4);
363
369
  } catch (n) {
364
370
  if (
365
371
  // direct Node execution
366
372
  typeof n == "object" && n !== null && "code" in n && n.code === "ERR_MODULE_NOT_FOUND" && "url" in n && typeof n.url == "string" && n.url.endsWith(`/${t}/codemod.ts`) || // Vite build execution
367
373
  String(n).includes("Unknown variable dynamic import:")
368
374
  ) {
369
- m("error", "@arcgis/codemod", `Can't find codemod by name "${t}". ${O}`), process.exitCode = 1;
375
+ g("error", "@arcgis/codemod", `Can't find codemod by name "${t}". ${O}`), process.exitCode = 1;
370
376
  return;
371
377
  } else
372
378
  throw n;
373
379
  }
374
380
  if (typeof s.codemod != "object" || s.codemod === null) {
375
- m("error", "@arcgis/codemod", `Can't find codemod by name "${t}". ${O}`), process.exitCode = 1;
381
+ g("error", "@arcgis/codemod", `Can't find codemod by name "${t}". ${O}`), process.exitCode = 1;
376
382
  return;
377
383
  }
378
- await xe(s.codemod, M("blue", t), o);
384
+ await Pe(s.codemod, M("blue", t), o);
379
385
  });
380
- const C = N.command("deprecations").description(
386
+ const C = F.command("deprecations").description(
381
387
  `Audit and report deprecated APIs.
382
388
 
383
389
  Documentation: https://webgis.esri.com/references/codemod/deprecations`
384
- ), ne = "Globs to exclude from the scan (relative to cwd). Example: deprecated-package/**. Can provide --exclude multiple times. Use this sparingly. Use cases: deprecated packages, unmaintained test apps";
390
+ ), ie = "Globs to exclude from the scan (relative to cwd). Example: deprecated-package/**. Can provide --exclude multiple times. Use this sparingly. Use cases: deprecated packages, unmaintained test apps";
385
391
  C.command("audit-usages").description(
386
392
  "Report deprecated API usages. Documentation: https://webgis.esri.com/references/codemod/deprecations#audit-usages"
387
- ).argument("[path]", "Directory to audit", process.cwd()).option("--exclude <glob>", ne, j, []).option("--esri-only", "Only report usages of deprecated APIs from Esri and ArcGIS packages", !1).option(
393
+ ).argument("[path]", "Directory to audit", process.cwd()).option("--exclude <glob>", ie, j, []).option("--esri-only", "Only report usages of deprecated APIs from Esri and ArcGIS packages", !1).option(
388
394
  "--category <category>",
389
395
  `Only report usages in a category. Available categories: ${Object.keys(R).join(", ")}`,
390
- re
396
+ ne
391
397
  ).option("--package <package-name>", "Only report usages of deprecated APIs from this package").option(
392
398
  "--report [url]",
393
- `Submit a complete repository scan to the WebGIS collector (default: ${A})`
399
+ `Submit a complete repository scan to the WebGIS collector (default: ${$})`
394
400
  ).option(
395
401
  "--json",
396
402
  "Output results as JSON. Example: npx @arcgis/codemod deprecations audit-usages --json > usages.json",
@@ -400,29 +406,18 @@ C.command("audit-usages").description(
400
406
  "Output results as Markdown. Example: npx @arcgis/codemod deprecations audit-usages --md > usages.md",
401
407
  !1
402
408
  ).action(async (t, e) => {
403
- if (e.json && e.md) {
404
- m("error", "@arcgis/codemod", "The --json and --md options cannot be used together."), process.exitCode = 1;
405
- return;
406
- }
407
- const o = await U(t), { auditDeprecatedUsages: s } = await import("./auditUsages.js"), n = e.md ? "md" : e.json ? "json" : "text";
408
- await s(o, {
409
- esriOnly: e.esriOnly,
410
- outputFormat: n,
411
- category: e.category,
412
- packageName: e.package,
413
- exclude: e.exclude,
414
- reportingUrl: e.report === !0 ? A : e.report || void 0
415
- });
409
+ const { auditDeprecatedUsages: o } = await import("./auditUsages.js");
410
+ await o(t, e);
416
411
  });
417
412
  C.command("audit-definitions").description(
418
413
  "Report exported APIs marked as deprecated. Documentation: https://webgis.esri.com/references/codemod/deprecations#audit-definitions"
419
- ).argument("[path]", "Directory to audit", process.cwd()).option("--exclude <glob>", ne, j, []).option(
414
+ ).argument("[path]", "Directory to audit", process.cwd()).option("--exclude <glob>", ie, j, []).option(
420
415
  "--json",
421
416
  "Output results as JSON. Example: npx @arcgis/codemod deprecations audit-definitions --json > definitions.json",
422
417
  !1
423
418
  ).action(async (t, e) => {
424
- const o = await U(t), { auditDeprecatedDefinitions: s } = await import("./auditDefinitions.js");
425
- await s(o, e.json, e.exclude);
419
+ const { auditDeprecatedDefinitions: o } = await import("./auditDefinitions.js");
420
+ await o(t, e);
426
421
  });
427
422
  C.command("aggregate-usages").description(
428
423
  "Aggregate audit-usages reports into repository summaries and an API usage tree. Documentation: https://webgis.esri.com/references/codemod/deprecations#analyze-the-ecosystem"
@@ -433,13 +428,13 @@ C.command("aggregate-usages").description(
433
428
  "all"
434
429
  ).option(
435
430
  "--remote [url]",
436
- `Read the latest stored audit per repository from the WebGIS collector (default: ${A})`
431
+ `Read the latest stored audit per repository from the WebGIS collector (default: ${$})`
437
432
  ).option(
438
433
  "--repository <repository>",
439
434
  "Select a remote repository (host/owner/repo); repeat to select multiple",
440
435
  j,
441
436
  []
442
- ).option("--branch <branch>", "Select remote audits from this branch").option("--since <date>", "Select remote audits on or after this ISO date", Q).option("--until <date>", "Select remote audits on or before this ISO date", Q).option(
437
+ ).option("--branch <branch>", "Select remote audits from this branch").option("--since <date>", "Select remote audits on or after this ISO date", V).option("--until <date>", "Select remote audits on or before this ISO date", V).option(
443
438
  "--definitions <report>",
444
439
  "Compare an audit-definitions JSON report to list APIs with zero detected usages. Can be specified multiple times.",
445
440
  j,
@@ -447,14 +442,14 @@ C.command("aggregate-usages").description(
447
442
  ).option("--esri-only", "Only report usages of deprecated APIs from Esri and ArcGIS packages", !1).option(
448
443
  "--category <category>",
449
444
  `Only report usages in a category. Available categories: ${Object.keys(R).join(", ")}`,
450
- re
445
+ ne
451
446
  ).option("--package <package-name>", "Only report usages of deprecated APIs from this package").option("--json", "Output results as JSON", !1).option("--md", "Output results as Markdown", !1).action(async (t, e) => {
452
447
  if (!t.length && !e.remote || !e.remote && (e.repository.length || e.branch || e.since || e.until))
453
448
  throw new Error("Provide report files or --remote. Repository, branch, and date selection require --remote.");
454
449
  if (e.since && e.until && e.since > e.until)
455
450
  throw new Error("--since must not be after --until.");
456
451
  if (e.json && e.md) {
457
- m("error", "@arcgis/codemod", "The --json and --md options cannot be used together."), process.exitCode = 1;
452
+ g("error", "@arcgis/codemod", "The --json and --md options cannot be used together."), process.exitCode = 1;
458
453
  return;
459
454
  }
460
455
  const { aggregateUsagesFromFiles: o } = await import("./aggregateUsages.js");
@@ -469,7 +464,7 @@ C.command("aggregate-usages").description(
469
464
  },
470
465
  e.definitions,
471
466
  e.remote ? {
472
- url: e.remote === !0 ? A : e.remote,
467
+ url: e.remote === !0 ? $ : e.remote,
473
468
  repositories: e.repository,
474
469
  branch: e.branch,
475
470
  since: e.since,
@@ -481,7 +476,7 @@ function ke(t) {
481
476
  const e = G.find((o) => o === t);
482
477
  if (e !== void 0)
483
478
  return e;
484
- throw new F(`Expected one of: ${G.join(", ")}.`);
479
+ throw new A(`Expected one of: ${G.join(", ")}.`);
485
480
  }
486
481
  C.command("sync-issues").description(
487
482
  `Create or update deprecation audit issues. Requires authenticated gh cli.
@@ -491,7 +486,7 @@ Otherwise, a new issue is created. Assignees are determined based on CODEOWNERS.
491
486
  ).argument(
492
487
  "<audit-json>",
493
488
  "Path to the JSON file as output by the --json flag in the audit-usages or audit-definitions CLI"
494
- ).option("--dry-run", "Print planned issue and comment changes without changing GitHub", !1).option("--close-resolved", "Close stale managed issues after a complete, unfiltered repository-root audit", !1).option("--offset <number>", "Skip the first number of issue plans", X, 0).option("--limit <number>", "Process at most this many issue plans", X).option(
489
+ ).option("--dry-run", "Print planned issue and comment changes without changing GitHub", !1).option("--close-resolved", "Close stale managed issues after a complete, unfiltered repository-root audit", !1).option("--offset <number>", "Skip the first number of issue plans", Q, 0).option("--limit <number>", "Process at most this many issue plans", Q).option(
495
490
  "--label <label>",
496
491
  "Label to add to managed issues. Can be specified multiple times. .github/labeler.yml config is applied by default",
497
492
  j,
@@ -499,62 +494,57 @@ Otherwise, a new issue is created. Assignees are determined based on CODEOWNERS.
499
494
  ).action(async (t, e) => {
500
495
  const o = r.resolve(t);
501
496
  if (!await J(o) || !(await Y(o)).isFile()) {
502
- m("error", "@arcgis/codemod", `Failed to find the audit JSON file: ${t}`), process.exitCode = 1;
497
+ g("error", "@arcgis/codemod", `Failed to find the audit JSON file: ${t}`), process.exitCode = 1;
503
498
  return;
504
499
  }
505
500
  const { syncDeprecationIssues: s } = await import("./sync.js");
506
- await s(await Z(o), e.dryRun, e.offset, e.limit, {
501
+ await s(await X(o), e.dryRun, e.offset, e.limit, {
507
502
  labels: e.label,
508
503
  closeResolved: e.closeResolved
509
504
  });
510
505
  });
511
- function Q(t) {
506
+ function V(t) {
512
507
  const e = new Date(t);
513
508
  if (!Number.isFinite(e.getTime()))
514
- throw new F("Expected an ISO date.");
509
+ throw new A("Expected an ISO date.");
515
510
  return e.toISOString();
516
511
  }
517
512
  function j(t, e) {
518
513
  return [...e, t];
519
514
  }
520
- function X(t) {
515
+ function Q(t) {
521
516
  const e = Number(t);
522
517
  if (!Number.isSafeInteger(e) || e < 0)
523
- throw new F("Expected a non-negative integer.");
518
+ throw new A("Expected a non-negative integer.");
524
519
  return e;
525
520
  }
526
- function re(t) {
521
+ function ne(t) {
527
522
  if (!Object.hasOwn(R, t))
528
- throw new F(`Expected one of: ${Object.keys(R).join(", ")}.`);
523
+ throw new A(`Expected one of: ${Object.keys(R).join(", ")}.`);
529
524
  return t;
530
525
  }
531
- async function U(t) {
532
- const e = r.resolve(t);
533
- await J(e) || (m("error", "@arcgis/codemod", `Failed to find the target path: ${t}`), process.exit(1));
534
- const o = await Z(e), s = (await Y(o)).isFile();
535
- return process.chdir(s ? r.dirname(o) : o), s ? o : void 0;
536
- }
537
526
  C.command("sync-markdown").description(
538
527
  "Update managed Markdown comments on an existing issue, leaving its body untouched. Requires authenticated gh cli."
539
528
  ).argument("<markdown-file>", "Path to the Markdown report").requiredOption("--issue <url>", "HTTPS URL of the existing GitHub issue").option("--dry-run", "Print planned comment changes without changing GitHub", !1).action(async (t, e) => {
540
529
  const { syncMarkdown: o } = await import("./syncMarkdown.js");
541
530
  await o(r.resolve(t), e.issue, e.dryRun);
542
531
  });
543
- N.parse();
532
+ F.parse();
544
533
  export {
545
- Le as a,
546
- Be as b,
547
- Me as c,
534
+ $ as a,
535
+ Pe as b,
536
+ Le as c,
548
537
  R as d,
549
- A as e,
550
- ze as f,
551
- v as g,
552
- Ke as h,
538
+ Be as e,
539
+ Me as f,
540
+ S as g,
541
+ ze as h,
553
542
  Ue as i,
554
- _e as j,
555
- He as k,
556
- qe as l,
557
- Pe as p,
558
- xe as r,
543
+ Ke as j,
544
+ _e as k,
545
+ He as l,
546
+ qe as m,
547
+ ye as p,
548
+ ve as r,
559
549
  Ve as s
560
550
  };
@@ -2,7 +2,7 @@ import l from "typescript";
2
2
  import { findPath as P, asyncFindPath as y } from "@arcgis/node-toolkit/file";
3
3
  import { path as p } from "@arcgis/node-toolkit/path";
4
4
  import { retrievePackageJson as w, asyncRetrievePackageJson as E } from "@arcgis/node-toolkit/packageJson";
5
- import { s as $, b as j } from "./cli.js";
5
+ import { s as $, e as j } from "./cli.js";
6
6
  import { log as v } from "@arcgis/toolkit/log";
7
7
  import { realpath as k, readFile as b, readdir as M } from "node:fs/promises";
8
8
  import { f as x } from "./log.js";
@@ -261,10 +261,10 @@ function g(e) {
261
261
  }
262
262
  export {
263
263
  G as a,
264
- Z as b,
264
+ V as b,
265
265
  Y as c,
266
- V as d,
267
- q as e,
266
+ q as d,
267
+ Z as e,
268
268
  Q as f,
269
269
  H as g,
270
270
  ee as l,