@arcgis/codemod 5.2.0-next.90 → 5.2.0-next.93

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.
Files changed (33) hide show
  1. package/dist/{actions-ACvjOtUF.js → actions-Dk0H5GL7.js} +1 -1
  2. package/dist/cli-BG_bddFb.js +269 -0
  3. package/dist/cli.js +1 -1
  4. package/dist/{codemod-CJvMRUCq.js → codemod-BL-hF1sl.js} +3 -3
  5. package/dist/codemod-BsJsUWX-.js +240 -0
  6. package/dist/{codemod-BSrbZ8nr.js → codemod-CE3IeY9A.js} +3 -3
  7. package/dist/{codemod-BNhkoGgL.js → codemod-Ct065XZR.js} +4 -4
  8. package/dist/codemod-D0WPk--E.js +311 -0
  9. package/dist/{codemod-3QuC4SaX.js → codemod-DVCFvVWI.js} +3 -3
  10. package/dist/{useProjectInstance-5uuenLkM.js → useProjectInstance-JISA7BBD.js} +13 -16
  11. package/package.json +4 -4
  12. package/dist/actions-CKBQcIhe.js +0 -354
  13. package/dist/actions-CakrAPrI.js +0 -354
  14. package/dist/actions-CtxXjpuZ.js +0 -354
  15. package/dist/cli-3BztOTDV.js +0 -266
  16. package/dist/cli-BIg5ZLTm.js +0 -266
  17. package/dist/cli-BJ6P_2T-.js +0 -266
  18. package/dist/cli-CJfbqFa-.js +0 -266
  19. package/dist/codemod-8GvQmmZV.js +0 -140
  20. package/dist/codemod-BD9n1ra2.js +0 -74
  21. package/dist/codemod-BWZBr6IZ.js +0 -140
  22. package/dist/codemod-Bz1NfItD.js +0 -436
  23. package/dist/codemod-CRHygcg2.js +0 -74
  24. package/dist/codemod-CXiJ129U.js +0 -436
  25. package/dist/codemod-CzsItZhZ.js +0 -74
  26. package/dist/codemod-DOOtgv8R.js +0 -436
  27. package/dist/codemod-Dc4LGHgd.js +0 -6080
  28. package/dist/codemod-UDMxoQjk.js +0 -6080
  29. package/dist/codemod-Xx_q11AP.js +0 -6080
  30. package/dist/codemod-urnOPYsG.js +0 -140
  31. package/dist/useProjectInstance-CGaAin_6.js +0 -50
  32. package/dist/useProjectInstance-DiZc_C2o.js +0 -50
  33. package/dist/useProjectInstance-DixfNjtt.js +0 -50
@@ -1,6 +1,6 @@
1
1
  import { path as T } from "@arcgis/node-toolkit/path";
2
2
  import { SyntaxKind as g } from "ts-morph";
3
- import { g as x } from "./cli-CJfbqFa-.js";
3
+ import { g as x } from "./cli-BG_bddFb.js";
4
4
  import { ModuleResolutionKind as D } from "typescript";
5
5
  import { capitalize as S } from "@arcgis/toolkit/string";
6
6
  import { log as q } from "@arcgis/toolkit/log";
