@arcgis/codemod 5.2.0-next.11 → 5.2.0-next.110

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.
@@ -30,12 +30,12 @@ var D = (n, e, i) => {
30
30
  return s();
31
31
  };
32
32
  import { log as y } from "@arcgis/toolkit/log";
33
- import { c as V } from "./useProjectInstance-ByvP74ku.js";
33
+ import { c as V } from "./useProjectInstance-Cs8LP18f.js";
34
34
  import { mergeApiExtractorConfigs as O, loadApiExtractorConfig as _ } from "@arcgis/api-extractor/extractor/config";
35
- import { g as F } from "./cli-BU99JSgL.js";
35
+ import { g as F } from "./cli-BLMaWpqf.js";
36
36
  import { writeFile as I, readFile as j } from "node:fs/promises";
37
37
  import { join as W, relative as Q } from "node:path";
38
- import { existsAsync as U } from "@arcgis/components-build-utils";
38
+ import { existsAsync as U } from "@arcgis/node-toolkit/file";
39
39
  import { ApiExtractor as Y } from "@arcgis/api-extractor/extractor/ApiExtractor";
40
40
  import { SyntaxKind as f } from "ts-morph";
41
41
  import { getApiMemberName as q } from "@arcgis/api-extractor/utils/apiHelpers";
@@ -127,7 +127,7 @@ function M(n, e) {
127
127
  return n.replace(/\{@link +([^}]+)\}/gu, (i, d) => {
128
128
  const r = d.trim(), s = r.indexOf(" "), t = s === -1 ? r : r.slice(0, s), c = s === -1 ? "" : r.slice(s + 1).trim();
129
129
  if (t.startsWith("https://"))
130
- return c ? `[${c}](${t})]` : t;
130
+ return c ? `[${c}](${t})` : t;
131
131
  if (t.includes("!"))
132
132
  return i;
133
133
  const o = t.indexOf("#"), a = o === -1 ? t : t.slice(0, o), l = o === -1 ? void 0 : t.slice(o + 1), u = e[a] ?? Object.values(e).find(({ modulePath: N }) => N === a);
@@ -182,7 +182,7 @@ ${a}
182
182
  For each added declaration, remove @public from it if it is not supposed to be public. For each removed declaration, add @public JSDoc tag if it needs to remain public.`
183
183
  );
184
184
  }
185
- const te = "5.2.0-next.11", ne = {
185
+ const te = "1.0.0-0", ne = {
186
186
  version: te
187
187
  };
188
188
  async function oe(n) {
@@ -382,7 +382,7 @@ async function re(n) {
382
382
  r.length > 0 && y(
383
383
  "warn",
384
384
  n.logName,
385
- `Found deprecated options in ${e}: ${r.join(", ")}. Please refactor these out to equivalents specific in their deprecation messages (see vscode tooltips). See https://webgis.esri.com/references/api-extractor/running-standalone for an example api-extractor.config.ts. You do not need to re-run the codemod.
385
+ `Found deprecated options in ${e}: ${r.join(", ")}. Please refactor these out to equivalents specific in their deprecation messages (see vscode tooltips). See https://webgis.esri.com/references/api-extractor/integrations for an example api-extractor.config.ts. You do not need to re-run the codemod.
386
386
  `
387
387
  );
388
388
  }
