@arcgis/codemod 5.2.0-next.37 → 5.2.0-next.39

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,40 +1,72 @@
1
- var p = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), g = (i) => {
1
+ var p = (i, o) => (o = Symbol[i]) ? o : /* @__PURE__ */ Symbol.for("Symbol." + i), f = (i) => {
2
2
  throw TypeError(i);
3
3
  };
4
- var f = (i, e, t) => {
5
- if (e != null) {
6
- typeof e != "object" && typeof e != "function" && g("Object expected");
7
- var a, n;
8
- t && (a = e[p("asyncDispose")]), a === void 0 && (a = e[p("dispose")], t && (n = a)), typeof a != "function" && g("Object not disposable"), n && (a = function() {
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
9
  try {
10
- n.call(this);
10
+ t.call(this);
11
11
  } catch (r) {
12
12
  return Promise.reject(r);
13
13
  }
14
- }), i.push([t, a, e]);
15
- } else t && i.push([t]);
16
- return e;
17
- }, m = (i, e, t) => {
18
- var a = typeof SuppressedError == "function" ? SuppressedError : function(o, s, c, d) {
19
- return d = Error(c), d.name = "SuppressedError", d.error = o, d.suppressed = s, d;
20
- }, n = (o) => e = t ? new a(o, e, "An error was suppressed during disposal") : (t = !0, o), r = (o) => {
21
- for (; o = i.pop(); )
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, d) {
19
+ return d = Error(c), d.name = "SuppressedError", d.error = e, d.suppressed = s, d;
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
22
  try {
23
- var s = o[1] && o[1].call(o[2]);
24
- if (o[0]) return Promise.resolve(s).then(r, (c) => (n(c), r()));
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
25
  } catch (c) {
26
- n(c);
26
+ t(c);
27
27
  }
28
- if (t) throw e;
28
+ if (a) throw o;
29
29
  };
30
30
  return r();
31
31
  };
32
- import { p as k } from "./actions-DALb_66K.js";
33
- import { f as P, a as h } from "./packageJson-CVYW5e37.js";
34
- import { c as y } from "./useProjectInstance-Drwl2zR7.js";
35
- import { p as u, g as x } from "./cli-DicyNPEu.js";
36
- import { log as J } from "@arcgis/toolkit/log";
37
- const l = "@arcgis/components-build-utils", v = {
32
+ import { f as h, p as P } from "./actions-CoNL8Vi9.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-BCvcfoQ5.js";
36
+ import { p as x, g as J } from "./cli-BHF6hwOe.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 l = "@arcgis/components-build-utils", S = {
38
70
  [l]: {
39
71
  existsAsync: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
40
72
  sh: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
@@ -66,41 +98,41 @@ const l = "@arcgis/components-build-utils", v = {
66
98
  specifier: "@arcgis/node-toolkit/vite/externalizeDependenciesPlugin"
67
99
  }
68
100
  }
69
- }, A = {
101
+ }, C = {
70
102
  meta: {
71
103
  needsTypeInformation: !1
72
104
  },
73
105
  async run(i) {
74
- await P(
106
+ await v(
75
107
  i,
76
- (r) => h(
108
+ (r) => D(
77
109
  r,
78
- (o) => o[l] ? {
79
- ...o,
110
+ (e) => e[l] ? {
111
+ ...e,
80
112
  [l]: void 0,
81
- "@arcgis/node-toolkit": o[l]
82
- } : o
113
+ "@arcgis/node-toolkit": e[l]
114
+ } : e
83
115
  )
84
116
  );
85
117
  for (const r of i) {
86
- var e = [];
118
+ var o = [];
87
119
  try {
88
- const o = f(e, y(r));
89
- for (const s of o.getCodemodFiles())
90
- k(s, v);
91
- } catch (t) {
92
- var a = t, n = !0;
120
+ const e = g(o, y(r));
121
+ for (const s of e.getCodemodFiles())
122
+ P(s, S);
123
+ } catch (a) {
124
+ var n = a, t = !0;
93
125
  } finally {
94
- m(e, a, n);
126
+ m(o, n, t);
95
127
  }
96
128
  }
97
- u(), J(
129
+ x(), k(
98
130
  "info",
99
- x.codemodName,
131
+ J.codemodName,
100
132
  "Next step: run npm install/pnpm install/yarn install to get @arcgis/node-toolkit package installed."
101
133
  );
102
134
  }
103
135
  };
104
136
  export {
105
- A as codemod
137
+ C as codemod
106
138
  };
@@ -1,7 +1,7 @@
1
1
  import { Project as l } from "ts-morph";
2
2
  import { log as f } from "@arcgis/toolkit/log";
3
3
  import { path as p } from "@arcgis/node-toolkit/path";
4
- import { g as t, d } from "./cli-DicyNPEu.js";
4
+ import { g as t, d } from "./cli-BHF6hwOe.js";
5
5
  import { styleText as s } from "node:util";
6
6
  function P(e) {
7
7
  if (t.project !== void 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/codemod",
3
- "version": "5.2.0-next.37",
3
+ "version": "5.2.0-next.39",
4
4
  "description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,12 +14,12 @@
14
14
  "dependencies": {
15
15
  "@commander-js/extra-typings": "^14.0.0",
16
16
  "commander": "^14.0.0",
17
- "tinyglobby": "^0.2.15",
17
+ "tinyglobby": "^0.2.17",
18
18
  "ts-morph": "^28.0.0",
19
19
  "tslib": "^2.8.1",
20
20
  "typescript": "~6.0.2",
21
- "@arcgis/api-extractor": "5.2.0-next.37",
22
- "@arcgis/node-toolkit": "5.2.0-next.37",
23
- "@arcgis/toolkit": "5.2.0-next.37"
21
+ "@arcgis/api-extractor": "5.2.0-next.39",
22
+ "@arcgis/node-toolkit": "5.2.0-next.39",
23
+ "@arcgis/toolkit": "5.2.0-next.39"
24
24
  }
25
25
  }
@@ -1,125 +0,0 @@
1
- var m = (o, e) => (e = Symbol[o]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + o), d = (o) => {
2
- throw TypeError(o);
3
- };
4
- var g = (o, e, r) => {
5
- if (e != null) {
6
- typeof e != "object" && typeof e != "function" && d("Object expected");
7
- var t, s;
8
- r && (t = e[m("asyncDispose")]), t === void 0 && (t = e[m("dispose")], r && (s = t)), typeof t != "function" && d("Object not disposable"), s && (t = function() {
9
- try {
10
- s.call(this);
11
- } catch (a) {
12
- return Promise.reject(a);
13
- }
14
- }), o.push([r, t, e]);
15
- } else r && o.push([r]);
16
- return e;
17
- }, p = (o, e, r) => {
18
- var t = typeof SuppressedError == "function" ? SuppressedError : function(i, n, c, l) {
19
- return l = Error(c), l.name = "SuppressedError", l.error = i, l.suppressed = n, l;
20
- }, s = (i) => e = r ? new t(i, e, "An error was suppressed during disposal") : (r = !0, i), a = (i) => {
21
- for (; i = o.pop(); )
22
- try {
23
- var n = i[1] && i[1].call(i[2]);
24
- if (i[0]) return Promise.resolve(n).then(a, (c) => (s(c), a()));
25
- } catch (c) {
26
- s(c);
27
- }
28
- if (r) throw e;
29
- };
30
- return a();
31
- };
32
- import { p as f } from "./actions-DALb_66K.js";
33
- import { f as k, a as u } from "./packageJson-CVYW5e37.js";
34
- import { c as E } from "./useProjectInstance-Drwl2zR7.js";
35
- import { p as b, g as L } from "./cli-DicyNPEu.js";
36
- import { log as T } from "@arcgis/toolkit/log";
37
- const F = {
38
- meta: {
39
- needsTypeInformation: !1
40
- },
41
- async run(o) {
42
- await k(
43
- o,
44
- (a) => u(
45
- a,
46
- (i) => i["@arcgis/components-utils"] ? {
47
- ...i,
48
- "@arcgis/components-utils": void 0,
49
- "@arcgis/toolkit": i["@arcgis/components-utils"]
50
- } : i
51
- )
52
- );
53
- for (const a of o) {
54
- var e = [];
55
- try {
56
- const i = g(e, E(a));
57
- for (const n of i.getCodemodFiles())
58
- f(n, {
59
- "@arcgis/components-utils": {
60
- // Deprecated
61
- setFocusOnElement: [{ do: "deprecate" }, { do: "rename", specifier: "@arcgis/toolkit/dom" }],
62
- setValuesInString: [{ do: "deprecate" }, { do: "rename", specifier: "@arcgis/toolkit/string" }],
63
- IHandle: [{ do: "deprecate" }, { do: "rename", specifier: "@arcgis/toolkit/type" }],
64
- Deferred: [{ do: "deprecate" }, { do: "rename", specifier: "@arcgis/toolkit/promise" }],
65
- // Renamed
66
- addLTRMark: { do: "rename", specifier: "@arcgis/toolkit/string", name: "addLtrMark" },
67
- getElementTheme: { do: "rename", specifier: "@arcgis/toolkit/dom", name: "unsafeGetCalciteModeName" },
68
- getElementDir: { do: "rename", specifier: "@arcgis/toolkit/dom", name: "unsafeGetElementDirection" },
69
- unsafeGetModeName: { do: "rename", specifier: "@arcgis/toolkit/dom", name: "unsafeGetCalciteModeName" },
70
- getElementLocales: { do: "rename", specifier: "@arcgis/toolkit/intl", name: "getElementLocale" },
71
- LocaleObserver: { do: "rename", specifier: "@arcgis/toolkit/intl", name: "LocaleObserverResult" },
72
- Nil: { do: "rename", specifier: "@arcgis/toolkit/type", name: "nil" },
73
- closestElement: { do: "rename", specifier: "@arcgis/toolkit/dom", name: "getClosestElement" },
74
- extractMinorVersion: { do: "rename", specifier: "@arcgis/toolkit/string", name: "getMinorVersion" },
75
- isURL: { do: "rename", specifier: "@arcgis/toolkit/string", name: "isUrl" },
76
- mappedFind: { do: "rename", specifier: "@arcgis/toolkit/array" },
77
- classes: { do: "rename", specifier: "@arcgis/toolkit/dom" },
78
- // Relocated
79
- observeAncestorsMutation: { do: "rename", specifier: "@arcgis/toolkit/dom" },
80
- getElementAttribute: { do: "rename", specifier: "@arcgis/toolkit/dom" },
81
- FocusableElement: { do: "rename", specifier: "@arcgis/toolkit/dom" },
82
- focusElement: { do: "rename", specifier: "@arcgis/toolkit/dom" },
83
- devToolsAwareTimeout: { do: "rename", specifier: "@arcgis/toolkit/promise" },
84
- isEsriInternalEnv: { do: "rename", specifier: "@arcgis/toolkit/error" },
85
- safeCall: { do: "rename", specifier: "@arcgis/toolkit/error" },
86
- safeAsyncCall: { do: "rename", specifier: "@arcgis/toolkit/error" },
87
- generateGuid: { do: "rename", specifier: "@arcgis/toolkit/string" },
88
- getPreamble: { do: "rename", specifier: "@arcgis/toolkit/string" },
89
- quoteString: { do: "rename", specifier: "@arcgis/toolkit/string" },
90
- createFilterExpression: { do: "rename", specifier: "@arcgis/toolkit/string" },
91
- kebabToPascal: { do: "rename", specifier: "@arcgis/toolkit/string" },
92
- camelToKebab: { do: "rename", specifier: "@arcgis/toolkit/string" },
93
- camelToHuman: { do: "rename", specifier: "@arcgis/toolkit/string" },
94
- capitalize: { do: "rename", specifier: "@arcgis/toolkit/string" },
95
- uncapitalize: { do: "rename", specifier: "@arcgis/toolkit/string" },
96
- GenericT9nStrings: { do: "rename", specifier: "@arcgis/toolkit/intl" },
97
- supportedLocales: { do: "rename", specifier: "@arcgis/toolkit/intl" },
98
- SupportedLocale: { do: "rename", specifier: "@arcgis/toolkit/intl" },
99
- defaultLocale: { do: "rename", specifier: "@arcgis/toolkit/intl" },
100
- fetchT9nStringsBundle: { do: "rename", specifier: "@arcgis/toolkit/intl" },
101
- normalizeLocale: { do: "rename", specifier: "@arcgis/toolkit/intl" },
102
- startLocaleObserver: { do: "rename", specifier: "@arcgis/toolkit/intl" },
103
- isNotNull: { do: "rename", specifier: "@arcgis/toolkit/predicate" },
104
- isNotUndefined: { do: "rename", specifier: "@arcgis/toolkit/predicate" },
105
- debounce: { do: "rename", specifier: "@arcgis/toolkit/function" },
106
- identity: { do: "rename", specifier: "@arcgis/toolkit/function" },
107
- hasSameOrigin: { do: "rename", specifier: "@arcgis/toolkit/url" }
108
- }
109
- });
110
- } catch (r) {
111
- var t = r, s = !0;
112
- } finally {
113
- p(e, t, s);
114
- }
115
- }
116
- b(), T(
117
- "info",
118
- L.codemodName,
119
- "Next step: run npm install/pnpm install/yarn install to get @arcgis/toolkit package installed."
120
- );
121
- }
122
- };
123
- export {
124
- F as codemod
125
- };
@@ -1,39 +0,0 @@
1
- import { log as r } from "@arcgis/toolkit/log";
2
- import { writeFile as s } from "node:fs/promises";
3
- import { f } from "./actions-DALb_66K.js";
4
- async function h(n, a) {
5
- const o = /* @__PURE__ */ new Set();
6
- for (const i of n) {
7
- const e = i.packageJson;
8
- if (e === void 0 || o.has(e.filePath))
9
- continue;
10
- o.add(e.filePath);
11
- const c = e.contents;
12
- try {
13
- const t = await a(c, e.filePath);
14
- c !== t && await s(e.filePath, `${JSON.stringify(t, null, 2)}
15
- `, "utf8");
16
- } catch (t) {
17
- process.exitCode = 1, r(
18
- "error",
19
- f(e.filePath),
20
- `Error occurred while migrating: ${String(t)}`,
21
- typeof t == "object" && t !== null && "stack" in t ? { detail: { stack: t.stack } } : void 0
22
- );
23
- }
24
- }
25
- }
26
- function u(n, a) {
27
- for (const o of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
28
- const i = n[o];
29
- if (i) {
30
- const e = a(i, o);
31
- e !== i && (n = { ...n, [o]: e });
32
- }
33
- }
34
- return n;
35
- }
36
- export {
37
- u as a,
38
- h as f
39
- };