@arcgis/codemod 6.0.0-next.42 → 6.0.0-next.44
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/README.md +87 -3
- package/dist/chunks/classification.js +1 -1
- package/dist/chunks/cli.js +43 -43
- package/dist/chunks/codemod10.js +83 -0
- package/dist/chunks/codemod11.js +74 -0
- package/dist/chunks/codemod2.js +180 -400
- package/dist/chunks/codemod3.js +77 -292
- package/dist/chunks/codemod4.js +398 -69
- package/dist/chunks/codemod5.js +292 -88
- package/dist/chunks/codemod6.js +71 -223
- package/dist/chunks/codemod7.js +89 -6041
- package/dist/chunks/codemod8.js +215 -49
- package/dist/chunks/codemod9.js +6059 -0
- package/package.json +5 -5
package/dist/chunks/codemod3.js
CHANGED
|
@@ -1,311 +1,96 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var x = (o, t) => (t = Symbol[o]) ? t : /* @__PURE__ */ Symbol.for("Symbol." + o), S = (o) => {
|
|
2
|
+
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
if (
|
|
6
|
-
typeof
|
|
7
|
-
var n,
|
|
8
|
-
|
|
4
|
+
var N = (o, t, r) => {
|
|
5
|
+
if (t != null) {
|
|
6
|
+
typeof t != "object" && typeof t != "function" && S("Object expected");
|
|
7
|
+
var n, l;
|
|
8
|
+
r && (n = t[x("asyncDispose")]), n === void 0 && (n = t[x("dispose")], r && (l = n)), typeof n != "function" && S("Object not disposable"), l && (n = function() {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
return Promise.reject(
|
|
10
|
+
l.call(this);
|
|
11
|
+
} catch (p) {
|
|
12
|
+
return Promise.reject(p);
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
var n = typeof SuppressedError == "function" ? SuppressedError : function(
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
for (;
|
|
14
|
+
}), o.push([r, n, t]);
|
|
15
|
+
} else r && o.push([r]);
|
|
16
|
+
return t;
|
|
17
|
+
}, T = (o, t, r) => {
|
|
18
|
+
var n = typeof SuppressedError == "function" ? SuppressedError : function(s, a, g, m) {
|
|
19
|
+
return m = Error(g), m.name = "SuppressedError", m.error = s, m.suppressed = a, m;
|
|
20
|
+
}, l = (s) => t = r ? new n(s, t, "An error was suppressed during disposal") : (r = !0, s), p = (s) => {
|
|
21
|
+
for (; s = o.pop(); )
|
|
22
22
|
try {
|
|
23
|
-
var a =
|
|
24
|
-
if (
|
|
25
|
-
} catch (
|
|
26
|
-
|
|
23
|
+
var a = s[1] && s[1].call(s[2]);
|
|
24
|
+
if (s[0]) return Promise.resolve(a).then(p, (g) => (l(g), p()));
|
|
25
|
+
} catch (g) {
|
|
26
|
+
l(g);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (r) throw t;
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return p();
|
|
31
31
|
};
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
const
|
|
32
|
+
import { log as A } from "@arcgis/toolkit/log";
|
|
33
|
+
import { Node as c } from "ts-morph";
|
|
34
|
+
import { p as F } from "./actions.js";
|
|
35
|
+
import { a as y } from "./log.js";
|
|
36
|
+
import { c as C } from "./useProjectInstance.js";
|
|
37
|
+
const f = "arcgis-features-next", u = "arcgis-features", E = /^@arcgis\/map-components\/(?:dist\/)?components\/arcgis-features-next(?:\/customElement)?$/u, L = /* @__PURE__ */ new Set(["@arcgis/map-components", "@arcgis/map-components/dist/components"]), D = /* @__PURE__ */ new Set([
|
|
38
|
+
"querySelector",
|
|
39
|
+
"querySelectorAll",
|
|
40
|
+
"createElement",
|
|
41
|
+
"getElementsByTagName",
|
|
42
|
+
"closest",
|
|
43
|
+
"matches"
|
|
44
|
+
]), q = {
|
|
38
45
|
meta: {
|
|
39
|
-
needsTypeInformation: !1
|
|
46
|
+
needsTypeInformation: !1,
|
|
47
|
+
needsFooter: !0
|
|
40
48
|
},
|
|
41
|
-
|
|
42
|
-
for (const
|
|
49
|
+
run(o) {
|
|
50
|
+
for (const p of o) {
|
|
43
51
|
var t = [];
|
|
44
52
|
try {
|
|
45
|
-
const
|
|
46
|
-
for (const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
const s = N(t, C(p));
|
|
54
|
+
for (const a of s.getCodemodFiles()) {
|
|
55
|
+
const g = a.getImportDeclarations().map((e) => e.getModuleSpecifierValue()).filter((e) => E.test(e) || L.has(e));
|
|
56
|
+
for (const e of g)
|
|
57
|
+
F(a, {
|
|
58
|
+
[e]: {
|
|
59
|
+
ArcgisFeaturesNext: { do: "rename", name: "ArcgisFeatures" }
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
for (const e of a.getImportDeclarations()) {
|
|
63
|
+
const i = e.getModuleSpecifierValue();
|
|
64
|
+
E.test(i) && e.setModuleSpecifier(i.replace(f, u));
|
|
65
|
+
}
|
|
66
|
+
for (const e of a.getDescendants().toReversed())
|
|
67
|
+
if (c.isJsxOpeningElement(e) || c.isJsxClosingElement(e) || c.isJsxSelfClosingElement(e)) {
|
|
68
|
+
const i = e.getTagNameNode();
|
|
69
|
+
i.getText() === f && i.replaceWithText(u);
|
|
70
|
+
} else if (c.isStringLiteral(e) || c.isNoSubstitutionTemplateLiteral(e)) {
|
|
71
|
+
const i = e.getParent();
|
|
72
|
+
if (e.getLiteralValue() !== f || !c.isCallExpression(i) || i.getArguments()[0] !== e)
|
|
73
|
+
continue;
|
|
74
|
+
const d = i.getExpression();
|
|
75
|
+
c.isPropertyAccessExpression(d) && D.has(d.getName()) && e.setLiteralValue(u);
|
|
76
|
+
}
|
|
77
|
+
const m = a.getFullText(), h = m.includes("ArcgisFeaturesNext") && a.getDescendants().some(
|
|
78
|
+
(e) => c.isStringLiteral(e) && L.has(e.getLiteralValue()) && !c.isImportDeclaration(e.getParent())
|
|
79
|
+
);
|
|
80
|
+
(m.includes(f) || h) && A(
|
|
81
|
+
"warn",
|
|
82
|
+
y(a),
|
|
83
|
+
"Remaining Features (Next) references require manual review (for example, dynamic imports, re-exports, compound selectors, or HTML/CSS templates)."
|
|
84
|
+
);
|
|
64
85
|
}
|
|
65
|
-
} catch (
|
|
66
|
-
var
|
|
86
|
+
} catch (r) {
|
|
87
|
+
var n = r, l = !0;
|
|
67
88
|
} finally {
|
|
68
|
-
|
|
89
|
+
T(t, n, l);
|
|
69
90
|
}
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
};
|
|
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
94
|
export {
|
|
309
|
-
|
|
310
|
-
oe as exportsForTests
|
|
95
|
+
q as codemod
|
|
311
96
|
};
|