@@ -0,0 +1,311 @@
1
+ var C = (t, s) => (s = Symbol[t]) ? s : /* @__PURE__ */ Symbol.for("Symbol." + t), D = (t) => {
2
+ throw TypeError(t);
3
+ };
4
+ var T = (t, s, e) => {
5
+ if (s != null) {
6
+ typeof s != "object" && typeof s != "function" && D("Object expected");
7
+ var n, o;
8
+ e && (n = s[C("asyncDispose")]), n === void 0 && (n = s[C("dispose")], e && (o = n)), typeof n != "function" && D("Object not disposable"), o && (n = function() {
9
+ try {
10
+ o.call(this);
11
+ } catch (i) {
12
+ return Promise.reject(i);
13
+ }
14
+ }), t.push([e, n, s]);
15
+ } else e && t.push([e]);
16
+ return s;
17
+ }, P = (t, s, e) => {
18
+ var n = typeof SuppressedError == "function" ? SuppressedError : function(r, a, c, d) {
19
+ return d = Error(c), d.name = "SuppressedError", d.error = r, d.suppressed = a, d;
20
+ }, o = (r) => s = e ? new n(r, s, "An error was suppressed during disposal") : (e = !0, r), i = (r) => {
21
+ for (; r = t.pop(); )
22
+ try {
23
+ var a = r[1] && r[1].call(r[2]);
24
+ if (r[0]) return Promise.resolve(a).then(i, (c) => (o(c), i()));
25
+ } catch (c) {
26
+ o(c);
27
+ }
28
+ if (e) throw s;
29
+ };
30
+ return i();
31
+ };
32
+ import { c as N } from "./useProjectInstance-Cs8LP18f.js";
33
+ import { g as B } from "./cli-BLMaWpqf.js";
34
+ import { SyntaxKind as f } from "ts-morph";
35
+ import { existsAsync as S } from "@arcgis/node-toolkit/file";
36
+ import { readFile as J, writeFile as K } from "node:fs/promises";
37
+ const ne = {
38
+ meta: {
39
+ needsTypeInformation: !1
40
+ },
41
+ async run() {
42
+ for (const o of B.projectsData) {
43
+ var t = [];
44
+ try {
45
+ const i = T(t, N(o));
46
+ for (const r of i.getCodemodFiles()) {
47
+ const a = r.getExtension();
48
+ if (a !== ".tsx" || !r.getFullText().includes("interface DeclareElements"))
49
+ continue;
50
+ const c = g(r);
51
+ if (c === void 0)
52
+ continue;
53
+ const d = j(c);
54
+ if (r.getFirstChildByKind(f.ModuleDeclaration) === void 0)
55
+ continue;
56
+ const $ = F(c);
57
+ $ !== void 0 && O(r, c, $, d);
58
+ const u = r.getFilePath().slice(0, -a.length + 1);
59
+ let l;
60
+ if (await S(`${u}css`) ? l = `${u}css` : await S(`${u}scss`) && (l = `${u}scss`), l === void 0)
61
+ continue;
62
+ const A = await J(l, "utf8"), p = w(A);
63
+ p !== void 0 && (p.properties.length > 0 && E(r, p.properties, d), await K(l, p.newCssText, "utf8"));
64
+ }
65
+ } catch (s) {
66
+ var e = s, n = !0;
67
+ } finally {
68
+ P(t, e, n);
69
+ }
70
+ }
71
+ }
72
+ };
73
+ function w(t) {
74
+ const s = [], e = L(t);
75
+ let n = t;
76
+ for (const o of e.toReversed()) {
77
+ const i = o.description.replaceAll(U, " ").trim(), r = i.endsWith("*") ? i.slice(0, -1).trim() : i, a = M(r);
78
+ s.unshift({
79
+ name: o.name,
80
+ deprecated: a.deprecated,
81
+ description: a.description
82
+ });
83
+ const c = o.index, d = c + o.text.length;
84
+ n = `${n.slice(0, c)}${n.slice(d)}`;
85
+ }
86
+ if (n = n.replaceAll(G, "").replaceAll(Q, ""), !(e.length === 0 && n === t))
87
+ return { newCssText: n, properties: s };
88
+ }
89
+ function L(t) {
90
+ const s = [];
91
+ for (const e of t.matchAll(q))
92
+ e.index !== void 0 && s.push({
93
+ index: e.index,
94
+ text: e[0],
95
+ name: e.groups.name,
96
+ description: e.groups.description
97
+ });
98
+ for (const e of t.matchAll(H))
99
+ e.index !== void 0 && s.push({
100
+ index: e.index,
101
+ text: e[0],
102
+ name: e.groups.name,
103
+ description: e.groups.description
104
+ });
105
+ return s.toSorted((e, n) => e.index - n.index);
106
+ }
107
+ function E(t, s, e) {
108
+ const n = t.getFirstChildByKindOrThrow(f.ModuleDeclaration);
109
+ t.insertText(
110
+ n.getEnd(),
111
+ `
112
+
113
+ ${y(s, e)}`
114
+ );
115
+ }
116
+ function W(t) {
117
+ return g(t) !== void 0;
118
+ }
119
+ function g(t) {
120
+ return t.getClasses().find((s) => s.hasExportKeyword() && s.getExtends() !== void 0);
121
+ }
122
+ function j(t) {
123
+ const s = t.getJsDocs()[0]?.getTags().map((e) => e.getTagName()) ?? [];
124
+ if (!s.includes("private")) {
125
+ if (s.includes("internal"))
126
+ return "internal";
127
+ if (s.includes("public"))
128
+ return "public";
129
+ }
130
+ }
131
+ function y(t, s) {
132
+ return [
133
+ 'declare module "@arcgis/lumina" {',
134
+ " interface DeclareCssProperties {",
135
+ ...t.map((n) => {
136
+ const o = [];
137
+ return n.description !== void 0 && o.push(` * ${n.description}`), s !== void 0 && o.push(` * @${s}`), n.deprecated !== void 0 && o.push(` * @deprecated ${n.deprecated}`), [
138
+ ...o.length > 0 ? [" /**", ...o, " */"] : [],
139
+ ` "${n.name}": "*";`
140
+ ].join(`
141
+ `);
142
+ }),
143
+ " }",
144
+ "}"
145
+ ].join(`
146
+ `);
147
+ }
148
+ function F(t) {
149
+ const s = t.getJsDocs()[0];
150
+ if (s === void 0)
151
+ return;
152
+ const e = {
153
+ slots: [],
154
+ cssParts: [],
155
+ cssStates: []
156
+ };
157
+ for (const i of s.getTags()) {
158
+ const r = i.getTagName();
159
+ if (r !== "slot" && r !== "csspart" && r !== "cssstate")
160
+ continue;
161
+ const a = I(z(r, i.getText()) ?? i.getCommentText());
162
+ i.remove(), r === "slot" ? e.slots.push(a) : r === "csspart" ? e.cssParts.push(a) : e.cssStates.push(a);
163
+ }
164
+ return e.slots.length > 0 || e.cssParts.length > 0 || e.cssStates.length > 0 ? (s.getTags().length === 0 && (s.getCommentText()?.trim() ?? "") === "" && s.remove(), e) : void 0;
165
+ }
166
+ function I(t) {
167
+ if (t === void 0)
168
+ return {
169
+ name: "",
170
+ deprecated: void 0,
171
+ description: void 0,
172
+ default: void 0
173
+ };
174
+ const s = t.indexOf(" - ");
175
+ if (s === -1)
176
+ return t.startsWith("- ") ? m({
177
+ name: "",
178
+ description: t.slice(2),
179
+ default: void 0
180
+ }) : m({
181
+ name: t,
182
+ description: void 0,
183
+ default: void 0
184
+ });
185
+ let e, n = t.slice(0, s);
186
+ if (n.startsWith("[") && n.endsWith("]")) {
187
+ const o = n.slice(1, -1), i = o.indexOf("=");
188
+ i === -1 ? n = o : (n = o.slice(0, i), e = o.slice(i + 1));
189
+ }
190
+ return m({
191
+ name: n,
192
+ description: t.slice(s + 3),
193
+ default: e
194
+ });
195
+ }
196
+ function z(t, s) {
197
+ const e = `@${t}`, n = s.trim();
198
+ if (!n.startsWith(e))
199
+ return;
200
+ const o = n.slice(e.length).split(/\r?\n/u).map((i) => i.replace(/^\s*\*\s?/u, "").trim()).filter((i) => i.length > 0).join(" ").trim();
201
+ return o.length > 0 ? o : void 0;
202
+ }
203
+ function m(t) {
204
+ const s = M(t.description);
205
+ return {
206
+ name: t.name.trim(),
207
+ description: s.description,
208
+ deprecated: s.deprecated,
209
+ default: t.default
210
+ };
211
+ }
212
+ function M(t) {
213
+ const s = t?.trim();
214
+ if (s?.startsWith("[Deprecated] ")) {
215
+ const e = s.slice(13).trim(), n = e.indexOf(". ");
216
+ return n !== -1 ? {
217
+ description: e.slice(n + 2).trim(),
218
+ deprecated: e.slice(0, n + 1).trim()
219
+ } : {
220
+ description: void 0,
221
+ deprecated: e
222
+ };
223
+ }
224
+ return {
225
+ description: s,
226
+ deprecated: void 0
227
+ };
228
+ }
229
+ function O(t, s, e, n) {
230
+ const o = s.getName();
231
+ if (o === void 0)
232
+ return;
233
+ let i = s;
234
+ const r = [];
235
+ if (e.cssStates.length > 0 && t.getInterface(`${o}CssStates`) === void 0 && r.push(R(o, e.cssStates, n)), e.cssParts.length > 0 && t.getTypeAlias(`${o}CssParts`) === void 0 && r.push(b(o, e.cssParts, n)), e.slots.length > 0 && t.getInterface(`${o}Slots`) === void 0 && r.push(V(o, e.slots, n)), r.length > 0) {
236
+ const v = t.getFirstChildByKindOrThrow(f.ModuleDeclaration);
237
+ t.insertText(v.getEnd(), `
238
+
239
+ ${r.join(`
240
+
241
+ `)}`), i = t.getClassOrThrow(o);
242
+ }
243
+ const a = i.getFirstChildByKindOrThrow(f.OpenBraceToken), c = [], d = i.getText();
244
+ e.cssStates.length > 0 && !d.includes('["@cssStates"]') && c.push(h("@cssStates", `${o}CssStates`, n)), e.slots.length > 0 && !d.includes('["@slots"]') && c.push(h("@slots", `${o}Slots`, n)), e.cssParts.length > 0 && !d.includes('["@cssParts"]') && c.push(h("@cssParts", `${o}CssParts`, n)), c.length > 0 && i.insertText(a.getEnd(), `
245
+
246
+ ${c.join(`
247
+
248
+ `)}
249
+ `);
250
+ }
251
+ function R(t, s, e) {
252
+ const n = s.filter((o) => o.name.length > 0).map((o) => x(o.name, "boolean", o, e));
253
+ return [
254
+ ...e !== void 0 ? [`/** @${e} */`] : [],
255
+ `interface ${t}CssStates {`,
256
+ ...n,
257
+ "}"
258
+ ].join(`
259
+ `);
260
+ }
261
+ function b(t, s, e) {
262
+ const n = s.filter((o) => o.name.length > 0).map((o) => x(o.name, "Node", o, e));
263
+ return [
264
+ ...e !== void 0 ? [`/** @${e} */`] : [],
265
+ `type ${t}CssParts = {`,
266
+ ...n,
267
+ "};"
268
+ ].join(`
269
+ `);
270
+ }
271
+ function V(t, s, e) {
272
+ const n = s.map((o) => x(o.name, "Node[]", o, e));
273
+ return [
274
+ ...e !== void 0 ? [`/** @${e} */`] : [],
275
+ `interface ${t}Slots {`,
276
+ ...n,
277
+ "}"
278
+ ].join(`
279
+ `);
280
+ }
281
+ function x(t, s, e, n) {
282
+ const o = t.length > 0 ? t : "", i = k(e, n), r = JSON.stringify(o);
283
+ return [...i, ` ${r}: ${s};`].join(`
284
+ `);
285
+ }
286
+ function k(t, s) {
287
+ const e = [];
288
+ if (t.description !== void 0 && e.push(...t.description.split(`
289
+ `).map((o) => ` * ${o}`)), s !== void 0 && e.push(` * @${s}`), t.default !== void 0 && e.push(` * @default ${t.default}`), t.deprecated !== void 0 && e.push(` * @deprecated ${t.deprecated}`), e.length === 0)
290
+ return [];
291
+ const n = [" /**", ...e];
292
+ return n.push(" */"), n;
293
+ }
294
+ function h(t, s, e) {
295
+ return e === void 0 ? ` override ["${t}"]!: ${s};` : ` /** @${e} */
296
+ override ["${t}"]!: ${s};`;
297
+ }
298
+ const q = /^\s*\*?\s*@prop\s+(?<name>--[\w-]+)(?:\s*:\s*|\s+-\s+)(?<description>[^@/]+?)(?=^\s*\*?\s*@|^\s*\*+\/)/gmu, H = /\/\*\*\s*@prop\s+(?<name>--[\w-]+)(?::\s*|\s+-\s+)(?<description>[^]*?)\s*\*\/\s*/gu, G = /\/\*\*\r?\n[\t ]*\* CSS Custom Properties\r?\n[\t ]*\*\r?\n[\t ]*\* These properties can be overridden using the component's tag as selector\.\r?\n(?:[\t ]*\*\s*\r?\n)*[\t ]*\*\/(?:[\t ]*\r?\n)*/gu, Q = /\/\*\*\s*(?:\r?\n\s*\*\s*)*\r?\n\s*\*\/\s*/gu, U = /\r?\n\s+\*? ?/gu, oe = {
299
+ parseStyleDocs: w,
300
+ addDeclareCssProperties: E,
301
+ hasExportedExtendedClass: W,
302
+ getExportedExtendedClass: g,
303
+ getVisibilityTag: j,
304
+ parseComponentExtrasTag: I,
305
+ collectAndRemoveComponentExtras: F,
306
+ addComponentExtrasTypesAndMembers: O
307
+ };
308
+ export {
309
+ ne as codemod,
310
+ oe as exportsForTests
311
+ };
@@ -0,0 +1,140 @@
1
+ var p = (i, o) => (o = Symbol[i]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + i), f = (i) => {
2
+ throw TypeError(i);
3
+ };
4
+ var g = (i, o, a) => {
5
+ if (o != null) {
6
+ typeof o != "object" && typeof o != "function" && f("Object expected");
7
+ var n, t;
8
+ a && (n = o[p("asyncDispose")]), n === void 0 && (n = o[p("dispose")], a && (t = n)), typeof n != "function" && f("Object not disposable"), t && (n = function() {
9
+ try {
10
+ t.call(this);
11
+ } catch (r) {
12
+ return Promise.reject(r);
13
+ }
14
+ }), i.push([a, n, o]);
15
+ } else a && i.push([a]);
16
+ return o;
17
+ }, m = (i, o, a) => {
18
+ var n = typeof SuppressedError == "function" ? SuppressedError : function(e, s, c, l) {
19
+ return l = Error(c), l.name = "SuppressedError", l.error = e, l.suppressed = s, l;
20
+ }, t = (e) => o = a ? new n(e, o, "An error was suppressed during disposal") : (a = !0, e), r = (e) => {
21
+ for (; e = i.pop(); )
22
+ try {
23
+ var s = e[1] && e[1].call(e[2]);
24
+ if (e[0]) return Promise.resolve(s).then(r, (c) => (t(c), r()));
25
+ } catch (c) {
26
+ t(c);
27
+ }
28
+ if (a) throw o;
29
+ };
30
+ return r();
31
+ };
32
+ import { f as h, p as P } from "./actions-CQZGPkk1.js";
33
+ import { log as k } from "@arcgis/toolkit/log";
34
+ import { writeFile as u } from "node:fs/promises";
35
+ import { c as y } from "./useProjectInstance-Cs8LP18f.js";
36
+ import { p as x, g as J } from "./cli-BLMaWpqf.js";
37
+ async function v(i, o) {
38
+ const a = /* @__PURE__ */ new Set();
39
+ for (const n of i) {
40
+ const t = n.packageJson;
41
+ if (t === void 0 || a.has(t.filePath))
42
+ continue;
43
+ a.add(t.filePath);
44
+ const r = t.contents;
45
+ try {
46
+ const e = await o(r, t.filePath);
47
+ r !== e && await u(t.filePath, `${JSON.stringify(e, null, 2)}
48
+ `, "utf8");
49
+ } catch (e) {
50
+ process.exitCode = 1, k(
51
+ "error",
52
+ h(t.filePath),
53
+ `Error occurred while migrating: ${String(e)}`,
54
+ typeof e == "object" && e !== null && "stack" in e ? { detail: { stack: e.stack } } : void 0
55
+ );
56
+ }
57
+ }
58
+ }
59
+ function D(i, o) {
60
+ for (const a of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
61
+ const n = i[a];
62
+ if (n) {
63
+ const t = o(n, a);
64
+ t !== n && (i = { ...i, [a]: t });
65
+ }
66
+ }
67
+ return i;
68
+ }
69
+ const d = "@arcgis/components-build-utils", S = {
70
+ [d]: {
71
+ existsAsync: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
72
+ // Command-string helpers require manual tokenization before using command-plus-args helpers.
73
+ sh: { do: "rename", specifier: "@arcgis/node-toolkit/shell" },
74
+ // sp was removed from node-toolkit; collectOutputSync is the closest return-value replacement.
75
+ sp: { do: "rename", name: "collectOutputSync", specifier: "@arcgis/node-toolkit/shell" },
76
+ asyncSh: { do: "rename", specifier: "@arcgis/node-toolkit/shell" },
77
+ findPath: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
78
+ asyncFindPath: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
79
+ createFileIfNotExists: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
80
+ gitIgnoreFileToGlobs: { do: "rename", specifier: "@arcgis/node-toolkit/glob" },
81
+ gitIgnoreToGlob: { do: "rename", specifier: "@arcgis/node-toolkit/glob" },
82
+ isPosix: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
83
+ toPosixPathSeparators: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
84
+ normalizePath: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
85
+ toSystemPathSeparators: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
86
+ getCwd: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
87
+ path: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
88
+ PackageJson: { do: "rename", specifier: "@arcgis/node-toolkit/packageJson" },
89
+ retrievePackageJson: { do: "rename", specifier: "@arcgis/node-toolkit/packageJson" },
90
+ asyncRetrievePackageJson: { do: "rename", specifier: "@arcgis/node-toolkit/packageJson" },
91
+ fetchPackageLocation: { do: "rename", specifier: "@arcgis/node-toolkit/packageJson" },
92
+ detectPackageManager: { do: "rename", specifier: "@arcgis/node-toolkit/packageJson" },
93
+ DependencyManagementOptions: {
94
+ do: "rename",
95
+ specifier: "@arcgis/node-toolkit/vite/externalizeDependenciesPlugin"
96
+ },
97
+ vitePresetPlugin: { do: "rename", specifier: "@arcgis/node-toolkit/vite/presetPlugin" },
98
+ externalizeDependencies: {
99
+ do: "rename",
100
+ specifier: "@arcgis/node-toolkit/vite/externalizeDependenciesPlugin"
101
+ }
102
+ }
103
+ }, C = {
104
+ meta: {
105
+ needsTypeInformation: !1
106
+ },
107
+ async run(i) {
108
+ await v(
109
+ i,
110
+ (r) => D(
111
+ r,
112
+ (e) => e[d] ? {
113
+ ...e,
114
+ [d]: void 0,
115
+ "@arcgis/node-toolkit": e[d]
116
+ } : e
117
+ )
118
+ );
119
+ for (const r of i) {
120
+ var o = [];
121
+ try {
122
+ const e = g(o, y(r));
123
+ for (const s of e.getCodemodFiles())
124
+ P(s, S);
125
+ } catch (a) {
126
+ var n = a, t = !0;
127
+ } finally {
128
+ m(o, n, t);
129
+ }
130
+ }
131
+ x(), k(
132
+ "info",
133
+ J.codemodName,
134
+ "Next step: run npm install/pnpm install/yarn install to get @arcgis/node-toolkit package installed."
135
+ );
136
+ }
137
+ };
138
+ export {
139
+ C as codemod
140
+ };
@@ -1,18 +1,18 @@
1
- import { Project as l } from "ts-morph";
2
- import { log as f } from "@arcgis/toolkit/log";
3
- import { path as p } from "@arcgis/components-build-utils";
4
- import { g as t, d } from "./cli-BU99JSgL.js";
1
+ import { Project as p } from "ts-morph";
2
+ import { log as d } from "@arcgis/toolkit/log";
3
+ import { path as f } from "@arcgis/node-toolkit/path";
4
+ import { g as t, d as m } from "./cli-BLMaWpqf.js";
5
5
  import { styleText as s } from "node:util";