@@ -0,0 +1,269 @@
1
+ import { log as y } from "@arcgis/toolkit/log";
2
+ import { Command as U } from "@commander-js/extra-typings";
3
+ import { statSync as B } from "node:fs";
4
+ import { getCwd as k, path as e, toPosixPathSeparators as W } from "@arcgis/node-toolkit/path";
5
+ import "ts-morph";
6
+ import c from "typescript";
7
+ import { existsAsync as q, asyncFindPath as M } from "@arcgis/node-toolkit/file";
8
+ import { asyncRetrievePackageJson as L } from "@arcgis/node-toolkit/packageJson";
9
+ import { glob as $ } from "tinyglobby";
10
+ import { gitIgnoreFileToGlobs as A } from "@arcgis/node-toolkit/glob";
11
+ import { identity as _ } from "@arcgis/toolkit/function";
12
+ import { styleText as F } from "node:util";
13
+ const z = (t, o, n) => {
14
+ const r = t[o];
15
+ return r ? typeof r == "function" ? r() : Promise.resolve(r) : new Promise((l, i) => {
16
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(i.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + o + (o.split("/").length !== n ? ". Note that variables only represent file names one level deep." : ""))));
17
+ });
18
+ }, ye = {
19
+ allowImportingTsExtensions: !0,
20
+ allowJs: !0,
21
+ allowArbitraryExtensions: !0,
22
+ allowSyntheticDefaultImports: !0,
23
+ checkJs: !0,
24
+ experimentalDecorators: !0,
25
+ forceConsistentCasingInFileNames: !1,
26
+ isolatedModules: !1,
27
+ isolatedDeclarations: !1,
28
+ jsx: c.JsxEmit.Preserve,
29
+ lib: ["lib.esnext.d.ts", "lib.dom.d.ts"],
30
+ module: c.ModuleKind.ESNext,
31
+ moduleResolution: c.ModuleResolutionKind.Bundler,
32
+ moduleDetection: c.ModuleDetectionKind.Auto,
33
+ strict: !1,
34
+ target: c.ScriptTarget.ESNext,
35
+ resolveJsonModule: !0,
36
+ esModuleInterop: !0
37
+ }, j = {
38
+ codemod: void 0,
39
+ codemodName: void 0,
40
+ projectsData: void 0,
41
+ project: void 0
42
+ };
43
+ async function H() {
44
+ const { ignorePatterns: t, globRoot: o } = await Q(), n = await V(o);
45
+ return t.push(...n), { ignorePatterns: t, globRoot: o };
46
+ }
47
+ async function Q() {
48
+ const t = [];
49
+ let o, n = k(), r = e.dirname(n);
50
+ do {
51
+ o = r;
52
+ const l = e.join(o, ".gitignore");
53
+ if (await q(l)) {
54
+ n = e.dirname(l);
55
+ const g = e.relative(n, k()).split("/"), P = A(l);
56
+ for (const u of P) {
57
+ const h = u.startsWith("!") ? u.slice(1) : u, p = h.search(/[*?[]/u), w = p === -1 ? h : h.slice(0, p), v = w.split("/"), s = p !== -1 && !w.endsWith("/");
58
+ let a = !0;
59
+ const d = Math.min(g.length, v.length);
60
+ for (let m = 0; m < d; m++) {
61
+ const f = v[m];
62
+ if (!(s && m === v.length - 1 ? g[m].startsWith(f) : g[m] === f) && f !== "") {
63
+ a = !1;
64
+ break;
65
+ }
66
+ }
67
+ a && (u.startsWith("!") || t.push(u));
68
+ }
69
+ }
70
+ r = e.dirname(o);
71
+ } while (r !== o);
72
+ return { ignorePatterns: t, globRoot: n };
73
+ }
74
+ async function V(t) {
75
+ return (await $("**/.gitignore", {
76
+ cwd: k(),
77
+ // Gitignore files are unlikely to be symbolic links
78
+ followSymbolicLinks: !1,
79
+ // Don't look for ignore files in these places for speed:
80
+ ignore: [
81
+ // Hardcoded ignores in TypeScript
82
+ "**/node_modules/**",
83
+ "**/bower_components/**",
84
+ "**/jspm_packages/**",
85
+ // Default build output folder in bundlers
86
+ "**/dist/**"
87
+ ],
88
+ // Not applicable for our glob pattern
89
+ expandDirectories: !1
90
+ })).flatMap((n) => {
91
+ const r = e.relative(t, e.dirname(n)), l = A(n), i = [];
92
+ for (const g of l)
93
+ g.startsWith("!") || i.push(e.join(r, g));
94
+ return i;
95
+ });
96
+ }
97
+ const X = ["js", "jsx", "mjs", "cjs"], Y = ["ts", "tsx", "mts", "cts"], Z = ["json"], ee = `**/*.{${[...X, ...Y, ...Z].join(",")}}`;
98
+ async function te() {
99
+ const t = await H(), o = e.join(process.cwd(), ee), n = await $(o, {
100
+ cwd: t.globRoot,
101
+ ignore: t.ignorePatterns,
102
+ // The files we are looking for are unlikely to be symbolic links
103
+ followSymbolicLinks: !1,
104
+ // Not applicable for our glob pattern
105
+ expandDirectories: !1
106
+ // Files and folders starting with . are excluded (matches TypeScript's
107
+ // default behavior). If any tsconfig.json explicitly includes such files,
108
+ // they will still be codemodded.
109
+ });
110
+ let r = e.relative(t.globRoot, process.cwd());
111
+ r !== "" && (r += "/");
112
+ const l = e.join(e.resolve(t.globRoot), "/"), i = l.length + r.length, g = [], P = [], u = /* @__PURE__ */ new Set();
113
+ for (const s of n) {
114
+ const a = l + s;
115
+ if (s.endsWith(".json")) {
116
+ const d = e.basename(s);
117
+ d === "package.json" ? g.push(a) : (d.startsWith("tsconfig.") || d.startsWith("jsconfig.")) && P.push(a);
118
+ } else {
119
+ const d = s.slice(r.length);
120
+ u.add(d);
121
+ }
122
+ }
123
+ let h = await M("tsconfig.json", e.dirname(process.cwd()));
124
+ h !== void 0 && (h = W(h), P.push(h)), P.sort((s, a) => {
125
+ const d = a.split("/").length - s.split("/").length;
126
+ if (d !== 0)
127
+ return d;
128
+ const m = e.basename(s), f = e.basename(a);
129
+ return m === f ? 0 : m.endsWith("tsconfig.json") ? -1 : f.endsWith("tsconfig.json") ? 1 : m.endsWith("tsconfig.build.json") ? -1 : f.endsWith("tsconfig.build.json") ? 1 : m.localeCompare(f);
130
+ });
131
+ let p = await M("package.json");
132
+ p !== void 0 && (p = W(p));
133
+ const w = [], v = /* @__PURE__ */ new Set();
134
+ if (await Promise.all(
135
+ P.map(async (s) => {
136
+ const a = e.relative(process.cwd(), s), d = c.readConfigFile(s, c.sys.readFile);
137
+ if (d.error !== void 0) {
138
+ y(
139
+ "error",
140
+ a,
141
+ c.formatDiagnosticsWithColorAndContext([d.error], {
142
+ getCanonicalFileName: _,
143
+ getCurrentDirectory: c.sys.getCurrentDirectory,
144
+ getNewLine: () => c.sys.newLine
145
+ })
146
+ );
147
+ return;
148
+ }
149
+ const m = e.basename(a), f = c.parseJsonConfigFileContent(
150
+ d.config,
151
+ c.sys,
152
+ e.dirname(s),
153
+ void 0,
154
+ m
155
+ ), R = 18003;
156
+ f.errors.filter((b) => b.code !== R).length > 0 && y(
157
+ "warn",
158
+ a,
159
+ c.formatDiagnosticsWithColorAndContext(f.errors, {
160
+ getCanonicalFileName: _,
161
+ getCurrentDirectory: c.sys.getCurrentDirectory,
162
+ getNewLine: () => c.sys.newLine
163
+ })
164
+ );
165
+ const E = s === h, O = a === m, N = f.fileNames.filter((b) => {
166
+ const D = b.slice(i);
167
+ return u.delete(D) ? (v.add(D), !0) : v.has(D) || D.endsWith(".json") || b.includes("node_modules") ? !1 : !E;
168
+ });
169
+ if (N.length === 0)
170
+ return;
171
+ P.length === 1 && (E || O) && u.clear();
172
+ const S = e.dirname(s);
173
+ let x = S, C = p;
174
+ do {
175
+ const b = e.join(x, "package.json");
176
+ if (g.includes(b)) {
177
+ C = b;
178
+ break;
179
+ }
180
+ } while (x !== t.globRoot && (x = e.dirname(x)));
181
+ const J = C === void 0 ? void 0 : { filePath: C, contents: await L(e.dirname(C)) }, K = {
182
+ typeScriptConfig: {
183
+ filePath: s,
184
+ compilerOptions: f.options
185
+ },
186
+ packageJson: J,
187
+ logName: F("blue", J?.contents?.name ?? S),
188
+ cwd: S,
189
+ filePaths: N
190
+ };
191
+ w.push(K);
192
+ })
193
+ ), u.size > 0) {
194
+ const s = p === void 0 ? void 0 : {
195
+ filePath: p,
196
+ contents: await L(e.dirname(p))
197
+ };
198
+ w.push({
199
+ typeScriptConfig: void 0,
200
+ packageJson: s,
201
+ cwd: process.cwd(),
202
+ logName: F("blue", s?.contents?.name ?? process.cwd()),
203
+ filePaths: Array.from(u).map((a) => e.join(process.cwd(), a))
204
+ });
205
+ }
206
+ return w.sort((s, a) => s.cwd.localeCompare(a.cwd)), j.projectsData = w, w;
207
+ }
208
+ let T = !1;
209
+ function oe() {
210
+ T || (T = !0, process.exitCode !== void 0 && process.exitCode !== 0 ? y(
211
+ "warn",
212
+ j.codemodName,
213
+ "One or more exceptions occurred during the codemod run. Please review the output above."
214
+ ) : y(
215
+ "info",
216
+ j.codemodName,
217
+ `${F("green", "Codemod completed successfully.")} Recommended next steps:
218
+ - Review the codemod changes.
219
+ - If your project uses ESLint, run ESLint autofix on the changed files.
220
+ - If your project uses Prettier, run Prettier on the changed files.
221
+ - If your project uses TypeScript, run type checking to ensure there are no type errors.`
222
+ ));
223
+ }
224
+ async function se(t, o) {
225
+ j.codemod = t, j.codemodName = o;
226
+ const n = await te();
227
+ if (n.length === 0) {
228
+ y("error", o, `Failed to find any .js or .ts files in ${process.cwd()} to run the codemod on.`), process.exitCode = 1;
229
+ return;
230
+ }
231
+ await t.run(n), oe();
232
+ }
233
+ const I = new U();
234
+ I.name("@arcgis/codemod").description("Codemod for migrating or refactoring usages of ArcGIS Maps SDK for JavaScript");
235
+ I.command("run").description("Run a single codemod").argument("<codemodName>", "Name of the transform").argument("[path]", "Directory to transform", process.cwd()).action(ne);
236
+ async function ne(t, o) {
237
+ const n = B(o, { throwIfNoEntry: !1 });
238
+ if (n === void 0) {
239
+ y("error", "@arcgis/codemod", `Failed to find the target path: ${o}`), process.exitCode = 1;
240
+ return;
241
+ }
242
+ const r = n.isFile();
243
+ process.chdir(r ? e.dirname(o) : o);
244
+ let l;
245
+ try {
246
+ l = await z(/* @__PURE__ */ Object.assign({ "./codemods/api-extractor-strict-mode/codemod.ts": () => import("./codemod-Ct065XZR.js"), "./codemods/lumina-component-extras-improvements/codemod.ts": () => import("./codemod-D0WPk--E.js"), "./codemods/node-toolkit/codemod.ts": () => import("./codemod-BL-hF1sl.js"), "./codemods/normalize-calcite-icon-names/codemod.ts": () => import("./codemod-BsJsUWX-.js"), "./codemods/refactor-out-esri-namespace/codemod.ts": () => import("./codemod-CE3IeY9A.js"), "./codemods/toolkit-5.2-renames/codemod.ts": () => import("./codemod-DVCFvVWI.js") }), `./codemods/${t}/codemod.ts`, 4);
247
+ } catch (i) {
248
+ if (
249
+ // direct Node execution
250
+ typeof i == "object" && i !== null && "code" in i && i.code === "ERR_MODULE_NOT_FOUND" && "url" in i && typeof i.url == "string" && i.url.endsWith(`${e.sep}${t}${e.sep}codemod.ts`) || // Vite build execution
251
+ String(i).includes("Unknown variable dynamic import:")
252
+ ) {
253
+ y("error", "@arcgis/codemod", `Can't find codemod by name "${t}".`), process.exitCode = 1;
254
+ return;
255
+ } else
256
+ throw i;
257
+ }
258
+ if (typeof l.codemod != "object" || l.codemod === null) {
259
+ y("error", "@arcgis/codemod", `Can't find codemod by name "${t}".`), process.exitCode = 1;
260
+ return;
261
+ }
262
+ await se(l.codemod, F("blue", t));
263
+ }
264
+ I.parse();
265
+ export {
266
+ ye as d,
267
+ j as g,
268
+ oe as p
269
+ };
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./cli-BIg5ZLTm.js";
1
+ import "./cli-BG_bddFb.js";
2
2
  import "@arcgis/toolkit/log";
3
3
  import "@commander-js/extra-typings";
4
4
  import "node:fs";
@@ -29,11 +29,11 @@ var g = (i, o, a) => {
29
29
  };
30
30
  return r();
31
31
  };
