@arcgis/codemod 5.2.0-next.94 → 5.2.0-next.95
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/package.json +4 -4
- package/dist/actions-BH4cN_p7.js +0 -354
- package/dist/cli-BzG3c735.js +0 -269
- package/dist/cli.js +0 -6
- package/dist/codemod-BBVZQTCI.js +0 -140
- package/dist/codemod-BtfCwWHO.js +0 -6080
- package/dist/codemod-C5PdcOsm.js +0 -74
- package/dist/codemod-CLpYeFPx.js +0 -240
- package/dist/codemod-DKGGUmp7.js +0 -311
- package/dist/codemod-DvxMqyjF.js +0 -436
- package/dist/useProjectInstance-9qPLRrHD.js +0 -47
package/dist/codemod-C5PdcOsm.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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-BH4cN_p7.js";
|
|
33
|
-
import { c as k } from "./useProjectInstance-9qPLRrHD.js";
|
|
34
|
-
import { p as C } from "./cli-BzG3c735.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
|
-
};
|
package/dist/codemod-CLpYeFPx.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
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-9qPLRrHD.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
|
-
};
|
package/dist/codemod-DKGGUmp7.js
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
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-9qPLRrHD.js";
|
|
33
|
-
import { g as B } from "./cli-BzG3c735.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
|
-
};
|