@arcgis/codemod 5.2.0-next.95 → 5.2.0-next.96
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.
- package/dist/actions-CkWwc89G.js +354 -0
- package/dist/cli-DAnuyHEr.js +269 -0
- package/dist/cli.js +6 -0
- package/dist/codemod-BCclgPFg.js +240 -0
- package/dist/codemod-CF0JIWmU.js +436 -0
- package/dist/codemod-DJtrKLN0.js +311 -0
- package/dist/codemod-qLUHpoU9.js +6080 -0
- package/dist/codemod-uvo2lksg.js +140 -0
- package/dist/codemod-wgeRWelQ.js +74 -0
- package/dist/useProjectInstance-WKJLKQxc.js +47 -0
- package/package.json +4 -4
|
@@ -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-CkWwc89G.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-WKJLKQxc.js";
|
|
36
|
+
import { p as x, g as J } from "./cli-DAnuyHEr.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
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var c = (t, e) => (e = Symbol[t]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + t), d = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
3
|
+
};
|
|
4
|
+
var g = (t, e, s) => {
|
|
5
|
+
if (e != null) {
|
|
6
|
+
typeof e != "object" && typeof e != "function" && d("Object expected");
|
|
7
|
+
var i, r;
|
|
8
|
+
s && (i = e[c("asyncDispose")]), i === void 0 && (i = e[c("dispose")], s && (r = i)), typeof i != "function" && d("Object not disposable"), r && (i = function() {
|
|
9
|
+
try {
|
|
10
|
+
r.call(this);
|
|
11
|
+
} catch (n) {
|
|
12
|
+
return Promise.reject(n);
|
|
13
|
+
}
|
|
14
|
+
}), t.push([s, i, e]);
|
|
15
|
+
} else s && t.push([s]);
|
|
16
|
+
return e;
|
|
17
|
+
}, f = (t, e, s) => {
|
|
18
|
+
var i = typeof SuppressedError == "function" ? SuppressedError : function(o, a, l, m) {
|
|
19
|
+
return m = Error(l), m.name = "SuppressedError", m.error = o, m.suppressed = a, m;
|
|
20
|
+
}, r = (o) => e = s ? new i(o, e, "An error was suppressed during disposal") : (s = !0, o), n = (o) => {
|
|
21
|
+
for (; o = t.pop(); )
|
|
22
|
+
try {
|
|
23
|
+
var a = o[1] && o[1].call(o[2]);
|
|
24
|
+
if (o[0]) return Promise.resolve(a).then(n, (l) => (r(l), n()));
|
|
25
|
+
} catch (l) {
|
|
26
|
+
r(l);
|
|
27
|
+
}
|
|
28
|
+
if (s) throw e;
|
|
29
|
+
};
|
|
30
|
+
return n();
|
|
31
|
+
};
|
|
32
|
+
import { p } from "./actions-CkWwc89G.js";
|
|
33
|
+
import { c as k } from "./useProjectInstance-WKJLKQxc.js";
|
|
34
|
+
import { p as C } from "./cli-DAnuyHEr.js";
|
|
35
|
+
const j = {
|
|
36
|
+
meta: {
|
|
37
|
+
needsTypeInformation: !1
|
|
38
|
+
},
|
|
39
|
+
run(t) {
|
|
40
|
+
for (const n of t) {
|
|
41
|
+
var e = [];
|
|
42
|
+
try {
|
|
43
|
+
const o = g(e, k(n));
|
|
44
|
+
for (const a of o.getCodemodFiles())
|
|
45
|
+
p(a, {
|
|
46
|
+
"@arcgis/toolkit/intl": {
|
|
47
|
+
getElementLocale: { do: "rename", specifier: "@arcgis/toolkit/intl/dom" },
|
|
48
|
+
startLocaleObserver: { do: "rename", specifier: "@arcgis/toolkit/intl/dom" },
|
|
49
|
+
LocaleObserverResult: { do: "rename", specifier: "@arcgis/toolkit/intl/dom" }
|
|
50
|
+
},
|
|
51
|
+
"@arcgis/toolkit/dom": {
|
|
52
|
+
slotChangeHasContent: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
53
|
+
slotChangeGetTextContent: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
54
|
+
slotChangeHasTextContent: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
55
|
+
slotChangeHasAssignedNode: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
56
|
+
slotChangeGetAssignedNodes: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
57
|
+
slotChangeHasAssignedElement: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
58
|
+
slotChangeGetAssignedElements: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
59
|
+
getSlotAssignedElements: { do: "rename", specifier: "@arcgis/toolkit/dom/slots" },
|
|
60
|
+
resolveReferenceElement: { do: "rename", specifier: "@arcgis/toolkit/dom/referenceElement" }
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} catch (s) {
|
|
64
|
+
var i = s, r = !0;
|
|
65
|
+
} finally {
|
|
66
|
+
f(e, i, r);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
C();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
j as codemod
|
|
74
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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-DAnuyHEr.js";
|
|
5
|
+
import { styleText as s } from "node:util";
|
|
6
|
+
function y(e) {
|
|
7
|
+
if (t.project !== void 0)
|
|
8
|
+
throw Error(
|
|
9
|
+
"A different ts-morph Project is already in use. Dispose of it before creating a new one. Example: using project = createProjectInstance(...)"
|
|
10
|
+
);
|
|
11
|
+
const i = t.codemod.meta.needsTypeInformation, o = new p({
|
|
12
|
+
// If tsconfig is missing, or project is untyped, use a permissive and
|
|
13
|
+
// compatible default config
|
|
14
|
+
compilerOptions: e.typeScriptConfig?.compilerOptions ?? {
|
|
15
|
+
...m,
|
|
16
|
+
// Read types from JSDoc annotations if present
|
|
17
|
+
checkJs: i
|
|
18
|
+
},
|
|
19
|
+
// We take care of reading the config file
|
|
20
|
+
tsConfigFilePath: void 0,
|
|
21
|
+
// We add files manually below
|
|
22
|
+
skipAddingFilesFromTsConfig: !0,
|
|
23
|
+
// We call this manually if needed below.
|
|
24
|
+
skipFileDependencyResolution: !0,
|
|
25
|
+
skipLoadingLibFiles: !i
|
|
26
|
+
}), l = e.filePaths.map((n) => o.addSourceFileAtPath(n));
|
|
27
|
+
i && o.resolveSourceFileDependencies();
|
|
28
|
+
const r = f.relative(process.cwd(), e.cwd);
|
|
29
|
+
process.stdout.write(""), d(
|
|
30
|
+
"info",
|
|
31
|
+
s("blue", r === "" ? process.cwd() : r),
|
|
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)}`}`
|
|
33
|
+
);
|
|
34
|
+
const c = {
|
|
35
|
+
[Symbol.dispose]() {
|
|
36
|
+
o.saveSync(), o.getRootDirectories().forEach((n) => n.forget()), t.project = void 0;
|
|
37
|
+
},
|
|
38
|
+
projectData: e,
|
|
39
|
+
// Resolved dependencies support type checking but are not codemod targets.
|
|
40
|
+
getCodemodFiles: () => l,
|
|
41
|
+
tsMorph: o
|
|
42
|
+
};
|
|
43
|
+
return t.project = c, c;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
y as c
|
|
47
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/codemod",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.96",
|
|
4
4
|
"description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@arcgis/api-extractor": "5.2.0-next.
|
|
15
|
-
"@arcgis/node-toolkit": "5.2.0-next.
|
|
16
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
14
|
+
"@arcgis/api-extractor": "5.2.0-next.96",
|
|
15
|
+
"@arcgis/node-toolkit": "5.2.0-next.96",
|
|
16
|
+
"@arcgis/toolkit": "5.2.0-next.96",
|
|
17
17
|
"@commander-js/extra-typings": "^15.0.0",
|
|
18
18
|
"commander": "^15.0.0",
|
|
19
19
|
"tinyglobby": "~0.2.17",
|