32
- import { f as h, p as P } from "./actions-CtxXjpuZ.js";
32
+ import { f as h, p as P } from "./actions-Dk0H5GL7.js";
33
33
  import { log as k } from "@arcgis/toolkit/log";
34
34
  import { writeFile as u } from "node:fs/promises";
35
- import { c as y } from "./useProjectInstance-CGaAin_6.js";
36
- import { p as x, g as J } from "./cli-BIg5ZLTm.js";
35
+ import { c as y } from "./useProjectInstance-JISA7BBD.js";
36
+ import { p as x, g as J } from "./cli-BG_bddFb.js";
37
37
  async function v(i, o) {
38
38
  const a = /* @__PURE__ */ new Set();
39
39
  for (const n of i) {
@@ -0,0 +1,240 @@
1
+ var N = (t, e) => (e = Symbol[t]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + t), x = (t) => {
2
+ throw TypeError(t);
3
+ };
4
+ var A = (t, e, n) => {
5
+ if (e != null) {
6
+ typeof e != "object" && typeof e != "function" && x("Object expected");
7
+ var r, o;
8
+ n && (r = e[N("asyncDispose")]), r === void 0 && (r = e[N("dispose")], n && (o = r)), typeof r != "function" && x("Object not disposable"), o && (r = function() {
9
+ try {
10
+ o.call(this);
11
+ } catch (a) {
12
+ return Promise.reject(a);
13
+ }
14
+ }), t.push([n, r, e]);
15
+ } else n && t.push([n]);
16
+ return e;
17
+ }, y = (t, e, n) => {
18
+ var r = typeof SuppressedError == "function" ? SuppressedError : function(s, c, l, u) {
19
+ return u = Error(l), u.name = "SuppressedError", u.error = s, u.suppressed = c, u;
20
+ }, o = (s) => e = n ? new r(s, e, "An error was suppressed during disposal") : (n = !0, s), a = (s) => {
21
+ for (; s = t.pop(); )
22
+ try {
23
+ var c = s[1] && s[1].call(s[2]);
24
+ if (s[0]) return Promise.resolve(c).then(a, (l) => (o(l), a()));
25
+ } catch (l) {
26
+ o(l);
27
+ }
28
+ if (n) throw e;
29
+ };
30
+ return a();
31
+ };
32
+ import { SyntaxKind as d, Node as i } from "ts-morph";
33
+ import { c as z } from "./useProjectInstance-JISA7BBD.js";
34
+ const P = /* @__PURE__ */ new Map([
35
+ ["arcgis-survey123", "arcgis-survey-123"],
36
+ ["arrow-double-diagonal1", "arrow-double-diagonal-1"],
37
+ ["arrow-double-diagonal2", "arrow-double-diagonal-2"],
38
+ ["arrow-left10", "arrow-left-10"],
39
+ ["arrow-right10", "arrow-right-10"],
40
+ ["battery1", "battery-1"],
41
+ ["battery2", "battery-2"],
42
+ ["battery3", "battery-3"],
43
+ ["battery4", "battery-4"],
44
+ ["graph-bar100-stacked", "graph-bar-100-stacked"],
45
+ ["hexagon2", "hexagon-2"],
46
+ ["hexagon2-inset-large", "hexagon-2-inset-large"],
47
+ ["hexagon2-inset-medium", "hexagon-2-inset-medium"],
48
+ ["hexagon2-inset-small", "hexagon-2-inset-small"],
49
+ ["i12x", "1-2x"],
50
+ ["i14x", "1-4x"],
51
+ ["i18x", "1-8x"],
52
+ ["i1x", "1x"],
53
+ ["i2d", "2d"],
54
+ ["i2d-explore", "2d-explore"],
55
+ ["i2x", "2-x"],
56
+ ["i360-view", "360-view"],
57
+ ["i3d", "3d"],
58
+ ["i3d-building", "3d-building"],
59
+ ["i3d-building-parameter", "3d-building-parameter"],
60
+ ["i3d-glasses", "3d-glasses"],
61
+ ["i3d-search", "3d-search"],
62
+ ["i4x", "4-x"],
63
+ ["i8x", "8-x"],
64
+ ["language2", "language-2"],
65
+ ["launch2", "launch-2"],
66
+ ["layer3d", "layer-3d"],
67
+ ["merge2", "merge-2"],
68
+ ["number-circle1", "number-circle-1"],
69
+ ["number-circle1f", "number-circle-1-f"],
70
+ ["number-circle2", "number-circle-2"],
71
+ ["number-circle2f", "number-circle-2-f"],
72
+ ["number-circle3", "number-circle-3"],
73
+ ["number-circle3f", "number-circle-3-f"],
74
+ ["number-circle4", "number-circle-4"],
75
+ ["number-circle4f", "number-circle-4-f"],
76
+ ["number-circle5", "number-circle-5"],
77
+ ["number-circle5f", "number-circle-5-f"],
78
+ ["number-circle6", "number-circle-6"],
79
+ ["number-circle6f", "number-circle-6-f"],
80
+ ["number-circle7", "number-circle-7"],
81
+ ["number-circle7f", "number-circle-7-f"],
82
+ ["number-circle8", "number-circle-8"],
83
+ ["number-circle8f", "number-circle-8-f"],
84
+ ["number-circle9", "number-circle-9"],
85
+ ["number-circle9f", "number-circle-9-f"],
86
+ ["person2", "person-2"],
87
+ ["pop-up1", "pop-up-1"],
88
+ ["satellite0", "satellite-0"],
89
+ ["satellite0f", "satellite-0-f"],
90
+ ["satellite1", "satellite-1"],
91
+ ["satellite1f", "satellite-1-f"],
92
+ ["satellite2", "satellite-2"],
93
+ ["satellite2f", "satellite-2-f"],
94
+ ["satellite3", "satellite-3"],
95
+ ["satellite3f", "satellite-3-f"],
96
+ ["shapes2d3d", "shapes-2d-3d"],
97
+ ["subheading1", "subheading-1"],
98
+ ["subheading1-rtl", "subheading-1-rtl"],
99
+ ["subheading2", "subheading-2"],
100
+ ["subheading2-rtl", "subheading-2-rtl"],
101
+ ["subheading3", "subheading-3"],
102
+ ["subheading3-rtl", "subheading-3-rtl"],
103
+ ["subheading4", "subheading-4"],
104
+ ["subheading4-rtl", "subheading-4-rtl"],
105
+ ["subheading5", "subheading-5"],
106
+ ["subheading5-rtl", "subheading-5-rtl"],
107
+ ["summarize-center-and-dispersion1", "summarize-center-and-dispersion-1"],
108
+ ["summarize-center-and-dispersion2", "summarize-center-and-dispersion-2"],
109
+ ["summarize-center-and-dispersion3", "summarize-center-and-dispersion-3"]
110
+ ]), T = /* @__PURE__ */ new Set(["icon", "icon-end", "icon-start", "iconEnd", "iconStart"]), D = /[A-Z]/u, B = /^i\d/u, L = /([A-Z]+)([A-Z][a-z])/gu, I = /([a-z\d])([A-Z])/gu;
111
+ function C(t) {
112
+ let e = t;
113
+ return D.test(e) && (B.test(e) && (e = e.slice(1)), e = e.replace(L, "$1-$2").replace(I, "$1-$2").toLowerCase()), P.get(e) ?? e;
114
+ }
115
+ function w(t) {
116
+ const e = t.getLiteralValue(), n = C(e);
117
+ n !== e && t.setLiteralValue(n);
118
+ }
119
+ function E(t, e) {
120
+ const n = t.getInitializer();
121
+ i.isStringLiteral(n) ? w(n) : i.isJsxExpression(n) && g(n.getExpression(), e);
122
+ }
123
+ function F(t, e) {
124
+ const n = t.getBody();
125
+ i.isExpression(n) ? g(n, e) : n?.getDescendantsOfKind(d.ReturnStatement).forEach((r) => g(r.getExpression(), e));
126
+ }
127
+ function J(t, e) {
128
+ for (const n of t.findReferencesAsNodes()) {
129
+ const r = n.getParent(), o = i.isPropertyAccessExpression(r) ? r : n, a = o.getParent();
130
+ i.isBinaryExpression(a) && a.getLeft() === o && a.getOperatorToken().isKind(d.EqualsToken) ? g(a.getRight(), e) : i.isJsxAttribute(a) && a.getNameNode() === n && E(a, e);
131
+ }
132
+ }
133
+ function h(t, e) {
134
+ if (!(t === void 0 || e.has(t))) {
135
+ e.add(t);
136
+ for (const n of t.getDeclarations())
137
+ if (i.isVariableDeclaration(n) || i.isPropertyDeclaration(n) || i.isParameterDeclaration(n) || i.isBindingElement(n) || i.isPropertyAssignment(n)) {
138
+ g(n.getInitializer(), e);
139
+ const r = n.getNameNode();
140
+ i.isIdentifier(r) && J(r, e);
141
+ } else (i.isFunctionDeclaration(n) || i.isMethodDeclaration(n) || i.isFunctionExpression(n) || i.isArrowFunction(n) || i.isGetAccessorDeclaration(n)) && F(n, e);
142
+ }
143
+ }
144
+ function g(t, e) {
145
+ if (t !== void 0)
146
+ if (i.isStringLiteral(t) || i.isNoSubstitutionTemplateLiteral(t))
147
+ w(t);
148
+ else if (i.isConditionalExpression(t))
149
+ g(t.getWhenTrue(), e), g(t.getWhenFalse(), e);
150
+ else if (i.isBinaryExpression(t)) {
151
+ const n = t.getOperatorToken().getKind();
152
+ (n === d.BarBarToken || n === d.QuestionQuestionToken) && (g(t.getLeft(), e), g(t.getRight(), e));
153
+ } else i.isParenthesizedExpression(t) || i.isAsExpression(t) || i.isSatisfiesExpression(t) || i.isTypeAssertion(t) || i.isNonNullExpression(t) || i.isAwaitExpression(t) ? g(t.getExpression(), e) : i.isArrayLiteralExpression(t) ? t.getElements().forEach((n) => {
154
+ i.isExpression(n) && g(n, e);
155
+ }) : i.isObjectLiteralExpression(t) ? t.getProperties().forEach((n) => {
156
+ i.isPropertyAssignment(n) ? g(n.getInitializer(), e) : i.isShorthandPropertyAssignment(n) ? h(n.getNameNode().getSymbol(), e) : i.isSpreadAssignment(n) && g(n.getExpression(), e);
157
+ }) : i.isCallExpression(t) ? h(t.getExpression().getSymbol(), e) : i.isElementAccessExpression(t) ? g(t.getExpression(), e) : (i.isIdentifier(t) || i.isPropertyAccessExpression(t)) && h(t.getSymbol(), e);
158
+ }
159
+ function K(t) {
160
+ const e = /* @__PURE__ */ new Map();
161
+ for (const n of t)
162
+ for (const r of n.getDescendantsOfKind(d.JsxAttribute)) {
163
+ const o = r.getFirstAncestor(
164
+ (u) => i.isJsxOpeningElement(u) || i.isJsxSelfClosingElement(u)
165
+ );
166
+ if (!i.isJsxOpeningElement(o) && !i.isJsxSelfClosingElement(o))
167
+ continue;
168
+ const a = o.getTagNameNode().getText(), s = r.getNameNode().getText(), c = e.get(a) ?? /* @__PURE__ */ new Map(), l = c.get(s) ?? [];
169
+ l.push(r), c.set(s, l), e.set(a, c);
170
+ }
171
+ return e;
172
+ }
173
+ function O(t) {
174
+ const e = /* @__PURE__ */ new Map();
175
+ for (const n of t)
176
+ for (const r of n.getDescendantsOfKind(d.InterfaceDeclaration))
177
+ if (r.getName() === "DeclareElements")
178
+ for (const o of r.getProperties()) {
179
+ const a = o.getNameNode(), s = o.getTypeNode()?.getText();
180
+ if (!i.isStringLiteral(a) || s === void 0)
181
+ continue;
182
+ const c = a.getLiteralValue(), l = e.get(c) ?? /* @__PURE__ */ new Set();
183
+ l.add(s), e.set(c, l);
184
+ }
185
+ return e;
186
+ }
187
+ function R(t, e, n) {
188
+ const r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
189
+ for (const a of n)
190
+ for (const s of a.getDeclarations()) {
191
+ if (!i.isPropertyDeclaration(s))
192
+ continue;
193
+ const c = s.getFirstAncestorByKind(d.ClassDeclaration)?.getName();
194
+ if (c === void 0)
195
+ continue;
196
+ const l = s.getName(), u = `${c}.${l}`;
197
+ if (r.has(u))
198
+ continue;
199
+ r.add(u);
200
+ let m = o.get(c);
201
+ if (m === void 0) {
202
+ const b = new RegExp(`\\b${c}\\b`, "u");
203
+ m = [...e].filter(
204
+ ([, f]) => [...f].some((p) => b.test(p))
205
+ ).map(([f]) => f), o.set(c, m);
206
+ }
207
+ for (const b of m)
208
+ for (const f of t.get(b)?.get(l) ?? [])
209
+ E(f, n);
210
+ }
211
+ }
212
+ const j = {
213
+ meta: {
214
+ needsTypeInformation: !0
215
+ },
216
+ run(t) {
217
+ for (const a of t) {
218
+ var e = [];
219
+ try {
220
+ const s = A(e, z(a));
221
+ const c = /* @__PURE__ */ new Set();
222
+ const l = s.getCodemodFiles();
223
+ const u = K(l);
224
+ for (const [m, b] of u)
225
+ if (m.startsWith("calcite-"))
226
+ for (const f of T)
227
+ for (const p of b.get(f) ?? [])
228
+ E(p, c);
229
+ R(u, O(l), c);
230
+ } catch (n) {
231
+ var r = n, o = !0;
232
+ } finally {
233
+ y(e, r, o);
234
+ }
235
+ }
236
+ }
237
+ };
238
+ export {
239
+ j as codemod
240
+ };