6
- function P(e) {
6
+ function y(e) {
7
7
  if (t.project !== void 0)
8
8
  throw Error(
9
9
  "A different ts-morph Project is already in use. Dispose of it before creating a new one. Example: using project = createProjectInstance(...)"
10
10
  );
11
- const i = t.codemod.meta.needsTypeInformation, o = new l({
11
+ const i = t.codemod.meta.needsTypeInformation, o = new p({
12
12
  // If tsconfig is missing, or project is untyped, use a permissive and
13
13
  // compatible default config
14
14
  compilerOptions: e.typeScriptConfig?.compilerOptions ?? {
15
- ...d,
15
+ ...m,
16
16
  // Read types from JSDoc annotations if present
17
17
  checkJs: i
18
18
  },
@@ -23,12 +23,10 @@ function P(e) {
23
23
  // We call this manually if needed below.
24
24
  skipFileDependencyResolution: !0,
25
25
  skipLoadingLibFiles: !i
26
- });
27
- for (const n of e.filePaths)
28
- o.addSourceFileAtPath(n);
26
+ }), l = e.filePaths.map((n) => o.addSourceFileAtPath(n));
29
27
  i && o.resolveSourceFileDependencies();
30
- const r = p.relative(process.cwd(), e.cwd);
31
- process.stdout.write(""), f(
28
+ const r = f.relative(process.cwd(), e.cwd);
29
+ process.stdout.write(""), d(
32
30
  "info",
33
31
  s("blue", r === "" ? process.cwd() : r),
34
32
  `Running the codemod on ${s("blue", String(e.filePaths.length))} file${e.filePaths.length !== 1 ? "s" : ""}${e.packageJson?.contents.name === void 0 ? "" : ` from ${s("blue", e.packageJson.contents.name)}`}`
@@ -38,13 +36,12 @@ function P(e) {
38
36
  o.saveSync(), o.getRootDirectories().forEach((n) => n.forget()), t.project = void 0;
39
37
  },
40
38
  projectData: e,
41
- // Any files added after projectData.filePaths are supporting files for type
42
- // checking, but are not codemod targets.
43
- getCodemodFiles: () => o.getSourceFiles().slice(0, e.filePaths.length),
39
+ // Resolved dependencies support type checking but are not codemod targets.
40
+ getCodemodFiles: () => l,
44
41
  tsMorph: o
45
42
  };
46
43
  return t.project = c, c;
47
44
  }
48
45
  export {
49
- P as c
46
+ y as c
50
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/codemod",
3
- "version": "5.2.0-next.11",
3
+ "version": "5.2.0-next.110",
4
4
  "description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,17 +9,19 @@
9
9
  "files": [
10
10
  "dist/"
11
11
  ],
12
- "bin": "./bin/cli.js",
13
12
  "license": "SEE LICENSE IN LICENSE.md",
14
13
  "dependencies": {
15
- "@commander-js/extra-typings": "^14.0.0",
16
- "commander": "^14.0.0",
17
- "tinyglobby": "^0.2.15",
14
+ "@arcgis/api-extractor": "5.2.0-next.110",
15
+ "@arcgis/node-toolkit": "5.2.0-next.110",
16
+ "@arcgis/toolkit": "5.2.0-next.110",
17
+ "@commander-js/extra-typings": "^15.0.0",
18
+ "commander": "^15.0.0",
19
+ "tinyglobby": "~0.2.17",
18
20
  "ts-morph": "^28.0.0",
19
21
  "tslib": "^2.8.1",
20
- "typescript": "~6.0.2",
21
- "@arcgis/api-extractor": "5.2.0-next.11",
22
- "@arcgis/components-build-utils": "5.2.0-next.11",
23
- "@arcgis/toolkit": "5.2.0-next.11"
22
+ "typescript": "~6.0.3"
23
+ },
24
+ "bin": {
25
+ "codemod": "./bin/cli.js"
24
26
  }
25
27
  }